From c5e823bbb5fa295306cdc992a4e9dbf351e18ebc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 24 Mar 2011 23:52:27 +0000 Subject: [PATCH 001/366] R*tree implementation based on boost::variant [SVN r70531] --- .gitattributes | 96 +++ .../extensions/index/algorithms/area.hpp | 58 ++ .../extensions/index/algorithms/margin.hpp | 102 +++ .../extensions/index/algorithms/overlap.hpp | 34 + .../index/algorithms/union_area.hpp | 32 + .../extensions/index/default_parameter.hpp | 62 ++ .../index/filters/nearest_filter.hpp | 78 ++ .../index/filters/spacial_filter.hpp | 63 ++ .../geometry/extensions/index/indexable.hpp | 160 ++++ .../extensions/index/rtree/filters.hpp | 52 ++ .../extensions/index/rtree/rstar/rstar.hpp | 16 + .../index/rtree/rstar/rtree_insert.hpp | 729 ++++++++++++++++++ .../extensions/index/rtree/rstar/tags.hpp | 19 + .../geometry/extensions/index/rtree/rtree.hpp | 111 +++ .../extensions/index/rtree/rtree_node.hpp | 196 +++++ .../index/rtree/visitors/gl_draw.hpp | 182 +++++ .../extensions/index/rtree/visitors/print.hpp | 207 +++++ .../index/rtree/visitors/rtree_delete.hpp | 47 ++ .../index/rtree/visitors/rtree_find.hpp | 66 ++ .../index/rtree/visitors/rtree_insert.hpp | 29 + .../index/rtree/visitors/rtree_is_leaf.hpp | 40 + .../index/rtree/visitors/rtree_remove.hpp | 29 + .../extensions/index/translator/def.hpp | 103 +++ .../extensions/index/translator/helpers.hpp | 192 +++++ .../extensions/index/translator/index.hpp | 43 ++ tests/TODO.txt | 20 + tests/additional_glut_vis.cpp | 70 ++ tests/additional_sizes_and_times.cpp | 62 ++ tests/main.cpp | 16 + tests/rtree_filters.hpp | 54 ++ tests/rtree_native.hpp | 150 ++++ tests/translators.hpp | 72 ++ 32 files changed, 3190 insertions(+) create mode 100644 .gitattributes create mode 100644 include/boost/geometry/extensions/index/algorithms/area.hpp create mode 100644 include/boost/geometry/extensions/index/algorithms/margin.hpp create mode 100644 include/boost/geometry/extensions/index/algorithms/overlap.hpp create mode 100644 include/boost/geometry/extensions/index/algorithms/union_area.hpp create mode 100644 include/boost/geometry/extensions/index/default_parameter.hpp create mode 100644 include/boost/geometry/extensions/index/filters/nearest_filter.hpp create mode 100644 include/boost/geometry/extensions/index/filters/spacial_filter.hpp create mode 100644 include/boost/geometry/extensions/index/indexable.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/filters.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/tags.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/rtree.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/rtree_node.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/print.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/rtree_delete.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/rtree_find.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/rtree_insert.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/rtree_is_leaf.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/rtree_remove.hpp create mode 100644 include/boost/geometry/extensions/index/translator/def.hpp create mode 100644 include/boost/geometry/extensions/index/translator/helpers.hpp create mode 100644 include/boost/geometry/extensions/index/translator/index.hpp create mode 100644 tests/TODO.txt create mode 100644 tests/additional_glut_vis.cpp create mode 100644 tests/additional_sizes_and_times.cpp create mode 100644 tests/main.cpp create mode 100644 tests/rtree_filters.hpp create mode 100644 tests/rtree_native.hpp create mode 100644 tests/translators.hpp diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..3e84d7c70 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,96 @@ +* text=auto !eol svneol=native#text/plain +*.gitattributes text svneol=native#text/plain + +# Scriptish formats +*.bat text svneol=native#text/plain +*.bsh text svneol=native#text/x-beanshell +*.cgi text svneol=native#text/plain +*.cmd text svneol=native#text/plain +*.js text svneol=native#text/javascript +*.php text svneol=native#text/x-php +*.pl text svneol=native#text/x-perl +*.pm text svneol=native#text/x-perl +*.py text svneol=native#text/x-python +*.sh eol=lf svneol=LF#text/x-sh +configure eol=lf svneol=LF#text/x-sh + +# Image formats +*.bmp binary svneol=unset#image/bmp +*.gif binary svneol=unset#image/gif +*.ico binary svneol=unset#image/ico +*.jpeg binary svneol=unset#image/jpeg +*.jpg binary svneol=unset#image/jpeg +*.png binary svneol=unset#image/png +*.tif binary svneol=unset#image/tiff +*.tiff binary svneol=unset#image/tiff +*.svg text svneol=native#image/svg%2Bxml + +# Data formats +*.pdf binary svneol=unset#application/pdf +*.avi binary svneol=unset#video/avi +*.doc binary svneol=unset#application/msword +*.dsp text svneol=crlf#text/plain +*.dsw text svneol=crlf#text/plain +*.eps binary svneol=unset#application/postscript +*.gz binary svneol=unset#application/gzip +*.mov binary svneol=unset#video/quicktime +*.mp3 binary svneol=unset#audio/mpeg +*.ppt binary svneol=unset#application/vnd.ms-powerpoint +*.ps binary svneol=unset#application/postscript +*.psd binary svneol=unset#application/photoshop +*.rdf binary svneol=unset#text/rdf +*.rss text svneol=unset#text/xml +*.rtf binary svneol=unset#text/rtf +*.sln text svneol=native#text/plain +*.swf binary svneol=unset#application/x-shockwave-flash +*.tgz binary svneol=unset#application/gzip +*.vcproj text svneol=native#text/xml +*.vcxproj text svneol=native#text/xml +*.vsprops text svneol=native#text/xml +*.wav binary svneol=unset#audio/wav +*.xls binary svneol=unset#application/vnd.ms-excel +*.zip binary svneol=unset#application/zip + +# Text formats +.htaccess text svneol=native#text/plain +*.bbk text svneol=native#text/xml +*.cmake text svneol=native#text/plain +*.css text svneol=native#text/css +*.dtd text svneol=native#text/xml +*.htm text svneol=native#text/html +*.html text svneol=native#text/html +*.ini text svneol=native#text/plain +*.log text svneol=native#text/plain +*.mak text svneol=native#text/plain +*.qbk text svneol=native#text/plain +*.rst text svneol=native#text/plain +*.sql text svneol=native#text/x-sql +*.txt text svneol=native#text/plain +*.xhtml text svneol=native#text/xhtml%2Bxml +*.xml text svneol=native#text/xml +*.xsd text svneol=native#text/xml +*.xsl text svneol=native#text/xml +*.xslt text svneol=native#text/xml +*.xul text svneol=native#text/xul +*.yml text svneol=native#text/plain +boost-no-inspect text svneol=native#text/plain +CHANGES text svneol=native#text/plain +COPYING text svneol=native#text/plain +INSTALL text svneol=native#text/plain +Jamfile text svneol=native#text/plain +Jamroot text svneol=native#text/plain +Jamfile.v2 text svneol=native#text/plain +Jamrules text svneol=native#text/plain +Makefile* text svneol=native#text/plain +README text svneol=native#text/plain +TODO text svneol=native#text/plain + +# Code formats +*.c text svneol=native#text/plain +*.cpp text svneol=native#text/plain +*.h text svneol=native#text/plain +*.hpp text svneol=native#text/plain +*.ipp text svneol=native#text/plain +*.tpp text svneol=native#text/plain +*.jam text svneol=native#text/plain +*.java text svneol=native#text/plain diff --git a/include/boost/geometry/extensions/index/algorithms/area.hpp b/include/boost/geometry/extensions/index/algorithms/area.hpp new file mode 100644 index 000000000..d54ee8609 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/area.hpp @@ -0,0 +1,58 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - n-dimensional box's area/volume +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP + +namespace boost { namespace geometry { namespace index { + +template +struct area_result +{ + typedef typename select_most_precise< + typename coordinate_type::type, + long double + >::type type; +}; + +namespace detail { + +template +struct area_for_each_dimension +{ + BOOST_STATIC_ASSERT(0 < CurrentDimension); + BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); + + static inline typename area_result::type apply(Box const& b) + { + return area_for_each_dimension::apply(b) * + ( geometry::get(b) - geometry::get(b) ); + } +}; + +template +struct area_for_each_dimension +{ + static inline typename area_result::type apply(Box const& b) + { + return geometry::get(b) - geometry::get(b); + } +}; + +} // namespace detail + +template +typename area_result::type area(Box const& b) +{ + return detail::area_for_each_dimension::value>::apply(b); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/margin.hpp b/include/boost/geometry/extensions/index/algorithms/margin.hpp new file mode 100644 index 000000000..44f0164f7 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/margin.hpp @@ -0,0 +1,102 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - n-dimensional box's margin value, 2d perimeter, 3d surface, etc... +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP + +namespace boost { namespace geometry { namespace index { + +template +struct margin_result +{ + typedef typename select_most_precise< + typename coordinate_type::type, + long double + >::type type; +}; + +namespace detail { + +template +struct margin_for_each_edge +{ + BOOST_STATIC_ASSERT(0 < CurrentDimension); + BOOST_STATIC_ASSERT(0 < EdgeDimension); + + static inline typename margin_result::type apply(Box const& b) + { + return margin_for_each_edge::apply(b) * + ( geometry::get(b) - geometry::get(b) ); + } +}; + +template +struct margin_for_each_edge +{ + BOOST_STATIC_ASSERT(0 < CurrentDimension); + + static inline typename margin_result::type apply(Box const& b) + { + return margin_for_each_edge::apply(b); + } +}; + +template +struct margin_for_each_edge +{ + BOOST_STATIC_ASSERT(0 < CurrentDimension); + + static inline typename margin_result::type apply(Box const& b) + { + return geometry::get(b) - geometry::get(b); + } +}; + +template +struct margin_for_each_edge +{ + static inline typename margin_result::type apply(Box const& b) + { + return 1; + } +}; + +template +struct margin_for_each_dimension +{ + BOOST_STATIC_ASSERT(0 < CurrentDimension); + BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); + + static inline typename margin_result::type apply(Box const& b) + { + return margin_for_each_dimension::apply(b) + + 2 * margin_for_each_edge::value>::apply(b); + } +}; + +template +struct margin_for_each_dimension +{ + static inline typename margin_result::type apply(Box const& b) + { + return 2 * margin_for_each_edge::value>::apply(b); + } +}; + +} // namespace detail + +template +typename margin_result::type margin(Box const& b) +{ + return detail::margin_for_each_dimension::value>::apply(b); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/overlap.hpp b/include/boost/geometry/extensions/index/algorithms/overlap.hpp new file mode 100644 index 000000000..c2e98d12b --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/overlap.hpp @@ -0,0 +1,34 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - n-dimensional area/volume of boxes intersecion/overlap +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +template +struct overlap_result +{ + typedef typename area_result::type type; +}; + +template +typename overlap_result::type overlap(Box const& b1, Box const& b2) +{ + Box inters; + geometry::intersection(b1, b2, inters); + return index::area(inters); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/union_area.hpp b/include/boost/geometry/extensions/index/algorithms/union_area.hpp new file mode 100644 index 000000000..38deeea25 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/union_area.hpp @@ -0,0 +1,32 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - boxes union/intersection area/volume +// +// Copyright 2008 Federico J. Fernandez. +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +/** + * \brief Compute the area of the union of b1 and b2 + */ +template +inline typename area_result::type union_area(Box const& b, Geometry const& g) +{ + Box expanded_box(b); + geometry::expand(expanded_box, g); + return index::area(expanded_box); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP diff --git a/include/boost/geometry/extensions/index/default_parameter.hpp b/include/boost/geometry/extensions/index/default_parameter.hpp new file mode 100644 index 000000000..beda15349 --- /dev/null +++ b/include/boost/geometry/extensions/index/default_parameter.hpp @@ -0,0 +1,62 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - default indexes parameters +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP + +#include +#include +#include + +namespace boost { namespace geometry { namespace index { + +// TODO: awulkiew - move this elsewhere +struct default_parameter {}; + +namespace detail { + +template +struct geometry_box_type +{ + typedef geometry::model::box< + geometry::model::point< + typename index::traits::coordinate_type::type, + index::traits::dimension::value, + typename index::traits::coordinate_system::type + > + > type; +}; + +template +struct default_translator_type +{ + typedef Translator type; +}; +template +struct default_translator_type +{ + typedef translator::def type; +}; + +template +struct default_box_type +{ + typedef Box type; +}; +template +struct default_box_type +{ + typedef typename detail::geometry_box_type::type type; +}; + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp new file mode 100644 index 000000000..ec6fcd9e0 --- /dev/null +++ b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp @@ -0,0 +1,78 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - nearest neighbour filter implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP + +namespace boost { namespace geometry { namespace index { namespace filters { + +template +class nearest_filter +{ +public: + typedef int* iterator; + typedef const int* const_iterator; + + template + nearest_filter( + SpacialIndex const&, + Point const&, + typename traits::coordinate_type::type const& + ) + {} + + iterator begin() { return 0; } + iterator end() { return 0; } + const_iterator begin() const { return 0; } + const_iterator end() const { return 0; } +}; + +namespace detail { + +template +class nearest_filtered +{ +public: + explicit nearest_filtered( + Point const& p, + typename traits::coordinate_type::type const& distance) + : m_point(p), m_distance(distance) {} + + Point const& point() const { return m_point; } + + typename traits::coordinate_type::type const& + distance() const { return m_distance; } + +private: + Point m_point; + typename traits::coordinate_type::type m_distance; +}; + +} // namespace detail + +template +detail::nearest_filtered nearest_filtered( + Point const& p, + typename traits::coordinate_type::type const& distance) +{ + return detail::nearest_filtered(p, distance); +} + +}}}} // namespace boost::geometry::index::filters + +template +boost::geometry::index::filters::nearest_filter + operator|( + SpacialIndex const& si, + boost::geometry::index::filters::detail::nearest_filtered const& f) +{ + return boost::geometry::index::filters::nearest_filter(si, f.point(), f.distance()); +} + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP diff --git a/include/boost/geometry/extensions/index/filters/spacial_filter.hpp b/include/boost/geometry/extensions/index/filters/spacial_filter.hpp new file mode 100644 index 000000000..7e8b69a6c --- /dev/null +++ b/include/boost/geometry/extensions/index/filters/spacial_filter.hpp @@ -0,0 +1,63 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - box query filter implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP + +namespace boost { namespace geometry { namespace index { namespace filters { + +template +class spatial_filter +{ +public: + typedef int* iterator; + typedef const int* const_iterator; + + template + spatial_filter(SpacialIndex const&, Geometry const&) {} + + iterator begin() { return 0; } + iterator end() { return 0; } + const_iterator begin() const { return 0; } + const_iterator end() const { return 0; } +}; + +namespace detail { + +template +class spatially_filtered +{ +public: + explicit spatially_filtered(Geometry const& geom) : m_geom(geom) {} + Geometry const& geometry() const { return m_geom; } + +private: + Geometry const& m_geom; +}; + +} // namespace detail + +template +detail::spatially_filtered spatially_filtered(Geometry const& geom) +{ + return detail::spatially_filtered(geom); +} + +}}}} // namespace boost::geometry::index::filters + +template +boost::geometry::index::filters::spatial_filter +operator|( + SpacialIndex const& si, + boost::geometry::index::filters::detail::spatially_filtered const& f) +{ + return boost::geometry::index::filters::spatial_filter(si, f.geometry()); +} + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP diff --git a/include/boost/geometry/extensions/index/indexable.hpp b/include/boost/geometry/extensions/index/indexable.hpp new file mode 100644 index 000000000..d964e091e --- /dev/null +++ b/include/boost/geometry/extensions/index/indexable.hpp @@ -0,0 +1,160 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - indexable traits and functions +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP + +namespace boost { namespace geometry { namespace index { + +namespace dispatch { + +// Distinguish between indexables and other geometries + +template +struct indexable_type +{ + typedef void type; +}; + +template +struct indexable_type +{ + typedef Point type; +}; + +template +struct indexable_type +{ + typedef Box type; +}; + +} // namespace dispatch + +namespace traits +{ + +template +struct indexable_type +{ + typedef typename dispatch::indexable_type< + Indexable, + typename geometry::traits::tag::type + >::type type; +}; + +} // namespace traits + +namespace dispatch { + +template +struct point_type +{ + typedef void type; +}; + +template +struct point_type +{ + typedef typename geometry::traits::point_type::type type; +}; + +template +struct point_type +{ + typedef Indexable type; +}; + +} // namespace dispatch + +namespace traits { + +template +struct point_type +{ + typedef typename dispatch::point_type< + Indexable, + typename geometry::traits::tag::type + >::type type; +}; + +template +struct coordinate_system +{ + typedef typename geometry::traits::coordinate_system< + typename point_type::type + >::type type; +}; + +template +struct coordinate_type +{ + typedef typename geometry::traits::coordinate_type< + typename point_type::type + >::type type; +}; + +template +struct dimension +{ + static const size_t value = + geometry::traits::dimension< + typename point_type::type + >::value; +}; + +} // namespace traits + +namespace dispatch { + +template +struct indexable_indexed_access {}; + +template +struct indexable_indexed_access +{ + typedef typename traits::point_type::type point_type; + typedef typename traits::coordinate_type::type coordinate_type; + + static inline coordinate_type get(Indexable const& i) + { + return geometry::get(i); + } +}; + +template +struct indexable_indexed_access +{ + typedef typename traits::coordinate_type::type coordinate_type; + + static inline coordinate_type get(Indexable const& i) + { + return geometry::get(i); + } +}; + +} // namespace dispatch + +namespace detail { + +template +typename traits::coordinate_type::type get(Indexable const& i) +{ + return dispatch::indexable_indexed_access< + Corner, + DimensionIndex, + Indexable, + typename geometry::traits::tag::type + >::get(i); +} + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp new file mode 100644 index 000000000..15bef8fa6 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -0,0 +1,52 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - rtree queries filters implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP + +#include +#include + +#include +#include + +namespace boost { namespace geometry { namespace index { + +template +class rtree; + +namespace filters { + +template +class spatial_filter< index::rtree > +{ +public: + typedef typename std::vector::iterator iterator; + typedef typename std::vector::const_iterator const_iterator; + + template + spatial_filter(index::rtree const& rtree, Geometry const& geom) + { + m_result = rtree.find(geom); + } + + iterator begin() { return m_result.begin(); } + iterator end() { return m_result.end(); } + const_iterator begin() const { return m_result.begin(); } + const_iterator end() const { return m_result.end(); } + +private: + std::vector m_result; +}; + +} // namespace filters + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp new file mode 100644 index 000000000..d5d218195 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -0,0 +1,16 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R*-tree +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP + +#include +#include + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp new file mode 100644 index 000000000..e4aa929ab --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp @@ -0,0 +1,729 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R*-tree insert algorithm implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RTREE_INSERT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RTREE_INSERT_HPP + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +// ----------------------------------------------------------------------------- // +// rstar/choose_next_node +// ----------------------------------------------------------------------------- // + +// TODO: awulkiew - it's possible that goodness values may be used to choose next node + +// rtree choose_next_node algorithm for rstar variant + +template +class rtree_rstar_choose_next_node +{ + typedef typename index::detail::rtree_node::type node; + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + typedef typename internal_node::children_type children_type; + +public: + // TODO: awulkiew - alternative lower-cost version of overlap calculation may be used (branch_areas) + // TODO: awulkiew - further optimization: don't calculate area with the overlap, calculate it only if + // overlap < smallest_overlap (and current area must be stored) OR + // overlap == smallest_overlap (and area must be compared) + template + static inline size_t apply(internal_node & n, Indexable const& indexable) + { + assert(!n.children.empty()); + + bool has_leaves = boost::apply_visitor( + visitors::rtree_is_leaf(), + *n.children.front().second); + + if ( !has_leaves ) + return impl(n, indexable); + else + return impl(n, indexable); + } + +private: + template + static inline size_t impl(internal_node & n, Indexable const& indexable) + { + typedef typename children_type::iterator children_iterator; + + //assert(!n.children.empty()); + + children_iterator temp_it = n.children.begin(); + children_iterator child_it = temp_it; + Areas min_areas(n.children, child_it, indexable); + + for (children_iterator it = ++temp_it; + it != n.children.end(); ++it) + { + Areas areas(n.children, it, indexable); + + if ( areas < min_areas ) + { + child_it = it; + min_areas = areas; + } + } + + // TODO: awulkiew - switch to indexes in the whole class? + return child_it - n.children.begin(); + } + + struct branch_areas + { + typedef typename area_result::type area_type; + + template + inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable) + { + overlap_area = 0; + for (typename children_type::const_iterator it = ch.begin(); it != ch.end(); ++it) + if ( it != k_it ) + overlap_area += index::overlap(k_it->first, it->first); + + area = index::area(k_it->first); + + diff_area = index::union_area(k_it->first, indexable) - area; + } + + inline bool operator<(branch_areas &a) const + { + return overlap_area < a.overlap_area || + ( overlap_area == a.overlap_area && diff_area < a.diff_area ) || + ( diff_area == a.diff_area && area < a.area ); + } + + area_type overlap_area; + area_type diff_area; + area_type area; + }; + + struct internal_node_areas + { + typedef typename area_result::type area_type; + + template + inline internal_node_areas(children_type const&, typename children_type::iterator const& k_it, Indexable const& indexable) + { + area = index::area(k_it->first); + diff_area = index::union_area(k_it->first, indexable) - area; + } + + inline bool operator<(internal_node_areas &a) const + { + return diff_area < a.diff_area || + ( diff_area == a.diff_area && area < a.area ); + } + + area_type diff_area; + area_type area; + }; +}; + +// ----------------------------------------------------------------------------- // +// rstar/sorts +// ----------------------------------------------------------------------------- // + +// elements ids less comparator + +template +class rtree_rstar_elements_indexes_less +{ +public: + rtree_rstar_elements_indexes_less(Elements const& elements, Translator const& tr) + : m_elements(elements), m_tr(tr) + {} + + bool operator()(size_t e1_index, size_t e2_index) + { + return + index::detail::get( + index::detail::rtree_element_indexable(m_elements[e1_index], m_tr) + ) + < + index::detail::get( + index::detail::rtree_element_indexable(m_elements[e2_index], m_tr) + ); + } + +private: + Elements const& m_elements; + Translator const& m_tr; +}; + +template +class rtree_rstar_vectors +{ +public: + inline rtree_rstar_vectors(size_t count) + : m_count(count), m_ids(Dimension * 2 * count) + {} + + template + inline typename std::vector::iterator begin() + { + BOOST_STATIC_ASSERT(AxisIndex < Dimension); + BOOST_STATIC_ASSERT(Corner < 2); + return m_ids.begin() + ( AxisIndex * 2 + Corner ) * m_count; + } + + template + inline typename std::vector::iterator end() + { + BOOST_STATIC_ASSERT(AxisIndex < Dimension); + BOOST_STATIC_ASSERT(Corner < 2); + return m_ids.begin() + ( AxisIndex * 2 + Corner + 1) * m_count; + } + + template + inline T const& get(size_t index) const + { + BOOST_STATIC_ASSERT(AxisIndex < Dimension); + BOOST_STATIC_ASSERT(Corner < 2); + assert(index < m_count); + return m_ids[( AxisIndex * 2 + Corner ) * m_count + index]; + } + + template + inline void set(size_t index, T const& v) + { + BOOST_STATIC_ASSERT(AxisIndex < Dimension); + BOOST_STATIC_ASSERT(Corner < 2); + assert(index < m_count); + m_ids[( AxisIndex * 2 + Corner ) * m_count + index] = v; + } + + inline T const& get(size_t axis, size_t corner, size_t index) const + { + assert(axis < Dimension); + assert(corner < 2); + assert(index < m_count); + return m_ids[( axis * 2 + corner ) * m_count + index]; + } + + inline size_t vector_size() const + { + return m_count; + } + +private: + size_t m_count; + std::vector m_ids; +}; + +// init indexes of elements and sort them + +template +class rtree_rstar_sorts_fill_ids +{ + BOOST_STATIC_ASSERT(0 < Dimension); + +public: + template + static inline void apply(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) + { + rtree_rstar_sorts_fill_ids::apply(ids, elements, tr); + + fill(ids, elements, tr); + fill(ids, elements, tr); + } + +private: + template + static inline void fill(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) + { + for ( size_t i = 0 ; i < elements.size() ; ++i ) + ids.set(i, i); + + rtree_rstar_elements_indexes_less less(elements, tr); + std::sort(ids.begin(), ids.end(), less); + } +}; + +template +class rtree_rstar_sorts_fill_ids +{ +public: + template + static inline void apply(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) + { + fill(ids, elements, tr); + fill(ids, elements, tr); + } + +private: + template + static inline void fill(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) + { + for ( size_t i = 0 ; i < elements.size() ; ++i ) + ids.set<0, Corner>(i, i); + + rtree_rstar_elements_indexes_less less(elements, tr); + std::sort(ids.begin<0, Corner>(), ids.end<0, Corner>(), less); + } +}; + +// sorts for each axis for min and max + +template +class rtree_rstar_sorts +{ +public: + inline rtree_rstar_sorts(Elements const& elements, Translator const& tr) + : m_elems(elements), m_tr(tr), m_ids(m_elems.size()) + { + rtree_rstar_sorts_fill_ids::apply(m_ids, elements, tr); + } + + // TODO: awulkiew - should those methods be here? Just leave get_element? + + template + inline typename index::detail::rtree_element_indexable_type::type const& + get_indexable(size_t index) const + { + size_t id = m_ids.get(index); + return index::detail::rtree_element_indexable(m_elems[id], m_tr); + } + + inline typename index::detail::rtree_element_indexable_type::type const& + get_indexable(size_t axis, size_t corner, size_t index) const + { + size_t id = m_ids.get(axis, corner, index); + return index::detail::rtree_element_indexable(m_elems[id], m_tr); + } + + template + inline typename Elements::value_type const& get_element(size_t index) const + { + size_t id = m_ids.get(index); + return m_elems[id]; + } + + inline typename Elements::value_type const& get_element(size_t axis, size_t corner, size_t index) const + { + size_t id = m_ids.get(axis, corner, index); + return m_elems[id]; + } + + inline size_t sort_size() const + { + return m_ids.vector_size(); + } + +private: + Elements const& m_elems; + Translator const& m_tr; + + rtree_rstar_vectors m_ids; +}; + +// ----------------------------------------------------------------------------- // +// rstar/goodness_values +// ----------------------------------------------------------------------------- // + +// calculate margins, areas and overlaps + +template +class rtree_rstar_calculate_goodness_values_for_axis +{ + typedef typename geometry::traits::coordinate_type< + typename geometry::traits::point_type::type + >::type coordinate_type; + + static const size_t dimension = geometry::traits::dimension< + typename geometry::traits::point_type::type + >::value; + + typedef typename area_result::type area_type; + typedef typename margin_result::type margin_type; + typedef typename overlap_result::type overlap_type; + typedef boost::tuple goodness_type; + +public: + template + static inline void apply( + rtree_rstar_vectors & goodness_vectors, + rtree_rstar_sorts const& sorts, + size_t min_elems, + size_t max_elems) + { + assert(sorts.sort_size() == max_elems + 1); + assert(goodness_vectors.vector_size() == max_elems - 2 * min_elems + 2); + + size_t median_index_last = max_elems - min_elems + 2; + size_t i = 0; + for ( size_t median_index = min_elems ; median_index < median_index_last ; ++median_index, ++i ) + { + Box left_box = calculate_box(sorts, 0, median_index); + Box right_box = calculate_box(sorts, median_index, sorts.sort_size()); + + margin_type margin = index::margin(left_box) + index::margin(right_box); + area_type area = index::area(left_box) + index::area(right_box); + overlap_type overlap = index::overlap(left_box, right_box); + + goodness_vectors.set( + i, + boost::make_tuple(left_box, right_box, margin, overlap, area)); + } + } +private: + template + static inline Box calculate_box( + rtree_rstar_sorts const& sorts, + size_t index_first, + size_t index_last) + { + assert(index_first < index_last); + + Box result; + geometry::convert(sorts.template get_indexable(index_first), result); + ++index_first; + for ( ; index_first < index_last ; ++index_first ) + geometry::expand(result, sorts.template get_indexable(index_first)); + return result; + } +}; + +// calculate goodness values for all axis + +template +struct rtree_rstar_calculate_goodness_values +{ + BOOST_STATIC_ASSERT(0 < Dimension); + + typedef typename area_result::type area_type; + typedef typename margin_result::type margin_type; + typedef typename overlap_result::type overlap_type; + typedef boost::tuple goodness_type; + + template + static inline void apply( + rtree_rstar_vectors & goodness_vectors, + rtree_rstar_sorts const& sorts, + size_t min_elems, + size_t max_elems) + { + rtree_rstar_calculate_goodness_values + ::apply(goodness_vectors, sorts, min_elems, max_elems); + + rtree_rstar_calculate_goodness_values_for_axis + ::apply(goodness_vectors, sorts, min_elems, max_elems); + rtree_rstar_calculate_goodness_values_for_axis + ::apply(goodness_vectors, sorts, min_elems, max_elems); + } +}; + +template +struct rtree_rstar_calculate_goodness_values +{ + typedef typename area_result::type area_type; + typedef typename margin_result::type margin_type; + typedef typename overlap_result::type overlap_type; + typedef boost::tuple goodness_type; + + template + static inline void apply( + rtree_rstar_vectors & goodness_vectors, + rtree_rstar_sorts const& sorts, + size_t min_elems, + size_t max_elems) + { + rtree_rstar_calculate_goodness_values_for_axis + ::apply(goodness_vectors, sorts, min_elems, max_elems); + rtree_rstar_calculate_goodness_values_for_axis + ::apply(goodness_vectors, sorts, min_elems, max_elems); + } +}; + +// goodness values + +template +class rtree_rstar_goodness_values +{ + typedef typename geometry::traits::coordinate_type< + typename geometry::traits::point_type::type + >::type coordinate_type; + + static const size_t dimension = geometry::traits::dimension< + typename geometry::traits::point_type::type + >::value; + + typedef typename area_result::type area_type; + typedef typename margin_result::type margin_type; + typedef typename overlap_result::type overlap_type; + typedef boost::tuple goodness_type; + +public: + inline rtree_rstar_goodness_values( + Elements const& elements, + Translator const& tr, + size_t min_elems, + size_t max_elems) + : m_sorts(elements, tr) + , m_goodness_vectors(max_elems - 2 * min_elems + 2) + { + rtree_rstar_calculate_goodness_values::apply( + m_goodness_vectors, m_sorts, min_elems, max_elems); + } + + inline size_t elements_size() const + { + return m_sorts.sort_size(); + } + + inline size_t goodnesses_size() const + { + return m_goodness_vectors.vector_size(); + } + + inline goodness_type const& get_goodness(size_t axis, size_t corner, size_t index) const + { + return m_goodness_vectors.get(axis, corner, index); + } + + inline typename Elements::value_type const& get_element(size_t axis, size_t corner, size_t index) const + { + return m_sorts.get_element(axis, corner, index); + } + +private: + rtree_rstar_sorts m_sorts; + rtree_rstar_vectors m_goodness_vectors; +}; + +template +class rtree_rstar_choose_split_axis +{ + typedef typename margin_result::type margin_type; +public: + static inline std::pair apply(rtree_rstar_goodness_values const& gv) + { + std::pair smallest_distr = std::make_pair(0, 0); + margin_type smallest_margins_sum = calculate_margins_sum(0, 0, gv); + + margin_type margins_sum = calculate_margins_sum(0, 1, gv); + if ( margins_sum < smallest_margins_sum ) + { + smallest_distr.second = 1; + smallest_margins_sum = margins_sum; + } + + for ( size_t a = 1 ; a < traits::dimension::value ; ++a ) + { + for ( size_t c = 0 ; c < 2 ; ++c ) + { + margins_sum = calculate_margins_sum(a, c, gv); + if ( margins_sum < smallest_margins_sum ) + { + smallest_distr.first = a; + smallest_distr.second = c; + smallest_margins_sum = margins_sum; + } + } + } + return smallest_distr; + } +private: + static inline typename margin_result::type + calculate_margins_sum(size_t axis, size_t corner, rtree_rstar_goodness_values const& gv) + { + typename margin_result::type margins_sum = 0; + for ( size_t i = 0 ; i < gv.goodnesses_size() ; ++i ) + margins_sum += boost::get<2>(gv.get_goodness(axis, corner, i)); + return margins_sum; + } +}; + +template +class rtree_rstar_choose_split_index +{ + typedef typename area_result::type area_type; + typedef typename overlap_result::type overlap_type; +public: + static inline size_t apply(rtree_rstar_goodness_values const& gv, size_t axis, size_t corner) + { + size_t smallest_index = 0; + overlap_type smallest_overlap = boost::get<3>(gv.get_goodness(axis, corner, 0)); + overlap_type smallest_area = boost::get<4>(gv.get_goodness(axis, corner, 0)); + + for ( size_t i = 1 ; i < gv.goodnesses_size() ; ++i ) + { + overlap_type overlap = boost::get<3>(gv.get_goodness(axis, corner, i)); + if ( overlap < smallest_overlap ) + { + smallest_overlap = overlap; + smallest_area = boost::get<4>(gv.get_goodness(axis, corner, i)); + smallest_index = i; + } + else if ( overlap == smallest_overlap ) + { + area_type area = boost::get<4>(gv.get_goodness(axis, corner, i)); + if ( area < smallest_area ) + { + smallest_area = area; + smallest_index = i; + } + } + } + + return smallest_index; + } +}; + +// rtree insert routine for rstar variant + +template +class rtree_insert : public boost::static_visitor<> +{ + typedef typename index::detail::rtree_node::type node; + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + +public: + inline explicit rtree_insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) + : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) + , m_root_node(root) + , m_parent(0), m_current_child_index(0) + {} + + inline void operator()(internal_node & n) + { + // save previous traverse inputs and set new ones + internal_node * parent_bckup = m_parent; + m_parent = &n; + size_t current_child_index_bckup = m_current_child_index; + + // choose next node, where value insert traversing should go + m_current_child_index = rtree_rstar_choose_next_node::apply(n, m_tr(m_value)); + + // TODO: awulkiew - if reinsert is implemented this must be changed + geometry::expand(n.children[m_current_child_index].first, m_tr(m_value)); + + // next traversing step + boost::apply_visitor(*this, *n.children[m_current_child_index].second); + + // restore previous traverse inputs + m_parent = parent_bckup; + m_current_child_index = current_child_index_bckup; + + if ( m_max_elems_per_node < n.children.size() ) + { + split(n); + } + } + + inline void operator()(leaf & n) + { + n.values.push_back(m_value); + + if ( m_max_elems_per_node < n.values.size() ) + { + split(n); + } + } + +private: + template + inline void split(Node & n) + { + typedef typename index::detail::rtree_elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + + elements_type & elems = index::detail::get_elements(n); + + rtree_rstar_goodness_values gv(elems, m_tr, m_min_elems_per_node, m_max_elems_per_node); + + std::pair axis_and_corner = + rtree_rstar_choose_split_axis::apply(gv); + size_t axis = axis_and_corner.first; + size_t corner = axis_and_corner.second; + + size_t choosen_index = + rtree_rstar_choose_split_index::apply(gv, axis, corner); + + size_t median_index = m_min_elems_per_node + choosen_index; + assert(median_index <= m_max_elems_per_node + 1 - m_min_elems_per_node); + + // create new node + node * right_node = rtree_create_node(Node()); + elements_type & new_elems = index::detail::get_elements(boost::get(*right_node)); + + // update new node's elements + new_elems.reserve(m_max_elems_per_node + 1 - median_index); + for ( size_t i = median_index ; i < m_max_elems_per_node + 1 ; ++i) + new_elems.push_back(gv.get_element(axis, corner, i)); + + // fill temporary container with left node's elements + elements_type left_elems; + left_elems.reserve(median_index); + for ( size_t i = 0 ; i < median_index ; ++i ) + left_elems.push_back(gv.get_element(axis, corner, i)); + // update old node's elements + elems = left_elems; + + if ( m_parent != 0 ) + { + // update old node's box + m_parent->children[m_current_child_index].first = boost::get<0>(gv.get_goodness(axis, corner, choosen_index)); + // add new node to the parent's children + m_parent->children.push_back( std::make_pair( + boost::get<1>(gv.get_goodness(axis, corner, choosen_index)), right_node ) ); + } + else + { + assert(&n == boost::get(m_root_node)); + + // create new root and add nodes + node * new_root = rtree_create_node(internal_node()); + + boost::get(*new_root).children.push_back( + std::make_pair(boost::get<0>(gv.get_goodness(axis, corner, choosen_index)), m_root_node) + ); + boost::get(*new_root).children.push_back( + std::make_pair(boost::get<1>(gv.get_goodness(axis, corner, choosen_index)), right_node) + ); + + m_root_node = new_root; + } + } + + Value const& m_value; + Translator const& m_tr; + size_t m_min_elems_per_node; + size_t m_max_elems_per_node; + + node* & m_root_node; + + // traversing input parameters + internal_node *m_parent; + size_t m_current_child_index; +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RTREE_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/tags.hpp b/include/boost/geometry/extensions/index/rtree/rstar/tags.hpp new file mode 100644 index 000000000..b19e29648 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/tags.hpp @@ -0,0 +1,19 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R*-tree tags +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_TAGS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_TAGS_HPP + +namespace boost { namespace geometry { namespace index { + +struct rtree_rstar_tag {}; + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_TAGS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp new file mode 100644 index 000000000..8c26668dc --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -0,0 +1,111 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree implementation +// +// Copyright 2008 Federico J. Fernandez. +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP + +#include + +#include + +#include +#include + +#include + +namespace boost { namespace geometry { namespace index { + +// TODO: awulkiew - min and max elems as template parameters? + +template < + typename Value, + typename Translator = default_parameter, + typename Box = default_parameter, + typename Tag = rtree_rstar_tag +> +class rtree +{ +public: + typedef Value value_type; + typedef typename detail::default_translator_type::type translator_type; + typedef typename detail::default_box_type::type box_type; + + typedef typename detail::rtree_node::type node; + typedef typename detail::rtree_internal_node::type internal_node; + typedef typename detail::rtree_leaf::type leaf; + + inline explicit rtree(size_t max_elems_per_node = 4, size_t min_elems_per_node = 2, translator_type const& translator = translator_type()) + : m_values_count(0) + , m_max_elems_per_node(max_elems_per_node) + , m_min_elems_per_node(min_elems_per_node) + , m_root(0) + , m_translator(translator) + { + if ( min_elems_per_node < 2 ) + min_elems_per_node = 2; + + // TODO: awulkiew - reconsider following assert + assert(2 * m_min_elems_per_node <= m_max_elems_per_node); + + m_root = detail::rtree_create_node(leaf()); + } + + ~rtree() + { + visitors::rtree_delete del_v; + boost::apply_visitor(del_v, *m_root); + } + + template + inline std::vector find(Geometry const& geom) const + { + visitors::rtree_find find_v(geom, m_translator); + boost::apply_visitor(find_v, *m_root); + return find_v.result; + } + + void insert(Value const& value) + { + visitors::rtree_insert + insert_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); + + boost::apply_visitor(insert_v, *m_root); + + ++m_values_count; + } + + template + void apply_visitor(Visitor & visitor) const + { + boost::apply_visitor(visitor, *m_root); + } + + translator_type const& get_translator() const + { + return m_translator; + } + +private: + size_t m_values_count; + size_t m_max_elems_per_node; + size_t m_min_elems_per_node; + node *m_root; + translator_type m_translator; +}; + +template +void insert(rtree & tree, Value const& v) +{ + tree.insert(v); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RSTREE_RSTREE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp new file mode 100644 index 000000000..e72baf688 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp @@ -0,0 +1,196 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree details +// +// Copyright 2008 Federico J. Fernandez. +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DEFAULT_NODE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DEFAULT_NODE_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template +struct rtree_node; + +// nodes default types + +template +struct rtree_internal_node_def +{ + typedef std::vector< + std::pair< + Box, + typename rtree_node::type * + > + > children_type; + + children_type children; +}; + +template +struct rtree_leaf_def +{ + typedef std::vector values_type; + values_type values; +}; + +// nodes traits + +template +struct rtree_node +{ + typedef boost::variant< + rtree_leaf_def, + rtree_internal_node_def + > type; +}; + +template +struct rtree_internal_node +{ + typedef rtree_internal_node_def type; +}; + +template +struct rtree_leaf +{ + typedef rtree_leaf_def type; +}; + +// nodes elements extractor + +template +struct rtree_elements_type +{ + typedef typename Node::elements_type type; +}; + +template +struct rtree_elements_type< rtree_internal_node_def > +{ + typedef typename rtree_internal_node_def::children_type type; +}; + +template +struct rtree_elements_type< rtree_leaf_def > +{ + typedef typename rtree_leaf_def::values_type type; +}; + +template +typename rtree_elements_type::type & get_elements(Node & n) +{ + return n.elements; +} + +template +typename rtree_internal_node_def::children_type & +get_elements(rtree_internal_node_def & n) +{ + return n.children; +} + +template +typename rtree_leaf_def::values_type & +get_elements(rtree_leaf_def & n) +{ + return n.values; +} + +// uniform indexable type for child node element's box and value's indexable + +template +struct rtree_element_indexable_type +{ + typedef typename Translator::indexable_type type; +}; + +template +struct rtree_element_indexable_type< + std::pair< + Box, + boost::variant< + rtree_leaf_def, + rtree_internal_node_def + > * + >, + Translator +> +{ + typedef Box type; +}; + +// uniform indexable getter for child node element's box and value's indexable + +template +Box const& +rtree_element_indexable( + std::pair< + Box, + boost::variant< + rtree_leaf_def, + rtree_internal_node_def + > * + > const& el, + Translator const&) +{ + return el.first; +} + +template +typename Translator::indexable_type const& +rtree_element_indexable(Value const& el, Translator const& tr) +{ + return tr(el); +}; + +// create leaf node + +template +typename rtree_node::type * +rtree_create_node(rtree_leaf_def const& l) +{ + typedef typename rtree_node::type node; + node * n = new node(); + *n = l; + return n; +} + +// create internal node + +template +typename rtree_node::type * +rtree_create_node(rtree_internal_node_def const& in) +{ + typedef typename rtree_node::type node; + node * n = new node(); + *n = in; + return n; +} + +// default node + +template +void rtree_delete_node( + boost::variant< + rtree_leaf_def, + rtree_internal_node_def + > * n) +{ + delete n; +} + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DEFAULT_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp new file mode 100644 index 000000000..666a48a4c --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -0,0 +1,182 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree GL-draw visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +namespace dispatch { + +template +struct rtree_gl_draw_point +{}; + +template +struct rtree_gl_draw_point +{ + static inline void apply(Point const& p) + { + glBegin(GL_POINT); + glVertex2f(geometry::get<0>(p), geometry::get<1>(p)); + glEnd(); + } +}; + +template +struct rtree_gl_draw_box +{}; + +template +struct rtree_gl_draw_box +{ + static inline void apply(Box const& b) + { + glBegin(GL_LINE_LOOP); + glVertex2f(geometry::get(b), geometry::get(b)); + glVertex2f(geometry::get(b), geometry::get(b)); + glVertex2f(geometry::get(b), geometry::get(b)); + glVertex2f(geometry::get(b), geometry::get(b)); + glEnd(); + } +}; + +template +struct rtree_gl_draw_indexable +{ +}; + +template +struct rtree_gl_draw_indexable +{ + typedef typename geometry::traits::point_type::type point_type; + static const size_t dimension = geometry::traits::dimension::value; + + static inline void apply(Indexable const& i) + { + rtree_gl_draw_box::apply(i); + } +}; + +template +struct rtree_gl_draw_indexable +{ + static const size_t dimension = geometry::traits::dimension::value; + + static inline void apply(std::ostream &os, Indexable const& i) + { + rtree_gl_draw_point::apply(i); + } +}; + +} // namespace dispatch + +namespace detail { + +template +inline void rtree_gl_draw_indexable(Indexable const& i) +{ + dispatch::rtree_gl_draw_indexable< + Indexable, + typename geometry::traits::tag::type + >::apply(i); +} + +} // namespace detail + +template +struct rtree_gl_draw : public boost::static_visitor<> +{ + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + inline rtree_gl_draw(Translator const& t) + : tr(t), level(0) + {} + + inline void operator()(internal_node const& n) + { + typedef typename internal_node::children_type children_type; + + if ( level == 0 ) + glColor3f(1.0f, 0.0f, 0.0f); + else if ( level == 1 ) + glColor3f(0.0f, 1.0f, 0.0f); + else if ( level == 2 ) + glColor3f(0.0f, 0.0f, 1.0f); + else if ( level == 3 ) + glColor3f(1.0f, 1.0f, 0.0f); + else if ( level == 4 ) + glColor3f(1.0f, 0.0f, 1.0f); + else if ( level == 5 ) + glColor3f(0.0f, 1.0f, 1.0f); + else + glColor3f(0.5f, 0.5f, 0.5f); + + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + detail::rtree_gl_draw_indexable(it->first); + } + + size_t level_backup = level; + ++level; + + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + boost::apply_visitor(*this, *it->second); + } + + level = level_backup; + } + + inline void operator()(leaf const& n) + { + typedef typename leaf::values_type values_type; + + glColor3f(1.0f, 1.0f, 1.0f); + + for (typename values_type::const_iterator it = n.values.begin(); + it != n.values.end(); ++it) + { + detail::rtree_gl_draw_indexable(tr(*it)); + } + } + + Translator const& tr; + + size_t level; +}; + +} // namespace visitors + +template +void gl_draw(rtree const& tree) +{ + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; + + glClear(GL_COLOR_BUFFER_BIT); + + visitors::rtree_gl_draw gl_draw_v(tree.get_translator()); + tree.apply_visitor(gl_draw_v); + + glFlush(); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp new file mode 100644 index 000000000..23799f938 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -0,0 +1,207 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree printing visitor +// +// Copyright 2008 Federico J. Fernandez. +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_PRINT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_PRINT_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +namespace dispatch { + +template +struct rtree_print_point +{ + BOOST_STATIC_ASSERT(0 < Dimension); + + static inline void apply(std::ostream & os, Point const& p) + { + rtree_print_point::apply(os, p); + + os << ", " << geometry::get(p); + } +}; + +template +struct rtree_print_point +{ + static inline void apply(std::ostream & os, Point const& p) + { + os << geometry::get<0>(p); + } +}; + +template +struct rtree_print_corner +{ + BOOST_STATIC_ASSERT(0 < Dimension); + + static inline void apply(std::ostream & os, Box const& b) + { + rtree_print_corner::apply(os, b); + + os << ", " << geometry::get(b); + } +}; + +template +struct rtree_print_corner +{ + static inline void apply(std::ostream & os, Box const& b) + { + os << geometry::get(b); + } +}; + +template +struct rtree_print_indexable +{ +}; + +template +struct rtree_print_indexable +{ + typedef typename geometry::traits::point_type::type point_type; + static const size_t dimension = geometry::traits::dimension::value; + + static inline void apply(std::ostream &os, Indexable const& i) + { + os << '('; + rtree_print_corner::apply(os, i); + os << ")x("; + rtree_print_corner::apply(os, i); + os << ')'; + } +}; + +template +struct rtree_print_indexable +{ + static const size_t dimension = geometry::traits::dimension::value; + + static inline void apply(std::ostream &os, Indexable const& i) + { + os << '('; + rtree_print_point::apply(os, i); + os << ')'; + } +}; + +} // namespace dispatch + +namespace detail { + +template +inline void rtree_print_indexable(std::ostream & os, Indexable const& i) +{ + dispatch::rtree_print_indexable< + Indexable, + typename geometry::traits::tag::type + >::apply(os, i); +} + +} // namespace detail + +template +struct rtree_print : public boost::static_visitor<> +{ + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + inline rtree_print(std::ostream & o, Translator const& t) + : os(o), tr(t), level(0) + {} + + inline void operator()(internal_node const& n) + { + typedef typename internal_node::children_type children_type; + + os << " --> Node --------" << std::endl; + os << " Address: " << this << std::endl; + os << " Level: " << level << std::endl; + os << " Children: " << n.children.size() << std::endl; + os << " | "; + + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + detail::rtree_print_indexable(os, it->first); + os << " | "; + } + os << std::endl; + os << " --< Node --------" << std::endl; + + os << " Children: " << std::endl; + + size_t level_backup = level; + ++level; + + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + boost::apply_visitor(*this, *it->second); + } + + level = level_backup; + } + + inline void operator()(leaf const& n) + { + typedef typename leaf::values_type values_type; + + os << "\t" << " --> Leaf --------" << std::endl; + os << "\t" << " Values: " << n.values.size() << std::endl; + for (typename values_type::const_iterator it = n.values.begin(); + it != n.values.end(); ++it) + { + os << "\t" << " | "; + detail::rtree_print_indexable(os, tr(*it)); + os << " | " << std::endl;; + } + os << "\t" << " --< Leaf --------" << std::endl; + + } + + std::ostream & os; + Translator const& tr; + + size_t level; +}; + +} // namespace visitors + +template +std::ostream & print(rtree const& tree, std::ostream & os = std::cout) +{ + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; + visitors::rtree_print print_v(os, tree.get_translator()); + tree.apply_visitor(print_v); + return os; +} + +template +std::ostream & operator<<(std::ostream & os, rtree const& tree) +{ + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; + visitors::rtree_print print_v(os, tree.get_translator()); + tree.apply_visitor(print_v); + return os; +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_PRINT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_delete.hpp b/include/boost/geometry/extensions/index/rtree/visitors/rtree_delete.hpp new file mode 100644 index 000000000..549200df5 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/rtree_delete.hpp @@ -0,0 +1,47 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree delete visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_DELETE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_DELETE_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +template +struct rtree_delete : public boost::static_visitor<> +{ + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + inline void operator()(internal_node & n) const + { + typedef typename internal_node::children_type children_type; + + for (typename children_type::iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + boost::apply_visitor(*this, *it->second); + + index::detail::rtree_delete_node(it->second); + } + } + + inline void operator()(leaf & n) const + { + } +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_DELETE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/rtree_find.hpp new file mode 100644 index 000000000..d1fe369c6 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/rtree_find.hpp @@ -0,0 +1,66 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree find +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_FIND_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_FIND_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +// rtree spatial query visitor + +template +struct rtree_find : public boost::static_visitor<> +{ + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + inline rtree_find(Geometry const& g, Translator const& t) + : geom(g), tr(t) + {} + + inline void operator()(internal_node const& n) + { + typedef typename internal_node::children_type children_type; + + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + if ( geometry::intersects(it->first, geom) ) + boost::apply_visitor(*this, *it->second); + } + } + + inline void operator()(leaf const& n) + { + typedef typename leaf::values_type values_type; + + for (typename values_type::const_iterator it = n.values.begin(); + it != n.values.end(); ++it) + { + if ( geometry::intersects(tr(*it), geom) ) + result.push_back(*it); + } + } + + Geometry const& geom; + Translator const& tr; + std::vector result; +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_FIND_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/rtree_insert.hpp new file mode 100644 index 000000000..6317255e5 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/rtree_insert.hpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree details +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_INSERT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_INSERT_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +template +struct rtree_insert +{ + // not implemented here +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/rtree_is_leaf.hpp new file mode 100644 index 000000000..50d6947f9 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/rtree_is_leaf.hpp @@ -0,0 +1,40 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree is leaf visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_IS_LEAF_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_IS_LEAF_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +template +struct rtree_is_leaf : public boost::static_visitor +{ + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + inline bool operator()(internal_node const&) const + { + return false; + } + + inline bool operator()(leaf const&) const + { + return true; + } +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_IS_LEAF_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/rtree_remove.hpp new file mode 100644 index 000000000..953fa49c3 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/rtree_remove.hpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree remove +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_REMOVE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_REMOVE_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +template +struct rtree_remove +{ + // not implemented here +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_REMOVE_HPP diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp new file mode 100644 index 000000000..4780d45be --- /dev/null +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -0,0 +1,103 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - default value to bounding object translation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_DEF_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_DEF_HPP + +#include + +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 indexable_type; + + indexable_type const& 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 indexable_type; + + indexable_type const& 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 indexable_type; + + indexable_type const& 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 + +template +struct def + : public dispatch::def + < + Value, + detail::is_iterator::value, + detail::is_smart_ptr::value + > +{ +}; + +template +struct def +{ + typedef typename detail::extract_indexable::type indexable_type; + + indexable_type const& operator()(const Value *v) const + { + return detail::extract_indexable::get(*v); + } + + /*bool equals(const Value* v1, const Value* v2) const + { + return v1 == v2; + }*/ +}; + +}}}} // namespace boost::geometry::index::translator + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_DEF_HPP diff --git a/include/boost/geometry/extensions/index/translator/helpers.hpp b/include/boost/geometry/extensions/index/translator/helpers.hpp new file mode 100644 index 000000000..b68ab9fd9 --- /dev/null +++ b/include/boost/geometry/extensions/index/translator/helpers.hpp @@ -0,0 +1,192 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - translators helper functions +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_HELPERS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_HELPERS_HPP + +#include + +#include + +#include +#include + +#include + +namespace boost { namespace geometry { namespace index { namespace translator { + +namespace dispatch { + +// Extract object from std::pair by non-void tag + +template +struct choose_pair_element +{ + typedef typename Pair::first_type type; + static type const& get(Pair const& p) { return p.first; } +}; + +template +struct choose_pair_element +{ + typedef typename Pair::first_type type; + static type const& get(Pair const& p) { return p.first; } +}; + +template +struct choose_pair_element +{ + typedef typename Pair::second_type type; + static type const& get(Pair const& p) { return p.second; } +}; + +template +struct choose_pair_element +{ + typedef void type; +}; + +} // namespace dispatch + +namespace detail { + +template +struct indexable_not_found_error +{ + static const bool value = false; +}; +template <> +struct indexable_not_found_error +{ + static const bool value = true; +}; + +// Extract indexable + +template +struct extract_indexable +{ + typedef Value type; + + BOOST_STATIC_ASSERT(!indexable_not_found_error::value); + + static type const& get(Value const& v) { return v; } +}; + +template +struct extract_indexable< std::pair > +{ + typedef typename dispatch::choose_pair_element< + std::pair, + typename traits::indexable_type::type, + typename traits::indexable_type::type + > cp; + + typedef typename cp::type type; + + BOOST_STATIC_ASSERT(!indexable_not_found_error::value); + + static type const& get(std::pair const& v) + { + return cp::get(v); + } +}; + +// Recognize iterators and smart pointers + +BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category) +BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer) +BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) + +BOOST_MPL_HAS_XXX_TRAIT_DEF(element_type) + +// TODO +// use has_operator_xxx in the future + +template +struct is_iterator +{ + static const bool value = boost::mpl::and_ + < + has_iterator_category, + has_value_type, + has_difference_type, + has_pointer, + has_reference + >::value; +}; + +template +struct is_smart_ptr +{ + static const bool value = has_element_type::value; +}; + +} // namespace detail + +//namespace dispatch { +// +//template +//struct equals +//{ +// static bool apply(Geometry const& g1, Geometry const& g2) +// { +// return geometry::equals(g1, g2); +// } +//}; +// +//template +//struct equals +//{ +// static bool apply(T const& v1, T const& v2) +// { +// return v1 == v2; +// } +//}; +// +//} // namespace dispatch +// +//namespace detail { +// +//template +//struct equals +//{ +// static bool apply(Geometry const& g1, Geometry const& g2) +// { +// return geometry::equals(g1, g2); +// } +//}; +// +//template +//struct equals< std::pair > +//{ +// static bool apply(std::pair const& p1, std::pair const& p2) +// { +// return +// dispatch::equals< +// First, +// typename traits::tag::type +// >::apply(p1.first, p2.first) +// && +// dispatch::equals< +// Second, +// typename traits::tag::type +// >::apply(p1.second, p2.second); +// } +//}; +// +//} // namespace detail + + + +}}}} // namespace boost::geometry::index::translator + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_HELPERS_HPP diff --git a/include/boost/geometry/extensions/index/translator/index.hpp b/include/boost/geometry/extensions/index/translator/index.hpp new file mode 100644 index 000000000..b0759393d --- /dev/null +++ b/include/boost/geometry/extensions/index/translator/index.hpp @@ -0,0 +1,43 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - container index value to bounding object translation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP + +#include + +namespace boost { namespace geometry { namespace index { namespace translator { + +template +class index +{ +public: + typedef typename detail::extract_indexable + ::type indexable_type; + + explicit index(Container const& c) : m_c(c) {} + + indexable_type const& operator()(size_t i) const + { + return detail::extract_indexable + ::get(m_c[i]); + } + + /*bool equals(size_t i1, size_t i2) const + { + return i1 == i2; + }*/ + +private: + Container const& m_c; +}; + +}}}} // namespace boost::geometry::index::translator + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP diff --git a/tests/TODO.txt b/tests/TODO.txt new file mode 100644 index 000000000..4cad34427 --- /dev/null +++ b/tests/TODO.txt @@ -0,0 +1,20 @@ +// TODO +// wewnetrzny typ pudelek zmienic na geometry::box +// do kopiowania pudelek uzytkownik -> internal uzyc specjlnej funkcji +// przydalaby sie inna struktura wezlow - w tej powielane sa dane +// node <- internal_node, node <- leaf_node +// traktowanie liscia jako wezla wewnetrznego tez jest bez sensu (nie widze dobrej sytuacji) + +// czy translator powinien zwracac geometry::model::point czy Point +// a jesli zalozymy ze uzytkownik przechowuje Polygon to powinien on byc przechowywany z Boxem czy nie +// to przechowuje pair lub jesli przechowuje Box pisze sobie nowy translator + +// czy wewnatrz struktury powinny byc przechowywane: Box i geometry::box +// czy geometry::box::value>, ...> + +// 1. box wewnatrz wezlow +// 2. bounding object w lisciach + +// 3. jakis automatyczny przechowywacz innych obiektow? polygon, segment +// powinien istniec automatyczny translator obiekt -> box +// i box/point przechowywany w lisciach razem z obiektem \ No newline at end of file diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp new file mode 100644 index 000000000..819dba15e --- /dev/null +++ b/tests/additional_glut_vis.cpp @@ -0,0 +1,70 @@ +#include +#define BOOST_GEOMETRY_INDEX_RTREE_ENABLE_GL_DRAW + +#include + +#include + +typedef boost::geometry::model::point P; +typedef boost::geometry::model::box

B; +boost::geometry::index::rtree t; + +void render_scene(void) +{ + boost::geometry::index::gl_draw(t); +} + +void resize(int w, int h) +{ + if ( h == 0 ) + h = 1; + + float ratio = float(w) / h; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glViewport(0, 0, w, h); + + gluPerspective(45, ratio, 1, 1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt( + 5.0f, 5.0f, 15.0f, + 5.0f, 5.0f, -1.0f, + 0.0f, 1.0f, 0.0f); +} + +void mouse(int button, int state, int x, int y) +{ + if ( state == GLUT_DOWN ) + { + float x = ( rand() % 10000 ) / 1000.0f; + float y = ( rand() % 10000 ) / 1000.0f; + float w = ( rand() % 10000 ) / 100000.0f; + float h = ( rand() % 10000 ) / 100000.0f; + + boost::geometry::index::insert(t, B(P(x - w, y - h),P(x + w, y + h))); + + glutPostRedisplay(); + } +} + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); + glutInitWindowPosition(100,100); + glutInitWindowSize(800, 600); + glutCreateWindow("Mouse click to insert new value"); + + glutDisplayFunc(render_scene); + glutReshapeFunc(resize); + glutMouseFunc(mouse); + + std::cout << "Mouse click to insert new value"; + + glutMainLoop(); + + return 0; +} diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp new file mode 100644 index 000000000..c3ce00515 --- /dev/null +++ b/tests/additional_sizes_and_times.cpp @@ -0,0 +1,62 @@ +#include + +#include + +#include +#include + +int main() +{ + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + boost::geometry::index::rtree::leaf l; + boost::geometry::index::rtree::internal_node n; + + std::cout << "internal node size: " << sizeof(n) << '\n'; + std::cout << "leaf size: " << sizeof(l) << '\n'; + } + + boost::timer tim; + + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + // randomize boxes + const size_t n = 10000; + std::vector v(n); + for ( size_t i = 0 ; i < n ; ++i ) + { + float x = ( rand() % 10000 ) / 1000.0f; + float y = ( rand() % 10000 ) / 1000.0f; + float w = ( rand() % 10000 ) / 100000.0f; + float h = ( rand() % 10000 ) / 100000.0f; + v[i] = B(P(x - w, y - h),P(x + w, y + h)); + } + + boost::geometry::index::rtree t(4, 2); + + std::cout << "inserting time test...\n"; + + tim.restart(); + + BOOST_FOREACH(B &b, v) + { + boost::geometry::index::insert(t, b); + } + + std::cout << "time: " << tim.elapsed() << "s\n"; + + std::cout << "deleting time test...\n"; + tim.restart(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + +#ifdef _MSC_VER + std::cin.get(); +#endif + + return 0; +} diff --git a/tests/main.cpp b/tests/main.cpp new file mode 100644 index 000000000..93fc439de --- /dev/null +++ b/tests/main.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main() +{ + tests_translators_hpp(); + tests_rtree_native_hpp(); + tests_rtree_filters_hpp(); + +#ifdef _MSC_VER + std::cin.get(); +#endif + + return 0; +} diff --git a/tests/rtree_filters.hpp b/tests/rtree_filters.hpp new file mode 100644 index 000000000..2162c6aa1 --- /dev/null +++ b/tests/rtree_filters.hpp @@ -0,0 +1,54 @@ +#ifndef TESTS_RTREE_FILTERS_HPP +#define TESTS_RTREE_FILTERS_HPP + +#include +#include + +#include +#include + +#include + +#include +#include + +template +void tests_rtree_filters_hpp_print_range(R const& r) +{ + BOOST_FOREACH(typename boost::iterator_value::type const& b, r) + { + float min_x = b.min_corner().template get<0>(); + float min_y = b.min_corner().template get<1>(); + float max_x = b.max_corner().template get<0>(); + float max_y = b.max_corner().template get<1>(); + std::cout << "(" << min_x << ", " << min_y << ")"; + std::cout << 'x'; + std::cout << "(" << max_x << ", " << max_y << ")"; + std::cout << '\n'; + } + std::cout << std::endl; +} + +void tests_rtree_filters_hpp() +{ + std::cout << "tests/rtree_filters.hpp\n"; + + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + { + boost::geometry::index::rtree t(4, 2); + boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); + boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); + boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); + boost::geometry::index::insert(t, B(P(6, 6), P(7, 7))); + boost::geometry::index::insert(t, B(P(8, 8), P(9, 9))); + std::cout << t; + + std::cout << "Query: (2.5, 2.5)x(4.5, 4.5)\n"; + namespace f = boost::geometry::index::filters; + tests_rtree_filters_hpp_print_range(t | f::spatially_filtered(B(P(2.5f, 2.5f), P(4.5f, 4.5f)))); + } +} + +#endif // TESTS_RTREE_FILTERS_HPP diff --git a/tests/rtree_native.hpp b/tests/rtree_native.hpp new file mode 100644 index 000000000..430c68bcd --- /dev/null +++ b/tests/rtree_native.hpp @@ -0,0 +1,150 @@ +#ifndef TESTS_RTREE_NATIVE_HPP +#define TESTS_RTREE_NATIVE_HPP + +#include + +#include +#include + +#include + +#include +#include + +#include + +void tests_rtree_native_hpp() +{ + std::cout << "tests/rtree_native.hpp\n"; + + std::cout << "Boxes\n"; + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + boost::geometry::index::rtree t(4, 2); + boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); + boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); + boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); + boost::geometry::index::insert(t, B(P(6, 6), P(7, 7))); + boost::geometry::index::insert(t, B(P(8, 8), P(9, 9))); + std::cerr << t; + } + + std::cout << "-------------------------------------------------\n"; + std::cout << "-------------------------------------------------\n"; + + std::cout << "Points\n"; + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + boost::geometry::index::rtree

t(4, 2); + boost::geometry::index::insert(t, P(0, 0)); + boost::geometry::index::insert(t, P(2, 2)); + boost::geometry::index::insert(t, P(4, 4)); + boost::geometry::index::insert(t, P(6, 6)); + boost::geometry::index::insert(t, P(8, 8)); + std::cerr << t; + } + + std::cout << "-------------------------------------------------\n"; + std::cout << "-------------------------------------------------\n"; + + std::cout << "std::pair\n"; + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + typedef std::pair V; + + boost::geometry::index::rtree t(4, 2); + boost::geometry::index::insert(t, V(B(P(0, 0), P(1, 1)), 0)); + boost::geometry::index::insert(t, V(B(P(2, 2), P(3, 3)), 1)); + boost::geometry::index::insert(t, V(B(P(4, 4), P(5, 5)), 2)); + boost::geometry::index::insert(t, V(B(P(6, 6), P(7, 7)), 3)); + boost::geometry::index::insert(t, V(B(P(8, 8), P(9, 9)), 4)); + std::cerr << t; + } + + std::cout << "-------------------------------------------------\n"; + std::cout << "-------------------------------------------------\n"; + + std::cout << "boost::shared_ptr< std::pair >\n"; + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + typedef boost::shared_ptr< std::pair > V; + + V v1( new std::pair(B(P(0, 0), P(1, 1)), 0) ); + V v2( new std::pair(B(P(2, 2), P(3, 3)), 1) ); + V v3( new std::pair(B(P(4, 4), P(5, 5)), 2) ); + V v4( new std::pair(B(P(6, 6), P(7, 7)), 3) ); + V v5( new std::pair(B(P(8, 8), P(9, 9)), 4) ); + + boost::geometry::index::rtree t(4, 2); + boost::geometry::index::insert(t, v1); + boost::geometry::index::insert(t, v2); + boost::geometry::index::insert(t, v3); + boost::geometry::index::insert(t, v4); + boost::geometry::index::insert(t, v5); + std::cerr << t; + } + + std::cout << "-------------------------------------------------\n"; + std::cout << "-------------------------------------------------\n"; + + std::cout << "std::map::iterator\n"; + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + typedef std::map::iterator V; + + std::map m; + m.insert(std::pair(0, B(P(0, 0), P(1, 1)))); + m.insert(std::pair(1, B(P(2, 2), P(3, 3)))); + m.insert(std::pair(2, B(P(4, 4), P(5, 5)))); + m.insert(std::pair(3, B(P(6, 6), P(7, 7)))); + m.insert(std::pair(4, B(P(8, 8), P(9, 9)))); + + boost::geometry::index::rtree t(4, 2); + V vit = m.begin(); + boost::geometry::index::insert(t, vit++); + boost::geometry::index::insert(t, vit++); + boost::geometry::index::insert(t, vit++); + boost::geometry::index::insert(t, vit++); + boost::geometry::index::insert(t, vit); + std::cerr << t; + } + + std::cout << "-------------------------------------------------\n"; + std::cout << "-------------------------------------------------\n"; + + std::cout << "size_t\n"; + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + typedef size_t V; + typedef boost::geometry::index::translator::index > T; + + std::vector v; + v.push_back(B(P(0, 0), P(1, 1))); + v.push_back(B(P(2, 2), P(3, 3))); + v.push_back(B(P(4, 4), P(5, 5))); + v.push_back(B(P(6, 6), P(7, 7))); + v.push_back(B(P(8, 8), P(9, 9))); + + boost::geometry::index::rtree t(4, 2, T(v)); + + boost::geometry::index::insert(t, 0u); + boost::geometry::index::insert(t, 1u); + boost::geometry::index::insert(t, 2u); + boost::geometry::index::insert(t, 3u); + boost::geometry::index::insert(t, 4u); + std::cerr << t; + } +} + +#endif // TESTS_RTREE_NATIVE_HPP diff --git a/tests/translators.hpp b/tests/translators.hpp new file mode 100644 index 000000000..f53681c8c --- /dev/null +++ b/tests/translators.hpp @@ -0,0 +1,72 @@ +#ifndef TESTS_TRANSLATORS_HPP +#define TESTS_TRANSLATORS_HPP + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +void tests_translators_hpp() +{ + std::cout << "tests/translators.hpp\n"; + + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + typedef boost::geometry::index::rtree I; + + using namespace boost::geometry; + + index::translator::def

p; + index::translator::def pp; + index::translator::def*> pip; + index::translator::def< boost::shared_ptr

> sp; + index::translator::def< std::vector

::iterator > ip; + index::translator::def< std::map::iterator > mip; + index::translator::def< std::pair > ppi; + index::translator::def< boost::shared_ptr< std::pair > > spip; + index::translator::def< boost::shared_ptr< std::pair > > sppi; + index::translator::def< boost::scoped_ptr< std::pair > > scppi; + index::translator::def< boost::scoped_ptr< std::pair > > scpip; + + P tmp_p; + boost::shared_ptr

tmp_sp(new P()); + std::vector

tmp_v(1); + std::map tmp_m; + tmp_m.insert(std::pair(0, P())); + std::pair tmp_pip; + boost::shared_ptr< std::pair > tmp_spip(new std::pair(0, P())); + boost::shared_ptr< std::pair > tmp_sppi(new std::pair(P(), 0)); + boost::scoped_ptr< std::pair > tmp_scpip(new std::pair(0, P())); + boost::scoped_ptr< std::pair > tmp_scppi(new std::pair(P(), 0)); + + tmp_p = p(P()); + tmp_p = pp(&tmp_p); + tmp_p = pip(&tmp_pip); + tmp_p = sp(tmp_sp); + tmp_p = ip(tmp_v.begin()); + tmp_p = mip(tmp_m.begin()); + tmp_p = ppi(std::pair(P(), 0)); + tmp_p = spip(tmp_spip); + tmp_p = sppi(tmp_sppi); + tmp_p = scpip(tmp_scpip); + tmp_p = scppi(tmp_scppi); + + //index::translator::def d; // error + //index::translator::def< model::segment

> d; // error + + index::translator::def< std::pair, B> > d; + index::translator::def< std::pair > > dd; + + B tmp_b; + tmp_b = d( std::pair, B>() ); + tmp_b = dd( std::pair >() ); +} + +#endif // TESTS_TRANSLATORS_HPP From debe89c751842a1d767c1eb0fd06dcf1f414a9b8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 24 Mar 2011 23:56:53 +0000 Subject: [PATCH 002/366] removed unneeded files [SVN r70533] --- tests/TODO.txt | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 tests/TODO.txt diff --git a/tests/TODO.txt b/tests/TODO.txt deleted file mode 100644 index 4cad34427..000000000 --- a/tests/TODO.txt +++ /dev/null @@ -1,20 +0,0 @@ -// TODO -// wewnetrzny typ pudelek zmienic na geometry::box -// do kopiowania pudelek uzytkownik -> internal uzyc specjlnej funkcji -// przydalaby sie inna struktura wezlow - w tej powielane sa dane -// node <- internal_node, node <- leaf_node -// traktowanie liscia jako wezla wewnetrznego tez jest bez sensu (nie widze dobrej sytuacji) - -// czy translator powinien zwracac geometry::model::point czy Point -// a jesli zalozymy ze uzytkownik przechowuje Polygon to powinien on byc przechowywany z Boxem czy nie -// to przechowuje pair lub jesli przechowuje Box pisze sobie nowy translator - -// czy wewnatrz struktury powinny byc przechowywane: Box i geometry::box -// czy geometry::box::value>, ...> - -// 1. box wewnatrz wezlow -// 2. bounding object w lisciach - -// 3. jakis automatyczny przechowywacz innych obiektow? polygon, segment -// powinien istniec automatyczny translator obiekt -> box -// i box/point przechowywany w lisciach razem z obiektem \ No newline at end of file From e05afa847ea173bd62c21553690c39f13878d753 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 27 Mar 2011 02:21:45 +0000 Subject: [PATCH 003/366] other version of split algorithm + a lot of minor changes [SVN r70607] --- .../index/rtree/rstar/choose_next_node.hpp | 186 +++++ .../index/rtree/rstar/rtree_insert.hpp | 645 +----------------- .../extensions/index/rtree/rstar/split.hpp | 338 +++++++++ .../geometry/extensions/index/rtree/rtree.hpp | 15 +- .../extensions/index/rtree/rtree_node.hpp | 18 + .../index/rtree/visitors/gl_draw.hpp | 30 +- .../extensions/index/rtree/visitors/print.hpp | 29 +- .../rtree/visitors/rtree_are_boxes_ok.hpp | 103 +++ tests/additional_glut_vis.cpp | 27 +- tests/additional_sizes_and_times.cpp | 8 +- tests/main.cpp | 13 + tests/rtree_native.hpp | 19 +- 12 files changed, 744 insertions(+), 687 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/split.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp new file mode 100644 index 000000000..20b88e08f --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -0,0 +1,186 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R*-tree ChooseNextNode algorithm +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP + +#include + +#include +#include +#include + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +struct rtree_rstar_chnn_min_overlap_cost {}; +struct rtree_rstar_chnn_nearly_min_overlap_cost {}; + +// TODO: awulkiew - it's possible that goodness values may be used to choose next node +// on this step some of the goodness values would be calculated (not all) +// and only for some nodes (goodness values should be calculated only if there is an overflow) + +template +class rtree_rstar_choose_next_node +{}; + +// TODO: awulkiew finish this version +// use min_element instead of searching by myself + +//template +//class rtree_rstar_choose_next_node +//{ +// typedef typename index::detail::rtree_node::type node; +// typedef typename index::detail::rtree_internal_node::type internal_node; +// typedef typename index::detail::rtree_leaf::type leaf; +// +// typedef typename internal_node::children_type children_type; +// +//public: +// template +// static inline size_t apply(internal_node & n, Indexable const& indexable) +// { +// assert(!n.children.empty()); +// +// bool has_leaves = boost::apply_visitor( +// visitors::rtree_is_leaf(), +// *n.children.front().second); +// +// if ( !has_leaves ) +// return impl(n, indexable); +// else +// return impl(n, indexable); +// } +// +//private: +// template +// static inline size_t impl(internal_node & n, Indexable const& indexable) +// { +// } +// +//}; + +// TODO: awulkiew - wrong algorithm? Should branch check be applied to Leafs? +// TODO: awulkiew - further optimization: don't calculate area with the overlap, calculate it only if +// overlap < smallest_overlap (and current area must be stored) OR +// overlap == smallest_overlap (and area must be compared) + +template +class rtree_rstar_choose_next_node +{ + typedef typename index::detail::rtree_node::type node; + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + typedef typename internal_node::children_type children_type; + +public: + template + static inline size_t apply(internal_node & n, Indexable const& indexable) + { + assert(!n.children.empty()); + + bool has_leaves = boost::apply_visitor( + visitors::rtree_is_leaf(), + *n.children.front().second); + + if ( !has_leaves ) + return impl(n, indexable); + else + return impl(n, indexable); + } + +private: + template + static inline size_t impl(internal_node & n, Indexable const& indexable) + { + typedef typename children_type::iterator children_iterator; + + //assert(!n.children.empty()); + + children_iterator temp_it = n.children.begin(); + children_iterator child_it = temp_it; + Areas min_areas(n.children, child_it, indexable); + + for (children_iterator it = ++temp_it; + it != n.children.end(); ++it) + { + Areas areas(n.children, it, indexable); + + if ( areas < min_areas ) + { + child_it = it; + min_areas = areas; + } + } + + // TODO: awulkiew - switch to indexes in the whole class? + return child_it - n.children.begin(); + } + + struct branch_areas + { + typedef typename area_result::type area_type; + + template + inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable) + { + overlap_area = 0; + for (typename children_type::const_iterator it = ch.begin(); it != ch.end(); ++it) + if ( it != k_it ) + overlap_area += index::overlap(k_it->first, it->first); + + area = index::area(k_it->first); + + diff_area = index::union_area(k_it->first, indexable) - area; + } + + inline bool operator<(branch_areas &a) const + { + return overlap_area < a.overlap_area || + ( overlap_area == a.overlap_area && diff_area < a.diff_area ) || + ( diff_area == a.diff_area && area < a.area ); + } + + area_type overlap_area; + area_type diff_area; + area_type area; + }; + + struct internal_node_areas + { + typedef typename area_result::type area_type; + + template + inline internal_node_areas(children_type const&, typename children_type::iterator const& k_it, Indexable const& indexable) + { + area = index::area(k_it->first); + diff_area = index::union_area(k_it->first, indexable) - area; + } + + inline bool operator<(internal_node_areas &a) const + { + return diff_area < a.diff_area || + ( diff_area == a.diff_area && area < a.area ); + } + + area_type diff_area; + area_type area; + }; +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp index e4aa929ab..3e317a3f4 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp @@ -23,578 +23,13 @@ #include #include +#include +#include + namespace boost { namespace geometry { namespace index { namespace visitors { -// ----------------------------------------------------------------------------- // -// rstar/choose_next_node -// ----------------------------------------------------------------------------- // - -// TODO: awulkiew - it's possible that goodness values may be used to choose next node - -// rtree choose_next_node algorithm for rstar variant - -template -class rtree_rstar_choose_next_node -{ - typedef typename index::detail::rtree_node::type node; - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; - - typedef typename internal_node::children_type children_type; - -public: - // TODO: awulkiew - alternative lower-cost version of overlap calculation may be used (branch_areas) - // TODO: awulkiew - further optimization: don't calculate area with the overlap, calculate it only if - // overlap < smallest_overlap (and current area must be stored) OR - // overlap == smallest_overlap (and area must be compared) - template - static inline size_t apply(internal_node & n, Indexable const& indexable) - { - assert(!n.children.empty()); - - bool has_leaves = boost::apply_visitor( - visitors::rtree_is_leaf(), - *n.children.front().second); - - if ( !has_leaves ) - return impl(n, indexable); - else - return impl(n, indexable); - } - -private: - template - static inline size_t impl(internal_node & n, Indexable const& indexable) - { - typedef typename children_type::iterator children_iterator; - - //assert(!n.children.empty()); - - children_iterator temp_it = n.children.begin(); - children_iterator child_it = temp_it; - Areas min_areas(n.children, child_it, indexable); - - for (children_iterator it = ++temp_it; - it != n.children.end(); ++it) - { - Areas areas(n.children, it, indexable); - - if ( areas < min_areas ) - { - child_it = it; - min_areas = areas; - } - } - - // TODO: awulkiew - switch to indexes in the whole class? - return child_it - n.children.begin(); - } - - struct branch_areas - { - typedef typename area_result::type area_type; - - template - inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable) - { - overlap_area = 0; - for (typename children_type::const_iterator it = ch.begin(); it != ch.end(); ++it) - if ( it != k_it ) - overlap_area += index::overlap(k_it->first, it->first); - - area = index::area(k_it->first); - - diff_area = index::union_area(k_it->first, indexable) - area; - } - - inline bool operator<(branch_areas &a) const - { - return overlap_area < a.overlap_area || - ( overlap_area == a.overlap_area && diff_area < a.diff_area ) || - ( diff_area == a.diff_area && area < a.area ); - } - - area_type overlap_area; - area_type diff_area; - area_type area; - }; - - struct internal_node_areas - { - typedef typename area_result::type area_type; - - template - inline internal_node_areas(children_type const&, typename children_type::iterator const& k_it, Indexable const& indexable) - { - area = index::area(k_it->first); - diff_area = index::union_area(k_it->first, indexable) - area; - } - - inline bool operator<(internal_node_areas &a) const - { - return diff_area < a.diff_area || - ( diff_area == a.diff_area && area < a.area ); - } - - area_type diff_area; - area_type area; - }; -}; - -// ----------------------------------------------------------------------------- // -// rstar/sorts -// ----------------------------------------------------------------------------- // - -// elements ids less comparator - -template -class rtree_rstar_elements_indexes_less -{ -public: - rtree_rstar_elements_indexes_less(Elements const& elements, Translator const& tr) - : m_elements(elements), m_tr(tr) - {} - - bool operator()(size_t e1_index, size_t e2_index) - { - return - index::detail::get( - index::detail::rtree_element_indexable(m_elements[e1_index], m_tr) - ) - < - index::detail::get( - index::detail::rtree_element_indexable(m_elements[e2_index], m_tr) - ); - } - -private: - Elements const& m_elements; - Translator const& m_tr; -}; - -template -class rtree_rstar_vectors -{ -public: - inline rtree_rstar_vectors(size_t count) - : m_count(count), m_ids(Dimension * 2 * count) - {} - - template - inline typename std::vector::iterator begin() - { - BOOST_STATIC_ASSERT(AxisIndex < Dimension); - BOOST_STATIC_ASSERT(Corner < 2); - return m_ids.begin() + ( AxisIndex * 2 + Corner ) * m_count; - } - - template - inline typename std::vector::iterator end() - { - BOOST_STATIC_ASSERT(AxisIndex < Dimension); - BOOST_STATIC_ASSERT(Corner < 2); - return m_ids.begin() + ( AxisIndex * 2 + Corner + 1) * m_count; - } - - template - inline T const& get(size_t index) const - { - BOOST_STATIC_ASSERT(AxisIndex < Dimension); - BOOST_STATIC_ASSERT(Corner < 2); - assert(index < m_count); - return m_ids[( AxisIndex * 2 + Corner ) * m_count + index]; - } - - template - inline void set(size_t index, T const& v) - { - BOOST_STATIC_ASSERT(AxisIndex < Dimension); - BOOST_STATIC_ASSERT(Corner < 2); - assert(index < m_count); - m_ids[( AxisIndex * 2 + Corner ) * m_count + index] = v; - } - - inline T const& get(size_t axis, size_t corner, size_t index) const - { - assert(axis < Dimension); - assert(corner < 2); - assert(index < m_count); - return m_ids[( axis * 2 + corner ) * m_count + index]; - } - - inline size_t vector_size() const - { - return m_count; - } - -private: - size_t m_count; - std::vector m_ids; -}; - -// init indexes of elements and sort them - -template -class rtree_rstar_sorts_fill_ids -{ - BOOST_STATIC_ASSERT(0 < Dimension); - -public: - template - static inline void apply(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) - { - rtree_rstar_sorts_fill_ids::apply(ids, elements, tr); - - fill(ids, elements, tr); - fill(ids, elements, tr); - } - -private: - template - static inline void fill(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) - { - for ( size_t i = 0 ; i < elements.size() ; ++i ) - ids.set(i, i); - - rtree_rstar_elements_indexes_less less(elements, tr); - std::sort(ids.begin(), ids.end(), less); - } -}; - -template -class rtree_rstar_sorts_fill_ids -{ -public: - template - static inline void apply(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) - { - fill(ids, elements, tr); - fill(ids, elements, tr); - } - -private: - template - static inline void fill(rtree_rstar_vectors & ids, Elements const& elements, Translator const& tr) - { - for ( size_t i = 0 ; i < elements.size() ; ++i ) - ids.set<0, Corner>(i, i); - - rtree_rstar_elements_indexes_less less(elements, tr); - std::sort(ids.begin<0, Corner>(), ids.end<0, Corner>(), less); - } -}; - -// sorts for each axis for min and max - -template -class rtree_rstar_sorts -{ -public: - inline rtree_rstar_sorts(Elements const& elements, Translator const& tr) - : m_elems(elements), m_tr(tr), m_ids(m_elems.size()) - { - rtree_rstar_sorts_fill_ids::apply(m_ids, elements, tr); - } - - // TODO: awulkiew - should those methods be here? Just leave get_element? - - template - inline typename index::detail::rtree_element_indexable_type::type const& - get_indexable(size_t index) const - { - size_t id = m_ids.get(index); - return index::detail::rtree_element_indexable(m_elems[id], m_tr); - } - - inline typename index::detail::rtree_element_indexable_type::type const& - get_indexable(size_t axis, size_t corner, size_t index) const - { - size_t id = m_ids.get(axis, corner, index); - return index::detail::rtree_element_indexable(m_elems[id], m_tr); - } - - template - inline typename Elements::value_type const& get_element(size_t index) const - { - size_t id = m_ids.get(index); - return m_elems[id]; - } - - inline typename Elements::value_type const& get_element(size_t axis, size_t corner, size_t index) const - { - size_t id = m_ids.get(axis, corner, index); - return m_elems[id]; - } - - inline size_t sort_size() const - { - return m_ids.vector_size(); - } - -private: - Elements const& m_elems; - Translator const& m_tr; - - rtree_rstar_vectors m_ids; -}; - -// ----------------------------------------------------------------------------- // -// rstar/goodness_values -// ----------------------------------------------------------------------------- // - -// calculate margins, areas and overlaps - -template -class rtree_rstar_calculate_goodness_values_for_axis -{ - typedef typename geometry::traits::coordinate_type< - typename geometry::traits::point_type::type - >::type coordinate_type; - - static const size_t dimension = geometry::traits::dimension< - typename geometry::traits::point_type::type - >::value; - - typedef typename area_result::type area_type; - typedef typename margin_result::type margin_type; - typedef typename overlap_result::type overlap_type; - typedef boost::tuple goodness_type; - -public: - template - static inline void apply( - rtree_rstar_vectors & goodness_vectors, - rtree_rstar_sorts const& sorts, - size_t min_elems, - size_t max_elems) - { - assert(sorts.sort_size() == max_elems + 1); - assert(goodness_vectors.vector_size() == max_elems - 2 * min_elems + 2); - - size_t median_index_last = max_elems - min_elems + 2; - size_t i = 0; - for ( size_t median_index = min_elems ; median_index < median_index_last ; ++median_index, ++i ) - { - Box left_box = calculate_box(sorts, 0, median_index); - Box right_box = calculate_box(sorts, median_index, sorts.sort_size()); - - margin_type margin = index::margin(left_box) + index::margin(right_box); - area_type area = index::area(left_box) + index::area(right_box); - overlap_type overlap = index::overlap(left_box, right_box); - - goodness_vectors.set( - i, - boost::make_tuple(left_box, right_box, margin, overlap, area)); - } - } -private: - template - static inline Box calculate_box( - rtree_rstar_sorts const& sorts, - size_t index_first, - size_t index_last) - { - assert(index_first < index_last); - - Box result; - geometry::convert(sorts.template get_indexable(index_first), result); - ++index_first; - for ( ; index_first < index_last ; ++index_first ) - geometry::expand(result, sorts.template get_indexable(index_first)); - return result; - } -}; - -// calculate goodness values for all axis - -template -struct rtree_rstar_calculate_goodness_values -{ - BOOST_STATIC_ASSERT(0 < Dimension); - - typedef typename area_result::type area_type; - typedef typename margin_result::type margin_type; - typedef typename overlap_result::type overlap_type; - typedef boost::tuple goodness_type; - - template - static inline void apply( - rtree_rstar_vectors & goodness_vectors, - rtree_rstar_sorts const& sorts, - size_t min_elems, - size_t max_elems) - { - rtree_rstar_calculate_goodness_values - ::apply(goodness_vectors, sorts, min_elems, max_elems); - - rtree_rstar_calculate_goodness_values_for_axis - ::apply(goodness_vectors, sorts, min_elems, max_elems); - rtree_rstar_calculate_goodness_values_for_axis - ::apply(goodness_vectors, sorts, min_elems, max_elems); - } -}; - -template -struct rtree_rstar_calculate_goodness_values -{ - typedef typename area_result::type area_type; - typedef typename margin_result::type margin_type; - typedef typename overlap_result::type overlap_type; - typedef boost::tuple goodness_type; - - template - static inline void apply( - rtree_rstar_vectors & goodness_vectors, - rtree_rstar_sorts const& sorts, - size_t min_elems, - size_t max_elems) - { - rtree_rstar_calculate_goodness_values_for_axis - ::apply(goodness_vectors, sorts, min_elems, max_elems); - rtree_rstar_calculate_goodness_values_for_axis - ::apply(goodness_vectors, sorts, min_elems, max_elems); - } -}; - -// goodness values - -template -class rtree_rstar_goodness_values -{ - typedef typename geometry::traits::coordinate_type< - typename geometry::traits::point_type::type - >::type coordinate_type; - - static const size_t dimension = geometry::traits::dimension< - typename geometry::traits::point_type::type - >::value; - - typedef typename area_result::type area_type; - typedef typename margin_result::type margin_type; - typedef typename overlap_result::type overlap_type; - typedef boost::tuple goodness_type; - -public: - inline rtree_rstar_goodness_values( - Elements const& elements, - Translator const& tr, - size_t min_elems, - size_t max_elems) - : m_sorts(elements, tr) - , m_goodness_vectors(max_elems - 2 * min_elems + 2) - { - rtree_rstar_calculate_goodness_values::apply( - m_goodness_vectors, m_sorts, min_elems, max_elems); - } - - inline size_t elements_size() const - { - return m_sorts.sort_size(); - } - - inline size_t goodnesses_size() const - { - return m_goodness_vectors.vector_size(); - } - - inline goodness_type const& get_goodness(size_t axis, size_t corner, size_t index) const - { - return m_goodness_vectors.get(axis, corner, index); - } - - inline typename Elements::value_type const& get_element(size_t axis, size_t corner, size_t index) const - { - return m_sorts.get_element(axis, corner, index); - } - -private: - rtree_rstar_sorts m_sorts; - rtree_rstar_vectors m_goodness_vectors; -}; - -template -class rtree_rstar_choose_split_axis -{ - typedef typename margin_result::type margin_type; -public: - static inline std::pair apply(rtree_rstar_goodness_values const& gv) - { - std::pair smallest_distr = std::make_pair(0, 0); - margin_type smallest_margins_sum = calculate_margins_sum(0, 0, gv); - - margin_type margins_sum = calculate_margins_sum(0, 1, gv); - if ( margins_sum < smallest_margins_sum ) - { - smallest_distr.second = 1; - smallest_margins_sum = margins_sum; - } - - for ( size_t a = 1 ; a < traits::dimension::value ; ++a ) - { - for ( size_t c = 0 ; c < 2 ; ++c ) - { - margins_sum = calculate_margins_sum(a, c, gv); - if ( margins_sum < smallest_margins_sum ) - { - smallest_distr.first = a; - smallest_distr.second = c; - smallest_margins_sum = margins_sum; - } - } - } - return smallest_distr; - } -private: - static inline typename margin_result::type - calculate_margins_sum(size_t axis, size_t corner, rtree_rstar_goodness_values const& gv) - { - typename margin_result::type margins_sum = 0; - for ( size_t i = 0 ; i < gv.goodnesses_size() ; ++i ) - margins_sum += boost::get<2>(gv.get_goodness(axis, corner, i)); - return margins_sum; - } -}; - -template -class rtree_rstar_choose_split_index -{ - typedef typename area_result::type area_type; - typedef typename overlap_result::type overlap_type; -public: - static inline size_t apply(rtree_rstar_goodness_values const& gv, size_t axis, size_t corner) - { - size_t smallest_index = 0; - overlap_type smallest_overlap = boost::get<3>(gv.get_goodness(axis, corner, 0)); - overlap_type smallest_area = boost::get<4>(gv.get_goodness(axis, corner, 0)); - - for ( size_t i = 1 ; i < gv.goodnesses_size() ; ++i ) - { - overlap_type overlap = boost::get<3>(gv.get_goodness(axis, corner, i)); - if ( overlap < smallest_overlap ) - { - smallest_overlap = overlap; - smallest_area = boost::get<4>(gv.get_goodness(axis, corner, i)); - smallest_index = i; - } - else if ( overlap == smallest_overlap ) - { - area_type area = boost::get<4>(gv.get_goodness(axis, corner, i)); - if ( area < smallest_area ) - { - smallest_area = area; - smallest_index = i; - } - } - } - - return smallest_index; - } -}; - -// rtree insert routine for rstar variant - template class rtree_insert : public boost::static_visitor<> { @@ -617,7 +52,9 @@ public: size_t current_child_index_bckup = m_current_child_index; // choose next node, where value insert traversing should go - m_current_child_index = rtree_rstar_choose_next_node::apply(n, m_tr(m_value)); + m_current_child_index = + rtree_rstar_choose_next_node:: + apply(n, m_tr(m_value)); // TODO: awulkiew - if reinsert is implemented this must be changed geometry::expand(n.children[m_current_child_index].first, m_tr(m_value)); @@ -631,7 +68,8 @@ public: if ( m_max_elems_per_node < n.children.size() ) { - split(n); + rtree_rstar_split:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); } } @@ -641,75 +79,12 @@ public: if ( m_max_elems_per_node < n.values.size() ) { - split(n); + rtree_rstar_split:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); } } private: - template - inline void split(Node & n) - { - typedef typename index::detail::rtree_elements_type::type elements_type; - typedef typename elements_type::value_type element_type; - - elements_type & elems = index::detail::get_elements(n); - - rtree_rstar_goodness_values gv(elems, m_tr, m_min_elems_per_node, m_max_elems_per_node); - - std::pair axis_and_corner = - rtree_rstar_choose_split_axis::apply(gv); - size_t axis = axis_and_corner.first; - size_t corner = axis_and_corner.second; - - size_t choosen_index = - rtree_rstar_choose_split_index::apply(gv, axis, corner); - - size_t median_index = m_min_elems_per_node + choosen_index; - assert(median_index <= m_max_elems_per_node + 1 - m_min_elems_per_node); - - // create new node - node * right_node = rtree_create_node(Node()); - elements_type & new_elems = index::detail::get_elements(boost::get(*right_node)); - - // update new node's elements - new_elems.reserve(m_max_elems_per_node + 1 - median_index); - for ( size_t i = median_index ; i < m_max_elems_per_node + 1 ; ++i) - new_elems.push_back(gv.get_element(axis, corner, i)); - - // fill temporary container with left node's elements - elements_type left_elems; - left_elems.reserve(median_index); - for ( size_t i = 0 ; i < median_index ; ++i ) - left_elems.push_back(gv.get_element(axis, corner, i)); - // update old node's elements - elems = left_elems; - - if ( m_parent != 0 ) - { - // update old node's box - m_parent->children[m_current_child_index].first = boost::get<0>(gv.get_goodness(axis, corner, choosen_index)); - // add new node to the parent's children - m_parent->children.push_back( std::make_pair( - boost::get<1>(gv.get_goodness(axis, corner, choosen_index)), right_node ) ); - } - else - { - assert(&n == boost::get(m_root_node)); - - // create new root and add nodes - node * new_root = rtree_create_node(internal_node()); - - boost::get(*new_root).children.push_back( - std::make_pair(boost::get<0>(gv.get_goodness(axis, corner, choosen_index)), m_root_node) - ); - boost::get(*new_root).children.push_back( - std::make_pair(boost::get<1>(gv.get_goodness(axis, corner, choosen_index)), right_node) - ); - - m_root_node = new_root; - } - } - Value const& m_value; Translator const& m_tr; size_t m_min_elems_per_node; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp new file mode 100644 index 000000000..e6d0fe3d9 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp @@ -0,0 +1,338 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R*-tree split algorithm implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_SPLIT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_SPLIT_HPP + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +// elements less + +template +class rtree_rstar_elements_less +{ + typedef typename Elements::value_type element_type; +public: + inline rtree_rstar_elements_less(Translator const& tr) + : m_tr(tr) + {} + + inline bool operator()(element_type const& e1, element_type const e2) const + { + return + index::detail::get( + index::detail::rtree_element_indexable(e1, m_tr) + ) + < + index::detail::get( + index::detail::rtree_element_indexable(e2, m_tr) + ); + } + +private: + Translator const& m_tr; +}; + +// rstar split axis data + +template +struct rtree_rstar_split_axis_data +{ + typedef typename margin_result::type margin_type; + typedef typename overlap_result::type overlap_type; + typedef typename area_result::type area_type; + + inline rtree_rstar_split_axis_data() + : margins_sum(0) + , smallest_overlap(std::numeric_limits::max()) + , smallest_area(std::numeric_limits::max()) + {} + + inline void update( + size_t corner, + size_t median_index, + Box const& left_box, + Box const& right_box, + margin_type const& margin, + overlap_type const& overlap, + area_type const& area) + { + margins_sum += margin; + + if ( overlap < smallest_overlap || + ( overlap == smallest_overlap && area < smallest_area ) ) + { + choosen_corner = corner; + choosen_median_index = median_index; + choosen_left_box = left_box; + choosen_right_box = right_box; + smallest_overlap = overlap; + smallest_area = area; + } + } + + size_t choosen_corner; + size_t choosen_median_index; + Box choosen_left_box; + Box choosen_right_box; + margin_type margins_sum; + overlap_type smallest_overlap; + area_type smallest_area; +}; + +// update axis data for given axis and corner + +template +class rtree_rstar_split_update_axis_data_for_corner +{ + typedef typename rtree_rstar_split_axis_data::margin_type margin_type; + typedef typename rtree_rstar_split_axis_data::overlap_type overlap_type; + typedef typename rtree_rstar_split_axis_data::area_type area_type; + + BOOST_STATIC_ASSERT(Corner < 2); + +public: + template + static inline void apply( + rtree_rstar_split_axis_data & split_axis_data, + Elements const& sorted_elements, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + size_t median_index_last = max_elems - min_elems + 2; + for ( size_t median_index = min_elems ; median_index < median_index_last ; ++median_index ) + { + Box left_box = index::detail::elements_box(sorted_elements.begin(), sorted_elements.begin() + median_index, tr); + Box right_box = index::detail::elements_box(sorted_elements.begin() + median_index, sorted_elements.end(), tr); + + margin_type margin = index::margin(left_box) + index::margin(right_box); + overlap_type overlap = index::overlap(left_box, right_box); + area_type area = index::area(left_box) + index::area(right_box); + + split_axis_data.update(Corner, median_index, left_box, right_box, margin, overlap, area); + } + } +}; + +// split data + +template +struct rtree_rstar_split_data +{ + typedef typename margin_result::type margin_type; + typedef typename overlap_result::type overlap_type; + typedef typename area_result::type area_type; + + inline rtree_rstar_split_data() + : smallest_margins_sum(std::numeric_limits::max()) + {} + + inline void update( + size_t axis, + size_t corner, + size_t median_index, + Box const& left_box, + Box const& right_box, + margin_type const& margins_sum, + Elements const& distribution) + { + if ( margins_sum < smallest_margins_sum ) + { + choosen_axis = axis; + choosen_corner = corner; + choosen_median_index = median_index; + choosen_left_box = left_box; + choosen_right_box = right_box; + smallest_margins_sum = margins_sum; + choosen_distribution = distribution; + } + } + + size_t choosen_axis; + size_t choosen_corner; + size_t choosen_median_index; + Box choosen_left_box; + Box choosen_right_box; + margin_type smallest_margins_sum; + Elements choosen_distribution; +}; + +// update split data for given axis and corner + +template +class rtree_rstar_split_update_data_for_axis_and_corner +{ + typedef typename rtree_rstar_split_axis_data::margin_type margin_type; + typedef typename rtree_rstar_split_axis_data::overlap_type overlap_type; + typedef typename rtree_rstar_split_axis_data::area_type area_type; + +public: + template + static inline void apply( + rtree_rstar_split_data & split_data, + Elements & elements, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + rtree_rstar_split_axis_data split_axis_data; + + rtree_rstar_elements_less less_min(tr); + std::sort(elements.begin(), elements.end(), less_min); + + rtree_rstar_split_update_axis_data_for_corner:: + apply(split_axis_data, elements, min_elems, max_elems, tr); + + split_data.update( + AxisIndex, + split_axis_data.choosen_corner, + split_axis_data.choosen_median_index, + split_axis_data.choosen_left_box, + split_axis_data.choosen_right_box, + split_axis_data.margins_sum, + elements); + } +}; + +// for each dimension and corner update split data + +template +struct rtree_rstar_split_update_data +{ + BOOST_STATIC_ASSERT(0 < Dimension); + + template + static inline void apply( + rtree_rstar_split_data & split_data, + Elements & elements, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + rtree_rstar_split_update_data:: + apply(split_data, elements, min_elems, max_elems, tr); + + rtree_rstar_split_update_data_for_axis_and_corner:: + apply(split_data, elements, min_elems, max_elems, tr); + rtree_rstar_split_update_data_for_axis_and_corner:: + apply(split_data, elements, min_elems, max_elems, tr); + } +}; + +template +struct rtree_rstar_split_update_data +{ + template + static inline void apply( + rtree_rstar_split_data & split_data, + Elements & elements, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + rtree_rstar_split_update_data_for_axis_and_corner:: + apply(split_data, elements, min_elems, max_elems, tr); + rtree_rstar_split_update_data_for_axis_and_corner:: + apply(split_data, elements, min_elems, max_elems, tr); + } +}; + +// split + +template +class rtree_rstar_split +{ + typedef typename index::detail::rtree_node::type node; + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + + static const size_t dimension = index::traits::dimension::value; + +public: + template + static inline void apply( + Node & n, + internal_node *parent, + size_t current_child_index, + node *& root, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename index::detail::rtree_elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + + elements_type & elements = index::detail::get_elements(n); + + // get split data + rtree_rstar_split_data split_data; + rtree_rstar_split_update_data:: + apply(split_data, elements, min_elems, max_elems, tr); + + // create new node + node * right_node = rtree_create_node(Node()); + elements_type & new_elems = index::detail::get_elements(boost::get(*right_node)); + + // update new node's elements + new_elems.resize(max_elems + 1 - split_data.choosen_median_index); + std::copy( + split_data.choosen_distribution.begin() + split_data.choosen_median_index, + split_data.choosen_distribution.end(), + new_elems.begin()); + + // update elements of the current node + elements.resize(split_data.choosen_median_index); + std::copy( + split_data.choosen_distribution.begin(), + split_data.choosen_distribution.begin() + split_data.choosen_median_index, + elements.begin()); + + if ( parent != 0 ) + { + // update old node's box + parent->children[current_child_index].first = split_data.choosen_left_box; + // add new node to the parent's children + parent->children.push_back(std::make_pair(split_data.choosen_right_box, right_node)); + } + else + { + assert(&n == boost::get(root)); + + // create new root and add nodes + node * new_root = rtree_create_node(internal_node()); + + boost::get(*new_root).children.push_back(std::make_pair(split_data.choosen_left_box, root)); + boost::get(*new_root).children.push_back(std::make_pair(split_data.choosen_right_box, right_node)); + + root = new_root; + } + } +}; + +} // namespace visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_SPLIT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 8c26668dc..3827ba6b9 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -41,18 +41,17 @@ public: typedef typename detail::rtree_internal_node::type internal_node; typedef typename detail::rtree_leaf::type leaf; - inline explicit rtree(size_t max_elems_per_node = 4, size_t min_elems_per_node = 2, translator_type const& translator = translator_type()) + inline explicit rtree(size_t max_elems_per_node = 2, size_t min_elems_per_node = 1, translator_type const& translator = translator_type()) : m_values_count(0) , m_max_elems_per_node(max_elems_per_node) , m_min_elems_per_node(min_elems_per_node) , m_root(0) , m_translator(translator) { - if ( min_elems_per_node < 2 ) - min_elems_per_node = 2; - - // TODO: awulkiew - reconsider following assert - assert(2 * m_min_elems_per_node <= m_max_elems_per_node); + if ( m_min_elems_per_node < 1 ) + m_min_elems_per_node = 1; + if ( m_max_elems_per_node < 2 ) + m_max_elems_per_node = 2; m_root = detail::rtree_create_node(leaf()); } @@ -82,9 +81,9 @@ public: } template - void apply_visitor(Visitor & visitor) const + typename Visitor::result_type apply_visitor(Visitor & visitor) const { - boost::apply_visitor(visitor, *m_root); + return boost::apply_visitor(visitor, *m_root); } translator_type const& get_translator() const diff --git a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp index e72baf688..f0742f987 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp @@ -153,6 +153,24 @@ rtree_element_indexable(Value const& el, Translator const& tr) return tr(el); }; +// elements box + +template +inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) +{ + assert(first != last); + + Box result; + + geometry::convert(index::detail::rtree_element_indexable(*first, tr), result); + ++first; + + for ( ; first != last ; ++first ) + geometry::expand(result, index::detail::rtree_element_indexable(*first, tr)); + + return result; +} + // create leaf node template 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 666a48a4c..2038bec98 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -27,10 +27,10 @@ struct rtree_gl_draw_point template struct rtree_gl_draw_point { - static inline void apply(Point const& p) + static inline void apply(Point const& p, size_t level) { glBegin(GL_POINT); - glVertex2f(geometry::get<0>(p), geometry::get<1>(p)); + glVertex2f(geometry::get<0>(p), geometry::get<1>(p), level); glEnd(); } }; @@ -42,13 +42,13 @@ struct rtree_gl_draw_box template struct rtree_gl_draw_box { - static inline void apply(Box const& b) + static inline void apply(Box const& b, size_t level) { glBegin(GL_LINE_LOOP); - glVertex2f(geometry::get(b), geometry::get(b)); - glVertex2f(geometry::get(b), geometry::get(b)); - glVertex2f(geometry::get(b), geometry::get(b)); - glVertex2f(geometry::get(b), geometry::get(b)); + glVertex3f(geometry::get(b), geometry::get(b), level); + glVertex3f(geometry::get(b), geometry::get(b), level); + glVertex3f(geometry::get(b), geometry::get(b), level); + glVertex3f(geometry::get(b), geometry::get(b), level); glEnd(); } }; @@ -64,9 +64,9 @@ struct rtree_gl_draw_indexable typedef typename geometry::traits::point_type::type point_type; static const size_t dimension = geometry::traits::dimension::value; - static inline void apply(Indexable const& i) + static inline void apply(Indexable const& i, size_t level) { - rtree_gl_draw_box::apply(i); + rtree_gl_draw_box::apply(i, level); } }; @@ -75,9 +75,9 @@ struct rtree_gl_draw_indexable { static const size_t dimension = geometry::traits::dimension::value; - static inline void apply(std::ostream &os, Indexable const& i) + static inline void apply(Indexable const& i, size_t level) { - rtree_gl_draw_point::apply(i); + rtree_gl_draw_point::apply(i, level); } }; @@ -86,12 +86,12 @@ struct rtree_gl_draw_indexable namespace detail { template -inline void rtree_gl_draw_indexable(Indexable const& i) +inline void rtree_gl_draw_indexable(Indexable const& i, size_t level) { dispatch::rtree_gl_draw_indexable< Indexable, typename geometry::traits::tag::type - >::apply(i); + >::apply(i, level); } } // namespace detail @@ -128,7 +128,7 @@ struct rtree_gl_draw : public boost::static_visitor<> for (typename children_type::const_iterator it = n.children.begin(); it != n.children.end(); ++it) { - detail::rtree_gl_draw_indexable(it->first); + detail::rtree_gl_draw_indexable(it->first, level); } size_t level_backup = level; @@ -152,7 +152,7 @@ struct rtree_gl_draw : public boost::static_visitor<> for (typename values_type::const_iterator it = n.values.begin(); it != n.values.end(); ++it) { - detail::rtree_gl_draw_indexable(tr(*it)); + detail::rtree_gl_draw_indexable(tr(*it), level); } } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 23799f938..63910a295 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -128,22 +128,15 @@ struct rtree_print : public boost::static_visitor<> { typedef typename internal_node::children_type children_type; - os << " --> Node --------" << std::endl; - os << " Address: " << this << std::endl; - os << " Level: " << level << std::endl; - os << " Children: " << n.children.size() << std::endl; - os << " | "; - + spaces(level) << "INTERNAL NODE - L:" << level << " Ch:" << n.children.size() << " @:" << &n << '\n'; + for (typename children_type::const_iterator it = n.children.begin(); it != n.children.end(); ++it) { + spaces(level); detail::rtree_print_indexable(os, it->first); - os << " | "; + os << " ->" << it->second << '\n'; } - os << std::endl; - os << " --< Node --------" << std::endl; - - os << " Children: " << std::endl; size_t level_backup = level; ++level; @@ -161,17 +154,21 @@ struct rtree_print : public boost::static_visitor<> { typedef typename leaf::values_type values_type; - os << "\t" << " --> Leaf --------" << std::endl; - os << "\t" << " Values: " << n.values.size() << std::endl; + spaces(level) << "LEAF - L:" << level << " V:" << n.values.size() << " @:" << &n << '\n'; for (typename values_type::const_iterator it = n.values.begin(); it != n.values.end(); ++it) { - os << "\t" << " | "; + spaces(level); detail::rtree_print_indexable(os, tr(*it)); - os << " | " << std::endl;; + os << '\n'; } - os << "\t" << " --< Leaf --------" << std::endl; + } + inline std::ostream & spaces(size_t level) + { + for ( size_t i = 0 ; i < 2 * level ; ++i ) + os << ' '; + return os; } std::ostream & os; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp new file mode 100644 index 000000000..5d09631e0 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp @@ -0,0 +1,103 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree boxes checking visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_ARE_BOXES_OK_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_ARE_BOXES_OK_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace visitors { + +template +class rtree_are_boxes_ok : public boost::static_visitor +{ + typedef typename index::detail::rtree_internal_node::type internal_node; + typedef typename index::detail::rtree_leaf::type leaf; + +public: + inline rtree_are_boxes_ok(Translator const& tr) + : m_tr(tr), m_is_root(true) + {} + + inline bool operator()(internal_node const& n) + { + if (n.children.empty()) + return false; + + Box box_bckup = m_box; + bool is_root_bckup = m_is_root; + + m_is_root = false; + + for ( internal_node::children_type::const_iterator it = n.children.begin(); + it != n.children.end() ; ++it) + { + m_box = it->first; + + if ( false == boost::apply_visitor(*this, *it->second) ) + return false; + } + + m_box = box_bckup; + m_is_root = is_root_bckup; + + Box result; + geometry::convert(n.children.front().first, result); + for(internal_node::children_type::const_iterator it = n.children.begin() + 1; + it != n.children.end() ; ++it) + { + geometry::expand(result, it->first); + } + + return m_is_root || geometry::equals(result, m_box); + } + + inline bool operator()(leaf const& n) + { + if (n.values.empty()) + return false; + + Box result; + geometry::convert(m_tr(n.values.front()), result); + for(leaf::values_type::const_iterator it = n.values.begin() + 1; + it != n.values.end() ; ++it) + { + geometry::expand(result, m_tr(*it)); + } + + return m_is_root || geometry::equals(result, m_box); + } + +private: + Translator const& m_tr; + Box m_box; + bool m_is_root; +}; + +} // namespace visitors + +template +bool rtree_are_boxes_ok(rtree const& tree) +{ + typedef rtree rt; + visitors::rtree_are_boxes_ok< + typename rt::value_type, + typename rt::translator_type, + typename rt::box_type, + Tag> v(tree.get_translator()); + + return tree.apply_visitor(v); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_ARE_BOXES_OK_HPP diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 819dba15e..4636f8820 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -4,10 +4,12 @@ #include #include +#include +#include typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; -boost::geometry::index::rtree t; +boost::geometry::index::rtree t(2, 1); void render_scene(void) { @@ -30,8 +32,8 @@ void resize(int w, int h) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( - 5.0f, 5.0f, 15.0f, - 5.0f, 5.0f, -1.0f, + 150.0f, 150.0f, 150.0f, + 50.0f, 50.0f, -1.0f, 0.0f, 1.0f, 0.0f); } @@ -39,12 +41,21 @@ void mouse(int button, int state, int x, int y) { if ( state == GLUT_DOWN ) { - float x = ( rand() % 10000 ) / 1000.0f; - float y = ( rand() % 10000 ) / 1000.0f; - float w = ( rand() % 10000 ) / 100000.0f; - float h = ( rand() % 10000 ) / 100000.0f; + float x = ( rand() % 100 ); + float y = ( rand() % 100 ); + float w = ( rand() % 2 ) + 1; + float h = ( rand() % 2 ) + 1; - boost::geometry::index::insert(t, B(P(x - w, y - h),P(x + w, y + h))); + B b(P(x - w, y - h),P(x + w, y + h)); + + boost::geometry::index::insert(t, b); + + std::cout << "\n\n\n" << t << "\n\n"; + + std::cout << "inserted: "; + boost::geometry::index::visitors::detail::rtree_print_indexable(std::cout, b); + std::cout << '\n'; + std::cout << ( boost::geometry::index::rtree_are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); glutPostRedisplay(); } diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index c3ce00515..53154fc06 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -29,10 +29,10 @@ int main() std::vector v(n); for ( size_t i = 0 ; i < n ; ++i ) { - float x = ( rand() % 10000 ) / 1000.0f; - float y = ( rand() % 10000 ) / 1000.0f; - float w = ( rand() % 10000 ) / 100000.0f; - float h = ( rand() % 10000 ) / 100000.0f; + float x = float( rand() % 1000 ); + float y = float( rand() % 1000 ); + float w = float( rand() % 10 ) / 10.0f; + float h = float( rand() % 10 ) / 10.0f; v[i] = B(P(x - w, y - h),P(x + w, y + h)); } diff --git a/tests/main.cpp b/tests/main.cpp index 93fc439de..fce78a685 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -8,6 +8,19 @@ int main() tests_rtree_native_hpp(); tests_rtree_filters_hpp(); + /*namespace g = boost::geometry; + typedef g::model::point P; + typedef g::model::box

B; + + g::index::rtree tree(4, 2); + g::index::insert(tree, B(P(1, 6),P(6, 19))); + g::index::insert(tree, B(P(10, 1),P(18, 18))); + g::index::insert(tree, B(P(22, 6),P(27, 20))); + g::index::insert(tree, B(P(29, 2),P(34, 18))); + g::index::insert(tree, B(P(35, 3),P(39, 19))); + + std::cout << tree;*/ + #ifdef _MSC_VER std::cin.get(); #endif diff --git a/tests/rtree_native.hpp b/tests/rtree_native.hpp index 430c68bcd..c05dd7566 100644 --- a/tests/rtree_native.hpp +++ b/tests/rtree_native.hpp @@ -17,7 +17,24 @@ void tests_rtree_native_hpp() { std::cout << "tests/rtree_native.hpp\n"; - std::cout << "Boxes\n"; + std::cout << "Boxes3d\n"; + { + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + boost::geometry::index::rtree t(4, 2); + boost::geometry::index::insert(t, B(P(0, 0, 0), P(1, 1, 1))); + boost::geometry::index::insert(t, B(P(2, 2, 2), P(3, 3, 3))); + boost::geometry::index::insert(t, B(P(4, 4, 4), P(5, 5, 5))); + boost::geometry::index::insert(t, B(P(6, 6, 6), P(7, 7, 7))); + boost::geometry::index::insert(t, B(P(8, 8, 8), P(9, 9, 9))); + std::cerr << t; + } + + std::cout << "-------------------------------------------------\n"; + std::cout << "-------------------------------------------------\n"; + + std::cout << "Boxes2d\n"; { typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; From c88052c5067ad276102ec93183205317c00aefb1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 27 Mar 2011 13:44:55 +0000 Subject: [PATCH 004/366] overlap error patch + minor changes [SVN r70627] --- .../extensions/index/algorithms/overlap.hpp | 1 + .../extensions/index/rtree/rstar/split.hpp | 15 ++++--- .../geometry/extensions/index/rtree/rtree.hpp | 5 +++ .../extensions/index/rtree/rtree_node.hpp | 15 +++---- tests/additional_sizes_and_times.cpp | 43 ++++++++++++------- 5 files changed, 51 insertions(+), 28 deletions(-) diff --git a/include/boost/geometry/extensions/index/algorithms/overlap.hpp b/include/boost/geometry/extensions/index/algorithms/overlap.hpp index c2e98d12b..5695cee7a 100644 --- a/include/boost/geometry/extensions/index/algorithms/overlap.hpp +++ b/include/boost/geometry/extensions/index/algorithms/overlap.hpp @@ -25,6 +25,7 @@ template typename overlap_result::type overlap(Box const& b1, Box const& b2) { Box inters; + geometry::assign_zero(inters); geometry::intersection(b1, b2, inters); return index::area(inters); } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp index e6d0fe3d9..f0b01af24 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp @@ -124,8 +124,8 @@ public: size_t median_index_last = max_elems - min_elems + 2; for ( size_t median_index = min_elems ; median_index < median_index_last ; ++median_index ) { - Box left_box = index::detail::elements_box(sorted_elements.begin(), sorted_elements.begin() + median_index, tr); - Box right_box = index::detail::elements_box(sorted_elements.begin() + median_index, sorted_elements.end(), tr); + Box left_box = index::detail::rtree_elements_box(sorted_elements.begin(), sorted_elements.begin() + median_index, tr); + Box right_box = index::detail::rtree_elements_box(sorted_elements.begin() + median_index, sorted_elements.end(), tr); margin_type margin = index::margin(left_box) + index::margin(right_box); overlap_type overlap = index::overlap(left_box, right_box); @@ -284,16 +284,21 @@ public: typedef typename index::detail::rtree_elements_type::type elements_type; typedef typename elements_type::value_type element_type; - elements_type & elements = index::detail::get_elements(n); + elements_type & elements = index::detail::rtree_elements_get(n); + + assert(elements.size() == max_elems + 1); // get split data rtree_rstar_split_data split_data; rtree_rstar_split_update_data:: apply(split_data, elements, min_elems, max_elems, tr); - + + assert(min_elems <= split_data.choosen_median_index); + assert(split_data.choosen_median_index <= max_elems + 1 - min_elems); + // create new node node * right_node = rtree_create_node(Node()); - elements_type & new_elems = index::detail::get_elements(boost::get(*right_node)); + elements_type & new_elems = index::detail::rtree_elements_get(boost::get(*right_node)); // update new node's elements new_elems.resize(max_elems + 1 - split_data.choosen_median_index); diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 3827ba6b9..6a362080e 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -91,6 +91,11 @@ public: return m_translator; } + size_t values_count() const + { + return m_values_count; + } + private: size_t m_values_count; size_t m_max_elems_per_node; diff --git a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp index f0742f987..97000e192 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp @@ -87,21 +87,22 @@ struct rtree_elements_type< rtree_leaf_def > }; template -typename rtree_elements_type::type & get_elements(Node & n) +typename rtree_elements_type::type & +rtree_elements_get(Node & n) { return n.elements; } template typename rtree_internal_node_def::children_type & -get_elements(rtree_internal_node_def & n) +rtree_elements_get(rtree_internal_node_def & n) { return n.children; } template typename rtree_leaf_def::values_type & -get_elements(rtree_leaf_def & n) +rtree_elements_get(rtree_leaf_def & n) { return n.values; } @@ -156,7 +157,7 @@ rtree_element_indexable(Value const& el, Translator const& tr) // elements box template -inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) +inline Box rtree_elements_box(FwdIter first, FwdIter last, Translator const& tr) { assert(first != last); @@ -178,8 +179,7 @@ typename rtree_node::type * rtree_create_node(rtree_leaf_def const& l) { typedef typename rtree_node::type node; - node * n = new node(); - *n = l; + node * n = new node(l); return n; } @@ -190,8 +190,7 @@ typename rtree_node::type * rtree_create_node(rtree_internal_node_def const& in) { typedef typename rtree_node::type node; - node * n = new node(); - *n = in; + node * n = new node(in); return n; } diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 53154fc06..9bc5e763e 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -1,10 +1,21 @@ #include #include +#include #include #include +template +void print(Box const& b) +{ + using namespace boost::geometry; + std::cout << boost::geometry::get(b) << ", "; + std::cout << boost::geometry::get(b) << " x "; + std::cout << boost::geometry::get(b) << ", "; + std::cout << boost::geometry::get(b)<< std::endl; +} + int main() { { @@ -20,30 +31,31 @@ int main() boost::timer tim; + typedef boost::geometry::model::point P; + typedef boost::geometry::model::box

B; + + // randomize boxes + const size_t n = 10000; + std::vector v(n); + for ( size_t i = 0 ; i < n ; ++i ) { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - // randomize boxes - const size_t n = 10000; - std::vector v(n); - for ( size_t i = 0 ; i < n ; ++i ) - { - float x = float( rand() % 1000 ); - float y = float( rand() % 1000 ); - float w = float( rand() % 10 ) / 10.0f; - float h = float( rand() % 10 ) / 10.0f; - v[i] = B(P(x - w, y - h),P(x + w, y + h)); - } + float x = float( rand() % 1000 ); + float y = float( rand() % 1000 ); + float w = float( rand() % 10 ) / 10.0f; + float h = float( rand() % 10 ) / 10.0f; + v[i] = B(P(x - w, y - h),P(x + w, y + h)); + } + { boost::geometry::index::rtree t(4, 2); std::cout << "inserting time test...\n"; tim.restart(); - BOOST_FOREACH(B &b, v) + for (size_t i = 0 ; i < n ; ++i ) { + B const& b = v[i]; boost::geometry::index::insert(t, b); } @@ -52,6 +64,7 @@ int main() std::cout << "deleting time test...\n"; tim.restart(); } + std::cout << "time: " << tim.elapsed() << "s\n"; #ifdef _MSC_VER From c8b2db430685c8a3ef307ada2ffa75ce9cf23959 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 29 Mar 2011 00:34:09 +0000 Subject: [PATCH 005/366] rtree Box template parameter removed [SVN r70689] --- .../geometry/extensions/index/indexable.hpp | 4 --- .../extensions/index/rtree/filters.hpp | 8 ++--- .../index/rtree/rstar/choose_next_node.hpp | 34 ++++++++++++++++++- .../extensions/index/rtree/rstar/split.hpp | 4 +-- .../geometry/extensions/index/rtree/rtree.hpp | 32 +++++++++-------- .../extensions/index/rtree/rtree_node.hpp | 8 +++-- .../index/rtree/visitors/gl_draw.hpp | 12 ++++--- .../extensions/index/rtree/visitors/print.hpp | 22 ++++-------- .../rtree/visitors/rtree_are_boxes_ok.hpp | 8 ++--- 9 files changed, 81 insertions(+), 51 deletions(-) diff --git a/include/boost/geometry/extensions/index/indexable.hpp b/include/boost/geometry/extensions/index/indexable.hpp index d964e091e..05a8ded9b 100644 --- a/include/boost/geometry/extensions/index/indexable.hpp +++ b/include/boost/geometry/extensions/index/indexable.hpp @@ -140,8 +140,6 @@ struct indexable_indexed_access } // namespace dispatch -namespace detail { - template typename traits::coordinate_type::type get(Indexable const& i) { @@ -153,8 +151,6 @@ typename traits::coordinate_type::type get(Indexable const& i) >::get(i); } -} // namespace detail - }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 15bef8fa6..4855ae8a6 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -18,20 +18,20 @@ namespace boost { namespace geometry { namespace index { -template +template class rtree; namespace filters { -template -class spatial_filter< index::rtree > +template +class spatial_filter< index::rtree > { public: typedef typename std::vector::iterator iterator; typedef typename std::vector::const_iterator const_iterator; template - spatial_filter(index::rtree const& rtree, Geometry const& geom) + spatial_filter(index::rtree const& rtree, Geometry const& geom) { m_result = rtree.find(geom); } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 20b88e08f..11ca1a2d3 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -70,6 +70,38 @@ class rtree_rstar_choose_next_node // //}; +//template +//typename index::area_result< +// typename detail::rtree_element_indexable_type< +// typename std::iterator_traits::value_type, +// Translator +// >::type +//>::type calculate_elements_overlap(ElIter el, ElIter first, ElIter last, Translator const& tr) +//{ +// typedef typename detail::rtree_element_indexable_type< +// typename std::iterator_traits::value_type, +// Translator +// >::type box_type; +// typedef typename index::area_result::type area_type; +// +// area_type result = 0; +// +// for ( ; first != last ; ++first ) +// { +// if ( first != el ) +// { +// box_type inters; +// geometry::assign_zero(inters); +// geometry::intersection( +// detail::rtree_element_indexable(*first, tr), +// detail::rtree_element_indexable(*el, tr), +// inters); +// result += index::area(inters); +// } +// } +// return result; +//} + // TODO: awulkiew - wrong algorithm? Should branch check be applied to Leafs? // TODO: awulkiew - further optimization: don't calculate area with the overlap, calculate it only if // overlap < smallest_overlap (and current area must be stored) OR @@ -130,7 +162,7 @@ private: struct branch_areas { - typedef typename area_result::type area_type; + typedef typename index::area_result::type area_type; template inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp index f0b01af24..d0ee35322 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp @@ -41,11 +41,11 @@ public: inline bool operator()(element_type const& e1, element_type const e2) const { return - index::detail::get( + index::get( index::detail::rtree_element_indexable(e1, m_tr) ) < - index::detail::get( + index::get( index::detail::rtree_element_indexable(e2, m_tr) ); } diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 6a362080e..efb821fc0 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -27,21 +27,25 @@ namespace boost { namespace geometry { namespace index { template < typename Value, typename Translator = default_parameter, - typename Box = default_parameter, typename Tag = rtree_rstar_tag > class rtree { public: typedef Value value_type; - typedef typename detail::default_translator_type::type translator_type; - typedef typename detail::default_box_type::type box_type; + typedef typename detail::default_translator_type::type translator_type; + typedef typename detail::geometry_box_type::type box_type; + typedef Tag tag_type; - typedef typename detail::rtree_node::type node; - typedef typename detail::rtree_internal_node::type internal_node; - typedef typename detail::rtree_leaf::type leaf; + typedef typename detail::rtree_node::type node; + typedef typename detail::rtree_internal_node::type internal_node; + typedef typename detail::rtree_leaf::type leaf; - inline explicit rtree(size_t max_elems_per_node = 2, size_t min_elems_per_node = 1, translator_type const& translator = translator_type()) + inline explicit rtree( + size_t max_elems_per_node = 2, + size_t min_elems_per_node = 1, + translator_type const& translator = translator_type() + ) : m_values_count(0) , m_max_elems_per_node(max_elems_per_node) , m_min_elems_per_node(min_elems_per_node) @@ -58,21 +62,21 @@ public: ~rtree() { - visitors::rtree_delete del_v; + visitors::rtree_delete del_v; boost::apply_visitor(del_v, *m_root); } template - inline std::vector find(Geometry const& geom) const + inline std::vector find(Geometry const& geom) const { - visitors::rtree_find find_v(geom, m_translator); + visitors::rtree_find find_v(geom, m_translator); boost::apply_visitor(find_v, *m_root); return find_v.result; } - void insert(Value const& value) + void insert(value_type const& value) { - visitors::rtree_insert + visitors::rtree_insert insert_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); boost::apply_visitor(insert_v, *m_root); @@ -104,8 +108,8 @@ private: translator_type m_translator; }; -template -void insert(rtree & tree, Value const& v) +template +void insert(rtree & tree, Value const& v) { tree.insert(v); } diff --git a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp index 97000e192..a7129922e 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree_node.hpp @@ -159,10 +159,14 @@ rtree_element_indexable(Value const& el, Translator const& tr) template inline Box rtree_elements_box(FwdIter first, FwdIter last, Translator const& tr) { - assert(first != last); - Box result; + if (first == last) + { + geometry::assign_zero(result); + return result; + } + geometry::convert(index::detail::rtree_element_indexable(*first, tr), result); ++first; 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 2038bec98..6f9c45ab6 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -163,15 +163,17 @@ struct rtree_gl_draw : public boost::static_visitor<> } // namespace visitors -template -void gl_draw(rtree const& tree) +template +void gl_draw(rtree const& tree) { - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; + typedef typename rtree::value_type value_type; + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; + typedef typename rtree::tag_type tag_type; glClear(GL_COLOR_BUFFER_BIT); - visitors::rtree_gl_draw gl_draw_v(tree.get_translator()); + visitors::rtree_gl_draw gl_draw_v(tree.get_translator()); tree.apply_visitor(gl_draw_v); glFlush(); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 63910a295..65ad8c95c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -179,22 +179,14 @@ struct rtree_print : public boost::static_visitor<> } // namespace visitors -template -std::ostream & print(rtree const& tree, std::ostream & os = std::cout) +template +std::ostream & operator<<(std::ostream & os, rtree const& tree) { - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; - visitors::rtree_print print_v(os, tree.get_translator()); - tree.apply_visitor(print_v); - return os; -} - -template -std::ostream & operator<<(std::ostream & os, rtree const& tree) -{ - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; - visitors::rtree_print print_v(os, tree.get_translator()); + typedef typename rtree::value_type value_type; + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; + typedef typename rtree::tag_type tag_type; + visitors::rtree_print print_v(os, tree.get_translator()); tree.apply_visitor(print_v); return os; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp index 5d09631e0..2e7c0d755 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp @@ -85,15 +85,15 @@ private: } // namespace visitors -template -bool rtree_are_boxes_ok(rtree const& tree) +template +bool rtree_are_boxes_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; visitors::rtree_are_boxes_ok< typename rt::value_type, typename rt::translator_type, typename rt::box_type, - Tag> v(tree.get_translator()); + typename rt::tag_type> v(tree.get_translator()); return tree.apply_visitor(v); } From 9c2ff588186601bb213f1719d50d6e64be2f329e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 29 Mar 2011 18:03:10 +0000 Subject: [PATCH 006/366] namespaces hierarchy changed [SVN r70701] --- .../geometry/extensions/index/indexable.hpp | 8 + .../index/rtree/{rtree_node.hpp => node.hpp} | 94 +++++------ .../index/rtree/rstar/choose_next_node.hpp | 102 ++---------- .../rstar/{rtree_insert.hpp => insert.hpp} | 32 ++-- .../extensions/index/rtree/rstar/rstar.hpp | 2 +- .../extensions/index/rtree/rstar/split.hpp | 146 +++++++++--------- .../geometry/extensions/index/rtree/rtree.hpp | 18 +-- ...tree_are_boxes_ok.hpp => are_boxes_ok.hpp} | 24 +-- .../{rtree_delete.hpp => destroy.hpp} | 22 +-- .../visitors/{rtree_find.hpp => find.hpp} | 20 +-- .../index/rtree/visitors/gl_draw.hpp | 49 +++--- .../visitors/{rtree_insert.hpp => insert.hpp} | 14 +- .../{rtree_is_leaf.hpp => is_leaf.hpp} | 18 +-- .../extensions/index/rtree/visitors/print.hpp | 53 ++++--- .../visitors/{rtree_remove.hpp => remove.hpp} | 12 +- tests/additional_glut_vis.cpp | 6 +- 16 files changed, 271 insertions(+), 349 deletions(-) rename include/boost/geometry/extensions/index/rtree/{rtree_node.hpp => node.hpp} (56%) rename include/boost/geometry/extensions/index/rtree/rstar/{rtree_insert.hpp => insert.hpp} (69%) rename include/boost/geometry/extensions/index/rtree/visitors/{rtree_are_boxes_ok.hpp => are_boxes_ok.hpp} (76%) rename include/boost/geometry/extensions/index/rtree/visitors/{rtree_delete.hpp => destroy.hpp} (56%) rename include/boost/geometry/extensions/index/rtree/visitors/{rtree_find.hpp => find.hpp} (70%) rename include/boost/geometry/extensions/index/rtree/visitors/{rtree_insert.hpp => insert.hpp} (58%) rename include/boost/geometry/extensions/index/rtree/visitors/{rtree_is_leaf.hpp => is_leaf.hpp} (54%) rename include/boost/geometry/extensions/index/rtree/visitors/{rtree_remove.hpp => remove.hpp} (60%) diff --git a/include/boost/geometry/extensions/index/indexable.hpp b/include/boost/geometry/extensions/index/indexable.hpp index 05a8ded9b..932bf9a92 100644 --- a/include/boost/geometry/extensions/index/indexable.hpp +++ b/include/boost/geometry/extensions/index/indexable.hpp @@ -108,6 +108,14 @@ struct dimension >::value; }; +template +struct tag +{ + typedef typename geometry::traits::tag< + Indexable + >::type type; +}; + } // namespace traits namespace dispatch { diff --git a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp b/include/boost/geometry/extensions/index/rtree/node.hpp similarity index 56% rename from include/boost/geometry/extensions/index/rtree/rtree_node.hpp rename to include/boost/geometry/extensions/index/rtree/node.hpp index a7129922e..53b74ff23 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node.hpp @@ -8,28 +8,28 @@ // 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_DEFAULT_NODE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DEFAULT_NODE_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP #include #include namespace boost { namespace geometry { namespace index { -namespace detail { +namespace detail { namespace rtree { template -struct rtree_node; +struct node; // nodes default types template -struct rtree_internal_node_def +struct internal_node_def { typedef std::vector< std::pair< Box, - typename rtree_node::type * + typename node::type * > > children_type; @@ -37,7 +37,7 @@ struct rtree_internal_node_def }; template -struct rtree_leaf_def +struct leaf_def { typedef std::vector values_type; values_type values; @@ -46,63 +46,63 @@ struct rtree_leaf_def // nodes traits template -struct rtree_node +struct node { typedef boost::variant< - rtree_leaf_def, - rtree_internal_node_def + leaf_def, + internal_node_def > type; }; template -struct rtree_internal_node +struct internal_node { - typedef rtree_internal_node_def type; + typedef internal_node_def type; }; template -struct rtree_leaf +struct leaf { - typedef rtree_leaf_def type; + typedef leaf_def type; }; // nodes elements extractor template -struct rtree_elements_type +struct elements_type { typedef typename Node::elements_type type; }; template -struct rtree_elements_type< rtree_internal_node_def > +struct elements_type< internal_node_def > { - typedef typename rtree_internal_node_def::children_type type; + typedef typename internal_node_def::children_type type; }; template -struct rtree_elements_type< rtree_leaf_def > +struct elements_type< leaf_def > { - typedef typename rtree_leaf_def::values_type type; + typedef typename leaf_def::values_type type; }; template -typename rtree_elements_type::type & -rtree_elements_get(Node & n) +typename elements_type::type & +elements_get(Node & n) { return n.elements; } template -typename rtree_internal_node_def::children_type & -rtree_elements_get(rtree_internal_node_def & n) +typename internal_node_def::children_type & +elements_get(internal_node_def & n) { return n.children; } template -typename rtree_leaf_def::values_type & -rtree_elements_get(rtree_leaf_def & n) +typename leaf_def::values_type & +elements_get(leaf_def & n) { return n.values; } @@ -110,18 +110,18 @@ rtree_elements_get(rtree_leaf_def & n) // uniform indexable type for child node element's box and value's indexable template -struct rtree_element_indexable_type +struct element_indexable_type { typedef typename Translator::indexable_type type; }; template -struct rtree_element_indexable_type< +struct element_indexable_type< std::pair< Box, boost::variant< - rtree_leaf_def, - rtree_internal_node_def + leaf_def, + internal_node_def > * >, Translator @@ -134,12 +134,12 @@ struct rtree_element_indexable_type< template Box const& -rtree_element_indexable( +element_indexable( std::pair< Box, boost::variant< - rtree_leaf_def, - rtree_internal_node_def + leaf_def, + internal_node_def > * > const& el, Translator const&) @@ -149,7 +149,7 @@ rtree_element_indexable( template typename Translator::indexable_type const& -rtree_element_indexable(Value const& el, Translator const& tr) +element_indexable(Value const& el, Translator const& tr) { return tr(el); }; @@ -157,7 +157,7 @@ rtree_element_indexable(Value const& el, Translator const& tr) // elements box template -inline Box rtree_elements_box(FwdIter first, FwdIter last, Translator const& tr) +inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) { Box result; @@ -167,11 +167,11 @@ inline Box rtree_elements_box(FwdIter first, FwdIter last, Translator const& tr) return result; } - geometry::convert(index::detail::rtree_element_indexable(*first, tr), result); + geometry::convert(element_indexable(*first, tr), result); ++first; for ( ; first != last ; ++first ) - geometry::expand(result, index::detail::rtree_element_indexable(*first, tr)); + geometry::expand(result, element_indexable(*first, tr)); return result; } @@ -179,10 +179,10 @@ inline Box rtree_elements_box(FwdIter first, FwdIter last, Translator const& tr) // create leaf node template -typename rtree_node::type * -rtree_create_node(rtree_leaf_def const& l) +typename node::type * +create_node(leaf_def const& l) { - typedef typename rtree_node::type node; + typedef typename node::type node; node * n = new node(l); return n; } @@ -190,10 +190,10 @@ rtree_create_node(rtree_leaf_def const& l) // create internal node template -typename rtree_node::type * -rtree_create_node(rtree_internal_node_def const& in) +typename node::type * +create_node(internal_node_def const& in) { - typedef typename rtree_node::type node; + typedef typename node::type node; node * n = new node(in); return n; } @@ -201,17 +201,17 @@ rtree_create_node(rtree_internal_node_def const& in) // default node template -void rtree_delete_node( +void delete_node( boost::variant< - rtree_leaf_def, - rtree_internal_node_def + leaf_def, + internal_node_def > * n) { delete n; } -} // namespace detail +}} // namespace detail::rtree }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DEFAULT_NODE_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 11ca1a2d3..bc6cd04ab 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -16,103 +16,19 @@ #include #include -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { - -struct rtree_rstar_chnn_min_overlap_cost {}; -struct rtree_rstar_chnn_nearly_min_overlap_cost {}; - -// TODO: awulkiew - it's possible that goodness values may be used to choose next node -// on this step some of the goodness values would be calculated (not all) -// and only for some nodes (goodness values should be calculated only if there is an overflow) - -template -class rtree_rstar_choose_next_node -{}; - -// TODO: awulkiew finish this version -// use min_element instead of searching by myself - -//template -//class rtree_rstar_choose_next_node -//{ -// typedef typename index::detail::rtree_node::type node; -// typedef typename index::detail::rtree_internal_node::type internal_node; -// typedef typename index::detail::rtree_leaf::type leaf; -// -// typedef typename internal_node::children_type children_type; -// -//public: -// template -// static inline size_t apply(internal_node & n, Indexable const& indexable) -// { -// assert(!n.children.empty()); -// -// bool has_leaves = boost::apply_visitor( -// visitors::rtree_is_leaf(), -// *n.children.front().second); -// -// if ( !has_leaves ) -// return impl(n, indexable); -// else -// return impl(n, indexable); -// } -// -//private: -// template -// static inline size_t impl(internal_node & n, Indexable const& indexable) -// { -// } -// -//}; - -//template -//typename index::area_result< -// typename detail::rtree_element_indexable_type< -// typename std::iterator_traits::value_type, -// Translator -// >::type -//>::type calculate_elements_overlap(ElIter el, ElIter first, ElIter last, Translator const& tr) -//{ -// typedef typename detail::rtree_element_indexable_type< -// typename std::iterator_traits::value_type, -// Translator -// >::type box_type; -// typedef typename index::area_result::type area_type; -// -// area_type result = 0; -// -// for ( ; first != last ; ++first ) -// { -// if ( first != el ) -// { -// box_type inters; -// geometry::assign_zero(inters); -// geometry::intersection( -// detail::rtree_element_indexable(*first, tr), -// detail::rtree_element_indexable(*el, tr), -// inters); -// result += index::area(inters); -// } -// } -// return result; -//} - -// TODO: awulkiew - wrong algorithm? Should branch check be applied to Leafs? -// TODO: awulkiew - further optimization: don't calculate area with the overlap, calculate it only if -// overlap < smallest_overlap (and current area must be stored) OR -// overlap == smallest_overlap (and area must be compared) +namespace detail { namespace rtree { namespace rstar { template -class rtree_rstar_choose_next_node +class choose_next_node { - typedef typename index::detail::rtree_node::type node; - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename internal_node::children_type children_type; @@ -123,7 +39,7 @@ public: assert(!n.children.empty()); bool has_leaves = boost::apply_visitor( - visitors::rtree_is_leaf(), + visitors::is_leaf(), *n.children.front().second); if ( !has_leaves ) @@ -211,7 +127,7 @@ private: }; }; -} // namespace visitors +}}} // namespace detail::rtree:rstar }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp similarity index 69% rename from include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp rename to include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 3e317a3f4..682247fb4 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rtree_insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -7,8 +7,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_RSTAR_RTREE_INSERT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RTREE_INSERT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP #include @@ -19,26 +19,26 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { template -class rtree_insert : public boost::static_visitor<> +class insert : public boost::static_visitor<> { - typedef typename index::detail::rtree_node::type node; - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: - inline explicit rtree_insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) + inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) , m_root_node(root) , m_parent(0), m_current_child_index(0) @@ -53,7 +53,7 @@ public: // choose next node, where value insert traversing should go m_current_child_index = - rtree_rstar_choose_next_node:: + rstar::choose_next_node:: apply(n, m_tr(m_value)); // TODO: awulkiew - if reinsert is implemented this must be changed @@ -68,7 +68,7 @@ public: if ( m_max_elems_per_node < n.children.size() ) { - rtree_rstar_split:: + rstar::split:: apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); } } @@ -79,7 +79,7 @@ public: if ( m_max_elems_per_node < n.values.size() ) { - rtree_rstar_split:: + rstar::split:: apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); } } @@ -97,8 +97,8 @@ private: size_t m_current_child_index; }; -} // namespace visitors +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RTREE_INSERT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index d5d218195..b4106b341 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -11,6 +11,6 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP #include -#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp index d0ee35322..2e25ae12b 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp @@ -19,22 +19,22 @@ #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace rstar { // elements less template -class rtree_rstar_elements_less +class elements_less { typedef typename Elements::value_type element_type; public: - inline rtree_rstar_elements_less(Translator const& tr) + inline elements_less(Translator const& tr) : m_tr(tr) {} @@ -42,11 +42,11 @@ public: { return index::get( - index::detail::rtree_element_indexable(e1, m_tr) + rtree::element_indexable(e1, m_tr) ) < index::get( - index::detail::rtree_element_indexable(e2, m_tr) + rtree::element_indexable(e2, m_tr) ); } @@ -57,13 +57,13 @@ private: // rstar split axis data template -struct rtree_rstar_split_axis_data +struct split_axis_data { typedef typename margin_result::type margin_type; typedef typename overlap_result::type overlap_type; typedef typename area_result::type area_type; - inline rtree_rstar_split_axis_data() + inline split_axis_data() : margins_sum(0) , smallest_overlap(std::numeric_limits::max()) , smallest_area(std::numeric_limits::max()) @@ -104,18 +104,18 @@ struct rtree_rstar_split_axis_data // update axis data for given axis and corner template -class rtree_rstar_split_update_axis_data_for_corner +class split_update_axis_data_for_corner { - typedef typename rtree_rstar_split_axis_data::margin_type margin_type; - typedef typename rtree_rstar_split_axis_data::overlap_type overlap_type; - typedef typename rtree_rstar_split_axis_data::area_type area_type; + typedef typename split_axis_data::margin_type margin_type; + typedef typename split_axis_data::overlap_type overlap_type; + typedef typename split_axis_data::area_type area_type; BOOST_STATIC_ASSERT(Corner < 2); public: template static inline void apply( - rtree_rstar_split_axis_data & split_axis_data, + split_axis_data & sad, Elements const& sorted_elements, size_t min_elems, size_t max_elems, @@ -124,14 +124,14 @@ public: size_t median_index_last = max_elems - min_elems + 2; for ( size_t median_index = min_elems ; median_index < median_index_last ; ++median_index ) { - Box left_box = index::detail::rtree_elements_box(sorted_elements.begin(), sorted_elements.begin() + median_index, tr); - Box right_box = index::detail::rtree_elements_box(sorted_elements.begin() + median_index, sorted_elements.end(), tr); + Box left_box = rtree::elements_box(sorted_elements.begin(), sorted_elements.begin() + median_index, tr); + Box right_box = rtree::elements_box(sorted_elements.begin() + median_index, sorted_elements.end(), tr); margin_type margin = index::margin(left_box) + index::margin(right_box); overlap_type overlap = index::overlap(left_box, right_box); area_type area = index::area(left_box) + index::area(right_box); - split_axis_data.update(Corner, median_index, left_box, right_box, margin, overlap, area); + sad.update(Corner, median_index, left_box, right_box, margin, overlap, area); } } }; @@ -139,13 +139,13 @@ public: // split data template -struct rtree_rstar_split_data +struct split_data { typedef typename margin_result::type margin_type; typedef typename overlap_result::type overlap_type; typedef typename area_result::type area_type; - inline rtree_rstar_split_data() + inline split_data() : smallest_margins_sum(std::numeric_limits::max()) {} @@ -182,36 +182,36 @@ struct rtree_rstar_split_data // update split data for given axis and corner template -class rtree_rstar_split_update_data_for_axis_and_corner +class split_update_data_for_axis_and_corner { - typedef typename rtree_rstar_split_axis_data::margin_type margin_type; - typedef typename rtree_rstar_split_axis_data::overlap_type overlap_type; - typedef typename rtree_rstar_split_axis_data::area_type area_type; + typedef typename split_axis_data::margin_type margin_type; + typedef typename split_axis_data::overlap_type overlap_type; + typedef typename split_axis_data::area_type area_type; public: template static inline void apply( - rtree_rstar_split_data & split_data, + split_data & split_data, Elements & elements, size_t min_elems, size_t max_elems, Translator const& tr) { - rtree_rstar_split_axis_data split_axis_data; + split_axis_data sad; - rtree_rstar_elements_less less_min(tr); + elements_less less_min(tr); std::sort(elements.begin(), elements.end(), less_min); - rtree_rstar_split_update_axis_data_for_corner:: - apply(split_axis_data, elements, min_elems, max_elems, tr); + split_update_axis_data_for_corner:: + apply(sad, elements, min_elems, max_elems, tr); split_data.update( AxisIndex, - split_axis_data.choosen_corner, - split_axis_data.choosen_median_index, - split_axis_data.choosen_left_box, - split_axis_data.choosen_right_box, - split_axis_data.margins_sum, + sad.choosen_corner, + sad.choosen_median_index, + sad.choosen_left_box, + sad.choosen_right_box, + sad.margins_sum, elements); } }; @@ -219,54 +219,54 @@ public: // for each dimension and corner update split data template -struct rtree_rstar_split_update_data +struct split_update_data { BOOST_STATIC_ASSERT(0 < Dimension); template static inline void apply( - rtree_rstar_split_data & split_data, + split_data & sd, Elements & elements, size_t min_elems, size_t max_elems, Translator const& tr) { - rtree_rstar_split_update_data:: - apply(split_data, elements, min_elems, max_elems, tr); + split_update_data:: + apply(sd, elements, min_elems, max_elems, tr); - rtree_rstar_split_update_data_for_axis_and_corner:: - apply(split_data, elements, min_elems, max_elems, tr); - rtree_rstar_split_update_data_for_axis_and_corner:: - apply(split_data, elements, min_elems, max_elems, tr); + split_update_data_for_axis_and_corner:: + apply(sd, elements, min_elems, max_elems, tr); + split_update_data_for_axis_and_corner:: + apply(sd, elements, min_elems, max_elems, tr); } }; template -struct rtree_rstar_split_update_data +struct split_update_data { template static inline void apply( - rtree_rstar_split_data & split_data, + split_data & sd, Elements & elements, size_t min_elems, size_t max_elems, Translator const& tr) { - rtree_rstar_split_update_data_for_axis_and_corner:: - apply(split_data, elements, min_elems, max_elems, tr); - rtree_rstar_split_update_data_for_axis_and_corner:: - apply(split_data, elements, min_elems, max_elems, tr); + split_update_data_for_axis_and_corner:: + apply(sd, elements, min_elems, max_elems, tr); + split_update_data_for_axis_and_corner:: + apply(sd, elements, min_elems, max_elems, tr); } }; // split template -class rtree_rstar_split +class split { - typedef typename index::detail::rtree_node::type node; - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; static const size_t dimension = index::traits::dimension::value; @@ -281,62 +281,62 @@ public: size_t max_elems, Translator const& tr) { - typedef typename index::detail::rtree_elements_type::type elements_type; + typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::value_type element_type; - elements_type & elements = index::detail::rtree_elements_get(n); + elements_type & elements = rtree::elements_get(n); assert(elements.size() == max_elems + 1); // get split data - rtree_rstar_split_data split_data; - rtree_rstar_split_update_data:: - apply(split_data, elements, min_elems, max_elems, tr); + split_data sd; + split_update_data:: + apply(sd, elements, min_elems, max_elems, tr); - assert(min_elems <= split_data.choosen_median_index); - assert(split_data.choosen_median_index <= max_elems + 1 - min_elems); + assert(min_elems <= sd.choosen_median_index); + assert(sd.choosen_median_index <= max_elems + 1 - min_elems); // create new node - node * right_node = rtree_create_node(Node()); - elements_type & new_elems = index::detail::rtree_elements_get(boost::get(*right_node)); + node * right_node = rtree::create_node(Node()); + elements_type & new_elems = rtree::elements_get(boost::get(*right_node)); // update new node's elements - new_elems.resize(max_elems + 1 - split_data.choosen_median_index); + new_elems.resize(max_elems + 1 - sd.choosen_median_index); std::copy( - split_data.choosen_distribution.begin() + split_data.choosen_median_index, - split_data.choosen_distribution.end(), + sd.choosen_distribution.begin() + sd.choosen_median_index, + sd.choosen_distribution.end(), new_elems.begin()); // update elements of the current node - elements.resize(split_data.choosen_median_index); + elements.resize(sd.choosen_median_index); std::copy( - split_data.choosen_distribution.begin(), - split_data.choosen_distribution.begin() + split_data.choosen_median_index, + sd.choosen_distribution.begin(), + sd.choosen_distribution.begin() + sd.choosen_median_index, elements.begin()); if ( parent != 0 ) { // update old node's box - parent->children[current_child_index].first = split_data.choosen_left_box; + parent->children[current_child_index].first = sd.choosen_left_box; // add new node to the parent's children - parent->children.push_back(std::make_pair(split_data.choosen_right_box, right_node)); + parent->children.push_back(std::make_pair(sd.choosen_right_box, right_node)); } else { assert(&n == boost::get(root)); // create new root and add nodes - node * new_root = rtree_create_node(internal_node()); + node * new_root = rtree::create_node(internal_node()); - boost::get(*new_root).children.push_back(std::make_pair(split_data.choosen_left_box, root)); - boost::get(*new_root).children.push_back(std::make_pair(split_data.choosen_right_box, right_node)); + boost::get(*new_root).children.push_back(std::make_pair(sd.choosen_left_box, root)); + boost::get(*new_root).children.push_back(std::make_pair(sd.choosen_right_box, right_node)); root = new_root; } } }; -} // namespace visitors +}}} // namespace detail::rtree:rstar }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index efb821fc0..6a0fae593 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -15,8 +15,8 @@ #include -#include -#include +#include +#include #include @@ -37,9 +37,9 @@ public: typedef typename detail::geometry_box_type::type box_type; typedef Tag tag_type; - typedef typename detail::rtree_node::type node; - typedef typename detail::rtree_internal_node::type internal_node; - typedef typename detail::rtree_leaf::type leaf; + typedef typename detail::rtree::node::type node; + typedef typename detail::rtree::internal_node::type internal_node; + typedef typename detail::rtree::leaf::type leaf; inline explicit rtree( size_t max_elems_per_node = 2, @@ -57,26 +57,26 @@ public: if ( m_max_elems_per_node < 2 ) m_max_elems_per_node = 2; - m_root = detail::rtree_create_node(leaf()); + m_root = detail::rtree::create_node(leaf()); } ~rtree() { - visitors::rtree_delete del_v; + detail::rtree::visitors::destroy del_v; boost::apply_visitor(del_v, *m_root); } template inline std::vector find(Geometry const& geom) const { - visitors::rtree_find find_v(geom, m_translator); + detail::rtree::visitors::find find_v(geom, m_translator); boost::apply_visitor(find_v, *m_root); return find_v.result; } void insert(value_type const& value) { - visitors::rtree_insert + detail::rtree::visitors::insert insert_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); boost::apply_visitor(insert_v, *m_root); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp similarity index 76% rename from include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 2e7c0d755..c83ac16fc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/rtree_are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -7,24 +7,24 @@ // 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_RTREE_ARE_BOXES_OK_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_ARE_BOXES_OK_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { template -class rtree_are_boxes_ok : public boost::static_visitor +class are_boxes_ok : public boost::static_visitor { - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: - inline rtree_are_boxes_ok(Translator const& tr) + inline are_boxes_ok(Translator const& tr) : m_tr(tr), m_is_root(true) {} @@ -83,13 +83,13 @@ private: bool m_is_root; }; -} // namespace visitors +}}} // namespace detail::rtree::visitors template -bool rtree_are_boxes_ok(rtree const& tree) +bool are_boxes_ok(rtree const& tree) { typedef rtree rt; - visitors::rtree_are_boxes_ok< + detail::rtree::visitors::are_boxes_ok< typename rt::value_type, typename rt::translator_type, typename rt::box_type, @@ -100,4 +100,4 @@ bool rtree_are_boxes_ok(rtree const& tree) }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_ARE_BOXES_OK_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_delete.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp similarity index 56% rename from include/boost/geometry/extensions/index/rtree/visitors/rtree_delete.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 549200df5..71af3b99c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/rtree_delete.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -1,26 +1,26 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R-tree delete visitor +// Boost.Index - R-tree destroy visitor // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_DELETE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_DELETE_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { template -struct rtree_delete : public boost::static_visitor<> +struct destroy : public boost::static_visitor<> { - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node & n) const { @@ -31,7 +31,7 @@ struct rtree_delete : public boost::static_visitor<> { boost::apply_visitor(*this, *it->second); - index::detail::rtree_delete_node(it->second); + rtree::delete_node(it->second); } } @@ -40,8 +40,8 @@ struct rtree_delete : public boost::static_visitor<> } }; -} // namespace visitors +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_DELETE_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp similarity index 70% rename from include/boost/geometry/extensions/index/rtree/visitors/rtree_find.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/find.hpp index d1fe369c6..004d68417 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/rtree_find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -7,26 +7,26 @@ // 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_RTREE_FIND_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_FIND_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { // rtree spatial query visitor template -struct rtree_find : public boost::static_visitor<> +struct find : public boost::static_visitor<> { - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; - inline rtree_find(Geometry const& g, Translator const& t) + inline find(Geometry const& g, Translator const& t) : geom(g), tr(t) {} @@ -59,8 +59,8 @@ struct rtree_find : public boost::static_visitor<> std::vector result; }; -} // namespace visitors +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_FIND_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_VISITORS_FIND_HPP 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 6f9c45ab6..c8b2c0f6b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -12,20 +12,20 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { namespace dispatch { template -struct rtree_gl_draw_point +struct gl_draw_point {}; template -struct rtree_gl_draw_point +struct gl_draw_point { static inline void apply(Point const& p, size_t level) { @@ -36,11 +36,11 @@ struct rtree_gl_draw_point }; template -struct rtree_gl_draw_box +struct gl_draw_box {}; template -struct rtree_gl_draw_box +struct gl_draw_box { static inline void apply(Box const& b, size_t level) { @@ -54,30 +54,29 @@ struct rtree_gl_draw_box }; template -struct rtree_gl_draw_indexable +struct gl_draw_indexable { }; template -struct rtree_gl_draw_indexable +struct gl_draw_indexable { - typedef typename geometry::traits::point_type::type point_type; - static const size_t dimension = geometry::traits::dimension::value; + static const size_t dimension = index::traits::dimension::value; static inline void apply(Indexable const& i, size_t level) { - rtree_gl_draw_box::apply(i, level); + gl_draw_box::apply(i, level); } }; template -struct rtree_gl_draw_indexable +struct gl_draw_indexable { - static const size_t dimension = geometry::traits::dimension::value; + static const size_t dimension = index::traits::dimension::value; static inline void apply(Indexable const& i, size_t level) { - rtree_gl_draw_point::apply(i, level); + gl_draw_point::apply(i, level); } }; @@ -86,23 +85,23 @@ struct rtree_gl_draw_indexable namespace detail { template -inline void rtree_gl_draw_indexable(Indexable const& i, size_t level) +inline void gl_draw_indexable(Indexable const& i, size_t level) { - dispatch::rtree_gl_draw_indexable< + dispatch::gl_draw_indexable< Indexable, - typename geometry::traits::tag::type + typename index::traits::tag::type >::apply(i, level); } } // namespace detail template -struct rtree_gl_draw : public boost::static_visitor<> +struct gl_draw : public boost::static_visitor<> { - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; - inline rtree_gl_draw(Translator const& t) + inline gl_draw(Translator const& t) : tr(t), level(0) {} @@ -128,7 +127,7 @@ struct rtree_gl_draw : public boost::static_visitor<> for (typename children_type::const_iterator it = n.children.begin(); it != n.children.end(); ++it) { - detail::rtree_gl_draw_indexable(it->first, level); + detail::gl_draw_indexable(it->first, level); } size_t level_backup = level; @@ -152,7 +151,7 @@ struct rtree_gl_draw : public boost::static_visitor<> for (typename values_type::const_iterator it = n.values.begin(); it != n.values.end(); ++it) { - detail::rtree_gl_draw_indexable(tr(*it), level); + detail::gl_draw_indexable(tr(*it), level); } } @@ -161,7 +160,7 @@ struct rtree_gl_draw : public boost::static_visitor<> size_t level; }; -} // namespace visitors +}}} // namespace detail::rtree::visitors template void gl_draw(rtree const& tree) @@ -173,7 +172,7 @@ void gl_draw(rtree const& tree) glClear(GL_COLOR_BUFFER_BIT); - visitors::rtree_gl_draw gl_draw_v(tree.get_translator()); + detail::rtree::visitors::gl_draw gl_draw_v(tree.get_translator()); tree.apply_visitor(gl_draw_v); glFlush(); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp similarity index 58% rename from include/boost/geometry/extensions/index/rtree/visitors/rtree_insert.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 6317255e5..f4fe164ab 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/rtree_insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -7,23 +7,23 @@ // 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_RTREE_INSERT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_INSERT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { template -struct rtree_insert +struct insert { // not implemented here }; -} // namespace visitors +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_INSERT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp similarity index 54% rename from include/boost/geometry/extensions/index/rtree/visitors/rtree_is_leaf.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index 50d6947f9..ef8a65249 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/rtree_is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -7,20 +7,20 @@ // 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_RTREE_IS_LEAF_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_IS_LEAF_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { template -struct rtree_is_leaf : public boost::static_visitor +struct is_leaf : public boost::static_visitor { - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline bool operator()(internal_node const&) const { @@ -33,8 +33,8 @@ struct rtree_is_leaf : public boost::static_visitor } }; -} // namespace visitors +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_IS_LEAF_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 65ad8c95c..b208ea36d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -13,29 +13,29 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { namespace dispatch { template -struct rtree_print_point +struct print_point { BOOST_STATIC_ASSERT(0 < Dimension); static inline void apply(std::ostream & os, Point const& p) { - rtree_print_point::apply(os, p); + print_point::apply(os, p); os << ", " << geometry::get(p); } }; template -struct rtree_print_point +struct print_point { static inline void apply(std::ostream & os, Point const& p) { @@ -44,20 +44,20 @@ struct rtree_print_point }; template -struct rtree_print_corner +struct print_corner { BOOST_STATIC_ASSERT(0 < Dimension); static inline void apply(std::ostream & os, Box const& b) { - rtree_print_corner::apply(os, b); + print_corner::apply(os, b); os << ", " << geometry::get(b); } }; template -struct rtree_print_corner +struct print_corner { static inline void apply(std::ostream & os, Box const& b) { @@ -66,35 +66,34 @@ struct rtree_print_corner }; template -struct rtree_print_indexable +struct print_indexable { }; template -struct rtree_print_indexable +struct print_indexable { - typedef typename geometry::traits::point_type::type point_type; - static const size_t dimension = geometry::traits::dimension::value; + static const size_t dimension = index::traits::dimension::value; static inline void apply(std::ostream &os, Indexable const& i) { os << '('; - rtree_print_corner::apply(os, i); + print_corner::apply(os, i); os << ")x("; - rtree_print_corner::apply(os, i); + print_corner::apply(os, i); os << ')'; } }; template -struct rtree_print_indexable +struct print_indexable { - static const size_t dimension = geometry::traits::dimension::value; + static const size_t dimension = index::traits::dimension::value; static inline void apply(std::ostream &os, Indexable const& i) { os << '('; - rtree_print_point::apply(os, i); + print_point::apply(os, i); os << ')'; } }; @@ -104,9 +103,9 @@ struct rtree_print_indexable namespace detail { template -inline void rtree_print_indexable(std::ostream & os, Indexable const& i) +inline void print_indexable(std::ostream & os, Indexable const& i) { - dispatch::rtree_print_indexable< + dispatch::print_indexable< Indexable, typename geometry::traits::tag::type >::apply(os, i); @@ -115,12 +114,12 @@ inline void rtree_print_indexable(std::ostream & os, Indexable const& i) } // namespace detail template -struct rtree_print : public boost::static_visitor<> +struct print : public boost::static_visitor<> { - typedef typename index::detail::rtree_internal_node::type internal_node; - typedef typename index::detail::rtree_leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; - inline rtree_print(std::ostream & o, Translator const& t) + inline print(std::ostream & o, Translator const& t) : os(o), tr(t), level(0) {} @@ -134,7 +133,7 @@ struct rtree_print : public boost::static_visitor<> it != n.children.end(); ++it) { spaces(level); - detail::rtree_print_indexable(os, it->first); + detail::print_indexable(os, it->first); os << " ->" << it->second << '\n'; } @@ -159,7 +158,7 @@ struct rtree_print : public boost::static_visitor<> it != n.values.end(); ++it) { spaces(level); - detail::rtree_print_indexable(os, tr(*it)); + detail::print_indexable(os, tr(*it)); os << '\n'; } } @@ -177,7 +176,7 @@ struct rtree_print : public boost::static_visitor<> size_t level; }; -} // namespace visitors +}}} // namespace detail::rtree::visitors template std::ostream & operator<<(std::ostream & os, rtree const& tree) @@ -186,7 +185,7 @@ std::ostream & operator<<(std::ostream & os, rtree const typedef typename rtree::translator_type translator_type; typedef typename rtree::box_type box_type; typedef typename rtree::tag_type tag_type; - visitors::rtree_print print_v(os, tree.get_translator()); + detail::rtree::visitors::print print_v(os, tree.get_translator()); tree.apply_visitor(print_v); return os; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/rtree_remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp similarity index 60% rename from include/boost/geometry/extensions/index/rtree/visitors/rtree_remove.hpp rename to include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 953fa49c3..d5e9a07a4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/rtree_remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -7,14 +7,14 @@ // 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_RTREE_REMOVE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_REMOVE_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP -#include +#include namespace boost { namespace geometry { namespace index { -namespace visitors { +namespace detail { namespace rtree { namespace visitors { template struct rtree_remove @@ -22,8 +22,8 @@ struct rtree_remove // not implemented here }; -} // namespace visitors +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_RTREE_REMOVE_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 4636f8820..359f959e0 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; @@ -53,9 +53,9 @@ void mouse(int button, int state, int x, int y) std::cout << "\n\n\n" << t << "\n\n"; std::cout << "inserted: "; - boost::geometry::index::visitors::detail::rtree_print_indexable(std::cout, b); + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; - std::cout << ( boost::geometry::index::rtree_are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); glutPostRedisplay(); } From 034bf7ce0a96b8427a7fc651ee3d1032c98b8de1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 29 Mar 2011 18:22:56 +0000 Subject: [PATCH 007/366] tagstags are now in the index namespace [SVN r70702] --- .../extensions/index/rtree/rstar/choose_next_node.hpp | 8 ++++---- .../geometry/extensions/index/rtree/rstar/insert.hpp | 8 ++++---- .../geometry/extensions/index/rtree/rstar/rstar.hpp | 2 +- .../geometry/extensions/index/rtree/rstar/split.hpp | 6 +++--- .../boost/geometry/extensions/index/rtree/rtree.hpp | 2 +- .../extensions/index/{rtree/rstar => }/tags.hpp | 10 +++++----- 6 files changed, 18 insertions(+), 18 deletions(-) rename include/boost/geometry/extensions/index/{rtree/rstar => }/tags.hpp (61%) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index bc6cd04ab..6003f380a 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -26,9 +26,9 @@ namespace detail { namespace rtree { namespace rstar { template class choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename internal_node::children_type children_type; @@ -39,7 +39,7 @@ public: assert(!n.children.empty()); bool has_leaves = boost::apply_visitor( - visitors::is_leaf(), + visitors::is_leaf(), *n.children.front().second); if ( !has_leaves ) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 682247fb4..bedcf0d2a 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -31,11 +31,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -class insert : public boost::static_visitor<> +class insert : public boost::static_visitor<> { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index b4106b341..6f0ee007f 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP -#include +#include #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp index 2e25ae12b..1c5684e02 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp @@ -264,9 +264,9 @@ struct split_update_data template class split { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; static const size_t dimension = index::traits::dimension::value; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 6a0fae593..7bf35939f 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -27,7 +27,7 @@ namespace boost { namespace geometry { namespace index { template < typename Value, typename Translator = default_parameter, - typename Tag = rtree_rstar_tag + typename Tag = rstar_tag > class rtree { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/tags.hpp b/include/boost/geometry/extensions/index/tags.hpp similarity index 61% rename from include/boost/geometry/extensions/index/rtree/rstar/tags.hpp rename to include/boost/geometry/extensions/index/tags.hpp index b19e29648..6032d3232 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/tags.hpp +++ b/include/boost/geometry/extensions/index/tags.hpp @@ -1,19 +1,19 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R*-tree tags +// Boost.Index - R*-tree tag // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_TAGS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_TAGS_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TAGS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TAGS_HPP namespace boost { namespace geometry { namespace index { -struct rtree_rstar_tag {}; +struct rstar_tag {}; }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_TAGS_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TAGS_HPP From 5b96b96c349384522402eea8c2377380b7f8e912 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 30 Mar 2011 10:16:03 +0000 Subject: [PATCH 008/366] choose_next_node algorithm changed [SVN r70746] --- .../index/rtree/rstar/choose_next_node.hpp | 224 +++++++++++++----- .../extensions/index/rtree/rstar/insert.hpp | 26 +- tests/additional_glut_vis.cpp | 3 +- 3 files changed, 184 insertions(+), 69 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 6003f380a..374be6081 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -12,6 +12,8 @@ #include +#include + #include #include #include @@ -32,6 +34,9 @@ class choose_next_node typedef typename internal_node::children_type children_type; + typedef typename index::area_result::type area_type; + typedef typename index::overlap_result::type overlap_type; + public: template static inline size_t apply(internal_node & n, Indexable const& indexable) @@ -42,89 +47,192 @@ public: visitors::is_leaf(), *n.children.front().second); - if ( !has_leaves ) - return impl(n, indexable); + if ( has_leaves ) + return branch_impl(n, indexable); + //return impl(n, indexable); else - return impl(n, indexable); + return internal_node_impl(n, indexable); + //return impl(n, indexable); } private: - template - static inline size_t impl(internal_node & n, Indexable const& indexable) + template + static inline size_t branch_impl(internal_node & n, Indexable const& indexable) { - typedef typename children_type::iterator children_iterator; - - //assert(!n.children.empty()); - - children_iterator temp_it = n.children.begin(); - children_iterator child_it = temp_it; - Areas min_areas(n.children, child_it, indexable); - - for (children_iterator it = ++temp_it; - it != n.children.end(); ++it) + size_t children_count = n.children.size(); + // overlaps values of all nodes' boxes, + // overlaps and areas of extended boxes are stored at indexes i + children_count + std::vector overlaps(children_count * 2, overlap_type(0)); + std::vector areas(children_count * 2); + // caculate overlaps and areas of all nodes' boxes + for (size_t i = 0 ; i < children_count ; ++i ) { - Areas areas(n.children, it, indexable); + typedef typename children_type::value_type child_type; + child_type const& ch_i = n.children[i]; - if ( areas < min_areas ) + Box ch_ext; + // calculate expanded box fo node ch_i + geometry::convert(ch_i.first, ch_ext); + geometry::expand(ch_ext, indexable); + + areas[i] = index::area(ch_i.first); + areas[i + children_count] = index::area(ch_ext); + + for (size_t j = i + 1 ; j < children_count ; ++j ) { - child_it = it; - min_areas = areas; + child_type const& ch_j = n.children[j]; + + // add overlap of both boxes + overlap_type ovl = index::overlap(ch_i.first, ch_j.first); + overlaps[i] += ovl; + overlaps[j] += ovl; + + // add overlap of expanded box i and box j + overlaps[i + children_count] = index::overlap(ch_ext, ch_j.first); + + // add overlap of expanded box j and box i + geometry::convert(ch_j.first, ch_ext); + geometry::expand(ch_ext, indexable); + overlaps[j + children_count] = index::overlap(ch_ext, ch_i.first); } } - // TODO: awulkiew - switch to indexes in the whole class? - return child_it - n.children.begin(); + // choose index with smallest overlap change value, or area change or smallest area + size_t choosen_index = 0; + overlap_type smallest_overlap_change = std::numeric_limits::max(); + area_type smallest_area_change = std::numeric_limits::max(); + area_type smallest_area = std::numeric_limits::max(); + + for ( size_t i = 0 ; i < children_count ; ++i ) + { + overlap_type overlap_change = overlaps[i + children_count] - overlaps[i]; + area_type area_change = areas[i + children_count] - areas[i]; + area_type area = areas[i + children_count]; + + if ( overlap_change < smallest_overlap_change || + ( overlap_change == smallest_overlap_change && area_change < smallest_area_change ) || + ( area_change == smallest_area_change && smallest_area < area ) ) + { + smallest_overlap_change = overlap_change; + smallest_area_change = area_change; + smallest_area = area; + choosen_index = i; + } + } + + return choosen_index; } - struct branch_areas + template + static inline size_t internal_node_impl(internal_node & n, Indexable const& indexable) { - typedef typename index::area_result::type area_type; + size_t children_count = n.children.size(); - template - inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable) + // choose index with smallest overlap change value, or area change or smallest area + size_t choosen_index = 0; + area_type smallest_area_change = std::numeric_limits::max(); + area_type smallest_area = std::numeric_limits::max(); + + // caculate areas and areas of all nodes' boxes + for ( size_t i = 0 ; i < children_count ; ++i ) { - overlap_area = 0; - for (typename children_type::const_iterator it = ch.begin(); it != ch.end(); ++it) - if ( it != k_it ) - overlap_area += index::overlap(k_it->first, it->first); + typedef typename children_type::value_type child_type; + child_type const& ch_i = n.children[i]; - area = index::area(k_it->first); + Box ch_exp; + geometry::convert(ch_i.first, ch_exp); + geometry::expand(ch_exp, indexable); - diff_area = index::union_area(k_it->first, indexable) - area; + area_type area = index::area(ch_exp); + area_type area_change = area - index::area(ch_i.first); + + if ( area_change < smallest_area_change || + ( area_change == smallest_area_change && smallest_area < area ) ) + { + smallest_area_change = area_change; + smallest_area = area; + choosen_index = i; + } } - inline bool operator<(branch_areas &a) const - { - return overlap_area < a.overlap_area || - ( overlap_area == a.overlap_area && diff_area < a.diff_area ) || - ( diff_area == a.diff_area && area < a.area ); - } + return choosen_index; + } - area_type overlap_area; - area_type diff_area; - area_type area; - }; + //template + //static inline size_t impl(internal_node & n, Indexable const& indexable) + //{ + // typedef typename children_type::iterator children_iterator; - struct internal_node_areas - { - typedef typename area_result::type area_type; + // //assert(!n.children.empty()); - template - inline internal_node_areas(children_type const&, typename children_type::iterator const& k_it, Indexable const& indexable) - { - area = index::area(k_it->first); - diff_area = index::union_area(k_it->first, indexable) - area; - } + // children_iterator temp_it = n.children.begin(); + // children_iterator child_it = temp_it; + // Areas min_areas(n.children, child_it, indexable); - inline bool operator<(internal_node_areas &a) const - { - return diff_area < a.diff_area || - ( diff_area == a.diff_area && area < a.area ); - } + // for (children_iterator it = ++temp_it; + // it != n.children.end(); ++it) + // { + // Areas areas(n.children, it, indexable); - area_type diff_area; - area_type area; - }; + // if ( areas < min_areas ) + // { + // child_it = it; + // min_areas = areas; + // } + // } + + // return child_it - n.children.begin(); + //} + + //struct branch_areas + //{ + // typedef typename index::area_result::type area_type; + + // template + // inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable) + // { + // overlap_area = 0; + // for (typename children_type::const_iterator it = ch.begin(); it != ch.end(); ++it) + // if ( it != k_it ) + // overlap_area += index::overlap(k_it->first, it->first); + + // area = index::area(k_it->first); + + // diff_area = index::union_area(k_it->first, indexable) - area; + // } + + // inline bool operator<(branch_areas &a) const + // { + // return overlap_area < a.overlap_area || + // ( overlap_area == a.overlap_area && diff_area < a.diff_area ) || + // ( diff_area == a.diff_area && area < a.area ); + // } + + // area_type overlap_area; + // area_type diff_area; + // area_type area; + //}; + + //struct internal_node_areas + //{ + // typedef typename area_result::type area_type; + + // template + // inline internal_node_areas(children_type const&, typename children_type::iterator const& k_it, Indexable const& indexable) + // { + // area = index::area(k_it->first); + // diff_area = index::union_area(k_it->first, indexable) - area; + // } + + // inline bool operator<(internal_node_areas &a) const + // { + // return diff_area < a.diff_area || + // ( diff_area == a.diff_area && area < a.area ); + // } + + // area_type diff_area; + // area_type area; + //}; }; }}} // namespace detail::rtree:rstar diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index bedcf0d2a..351df920f 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -41,7 +41,7 @@ public: inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) , m_root_node(root) - , m_parent(0), m_current_child_index(0) + , m_parent(0), m_current_child_index(0), m_current_level(0) {} inline void operator()(internal_node & n) @@ -50,13 +50,14 @@ public: internal_node * parent_bckup = m_parent; m_parent = &n; size_t current_child_index_bckup = m_current_child_index; + size_t current_level_bckup = m_current_level; // choose next node, where value insert traversing should go m_current_child_index = rstar::choose_next_node:: apply(n, m_tr(m_value)); - // TODO: awulkiew - if reinsert is implemented this must be changed + // expand the node to contain value geometry::expand(n.children[m_current_child_index].first, m_tr(m_value)); // next traversing step @@ -65,12 +66,10 @@ public: // restore previous traverse inputs m_parent = parent_bckup; m_current_child_index = current_child_index_bckup; + m_current_level = current_level_bckup; if ( m_max_elems_per_node < n.children.size() ) - { - rstar::split:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - } + overflow_treatment(n); } inline void operator()(leaf & n) @@ -78,13 +77,19 @@ public: n.values.push_back(m_value); if ( m_max_elems_per_node < n.values.size() ) - { - rstar::split:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - } + overflow_treatment(n); } private: + template + inline void overflow_treatment(Node & n) + { + // TODO: awulkiew - reinsert + + rstar::split:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); + } + Value const& m_value; Translator const& m_tr; size_t m_min_elems_per_node; @@ -95,6 +100,7 @@ private: // traversing input parameters internal_node *m_parent; size_t m_current_child_index; + size_t m_current_level; }; }}} // namespace detail::rtree::visitors diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 359f959e0..6cf7e87ce 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -9,7 +9,8 @@ typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; -boost::geometry::index::rtree t(2, 1); +//boost::geometry::index::rtree t(2, 1); +boost::geometry::index::rtree t(4, 2); void render_scene(void) { From 98e4b47b3247f5475e6893aaffec909c04095f7f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 3 Apr 2011 23:07:34 +0000 Subject: [PATCH 009/366] reinsert implemented [SVN r70964] --- .../extensions/index/algorithms/area.hpp | 8 +- .../extensions/index/algorithms/margin.hpp | 16 +- .../extensions/index/algorithms/overlap.hpp | 6 +- .../index/algorithms/union_area.hpp | 2 +- .../geometry/extensions/index/rtree/node.hpp | 6 + .../index/rtree/rstar/choose_next_node.hpp | 4 +- .../extensions/index/rtree/rstar/insert.hpp | 66 +--- .../index/rtree/rstar/insert_impl.hpp | 307 ++++++++++++++++++ .../extensions/index/rtree/rstar/split.hpp | 14 +- .../geometry/extensions/index/rtree/rtree.hpp | 4 +- .../index/rtree/visitors/are_boxes_ok.hpp | 2 +- .../index/rtree/visitors/gl_draw.hpp | 2 - tests/additional_sizes_and_times.cpp | 10 +- 13 files changed, 356 insertions(+), 91 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/area.hpp b/include/boost/geometry/extensions/index/algorithms/area.hpp index d54ee8609..dbfe23376 100644 --- a/include/boost/geometry/extensions/index/algorithms/area.hpp +++ b/include/boost/geometry/extensions/index/algorithms/area.hpp @@ -13,7 +13,7 @@ namespace boost { namespace geometry { namespace index { template -struct area_result +struct default_area_result { typedef typename select_most_precise< typename coordinate_type::type, @@ -29,7 +29,7 @@ struct area_for_each_dimension BOOST_STATIC_ASSERT(0 < CurrentDimension); BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); - static inline typename area_result::type apply(Box const& b) + static inline typename default_area_result::type apply(Box const& b) { return area_for_each_dimension::apply(b) * ( geometry::get(b) - geometry::get(b) ); @@ -39,7 +39,7 @@ struct area_for_each_dimension template struct area_for_each_dimension { - static inline typename area_result::type apply(Box const& b) + static inline typename default_area_result::type apply(Box const& b) { return geometry::get(b) - geometry::get(b); } @@ -48,7 +48,7 @@ struct area_for_each_dimension } // namespace detail template -typename area_result::type area(Box const& b) +typename default_area_result::type area(Box const& b) { return detail::area_for_each_dimension::value>::apply(b); } diff --git a/include/boost/geometry/extensions/index/algorithms/margin.hpp b/include/boost/geometry/extensions/index/algorithms/margin.hpp index 44f0164f7..fb2f45722 100644 --- a/include/boost/geometry/extensions/index/algorithms/margin.hpp +++ b/include/boost/geometry/extensions/index/algorithms/margin.hpp @@ -13,7 +13,7 @@ namespace boost { namespace geometry { namespace index { template -struct margin_result +struct default_margin_result { typedef typename select_most_precise< typename coordinate_type::type, @@ -29,7 +29,7 @@ struct margin_for_each_edge BOOST_STATIC_ASSERT(0 < CurrentDimension); BOOST_STATIC_ASSERT(0 < EdgeDimension); - static inline typename margin_result::type apply(Box const& b) + static inline typename default_margin_result::type apply(Box const& b) { return margin_for_each_edge::apply(b) * ( geometry::get(b) - geometry::get(b) ); @@ -41,7 +41,7 @@ struct margin_for_each_edge { BOOST_STATIC_ASSERT(0 < CurrentDimension); - static inline typename margin_result::type apply(Box const& b) + static inline typename default_margin_result::type apply(Box const& b) { return margin_for_each_edge::apply(b); } @@ -52,7 +52,7 @@ struct margin_for_each_edge { BOOST_STATIC_ASSERT(0 < CurrentDimension); - static inline typename margin_result::type apply(Box const& b) + static inline typename default_margin_result::type apply(Box const& b) { return geometry::get(b) - geometry::get(b); } @@ -61,7 +61,7 @@ struct margin_for_each_edge template struct margin_for_each_edge { - static inline typename margin_result::type apply(Box const& b) + static inline typename default_margin_result::type apply(Box const& b) { return 1; } @@ -73,7 +73,7 @@ struct margin_for_each_dimension BOOST_STATIC_ASSERT(0 < CurrentDimension); BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); - static inline typename margin_result::type apply(Box const& b) + static inline typename default_margin_result::type apply(Box const& b) { return margin_for_each_dimension::apply(b) + 2 * margin_for_each_edge::value>::apply(b); @@ -83,7 +83,7 @@ struct margin_for_each_dimension template struct margin_for_each_dimension { - static inline typename margin_result::type apply(Box const& b) + static inline typename default_margin_result::type apply(Box const& b) { return 2 * margin_for_each_edge::value>::apply(b); } @@ -92,7 +92,7 @@ struct margin_for_each_dimension } // namespace detail template -typename margin_result::type margin(Box const& b) +typename default_margin_result::type margin(Box const& b) { return detail::margin_for_each_dimension::value>::apply(b); } diff --git a/include/boost/geometry/extensions/index/algorithms/overlap.hpp b/include/boost/geometry/extensions/index/algorithms/overlap.hpp index 5695cee7a..fd9882783 100644 --- a/include/boost/geometry/extensions/index/algorithms/overlap.hpp +++ b/include/boost/geometry/extensions/index/algorithms/overlap.hpp @@ -16,13 +16,13 @@ namespace boost { namespace geometry { namespace index { template -struct overlap_result +struct default_overlap_result { - typedef typename area_result::type type; + typedef typename default_area_result::type type; }; template -typename overlap_result::type overlap(Box const& b1, Box const& b2) +typename default_overlap_result::type overlap(Box const& b1, Box const& b2) { Box inters; geometry::assign_zero(inters); diff --git a/include/boost/geometry/extensions/index/algorithms/union_area.hpp b/include/boost/geometry/extensions/index/algorithms/union_area.hpp index 38deeea25..8beee71a5 100644 --- a/include/boost/geometry/extensions/index/algorithms/union_area.hpp +++ b/include/boost/geometry/extensions/index/algorithms/union_area.hpp @@ -20,7 +20,7 @@ namespace boost { namespace geometry { namespace index { * \brief Compute the area of the union of b1 and b2 */ template -inline typename area_result::type union_area(Box const& b, Geometry const& g) +inline typename default_area_result::type union_area(Box const& b, Geometry const& g) { Box expanded_box(b); geometry::expand(expanded_box, g); diff --git a/include/boost/geometry/extensions/index/rtree/node.hpp b/include/boost/geometry/extensions/index/rtree/node.hpp index 53b74ff23..0104acd72 100644 --- a/include/boost/geometry/extensions/index/rtree/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node.hpp @@ -107,6 +107,12 @@ elements_get(leaf_def & n) return n.values; } +template +struct element_type +{ + typedef typename elements_type::type::value_type type; +}; + // uniform indexable type for child node element's box and value's indexable template diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 374be6081..597b831de 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -34,8 +34,8 @@ class choose_next_node typedef typename internal_node::children_type children_type; - typedef typename index::area_result::type area_type; - typedef typename index::overlap_result::type overlap_type; + typedef typename index::default_area_result::type area_type; + typedef typename index::default_overlap_result::type overlap_type; public: template diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 351df920f..b9a65ea31 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -10,10 +10,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP -#include - -#include - #include #include #include @@ -23,8 +19,7 @@ #include #include -#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -39,68 +34,25 @@ class insert : public boost::static_visitor<> public: inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) - : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) - , m_root_node(root) - , m_parent(0), m_current_child_index(0), m_current_level(0) + : m_root(root) + , m_impl(root, v, min_elements, max_elements, t) {} inline void operator()(internal_node & n) { - // save previous traverse inputs and set new ones - internal_node * parent_bckup = m_parent; - m_parent = &n; - size_t current_child_index_bckup = m_current_child_index; - size_t current_level_bckup = m_current_level; - - // choose next node, where value insert traversing should go - m_current_child_index = - rstar::choose_next_node:: - apply(n, m_tr(m_value)); - - // expand the node to contain value - geometry::expand(n.children[m_current_child_index].first, m_tr(m_value)); - - // next traversing step - boost::apply_visitor(*this, *n.children[m_current_child_index].second); - - // restore previous traverse inputs - m_parent = parent_bckup; - m_current_child_index = current_child_index_bckup; - m_current_level = current_level_bckup; - - if ( m_max_elems_per_node < n.children.size() ) - overflow_treatment(n); + assert(&n == &boost::get(*m_root)); + boost::apply_visitor(m_impl, *m_root); } inline void operator()(leaf & n) { - n.values.push_back(m_value); - - if ( m_max_elems_per_node < n.values.size() ) - overflow_treatment(n); + assert(&n == &boost::get(*m_root)); + boost::apply_visitor(m_impl, *m_root); } private: - template - inline void overflow_treatment(Node & n) - { - // TODO: awulkiew - reinsert - - rstar::split:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - } - - Value const& m_value; - Translator const& m_tr; - size_t m_min_elems_per_node; - size_t m_max_elems_per_node; - - node* & m_root_node; - - // traversing input parameters - internal_node *m_parent; - size_t m_current_child_index; - size_t m_current_level; + node* & m_root; + index::detail::rtree::rstar::insert_impl m_impl; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp new file mode 100644 index 000000000..9430150a9 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp @@ -0,0 +1,307 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R*-tree reinsert algorithm implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_IMPL_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_IMPL_HPP + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace rstar { + +template +class insert_base; + +template +class insert_impl : public insert_base +{ + typedef insert_base base; + +public: + inline insert_impl( + node* & root, + Element const& el, + size_t min_elements, + size_t max_elements, + Translator const& t, + size_t level = std::numeric_limits::max() + ) + : base(root, el, min_elements, max_elements, t, level) + {} + + inline void operator()(internal_node & n) + { + if ( m_current_level < m_level ) + { + // next traversing step + base::traverse(*this, n); + } + else + { + assert( m_level == m_current_level ); + + // push new child node + n.children.push_back(m_element); + } + + if ( m_max_elems_per_node < n.children.size() ) + base::overflow_treatment(n); + } + + inline void operator()(leaf & n) + { + assert(false); + } +}; + +template +class insert_impl : public insert_base +{ + typedef insert_base base; + +public: + inline insert_impl( + node* & root, + Value const& v, + size_t min_elements, + size_t max_elements, + Translator const& t, + size_t level = std::numeric_limits::max() + ) + : base(root, v, min_elements, max_elements, t, level) + {} + + inline void operator()(internal_node & n) + { + assert(m_current_level < m_level); + + // next traversing step + base::traverse(*this, n); + + if ( m_max_elems_per_node < n.children.size() ) + base::overflow_treatment(n); + } + + inline void operator()(leaf & n) + { + assert( m_level == m_current_level || + m_level == std::numeric_limits::max() ); + + n.values.push_back(m_element); + + if ( m_max_elems_per_node < n.values.size() ) + base::overflow_treatment(n); + } +}; + +template +class insert_base : public boost::static_visitor<> +{ +protected: + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + inline insert_base( + node* & root, + Element const& el, + size_t min_elements, + size_t max_elements, + Translator const& t, + size_t level = std::numeric_limits::max() + ) + : m_element(el) + , m_tr(t) + , m_min_elems_per_node(min_elements) + , m_max_elems_per_node(max_elements) + , m_reinserted_elements_count(size_t(max_elements * 0.3f)) + , m_level(level) + , m_root_node(root) + , m_parent(0), m_current_child_index(0), m_current_level(0) + {} + + template + inline void traverse(Derived & d, internal_node & n) + { + // choose next node, where value insert traversing should go + size_t choosen_node_index = rstar::choose_next_node:: + apply(n, rtree::element_indexable(m_element, m_tr)); + + // expand the node to contain value + geometry::expand( + n.children[choosen_node_index].first, + rtree::element_indexable(m_element, m_tr)); + + // apply traversing visitor + traverse_apply_visitor(d, n, choosen_node_index); + } + + template + inline void traverse_apply_visitor(Derived & d, internal_node &n, size_t choosen_node_index) + { + // save previous traverse inputs and set new ones + internal_node * parent_bckup = m_parent; + size_t current_child_index_bckup = m_current_child_index; + size_t current_level_bckup = m_current_level; + + m_parent = &n; + m_current_child_index = choosen_node_index; + ++m_current_level; + + // next traversing step + boost::apply_visitor(d, *n.children[choosen_node_index].second); + + // restore previous traverse inputs + m_parent = parent_bckup; + m_current_child_index = current_child_index_bckup; + m_current_level = current_level_bckup; + } + + // before calling overflow_treatment all nodes have aabbs expanded + // and the number of elements in the current node is max + 1 + template + inline void overflow_treatment(Node & n) + { + // TODO: awulkiew - replace this condition with tag dispatched template + + // first time insert + if ( m_parent != 0 && + m_level == std::numeric_limits::max() && + 0 < m_reinserted_elements_count ) + { + reinsert(n); + } + // second time insert + else + { + rstar::split:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); + } + } + + template + static inline bool distances_asc( + std::pair const& d1, + std::pair const& d2) + { + return d1.first < d2.first; + } + + template + static inline bool distances_dsc( + std::pair const& d1, + std::pair const& d2) + { + return d1.first > d2.first; + } + + template + inline void reinsert(Node & n) + { + typedef typename index::detail::rtree::elements_type::type elements_type; + typedef typename index::detail::rtree::element_type::type element_type; + typedef typename geometry::point_type::type point_type; + // TODO: awulkiew - use distance_result + typedef typename index::traits::coordinate_type::type distance_type; + + assert(m_parent != 0); + assert(0 < m_reinserted_elements_count); + + point_type node_center; + geometry::centroid(m_parent->children[m_current_child_index].first, node_center); + + elements_type & elements = index::detail::rtree::elements_get(n); + + size_t elements_count = elements.size(); + std::vector< std::pair > distances(elements_count); + for ( size_t i = 0 ; i < elements_count ; ++i ) + { + // TODO: awulkiew - use distance_sqr + // (use select_calculation_type if distance_sqr must be implemented in geometry::index) + // change point type for this geometry + point_type element_center; + geometry::centroid( index::detail::rtree::element_indexable( + elements[i], + m_tr + ), element_center); + + distances[i].first = geometry::distance(node_center, element_center); + distances[i].second = elements[i]; + } + + // sort elements by distances from center + std::partial_sort( + distances.begin(), + distances.begin() + m_reinserted_elements_count, + distances.end(), + distances_dsc); + + // copy elements which will be reinserted + elements_type elements_to_reinsert(m_reinserted_elements_count); + for ( size_t i = 0 ; i < m_reinserted_elements_count ; ++i ) + elements_to_reinsert[i] = distances[i].second; + + // copy elements to the current node + elements.resize(elements_count - m_reinserted_elements_count); + for ( size_t i = m_reinserted_elements_count ; i < elements_count ; ++i ) + elements[i - m_reinserted_elements_count] = distances[i].second; + + // calulate node's new box + m_parent->children[m_current_child_index].first = + elements_box(elements.begin(), elements.end(), m_tr); + + // reinsert children starting from the minimum distance + for ( size_t i = m_reinserted_elements_count ; 0 < i ; --i ) + { + insert_impl insert_v( + m_root_node, elements_to_reinsert[i - 1], + m_min_elems_per_node, m_max_elems_per_node, + m_tr, m_current_level); + boost::apply_visitor(insert_v, *m_root_node); + } + } + + Element const& m_element; + Translator const& m_tr; + const size_t m_min_elems_per_node; + const size_t m_max_elems_per_node; + const size_t m_reinserted_elements_count; + + const size_t m_level; + + node* & m_root_node; + + // traversing input parameters + internal_node *m_parent; + size_t m_current_child_index; + size_t m_current_level; +}; + +}}} // namespace detail::rtree::rstar + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_IMPL_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp index 1c5684e02..c91c131f1 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp @@ -59,9 +59,9 @@ private: template struct split_axis_data { - typedef typename margin_result::type margin_type; - typedef typename overlap_result::type overlap_type; - typedef typename area_result::type area_type; + typedef typename default_margin_result::type margin_type; + typedef typename default_overlap_result::type overlap_type; + typedef typename default_area_result::type area_type; inline split_axis_data() : margins_sum(0) @@ -141,9 +141,9 @@ public: template struct split_data { - typedef typename margin_result::type margin_type; - typedef typename overlap_result::type overlap_type; - typedef typename area_result::type area_type; + typedef typename default_margin_result::type margin_type; + typedef typename default_overlap_result::type overlap_type; + typedef typename default_area_result::type area_type; inline split_data() : smallest_margins_sum(std::numeric_limits::max()) @@ -314,6 +314,7 @@ public: sd.choosen_distribution.begin() + sd.choosen_median_index, elements.begin()); + // node is not the root if ( parent != 0 ) { // update old node's box @@ -321,6 +322,7 @@ public: // add new node to the parent's children parent->children.push_back(std::make_pair(sd.choosen_right_box, right_node)); } + // node is the root else { assert(&n == boost::get(root)); diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 7bf35939f..2f882d637 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -42,8 +42,8 @@ public: typedef typename detail::rtree::leaf::type leaf; inline explicit rtree( - size_t max_elems_per_node = 2, - size_t min_elems_per_node = 1, + size_t max_elems_per_node = 4, + size_t min_elems_per_node = 2, translator_type const& translator = translator_type() ) : m_values_count(0) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index c83ac16fc..af242e945 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP -#include +#include #include namespace boost { namespace geometry { namespace index { 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 c8b2c0f6b..390912eb4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -10,8 +10,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP -#include - #include namespace boost { namespace geometry { namespace index { diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 9bc5e763e..bb69cdf52 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -35,14 +35,14 @@ int main() typedef boost::geometry::model::box

B; // randomize boxes - const size_t n = 10000; + const size_t n = 100000; std::vector v(n); for ( size_t i = 0 ; i < n ; ++i ) { - float x = float( rand() % 1000 ); - float y = float( rand() % 1000 ); - float w = float( rand() % 10 ) / 10.0f; - float h = float( rand() % 10 ) / 10.0f; + float x = float( rand() % 100000 ); + float y = float( rand() % 100000 ); + float w = float( rand() % 100 ); + float h = float( rand() % 100 ); v[i] = B(P(x - w, y - h),P(x + w, y + h)); } From 7d1068077185e410fe4fec3fe4e46075a3d2479d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 27 Apr 2011 18:14:45 +0000 Subject: [PATCH 010/366] reinsertions disabled + minor changes [SVN r71544] --- .../extensions/index/rtree/rstar/insert.hpp | 5 +- .../index/rtree/rstar/insert_impl.hpp | 83 +++++++++----- .../geometry/extensions/index/rtree/rtree.hpp | 2 +- .../extensions/index/rtree/visitors/find.hpp | 2 +- tests/additional_glut_vis.cpp | 1 - tests/additional_sizes_and_times.cpp | 101 ++++++++++-------- 6 files changed, 121 insertions(+), 73 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index b9a65ea31..dfd204540 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -36,7 +36,10 @@ public: inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) : m_root(root) , m_impl(root, v, min_elements, max_elements, t) - {} + { + // TODO + // assert - check if Box is correct + } inline void operator()(internal_node & n) { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp index 9430150a9..90e163d34 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp @@ -28,6 +28,10 @@ #include #include +//TEST +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace rstar { @@ -39,6 +43,9 @@ template class insert_impl : public insert_base { typedef insert_base base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; public: inline insert_impl( @@ -54,20 +61,20 @@ public: inline void operator()(internal_node & n) { - if ( m_current_level < m_level ) + if ( base::m_current_level < base::m_level ) { // next traversing step base::traverse(*this, n); } else { - assert( m_level == m_current_level ); + assert( base::m_level == base::m_current_level ); // push new child node - n.children.push_back(m_element); + n.children.push_back(base::m_element); } - if ( m_max_elems_per_node < n.children.size() ) + if ( base::m_max_elems_per_node < n.children.size() ) base::overflow_treatment(n); } @@ -81,6 +88,9 @@ template class insert_impl : public insert_base { typedef insert_base base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; public: inline insert_impl( @@ -96,23 +106,23 @@ public: inline void operator()(internal_node & n) { - assert(m_current_level < m_level); + assert(base::m_current_level < base::m_level); // next traversing step base::traverse(*this, n); - if ( m_max_elems_per_node < n.children.size() ) + if ( base::m_max_elems_per_node < n.children.size() ) base::overflow_treatment(n); } inline void operator()(leaf & n) { - assert( m_level == m_current_level || - m_level == std::numeric_limits::max() ); + assert( base::m_level == base::m_current_level || + base::m_level == std::numeric_limits::max() ); - n.values.push_back(m_element); + n.values.push_back(base::m_element); - if ( m_max_elems_per_node < n.values.size() ) + if ( base::m_max_elems_per_node < n.values.size() ) base::overflow_treatment(n); } }; @@ -132,7 +142,7 @@ protected: size_t max_elements, Translator const& t, size_t level = std::numeric_limits::max() - ) + ) : m_element(el) , m_tr(t) , m_min_elems_per_node(min_elements) @@ -150,11 +160,32 @@ protected: size_t choosen_node_index = rstar::choose_next_node:: apply(n, rtree::element_indexable(m_element, m_tr)); + //TEST + /*{ + std::ofstream log("log.txt", std::ofstream::trunc); + log << std::fixed << "internal node " << m_current_level << " " << m_level << '\n'; + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, rtree::element_indexable(m_element, m_tr)); + log << '\n' << "choosen node: " << choosen_node_index << "\n"; + log << "before: "; + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); + log << "\n"; + }*/ + // expand the node to contain value geometry::expand( n.children[choosen_node_index].first, rtree::element_indexable(m_element, m_tr)); + //TEST + /*{ + std::ofstream log("log.txt", std::ofstream::app); + log << std::fixed << choosen_node_index << "after: "; + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); + log << '\n'; + boost::geometry::index::detail::rtree::visitors::print print_v(log, m_tr); + boost::apply_visitor(print_v, *m_root_node); + }*/ + // apply traversing visitor traverse_apply_visitor(d, n, choosen_node_index); } @@ -188,32 +219,32 @@ protected: // TODO: awulkiew - replace this condition with tag dispatched template // first time insert - if ( m_parent != 0 && - m_level == std::numeric_limits::max() && - 0 < m_reinserted_elements_count ) + /*if ( m_parent != 0 && + m_level == std::numeric_limits::max() && + 0 < m_reinserted_elements_count ) { reinsert(n); } // second time insert else - { + {*/ rstar::split:: apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - } + //} } - template + template static inline bool distances_asc( - std::pair const& d1, - std::pair const& d2) + std::pair const& d1, + std::pair const& d2) { return d1.first < d2.first; } - template + template static inline bool distances_dsc( - std::pair const& d1, - std::pair const& d2) + std::pair const& d1, + std::pair const& d2) { return d1.first > d2.first; } @@ -226,7 +257,7 @@ protected: typedef typename geometry::point_type::type point_type; // TODO: awulkiew - use distance_result typedef typename index::traits::coordinate_type::type distance_type; - + assert(m_parent != 0); assert(0 < m_reinserted_elements_count); @@ -246,7 +277,7 @@ protected: geometry::centroid( index::detail::rtree::element_indexable( elements[i], m_tr - ), element_center); + ), element_center); distances[i].first = geometry::distance(node_center, element_center); distances[i].second = elements[i]; @@ -272,7 +303,7 @@ protected: // calulate node's new box m_parent->children[m_current_child_index].first = elements_box(elements.begin(), elements.end(), m_tr); - + // reinsert children starting from the minimum distance for ( size_t i = m_reinserted_elements_count ; 0 < i ; --i ) { @@ -291,7 +322,7 @@ protected: const size_t m_reinserted_elements_count; const size_t m_level; - + node* & m_root_node; // traversing input parameters diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 2f882d637..734767e2a 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -67,7 +67,7 @@ public: } template - inline std::vector find(Geometry const& geom) const + inline std::deque find(Geometry const& geom) const { detail::rtree::visitors::find find_v(geom, m_translator); boost::apply_visitor(find_v, *m_root); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 004d68417..3ed40e0d8 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -56,7 +56,7 @@ struct find : public boost::static_visitor<> Geometry const& geom; Translator const& tr; - std::vector result; + std::deque result; }; }}} // namespace detail::rtree::visitors diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 6cf7e87ce..db01250fc 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -1,5 +1,4 @@ #include -#define BOOST_GEOMETRY_INDEX_RTREE_ENABLE_GL_DRAW #include diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index bb69cdf52..dea136624 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -6,70 +6,85 @@ #include #include -template -void print(Box const& b) -{ - using namespace boost::geometry; - std::cout << boost::geometry::get(b) << ", "; - std::cout << boost::geometry::get(b) << " x "; - std::cout << boost::geometry::get(b) << ", "; - std::cout << boost::geometry::get(b)<< std::endl; -} - int main() { - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - boost::geometry::index::rtree::leaf l; - boost::geometry::index::rtree::internal_node n; - - std::cout << "internal node size: " << sizeof(n) << '\n'; - std::cout << "leaf size: " << sizeof(l) << '\n'; - } - boost::timer tim; typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; // randomize boxes - const size_t n = 100000; - std::vector v(n); + const size_t n = 1000000; + //const size_t n = 300; + const size_t ns = 100000; + + std::ifstream file_cfg("config.txt"); + std::ifstream file("test_coords.txt"); + + std::cout << "loading data\n"; + std::vector< std::pair > coords(n); for ( size_t i = 0 ; i < n ; ++i ) { - float x = float( rand() % 100000 ); - float y = float( rand() % 100000 ); - float w = float( rand() % 100 ); - float h = float( rand() % 100 ); - v[i] = B(P(x - w, y - h),P(x + w, y + h)); + file >> coords[i].first; + file >> coords[i].second; } + std::cout << "loaded\n"; + + //std::cin.get(); + size_t max_elems, min_elems; + file_cfg >> max_elems; + file_cfg >> min_elems; + std::cout << "max: " << max_elems << ", min: " << min_elems << "\n"; + + std::cout << "inserting time test...\n"; + tim.restart(); + boost::geometry::index::rtree< std::pair > t(max_elems, min_elems); + for (size_t i = 0 ; i < n ; ++i ) { - boost::geometry::index::rtree t(4, 2); + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - std::cout << "inserting time test...\n"; + // Zle wyswietla dane, obcina czesc ulamkowa + // Zle buduje drzewo dla i == 228 - tim.restart(); - - for (size_t i = 0 ; i < n ; ++i ) + //TEST + /*if ( i == 228 ) { - B const& b = v[i]; - boost::geometry::index::insert(t, b); - } + std::cout << std::fixed << x << ", " << y << "\n"; + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); + }*/ - std::cout << "time: " << tim.elapsed() << "s\n"; - - std::cout << "deleting time test...\n"; - tim.restart(); + t.insert(std::make_pair(b, i)); + + //TEST + /*if ( !boost::geometry::index::are_boxes_ok(t) ) + { + std::ofstream log("log1.txt", std::ofstream::trunc); + log << std::fixed << i << " - " << x << ", " << y << " - inserted: "; + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, b); + log << '\n'; + log << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); + log << '\n' << t; + }*/ } - std::cout << "time: " << tim.elapsed() << "s\n"; -#ifdef _MSC_VER + std::cout << "searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < ns ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result = t.find(B(P(x - 10, y - 10), P(x + 10, y + 10))); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << temp << "\n"; + std::cin.get(); -#endif return 0; } From 433c25089199782dd3fe58d98ac65423c6c07c62 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 30 Apr 2011 20:53:59 +0000 Subject: [PATCH 011/366] new creation algorithm added [SVN r71634] --- .../index/rtree/linear/choose_next_node.hpp | 80 ++++ .../extensions/index/rtree/linear/insert.hpp | 112 ++++++ .../{tags.hpp => rtree/linear/linear.hpp} | 12 +- .../extensions/index/rtree/linear/split.hpp | 374 ++++++++++++++++++ .../geometry/extensions/index/rtree/node.hpp | 10 +- .../index/rtree/rstar/choose_next_node.hpp | 2 +- .../extensions/index/rtree/rstar/rstar.hpp | 7 +- .../geometry/extensions/index/rtree/rtree.hpp | 26 +- .../index/rtree/visitors/gl_draw.hpp | 119 ++++-- .../extensions/index/rtree/visitors/load.hpp | 111 ++++++ .../extensions/index/rtree/visitors/save.hpp | 97 +++++ tests/additional_load_time_vis.cpp | 141 +++++++ tests/additional_sizes_and_times.cpp | 51 ++- 13 files changed, 1069 insertions(+), 73 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/linear/insert.hpp rename include/boost/geometry/extensions/index/{tags.hpp => rtree/linear/linear.hpp} (55%) create mode 100644 include/boost/geometry/extensions/index/rtree/linear/split.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/load.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/save.hpp create mode 100644 tests/additional_load_time_vis.cpp diff --git a/include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp new file mode 100644 index 000000000..b4b27789d --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp @@ -0,0 +1,80 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree ChooseNextNode algorithm - per traverse level ChooseSubtree +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_LINEAR_LINEAR_CHOOSE_NEXT_NODE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_LINEAR_LINEAR_CHOOSE_NEXT_NODE_HPP + +#include + +#include + +#include +#include +#include + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace linear { + +template +struct choose_next_node +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename internal_node::children_type children_type; + + typedef typename index::default_area_result::type area_type; + + template + static inline size_t apply(internal_node & n, Indexable const& indexable) + { + assert(!n.children.empty()); + + size_t children_count = n.children.size(); + + // choose index with smallest area change or smallest area + size_t choosen_index = 0; + area_type smallest_area_diff = std::numeric_limits::max(); + area_type smallest_area = std::numeric_limits::max(); + + // caculate areas and areas of all nodes' boxes + for ( size_t i = 0 ; i < children_count ; ++i ) + { + typedef typename children_type::value_type child_type; + child_type const& ch_i = n.children[i]; + + Box box_exp(ch_i.first); + geometry::expand(box_exp, indexable); + + area_type area = index::area(box_exp); + area_type area_diff = area - index::area(ch_i.first); + + if ( area_diff < smallest_area_diff || + ( area_diff == smallest_area_diff && area < smallest_area ) ) + { + smallest_area_diff = area_diff; + smallest_area = area; + choosen_index = i; + } + } + + return choosen_index; + } +}; + +}}} // namespace detail::rtree:linear + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_LINEAR_LINEAR_CHOOSE_NEXT_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/insert.hpp b/include/boost/geometry/extensions/index/rtree/linear/insert.hpp new file mode 100644 index 000000000..4be05fa8c --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/linear/insert.hpp @@ -0,0 +1,112 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree insert algorithm implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_INSERT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_INSERT_HPP + +#include +#include +#include +#include + +#include +#include + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +class insert : public boost::static_visitor<> +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + +public: + inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) + : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) + , m_root_node(root) + , m_parent(0), m_current_child_index(0), m_current_level(0) + { + // TODO + // assert - check if Box is correct + } + + inline void operator()(internal_node & n) + { + // choose next node + size_t choosen_node_index = linear::choose_next_node:: + apply(n, rtree::element_indexable(m_value, m_tr)); + + // expand the node to contain value + geometry::expand(n.children[choosen_node_index].first, m_tr(m_value)); + + // next traversing step + traverse_apply_visitor(n, choosen_node_index); + + // handle overflow + if ( m_max_elems_per_node < n.children.size() ) + linear::split:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); + } + + inline void operator()(leaf & n) + { + // push value + n.values.push_back(m_value); + + // handle overflow + if ( m_max_elems_per_node < n.values.size() ) + linear::split:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); + } + +private: + inline void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) + { + // save previous traverse inputs and set new ones + internal_node * parent_bckup = m_parent; + size_t current_child_index_bckup = m_current_child_index; + size_t current_level_bckup = m_current_level; + + m_parent = &n; + m_current_child_index = choosen_node_index; + ++m_current_level; + + // next traversing step + boost::apply_visitor(*this, *n.children[choosen_node_index].second); + + // restore previous traverse inputs + m_parent = parent_bckup; + m_current_child_index = current_child_index_bckup; + m_current_level = current_level_bckup; + } + + Value const& m_value; + Translator const& m_tr; + const size_t m_min_elems_per_node; + const size_t m_max_elems_per_node; + + node* & m_root_node; + + // traversing input parameters + internal_node *m_parent; + size_t m_current_child_index; + size_t m_current_level; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/tags.hpp b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp similarity index 55% rename from include/boost/geometry/extensions/index/tags.hpp rename to include/boost/geometry/extensions/index/rtree/linear/linear.hpp index 6032d3232..d2d3f4074 100644 --- a/include/boost/geometry/extensions/index/tags.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp @@ -1,19 +1,21 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R*-tree tag +// Boost.Index - R-tree // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TAGS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TAGS_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP namespace boost { namespace geometry { namespace index { -struct rstar_tag {}; +struct linear_tag {}; }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TAGS_HPP +#include + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/split.hpp b/include/boost/geometry/extensions/index/rtree/linear/split.hpp new file mode 100644 index 000000000..2df8f1921 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/linear/split.hpp @@ -0,0 +1,374 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R*-tree split algorithm implementation +// +// Copyright 2008 Federico J. Fernandez. +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_SPLIT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_SPLIT_HPP + +#include + +#include + +#include +#include + +#include +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace linear { + +// from void find_normalized_separations(std::vector const& boxes, T& separation, unsigned int& first, unsigned int& second) const + +template +struct find_greatest_normalized_separation +{ + typedef typename Elements::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + + static inline void apply(Elements const& elements, + Translator const& tr, + coordinate_type & separation, + size_t & seed1, + size_t & seed2) + { + size_t elements_count = elements.size(); + + assert(2 <= elements_count); + + // find the lowest low, highest high + coordinate_type lowest_low = geometry::get(rtree::element_indexable(elements[0], tr)); + coordinate_type highest_high = geometry::get(rtree::element_indexable(elements[0], tr)); + // and the lowest high + coordinate_type lowest_high = highest_high; + size_t lowest_high_index = 0; + for ( size_t i = 1 ; i < elements_count ; ++i ) + { + coordinate_type min_coord = index::get(rtree::element_indexable(elements[i], tr)); + coordinate_type max_coord = index::get(rtree::element_indexable(elements[i], tr)); + + if ( max_coord < lowest_high ) + { + lowest_high = max_coord; + lowest_high_index = i; + } + + if ( min_coord < lowest_low ) + lowest_low = min_coord; + + if ( highest_high < max_coord ) + highest_high = max_coord; + } + + // find the highest low + size_t highest_low_index = lowest_high_index == 0 ? 1 : 0; + coordinate_type highest_low = geometry::get(rtree::element_indexable(elements[highest_low_index], tr)); + for ( size_t i = highest_low_index ; i < elements_count ; ++i ) + { + coordinate_type min_coord = index::get(rtree::element_indexable(elements[i], tr)); + if ( highest_low < min_coord && + i != lowest_high_index ) + { + highest_low = min_coord; + highest_low_index = i; + } + } + + coordinate_type const width = highest_high - lowest_low; + + separation = (highest_low - lowest_high) / width; + seed1 = highest_low_index; + seed2 = lowest_high_index; + } +}; + +namespace dispatch { + +template +struct choose_axis_impl +{ + BOOST_STATIC_ASSERT(0 < DimensionIndex); + + typedef typename Elements::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + + static inline void apply(Elements const& elements, + Translator const& tr, + size_t & axis, + coordinate_type & separation, + size_t & seed1, + size_t & seed2) + { + choose_axis_impl::apply(elements, tr, axis, separation, seed1, seed2); + + coordinate_type current_separation; + size_t s1, s2; + find_greatest_normalized_separation::apply(elements, tr, current_separation, s1, s2); + + // TODO: operator test!, change <= to < later + if ( separation <= current_separation ) + { + separation = current_separation; + seed1 = s1; + seed2 = s2; + axis = DimensionIndex - 1; + } + } +}; + +template +struct choose_axis_impl +{ + typedef typename Elements::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + + static inline void apply(Elements const& elements, + Translator const& tr, + size_t & axis, + coordinate_type & separation, + size_t & seed1, + size_t & seed2) + { + find_greatest_normalized_separation::apply(elements, tr, separation, seed1, seed2); + axis = 0; + } +}; + +} // namespace dispatch + +// from void linear_pick_seeds(node_pointer const& n, unsigned int &seed1, unsigned int &seed2) const + +template +struct choose_axis +{ + typedef typename Elements::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + + static const size_t dimension = index::traits::dimension::value; + + static inline size_t apply(Elements const& elements, + Translator const& tr, + size_t & seed1, + size_t & seed2) + { + size_t axis = 0; + coordinate_type separation = 0; + dispatch::choose_axis_impl::apply(elements, tr, axis, separation, seed1, seed2); + return axis; + } +}; + +// from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const + +template +struct redistribute_elements +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + template + static inline void apply(Node & n, + Node & second_node, + Box & box1, + Box & box2, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename rtree::elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::default_area_result::type area_type; + + static const size_t dimension = index::traits::dimension::value; + + // copy original elements + elements_type elements_copy = rtree::elements_get(n); + size_t elements_count = elements_copy.size(); + + // calculate initial seeds + size_t seed1 = 0; + size_t seed2 = 0; + choose_axis::apply(elements_copy, tr, seed1, seed2); + + // prepare nodes' elements containers + elements_type & elements1 = rtree::elements_get(n); + elements_type & elements2 = rtree::elements_get(second_node); + elements1.clear(); + assert(elements2.empty()); + + // add seeds + elements1.push_back(elements_copy[seed1]); + elements2.push_back(elements_copy[seed2]); + + // calculate boxes + geometry::convert(rtree::element_indexable(elements_copy[seed1], tr), box1); + geometry::convert(rtree::element_indexable(elements_copy[seed2], tr), box2); + + // initialize areas + area_type area1 = index::area(box1); + area_type area2 = index::area(box2); + + assert(2 <= elements_count); + size_t remaining = elements_count - 2; + + // redistribute the rest of the elements + for ( size_t i = 0 ; i < elements_count ; ++i ) + { + if (i != seed1 && i != seed2) + { + element_type const& elem = elements_copy[i]; + indexable_type const& indexable = rtree::element_indexable(elem, tr); + + // TODO: awulkiew - is this needed? + if ( elements1.size() + remaining == min_elems ) + { + elements1.push_back(elem); + geometry::expand(box1, indexable); + area1 = index::area(box1); + continue; + } + if ( elements2.size() + remaining == min_elems ) + { + elements2.push_back(elem); + geometry::expand(box2, indexable); + area2 = index::area(box2); + continue; + } + + assert(0 < remaining); + remaining--; + + // calculate enlarged boxes and areas + Box enlarged_box1(box1); + Box enlarged_box2(box2); + geometry::expand(enlarged_box1, indexable); + geometry::expand(enlarged_box2, indexable); + area_type enlarged_area1 = index::area(enlarged_box1); + area_type enlarged_area2 = index::area(enlarged_box2); + + area_type areas_diff1 = enlarged_area1 - area1; + area_type areas_diff2 = enlarged_area2 - area2; + + // choose group which box area have to be enlarged least + if ( areas_diff1 < areas_diff2 ) + { + elements1.push_back(elem); + box1 = enlarged_box1; + area1 = enlarged_area1; + } + else if ( areas_diff2 < areas_diff1 ) + { + elements2.push_back(elem); + box2 = enlarged_box2; + area2 = enlarged_area2; + } + else + { + // choose group which box has smaller area + if ( area1 < area2 ) + { + elements1.push_back(elem); + box1 = enlarged_box1; + area1 = enlarged_area1; + } + else if ( area2 < area1 ) + { + elements2.push_back(elem); + box2 = enlarged_box2; + area2 = enlarged_area2; + } + else + { + // choose group with fewer elements + if ( elements1.size() <= elements2.size() ) + { + elements1.push_back(elem); + box1 = enlarged_box1; + area1 = enlarged_area1; + } + else + { + elements2.push_back(elem); + box2 = enlarged_box2; + area2 = enlarged_area2; + } + } + } + } + } + } +}; + +// split + +template +class split +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + static const size_t dimension = index::traits::dimension::value; + +public: + template + static inline void apply( + Node & n, + internal_node *parent, + size_t current_child_index, + node *& root, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + node * second_node = rtree::create_node(Node()); + + // redistribute elements + Box box1, box2; + linear::redistribute_elements:: + apply(n, boost::get(*second_node), box1, box2, min_elems, max_elems, tr); + + // node is not the root + if ( parent != 0 ) + { + // update old node's box + parent->children[current_child_index].first = box1; + // add new node to the parent's children + parent->children.push_back(std::make_pair(box2, second_node)); + } + // node is the root + else + { + assert(&n == boost::get(root)); + + // create new root and add nodes + node * new_root = rtree::create_node(internal_node()); + + boost::get(*new_root).children.push_back(std::make_pair(box1, root)); + boost::get(*new_root).children.push_back(std::make_pair(box2, second_node)); + + root = new_root; + } + } +}; + +}}} // namespace detail::rtree:linear + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_SPLIT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node.hpp b/include/boost/geometry/extensions/index/rtree/node.hpp index 0104acd72..aee3567a4 100644 --- a/include/boost/geometry/extensions/index/rtree/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node.hpp @@ -107,11 +107,11 @@ elements_get(leaf_def & n) return n.values; } -template -struct element_type -{ - typedef typename elements_type::type::value_type type; -}; +//template +//struct element_type +//{ +// typedef typename elements_type::type::value_type type; +//}; // uniform indexable type for child node element's box and value's indexable diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 597b831de..785b7f24f 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -128,7 +128,7 @@ private: { size_t children_count = n.children.size(); - // choose index with smallest overlap change value, or area change or smallest area + // choose index with smallest area change or smallest area size_t choosen_index = 0; area_type smallest_area_change = std::numeric_limits::max(); area_type smallest_area = std::numeric_limits::max(); diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index 6f0ee007f..53b901ba1 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -10,7 +10,12 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP -#include +namespace boost { namespace geometry { namespace index { + +struct rstar_tag {}; + +}}} // namespace boost::geometry::index + #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 734767e2a..5f414a852 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -19,6 +19,10 @@ #include #include +#include + +//TEST +//#include namespace boost { namespace geometry { namespace index { @@ -27,7 +31,7 @@ namespace boost { namespace geometry { namespace index { template < typename Value, typename Translator = default_parameter, - typename Tag = rstar_tag + typename Tag = linear_tag > class rtree { @@ -100,6 +104,26 @@ public: return m_values_count; } + //TEST + //inline void load(std::istream &is) + //{ + // std::string t; + // size_t n; + // is >> t; + // is >> n; + + // if ( t == "i" ) + // m_root = detail::rtree::create_node(internal_node()); + // else + // m_root = detail::rtree::create_node(leaf()); + + // detail::rtree::visitors::load + // load_v(is, m_translator); + + // for ( size_t i = 0 ; i < n ; ++i ) + // boost::apply_visitor(load_v, *m_root); + //} + private: size_t m_values_count; size_t m_max_elems_per_node; 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 390912eb4..7acddd13c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -10,6 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP +#include #include namespace boost { namespace geometry { namespace index { @@ -25,10 +26,10 @@ struct gl_draw_point template struct gl_draw_point { - static inline void apply(Point const& p, size_t level) + static inline void apply(Point const& p, typename index::traits::coordinate_type::type z) { glBegin(GL_POINT); - glVertex2f(geometry::get<0>(p), geometry::get<1>(p), level); + glVertex3f(geometry::get<0>(p), geometry::get<1>(p), z); glEnd(); } }; @@ -40,13 +41,13 @@ struct gl_draw_box template struct gl_draw_box { - static inline void apply(Box const& b, size_t level) + static inline void apply(Box const& b, typename index::traits::coordinate_type::type z) { glBegin(GL_LINE_LOOP); - glVertex3f(geometry::get(b), geometry::get(b), level); - glVertex3f(geometry::get(b), geometry::get(b), level); - glVertex3f(geometry::get(b), geometry::get(b), level); - glVertex3f(geometry::get(b), geometry::get(b), level); + glVertex3f(geometry::get(b), geometry::get(b), z); + glVertex3f(geometry::get(b), geometry::get(b), z); + glVertex3f(geometry::get(b), geometry::get(b), z); + glVertex3f(geometry::get(b), geometry::get(b), z); glEnd(); } }; @@ -61,9 +62,9 @@ struct gl_draw_indexable { static const size_t dimension = index::traits::dimension::value; - static inline void apply(Indexable const& i, size_t level) + static inline void apply(Indexable const& i, typename index::traits::coordinate_type::type z) { - gl_draw_box::apply(i, level); + gl_draw_box::apply(i, z); } }; @@ -72,9 +73,9 @@ struct gl_draw_indexable { static const size_t dimension = index::traits::dimension::value; - static inline void apply(Indexable const& i, size_t level) + static inline void apply(Indexable const& i, typename index::traits::coordinate_type::type z) { - gl_draw_point::apply(i, level); + gl_draw_point::apply(i, z); } }; @@ -83,12 +84,12 @@ struct gl_draw_indexable namespace detail { template -inline void gl_draw_indexable(Indexable const& i, size_t level) +inline void gl_draw_indexable(Indexable const& i, typename index::traits::coordinate_type::type z) { dispatch::gl_draw_indexable< Indexable, typename index::traits::tag::type - >::apply(i, level); + >::apply(i, z); } } // namespace detail @@ -99,42 +100,58 @@ struct gl_draw : public boost::static_visitor<> typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - inline gl_draw(Translator const& t) - : tr(t), level(0) + inline gl_draw(Translator const& t, + size_t level_first = 0, + size_t level_last = std::numeric_limits::max(), + typename index::traits::coordinate_type::type z_coord_level_multiplier = 1 + ) + : tr(t) + , level_f(level_first) + , level_l(level_last) + , z_mul(z_coord_level_multiplier) + , level(0) {} inline void operator()(internal_node const& n) { typedef typename internal_node::children_type children_type; - if ( level == 0 ) - glColor3f(1.0f, 0.0f, 0.0f); - else if ( level == 1 ) - glColor3f(0.0f, 1.0f, 0.0f); - else if ( level == 2 ) - glColor3f(0.0f, 0.0f, 1.0f); - else if ( level == 3 ) - glColor3f(1.0f, 1.0f, 0.0f); - else if ( level == 4 ) - glColor3f(1.0f, 0.0f, 1.0f); - else if ( level == 5 ) - glColor3f(0.0f, 1.0f, 1.0f); - else - glColor3f(0.5f, 0.5f, 0.5f); - - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) + if ( level_f <= level ) { - detail::gl_draw_indexable(it->first, level); + size_t level_rel = level - level_f; + + if ( level_rel == 0 ) + glColor3f(1.0f, 0.0f, 0.0f); + else if ( level_rel == 1 ) + glColor3f(0.0f, 1.0f, 0.0f); + else if ( level_rel == 2 ) + glColor3f(0.0f, 0.0f, 1.0f); + else if ( level_rel == 3 ) + glColor3f(1.0f, 1.0f, 0.0f); + else if ( level_rel == 4 ) + glColor3f(1.0f, 0.0f, 1.0f); + else if ( level_rel == 5 ) + glColor3f(0.0f, 1.0f, 1.0f); + else + glColor3f(0.5f, 0.5f, 0.5f); + + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + detail::gl_draw_indexable(it->first, level_rel * z_mul); + } } size_t level_backup = level; ++level; - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) + if ( level < level_l ) { - boost::apply_visitor(*this, *it->second); + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + boost::apply_visitor(*this, *it->second); + } } level = level_backup; @@ -144,16 +161,24 @@ struct gl_draw : public boost::static_visitor<> { typedef typename leaf::values_type values_type; - glColor3f(1.0f, 1.0f, 1.0f); - - for (typename values_type::const_iterator it = n.values.begin(); - it != n.values.end(); ++it) + if ( level_f <= level ) { - detail::gl_draw_indexable(tr(*it), level); + size_t level_rel = level - level_f; + + glColor3f(1.0f, 1.0f, 1.0f); + + for (typename values_type::const_iterator it = n.values.begin(); + it != n.values.end(); ++it) + { + detail::gl_draw_indexable(tr(*it), level_rel * z_mul); + } } } Translator const& tr; + size_t level_f; + size_t level_l; + typename index::traits::coordinate_type::type z_mul; size_t level; }; @@ -161,7 +186,13 @@ struct gl_draw : public boost::static_visitor<> }}} // namespace detail::rtree::visitors template -void gl_draw(rtree const& tree) +void gl_draw(rtree const& tree, + size_t level_first = 0, + size_t level_last = std::numeric_limits::max(), + typename index::traits::coordinate_type< + typename rtree::box_type + >::type z_coord_level_multiplier = 1 + ) { typedef typename rtree::value_type value_type; typedef typename rtree::translator_type translator_type; @@ -170,7 +201,9 @@ void gl_draw(rtree const& tree) glClear(GL_COLOR_BUFFER_BIT); - detail::rtree::visitors::gl_draw gl_draw_v(tree.get_translator()); + detail::rtree::visitors::gl_draw + gl_draw_v(tree.get_translator(), level_first, level_last, z_coord_level_multiplier); + tree.apply_visitor(gl_draw_v); glFlush(); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/load.hpp b/include/boost/geometry/extensions/index/rtree/visitors/load.hpp new file mode 100644 index 000000000..ffbedffa9 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/load.hpp @@ -0,0 +1,111 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree loading visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_LOAD_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_LOAD_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +struct load; + +template +struct load< + std::pair< + boost::geometry::model::box< + boost::geometry::model::point + >, + size_t + >, + typename Translator, + Box, + Tag +> +: public boost::static_visitor<> +{ + typedef boost::geometry::model::point point_type; + + typedef std::pair< + boost::geometry::model::box< + point_type + >, + size_t + > value_type; + + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + inline load(std::istream & i, Translator const& t) + : is(i), tr(t) + {} + + inline void operator()(internal_node & n) + { + std::string node_type; + float min_x, min_y, max_x, max_y; + size_t c; + + is >> node_type; + is >> min_x; + is >> min_y; + is >> max_x; + is >> max_y; + is >> c; + + Box b(point_type(min_x, min_y), point_type(max_x, max_y)); + node * new_n = 0; + + if ( node_type == "i" ) + new_n = rtree::create_node(internal_node()); + else if ( node_type == "l" ) + new_n = rtree::create_node(leaf()); + else + assert(0); + + n.children.push_back(std::make_pair(b, new_n)); + + for ( size_t i = 0 ; i < c ; ++i ) + boost::apply_visitor(*this, *new_n); + } + + inline void operator()(leaf & n) + { + std::string node_type; + float min_x, min_y, max_x, max_y; + size_t id; + + is >> node_type; + is >> min_x; + is >> min_y; + is >> max_x; + is >> max_y; + is >> id; + + assert(id == "v"); + + Box b(point_type(min_x, min_y), point_type(max_x, max_y)); + n.values.push_back(std::make_pair(b, id)); + } + + std::istream & is; + Translator const& tr; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_LOAD_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/save.hpp b/include/boost/geometry/extensions/index/rtree/visitors/save.hpp new file mode 100644 index 000000000..47925e6ad --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/save.hpp @@ -0,0 +1,97 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree saving visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SAVE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SAVE_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +struct save; + +template +struct save< + std::pair< + boost::geometry::model::box< + boost::geometry::model::point + >, + size_t + >, + typename Translator, + Box, + Tag +> +: public boost::static_visitor<> +{ + typedef boost::geometry::model::point point_type; + + typedef std::pair< + boost::geometry::model::box< + point_type + >, + size_t + > value_type; + + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + inline save(std::ostream & o, Translator const& t) + : os(o), tr(t) + {} + + inline void operator()(internal_node & n) + { + os << n.children.size() << '\n'; + + for ( size_t i = 0 ; i < n.children.size() ; ++i ) + { + if ( boost::apply_visitor(visitors::is_leaf(), *(n.children[i].second)) ) + os << "l "; + else + os << "i "; + os << geometry::get(n.children[i].first) << ' '; + os << geometry::get(n.children[i].first) << ' '; + os << geometry::get(n.children[i].first) << ' '; + os << geometry::get(n.children[i].first) << ' '; + + boost::apply_visitor(*this, *(n.children[i].second)); + } + } + + inline void operator()(leaf & n) + { + os << n.values.size() << '\n'; + + for ( size_t i = 0 ; i < n.values.size() ; ++i ) + { + os << "v "; + os << geometry::get(n.values[i].first) << ' '; + os << geometry::get(n.values[i].first) << ' '; + os << geometry::get(n.values[i].first) << ' '; + os << geometry::get(n.values[i].first) << ' '; + os << n.values[i].second << '\n'; + } + } + + std::ostream & os; + Translator const& tr; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SAVE_HPP diff --git a/tests/additional_load_time_vis.cpp b/tests/additional_load_time_vis.cpp new file mode 100644 index 000000000..0db3b5ac6 --- /dev/null +++ b/tests/additional_load_time_vis.cpp @@ -0,0 +1,141 @@ +#include + +#include +#include + +#include +#include + +//TEST +#include +#include + +typedef boost::geometry::model::point P; +typedef boost::geometry::model::box

B; +boost::geometry::index::rtree< std::pair > t; + +void render_scene(void) +{ + boost::geometry::index::gl_draw(t, 0, 1, 20000.0f); +} + +void resize(int w, int h) +{ + if ( h == 0 ) + h = 1; + + float ratio = float(w) / h; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glViewport(0, 0, w, h); + + gluPerspective(45.0, ratio, 1, 10000000.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt( + 2000000.0, 2000000.0, 2000000.0, + 0.0, 0.0, -1.0, + 0.0, 1.0, 0.0); +} + +int main(int argc, char **argv) +{ + boost::timer tim; + + // randomize boxes + const size_t n = 1000000; + //const size_t n = 300; + const size_t ns = 100000; + + std::ifstream file_cfg("config.txt"); + std::ifstream file("test_coords.txt"); + + std::cout << "loading data\n"; + std::vector< std::pair > coords(n); + for ( size_t i = 0 ; i < n ; ++i ) + { + file >> coords[i].first; + file >> coords[i].second; + } + std::cout << "loaded\n"; + + std::cin.get(); + + size_t max_elems, min_elems; + file_cfg >> max_elems; + file_cfg >> min_elems; + std::cout << "max: " << max_elems << ", min: " << min_elems << "\n"; + + t = boost::geometry::index::rtree< std::pair > (max_elems, min_elems); + + //std::cout << "inserting time test...\n"; + //tim.restart(); + //for (size_t i = 0 ; i < n ; ++i ) + //{ + // float x = coords[i].first; + // float y = coords[i].second; + // B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + // // Zle wyswietla dane, obcina czesc ulamkowa + // // Zle buduje drzewo dla i == 228 + + // //TEST + // /*if ( i == 228 ) + // { + // std::cout << std::fixed << x << ", " << y << "\n"; + // boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); + // }*/ + + // t.insert(std::make_pair(b, i)); + + // //TEST + // /*if ( !boost::geometry::index::are_boxes_ok(t) ) + // { + // std::ofstream log("log1.txt", std::ofstream::trunc); + // log << std::fixed << i << " - " << x << ", " << y << " - inserted: "; + // boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, b); + // log << '\n'; + // log << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); + // log << '\n' << t; + // }*/ + //} + //std::cout << "time: " << tim.elapsed() << "s\n"; + + { + std::cout << "loading tree structure...\n"; + std::ifstream is("save.txt"); + t.load(is); + std::cout << "done.\n"; + } + + std::cout << "searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < ns ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result = t.find(B(P(x - 10, y - 10), P(x + 10, y + 10))); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << temp << "\n"; + + std::cin.get(); + + //TEST + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); + glutInitWindowPosition(100,100); + glutInitWindowSize(800, 600); + glutCreateWindow("Mouse click to insert new value"); + + glutDisplayFunc(render_scene); + glutReshapeFunc(resize); + + glutMainLoop(); + + return 0; +} diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index dea136624..3ebec7099 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -6,6 +6,8 @@ #include #include +#include + int main() { boost::timer tim; @@ -13,34 +15,34 @@ int main() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - // randomize boxes - const size_t n = 1000000; - //const size_t n = 300; - const size_t ns = 100000; - std::ifstream file_cfg("config.txt"); - std::ifstream file("test_coords.txt"); + size_t max_elems = 4; + size_t min_elems = 2; + size_t values_count = 0; + size_t queries_count = 0; + char save_ch = 'n'; + file_cfg >> max_elems; + file_cfg >> min_elems; + file_cfg >> values_count; + file_cfg >> queries_count; + file_cfg >> save_ch; + std::cout << "max: " << max_elems << ", min: " << min_elems << "\n"; + std::cout << "v: " << values_count << ", q: " << queries_count << "\n"; + std::ifstream file("test_coords.txt"); std::cout << "loading data\n"; - std::vector< std::pair > coords(n); - for ( size_t i = 0 ; i < n ; ++i ) + std::vector< std::pair > coords(values_count); + for ( size_t i = 0 ; i < values_count ; ++i ) { file >> coords[i].first; file >> coords[i].second; } std::cout << "loaded\n"; - //std::cin.get(); - - size_t max_elems, min_elems; - file_cfg >> max_elems; - file_cfg >> min_elems; - std::cout << "max: " << max_elems << ", min: " << min_elems << "\n"; - std::cout << "inserting time test...\n"; tim.restart(); boost::geometry::index::rtree< std::pair > t(max_elems, min_elems); - for (size_t i = 0 ; i < n ; ++i ) + for (size_t i = 0 ; i < values_count ; ++i ) { float x = coords[i].first; float y = coords[i].second; @@ -71,10 +73,25 @@ int main() } std::cout << "time: " << tim.elapsed() << "s\n"; + if ( save_ch == 's' ) + { + std::cout << "saving...\n"; + std::ofstream file("save_new.txt", std::ofstream::trunc); + file << std::fixed; + boost::geometry::index::detail::rtree::visitors::save< + boost::geometry::index::rtree< std::pair >::value_type, + boost::geometry::index::rtree< std::pair >::translator_type, + boost::geometry::index::rtree< std::pair >::box_type, + boost::geometry::index::rtree< std::pair >::tag_type + > saving_v(file, t.get_translator()); + t.apply_visitor(saving_v); + std::cout << "saved...\n"; + } + std::cout << "searching time test...\n"; tim.restart(); size_t temp = 0; - for (size_t i = 0 ; i < ns ; ++i ) + for (size_t i = 0 ; i < queries_count ; ++i ) { float x = coords[i].first; float y = coords[i].second; From 7a761b359eabfe7a9e0333efb7f512bfa2979283 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 1 May 2011 00:42:54 +0000 Subject: [PATCH 012/366] rtree::find parameters changed [SVN r71640] --- .../extensions/index/rtree/filters.hpp | 14 +++-- .../extensions/index/rtree/linear/split.hpp | 6 +- .../geometry/extensions/index/rtree/rtree.hpp | 9 +-- .../extensions/index/rtree/visitors/find.hpp | 56 +++++++++++++++++-- tests/additional_sizes_and_times.cpp | 3 +- 5 files changed, 68 insertions(+), 20 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 4855ae8a6..dcd598152 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -10,11 +10,13 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP -#include +#include #include #include -#include + +// TODO: awulkiew - implement nearest filter +//#include namespace boost { namespace geometry { namespace index { @@ -27,13 +29,13 @@ template class spatial_filter< index::rtree > { public: - typedef typename std::vector::iterator iterator; - typedef typename std::vector::const_iterator const_iterator; + typedef typename std::deque::iterator iterator; + typedef typename std::deque::const_iterator const_iterator; template spatial_filter(index::rtree const& rtree, Geometry const& geom) { - m_result = rtree.find(geom); + rtree.find(geom, std::back_inserter(m_result)); } iterator begin() { return m_result.begin(); } @@ -42,7 +44,7 @@ public: const_iterator end() const { return m_result.end(); } private: - std::vector m_result; + std::deque m_result; }; } // namespace filters diff --git a/include/boost/geometry/extensions/index/rtree/linear/split.hpp b/include/boost/geometry/extensions/index/rtree/linear/split.hpp index 2df8f1921..c1b279105 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/split.hpp @@ -46,8 +46,8 @@ struct find_greatest_normalized_separation assert(2 <= elements_count); // find the lowest low, highest high - coordinate_type lowest_low = geometry::get(rtree::element_indexable(elements[0], tr)); - coordinate_type highest_high = geometry::get(rtree::element_indexable(elements[0], tr)); + coordinate_type lowest_low = index::get(rtree::element_indexable(elements[0], tr)); + coordinate_type highest_high = index::get(rtree::element_indexable(elements[0], tr)); // and the lowest high coordinate_type lowest_high = highest_high; size_t lowest_high_index = 0; @@ -71,7 +71,7 @@ struct find_greatest_normalized_separation // find the highest low size_t highest_low_index = lowest_high_index == 0 ? 1 : 0; - coordinate_type highest_low = geometry::get(rtree::element_indexable(elements[highest_low_index], tr)); + coordinate_type highest_low = index::get(rtree::element_indexable(elements[highest_low_index], tr)); for ( size_t i = highest_low_index ; i < elements_count ; ++i ) { coordinate_type min_coord = index::get(rtree::element_indexable(elements[i], tr)); diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 5f414a852..e39c258f2 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -70,12 +70,13 @@ public: boost::apply_visitor(del_v, *m_root); } - template - inline std::deque find(Geometry const& geom) const + // TODO: awulkiew - change name to query? + + template + inline void find(Geometry const& geom, OutIter out_it) const { - detail::rtree::visitors::find find_v(geom, m_translator); + detail::rtree::visitors::find find_v(m_translator, geom, out_it); boost::apply_visitor(find_v, *m_root); - return find_v.result; } void insert(value_type const& value) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 3ed40e0d8..d92b9126f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -14,24 +14,65 @@ #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { // rtree spatial query visitor -template +template struct find : public boost::static_visitor<> { + typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - inline find(Geometry const& g, Translator const& t) - : geom(g), tr(t) + inline find(Translator const& t, Geometry const& g, OutIter out_it) + : tr(t), geom(g), out_iter(out_it) {} inline void operator()(internal_node const& n) { + /*typedef typename internal_node::children_type children_type; + + std::deque nodes; + + for (typename children_type::const_iterator it = n.children.begin(); + it != n.children.end(); ++it) + { + if ( geometry::intersects(it->first, geom) ) + { + nodes.push_back(it->second); + } + } + + while ( !nodes.empty() ) + { + node *n = nodes.back(); + nodes.pop_back(); + + if ( !boost::apply_visitor(visitors::is_leaf(), *n) ) + { + internal_node &in = boost::get(*n); + + for (typename children_type::const_iterator it = in.children.begin(); + it != in.children.end(); ++it) + { + if ( geometry::intersects(it->first, geom) ) + { + nodes.push_back(it->second); + } + } + } + else + { + operator()(boost::get(*n)); + } + } + */ + typedef typename internal_node::children_type children_type; for (typename children_type::const_iterator it = n.children.begin(); @@ -50,13 +91,16 @@ struct find : public boost::static_visitor<> it != n.values.end(); ++it) { if ( geometry::intersects(tr(*it), geom) ) - result.push_back(*it); + { + out_iter = *it; + ++out_iter; + } } } - Geometry const& geom; Translator const& tr; - std::deque result; + Geometry const& geom; + OutIter out_iter; }; }}} // namespace detail::rtree::visitors diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 3ebec7099..a4cd11e42 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -95,7 +95,8 @@ int main() { float x = coords[i].first; float y = coords[i].second; - std::deque< std::pair > result = t.find(B(P(x - 10, y - 10), P(x + 10, y + 10))); + std::deque< std::pair > result; + t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; From 803ac7fbf9dfcbdba29f7f809b77d3d2388e2972 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 1 May 2011 01:11:45 +0000 Subject: [PATCH 013/366] operator| moved to namespace index [SVN r71642] --- .../index/filters/nearest_filter.hpp | 8 ++++-- .../index/filters/spacial_filter.hpp | 14 +++++++---- .../extensions/index/rtree/filters.hpp | 25 ++++++++++++++----- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp index ec6fcd9e0..adc871b7c 100644 --- a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp @@ -10,7 +10,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP -namespace boost { namespace geometry { namespace index { namespace filters { +namespace boost { namespace geometry { namespace index { + +namespace filters { template class nearest_filter @@ -64,7 +66,7 @@ detail::nearest_filtered nearest_filtered( return detail::nearest_filtered(p, distance); } -}}}} // namespace boost::geometry::index::filters +} // namespace filters template boost::geometry::index::filters::nearest_filter @@ -75,4 +77,6 @@ boost::geometry::index::filters::nearest_filter return boost::geometry::index::filters::nearest_filter(si, f.point(), f.distance()); } +}}} // namespace boost::geometry::index + #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP diff --git a/include/boost/geometry/extensions/index/filters/spacial_filter.hpp b/include/boost/geometry/extensions/index/filters/spacial_filter.hpp index 7e8b69a6c..7790471e0 100644 --- a/include/boost/geometry/extensions/index/filters/spacial_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/spacial_filter.hpp @@ -10,7 +10,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP -namespace boost { namespace geometry { namespace index { namespace filters { +namespace boost { namespace geometry { namespace index { + +namespace filters { template class spatial_filter @@ -49,15 +51,17 @@ detail::spatially_filtered spatially_filtered(Geometry const& geom) return detail::spatially_filtered(geom); } -}}}} // namespace boost::geometry::index::filters +} // namespace filters template -boost::geometry::index::filters::spatial_filter +index::filters::spatial_filter operator|( SpacialIndex const& si, - boost::geometry::index::filters::detail::spatially_filtered const& f) + index::filters::detail::spatially_filtered const& f) { - return boost::geometry::index::filters::spatial_filter(si, f.geometry()); + return index::filters::spatial_filter(si, f.geometry()); } +}}} // namespace boost::geometry::index + #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index dcd598152..1f3a610b4 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -31,17 +31,17 @@ class spatial_filter< index::rtree > public: typedef typename std::deque::iterator iterator; typedef typename std::deque::const_iterator const_iterator; - + template - spatial_filter(index::rtree const& rtree, Geometry const& geom) + inline spatial_filter(index::rtree const& rtree, Geometry const& geom) { rtree.find(geom, std::back_inserter(m_result)); } - iterator begin() { return m_result.begin(); } - iterator end() { return m_result.end(); } - const_iterator begin() const { return m_result.begin(); } - const_iterator end() const { return m_result.end(); } + inline iterator begin() { return m_result.begin(); } + inline iterator end() { return m_result.end(); } + inline const_iterator begin() const { return m_result.begin(); } + inline const_iterator end() const { return m_result.end(); } private: std::deque m_result; @@ -49,6 +49,19 @@ private: } // namespace filters +// TODO: awulkiew - filter may be implemented in operator| + +//template +//std::deque +//operator|( +// index::rtree const& si, +// index::filters::detail::spatially_filtered const& f) +//{ +// std::deque result; +// si.find(f.geometry(), std::back_inserter(result)); +// return result; +//} + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP From bff387c63168ff40a90945b8b8957d6fb6b6e39d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 1 May 2011 23:51:45 +0000 Subject: [PATCH 014/366] insert algorithm divided to tag dispatched parts [SVN r71658] --- .../index/rtree/linear/choose_next_node.hpp | 80 ------- .../extensions/index/rtree/linear/insert.hpp | 112 --------- .../extensions/index/rtree/linear/linear.hpp | 2 +- .../{split.hpp => redistribute_elements.hpp} | 91 ++------ .../geometry/extensions/index/rtree/rtree.hpp | 25 +- .../extensions/index/rtree/visitors/find.hpp | 73 +++++- .../index/rtree/visitors/insert.hpp | 219 +++++++++++++++++- tests/main.cpp | 3 +- tests/rtree_native.hpp | 15 +- 9 files changed, 318 insertions(+), 302 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/linear/insert.hpp rename include/boost/geometry/extensions/index/rtree/linear/{split.hpp => redistribute_elements.hpp} (83%) diff --git a/include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp deleted file mode 100644 index b4b27789d..000000000 --- a/include/boost/geometry/extensions/index/rtree/linear/choose_next_node.hpp +++ /dev/null @@ -1,80 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R-tree ChooseNextNode algorithm - per traverse level ChooseSubtree -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_LINEAR_LINEAR_CHOOSE_NEXT_NODE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_LINEAR_LINEAR_CHOOSE_NEXT_NODE_HPP - -#include - -#include - -#include -#include -#include - -#include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace linear { - -template -struct choose_next_node -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - typedef typename internal_node::children_type children_type; - - typedef typename index::default_area_result::type area_type; - - template - static inline size_t apply(internal_node & n, Indexable const& indexable) - { - assert(!n.children.empty()); - - size_t children_count = n.children.size(); - - // choose index with smallest area change or smallest area - size_t choosen_index = 0; - area_type smallest_area_diff = std::numeric_limits::max(); - area_type smallest_area = std::numeric_limits::max(); - - // caculate areas and areas of all nodes' boxes - for ( size_t i = 0 ; i < children_count ; ++i ) - { - typedef typename children_type::value_type child_type; - child_type const& ch_i = n.children[i]; - - Box box_exp(ch_i.first); - geometry::expand(box_exp, indexable); - - area_type area = index::area(box_exp); - area_type area_diff = area - index::area(ch_i.first); - - if ( area_diff < smallest_area_diff || - ( area_diff == smallest_area_diff && area < smallest_area ) ) - { - smallest_area_diff = area_diff; - smallest_area = area; - choosen_index = i; - } - } - - return choosen_index; - } -}; - -}}} // namespace detail::rtree:linear - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_LINEAR_LINEAR_CHOOSE_NEXT_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/insert.hpp b/include/boost/geometry/extensions/index/rtree/linear/insert.hpp deleted file mode 100644 index 4be05fa8c..000000000 --- a/include/boost/geometry/extensions/index/rtree/linear/insert.hpp +++ /dev/null @@ -1,112 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R-tree insert algorithm implementation -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_INSERT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_INSERT_HPP - -#include -#include -#include -#include - -#include -#include - -#include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace visitors { - -template -class insert : public boost::static_visitor<> -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - -public: - inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) - : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) - , m_root_node(root) - , m_parent(0), m_current_child_index(0), m_current_level(0) - { - // TODO - // assert - check if Box is correct - } - - inline void operator()(internal_node & n) - { - // choose next node - size_t choosen_node_index = linear::choose_next_node:: - apply(n, rtree::element_indexable(m_value, m_tr)); - - // expand the node to contain value - geometry::expand(n.children[choosen_node_index].first, m_tr(m_value)); - - // next traversing step - traverse_apply_visitor(n, choosen_node_index); - - // handle overflow - if ( m_max_elems_per_node < n.children.size() ) - linear::split:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - } - - inline void operator()(leaf & n) - { - // push value - n.values.push_back(m_value); - - // handle overflow - if ( m_max_elems_per_node < n.values.size() ) - linear::split:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - } - -private: - inline void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) - { - // save previous traverse inputs and set new ones - internal_node * parent_bckup = m_parent; - size_t current_child_index_bckup = m_current_child_index; - size_t current_level_bckup = m_current_level; - - m_parent = &n; - m_current_child_index = choosen_node_index; - ++m_current_level; - - // next traversing step - boost::apply_visitor(*this, *n.children[choosen_node_index].second); - - // restore previous traverse inputs - m_parent = parent_bckup; - m_current_child_index = current_child_index_bckup; - m_current_level = current_level_bckup; - } - - Value const& m_value; - Translator const& m_tr; - const size_t m_min_elems_per_node; - const size_t m_max_elems_per_node; - - node* & m_root_node; - - // traversing input parameters - internal_node *m_parent; - size_t m_current_child_index; - size_t m_current_level; -}; - -}}} // namespace detail::rtree::visitors - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp index d2d3f4074..7bb7879c4 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp @@ -16,6 +16,6 @@ struct linear_tag {}; }}} // namespace boost::geometry::index -#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/split.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp similarity index 83% rename from include/boost/geometry/extensions/index/rtree/linear/split.hpp rename to include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index c1b279105..de53a04f7 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R*-tree split algorithm implementation +// Boost.Index - R-tree linear split algorithm implementation // // Copyright 2008 Federico J. Fernandez. // Copyright 2011 Adam Wulkiewicz. @@ -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_LINEAR_SPLIT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_SPLIT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP #include @@ -24,7 +24,11 @@ namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace linear { +namespace detail { namespace rtree { namespace visitors { + +namespace detail { + +namespace linear { // from void find_normalized_separations(std::vector const& boxes, T& separation, unsigned int& first, unsigned int& second) const @@ -91,8 +95,6 @@ struct find_greatest_normalized_separation } }; -namespace dispatch { - template struct choose_axis_impl { @@ -115,8 +117,8 @@ struct choose_axis_impl size_t s1, s2; find_greatest_normalized_separation::apply(elements, tr, current_separation, s1, s2); - // TODO: operator test!, change <= to < later - if ( separation <= current_separation ) + // in the old implementation different operator was used: <= + if ( separation < current_separation ) { separation = current_separation; seed1 = s1; @@ -145,8 +147,6 @@ struct choose_axis_impl } }; -} // namespace dispatch - // from void linear_pick_seeds(node_pointer const& n, unsigned int &seed1, unsigned int &seed2) const template @@ -165,19 +165,21 @@ struct choose_axis { size_t axis = 0; coordinate_type separation = 0; - dispatch::choose_axis_impl::apply(elements, tr, axis, separation, seed1, seed2); + choose_axis_impl::apply(elements, tr, axis, separation, seed1, seed2); return axis; } }; +} // namespace linear + // from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const template -struct redistribute_elements +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; template static inline void apply(Node & n, @@ -203,7 +205,7 @@ struct redistribute_elements // calculate initial seeds size_t seed1 = 0; size_t seed2 = 0; - choose_axis::apply(elements_copy, tr, seed1, seed2); + linear::choose_axis::apply(elements_copy, tr, seed1, seed2); // prepare nodes' elements containers elements_type & elements1 = rtree::elements_get(n); @@ -314,61 +316,10 @@ struct redistribute_elements } }; -// split +} // namespace detail -template -class split -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - static const size_t dimension = index::traits::dimension::value; - -public: - template - static inline void apply( - Node & n, - internal_node *parent, - size_t current_child_index, - node *& root, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - node * second_node = rtree::create_node(Node()); - - // redistribute elements - Box box1, box2; - linear::redistribute_elements:: - apply(n, boost::get(*second_node), box1, box2, min_elems, max_elems, tr); - - // node is not the root - if ( parent != 0 ) - { - // update old node's box - parent->children[current_child_index].first = box1; - // add new node to the parent's children - parent->children.push_back(std::make_pair(box2, second_node)); - } - // node is the root - else - { - assert(&n == boost::get(root)); - - // create new root and add nodes - node * new_root = rtree::create_node(internal_node()); - - boost::get(*new_root).children.push_back(std::make_pair(box1, root)); - boost::get(*new_root).children.push_back(std::make_pair(box2, second_node)); - - root = new_root; - } - } -}; - -}}} // namespace detail::rtree:linear +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_SPLIT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index e39c258f2..d1e40ce7b 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -18,11 +18,8 @@ #include #include -#include #include - -//TEST -//#include +#include namespace boost { namespace geometry { namespace index { @@ -105,26 +102,6 @@ public: return m_values_count; } - //TEST - //inline void load(std::istream &is) - //{ - // std::string t; - // size_t n; - // is >> t; - // is >> n; - - // if ( t == "i" ) - // m_root = detail::rtree::create_node(internal_node()); - // else - // m_root = detail::rtree::create_node(leaf()); - - // detail::rtree::visitors::load - // load_v(is, m_translator); - - // for ( size_t i = 0 ; i < n ; ++i ) - // boost::apply_visitor(load_v, *m_root); - //} - private: size_t m_values_count; size_t m_max_elems_per_node; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index d92b9126f..400976e33 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -20,6 +20,74 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { +//template +//class array_semi_dynamic +//{ +//public: +// typedef typename Cont::value_type value_type; +// +// array_semi_dynamic() +// : arr_elements(0) +// {} +// +// void push_back(value_type const& v) +// { +// if ( arr_elements < N ) +// arr[arr_elements++] = v; +// else +// cont.push_back(v); +// } +// +// void pop_back() +// { +// if ( !cont.empty() ) +// cont.pop_back(); +// else +// { +// assert(0 < arr_elements); +// --arr_elements; +// } +// } +// +// value_type & back() +// { +// if ( !cont.empty() ) +// return cont.back(); +// else +// { +// assert(0 < arr_elements); +// return arr[arr_elements - 1]; +// } +// } +// +// value_type const& back() const +// { +// if ( !cont.empty() ) +// return cont.back(); +// else +// { +// assert(0 < arr_elements); +// return arr[arr_elements - 1]; +// } +// } +// +// bool empty() const +// { +// assert(cont.empty()); +// return 0 == arr_elements; +// } +// +// size_t size() const +// { +// return arr_elements + cont.size(); +// } +// +//private: +// boost::array arr; +// size_t arr_elements; +// Cont cont; +//}; + // rtree spatial query visitor template @@ -37,7 +105,7 @@ struct find : public boost::static_visitor<> { /*typedef typename internal_node::children_type children_type; - std::deque nodes; + array_semi_dynamic<512, std::deque > nodes; for (typename children_type::const_iterator it = n.children.begin(); it != n.children.end(); ++it) @@ -70,8 +138,7 @@ struct find : public boost::static_visitor<> { operator()(boost::get(*n)); } - } - */ + }*/ typedef typename internal_node::children_type children_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index f4fe164ab..9362f2a1b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R-tree details +// Boost.Index - R-tree insert details // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, @@ -16,10 +16,221 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct insert +namespace detail { + +// Default choose_next_node +template +struct choose_next_node { - // not implemented here + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename internal_node::children_type children_type; + + typedef typename index::default_area_result::type area_type; + + template + static inline size_t apply(internal_node & n, Indexable const& indexable) + { + assert(!n.children.empty()); + + size_t children_count = n.children.size(); + + // choose index with smallest area change or smallest area + size_t choosen_index = 0; + area_type smallest_area_diff = std::numeric_limits::max(); + area_type smallest_area = std::numeric_limits::max(); + + // caculate areas and areas of all nodes' boxes + for ( size_t i = 0 ; i < children_count ; ++i ) + { + typedef typename children_type::value_type child_type; + child_type const& ch_i = n.children[i]; + + Box box_exp(ch_i.first); + geometry::expand(box_exp, indexable); + + area_type area = index::area(box_exp); + area_type area_diff = area - index::area(ch_i.first); + + if ( area_diff < smallest_area_diff || + ( area_diff == smallest_area_diff && area < smallest_area ) ) + { + smallest_area_diff = area_diff; + smallest_area = area; + choosen_index = i; + } + } + + return choosen_index; + } +}; + +// Not implemented here +template +struct redistribute_elements; + +// Default split algorithm +template +class split +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + static const size_t dimension = index::traits::dimension::value; + +public: + template + static inline void apply( + Node & n, + internal_node *parent, + size_t current_child_index, + node *& root, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + node * second_node = rtree::create_node(Node()); + + // redistribute elements + Box box1, box2; + redistribute_elements:: + apply(n, boost::get(*second_node), box1, box2, min_elems, max_elems, tr); + + // node is not the root + if ( parent != 0 ) + { + // update old node's box + parent->children[current_child_index].first = box1; + // add new node to the parent's children + parent->children.push_back(std::make_pair(box2, second_node)); + } + // node is the root + else + { + assert(&n == boost::get(root)); + + // create new root and add nodes + node * new_root = rtree::create_node(internal_node()); + + boost::get(*new_root).children.push_back(std::make_pair(box1, root)); + boost::get(*new_root).children.push_back(std::make_pair(box2, second_node)); + + root = new_root; + } + } +}; + +// Default overflow treatment algorithm +template +struct overflow_treatment +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + +public: + template + static inline void apply( + Node & n, + internal_node *parent, + size_t current_child_index, + node *& root, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + split::apply(n, parent, current_child_index, root, min_elems, max_elems, tr); + } +}; + +} // namespace detail + +// Default insert algorithm +template +class insert : public boost::static_visitor<> +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + +public: + inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) + : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) + , m_root_node(root) + , m_parent(0), m_current_child_index(0), m_current_level(0) + { + // TODO + // assert - check if Box is correct + } + + inline void operator()(internal_node & n) + { + // choose next node + size_t choosen_node_index = detail::choose_next_node:: + apply(n, rtree::element_indexable(m_value, m_tr)); + + // expand the node to contain value + geometry::expand(n.children[choosen_node_index].first, m_tr(m_value)); + + // next traversing step + traverse_apply_visitor(n, choosen_node_index); + + // handle overflow + if ( m_max_elems_per_node < n.children.size() ) + { + detail::overflow_treatment:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); + } + } + + inline void operator()(leaf & n) + { + // push value + n.values.push_back(m_value); + + // handle overflow + if ( m_max_elems_per_node < n.values.size() ) + { + detail::overflow_treatment:: + apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); + } + } + +private: + inline void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) + { + // save previous traverse inputs and set new ones + internal_node * parent_bckup = m_parent; + size_t current_child_index_bckup = m_current_child_index; + size_t current_level_bckup = m_current_level; + + m_parent = &n; + m_current_child_index = choosen_node_index; + ++m_current_level; + + // next traversing step + boost::apply_visitor(*this, *n.children[choosen_node_index].second); + + // restore previous traverse inputs + m_parent = parent_bckup; + m_current_child_index = current_child_index_bckup; + m_current_level = current_level_bckup; + } + + Value const& m_value; + Translator const& m_tr; + const size_t m_min_elems_per_node; + const size_t m_max_elems_per_node; + + node* & m_root_node; + + // traversing input parameters + internal_node *m_parent; + size_t m_current_child_index; + size_t m_current_level; }; }}} // namespace detail::rtree::visitors diff --git a/tests/main.cpp b/tests/main.cpp index fce78a685..4a7e696dd 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -5,7 +5,8 @@ int main() { tests_translators_hpp(); - tests_rtree_native_hpp(); + tests_rtree_native_hpp(); + tests_rtree_native_hpp(); tests_rtree_filters_hpp(); /*namespace g = boost::geometry; diff --git a/tests/rtree_native.hpp b/tests/rtree_native.hpp index c05dd7566..62e322e94 100644 --- a/tests/rtree_native.hpp +++ b/tests/rtree_native.hpp @@ -13,6 +13,7 @@ #include +template void tests_rtree_native_hpp() { std::cout << "tests/rtree_native.hpp\n"; @@ -22,7 +23,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, B(P(0, 0, 0), P(1, 1, 1))); boost::geometry::index::insert(t, B(P(2, 2, 2), P(3, 3, 3))); boost::geometry::index::insert(t, B(P(4, 4, 4), P(5, 5, 5))); @@ -39,7 +40,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); @@ -56,7 +57,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree

t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, P(0, 0)); boost::geometry::index::insert(t, P(2, 2)); boost::geometry::index::insert(t, P(4, 4)); @@ -74,7 +75,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::box

B; typedef std::pair V; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, V(B(P(0, 0), P(1, 1)), 0)); boost::geometry::index::insert(t, V(B(P(2, 2), P(3, 3)), 1)); boost::geometry::index::insert(t, V(B(P(4, 4), P(5, 5)), 2)); @@ -99,7 +100,7 @@ void tests_rtree_native_hpp() V v4( new std::pair(B(P(6, 6), P(7, 7)), 3) ); V v5( new std::pair(B(P(8, 8), P(9, 9)), 4) ); - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, v1); boost::geometry::index::insert(t, v2); boost::geometry::index::insert(t, v3); @@ -125,7 +126,7 @@ void tests_rtree_native_hpp() m.insert(std::pair(3, B(P(6, 6), P(7, 7)))); m.insert(std::pair(4, B(P(8, 8), P(9, 9)))); - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); V vit = m.begin(); boost::geometry::index::insert(t, vit++); boost::geometry::index::insert(t, vit++); @@ -153,7 +154,7 @@ void tests_rtree_native_hpp() v.push_back(B(P(6, 6), P(7, 7))); v.push_back(B(P(8, 8), P(9, 9))); - boost::geometry::index::rtree t(4, 2, T(v)); + boost::geometry::index::rtree t(4, 2, T(v)); boost::geometry::index::insert(t, 0u); boost::geometry::index::insert(t, 1u); From d121f4e9e9452c4f48ecabd0eb5e22d7d1e48ea9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 2 May 2011 12:14:44 +0000 Subject: [PATCH 015/366] searching time tests related code added [SVN r71664] --- .../geometry/extensions/index/rtree/node.hpp | 3 +- .../geometry/extensions/index/rtree/rtree.hpp | 4 +- .../extensions/index/rtree/visitors/find.hpp | 177 ++++++++++++------ tests/additional_sizes_and_times.cpp | 20 +- 4 files changed, 131 insertions(+), 73 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node.hpp b/include/boost/geometry/extensions/index/rtree/node.hpp index aee3567a4..95cafd568 100644 --- a/include/boost/geometry/extensions/index/rtree/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node.hpp @@ -1,8 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R-tree details +// Boost.Index - R-tree default nodes // -// Copyright 2008 Federico J. Fernandez. // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d1e40ce7b..77428920f 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -72,7 +72,9 @@ public: template inline void find(Geometry const& geom, OutIter out_it) const { - detail::rtree::visitors::find find_v(m_translator, geom, out_it); + detail::rtree::visitors::find + find_v(m_translator, geom, out_it); + boost::apply_visitor(find_v, *m_root); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 400976e33..5cdc65e12 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -20,17 +20,88 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { +//template +//class array +//{ +//public: +// inline array() +// : arr_elements(0) +// {} +// +// inline void push(T const& v) +// { +// arr[arr_elements++] = v; +// } +// +// inline T pop() +// { +// assert(0 < arr_elements); +// return arr[--arr_elements]; +// } +// +// inline bool empty() const +// { +// return 0 == arr_elements; +// } +// +// inline size_t size() const +// { +// return arr_elements; +// } +// +//private: +// boost::array arr; +// size_t arr_elements; +//}; +// +//template +//class dynamic +//{ +//public: +// typedef typename Cont::value_type value_type; +// +// inline void push(value_type const& v) +// { +// cont.push_back(v); +// } +// +// inline value_type pop() +// { +// value_type v = cont.back(); +// cont.pop_back(); +// return v; +// } +// +// inline bool empty() const +// { +// return cont.empty(); +// } +// +// inline size_t size() const +// { +// return cont.size(); +// } +// +// inline void clear() +// { +// cont.clear(); +// } +// +//private: +// Cont cont; +//}; +// //template //class array_semi_dynamic //{ //public: // typedef typename Cont::value_type value_type; // -// array_semi_dynamic() +// inline array_semi_dynamic() // : arr_elements(0) // {} // -// void push_back(value_type const& v) +// inline void push(value_type const& v) // { // if ( arr_elements < N ) // arr[arr_elements++] = v; @@ -38,46 +109,27 @@ namespace detail { namespace rtree { namespace visitors { // cont.push_back(v); // } // -// void pop_back() +// inline value_type pop() // { // if ( !cont.empty() ) +// { +// value_type v = cont.back(); // cont.pop_back(); +// return v; +// } // else // { // assert(0 < arr_elements); -// --arr_elements; +// return arr[--arr_elements]; // } // } // -// value_type & back() +// inline bool empty() const // { -// if ( !cont.empty() ) -// return cont.back(); -// else -// { -// assert(0 < arr_elements); -// return arr[arr_elements - 1]; -// } +// return cont.empty() && 0 == arr_elements; // } // -// value_type const& back() const -// { -// if ( !cont.empty() ) -// return cont.back(); -// else -// { -// assert(0 < arr_elements); -// return arr[arr_elements - 1]; -// } -// } -// -// bool empty() const -// { -// assert(cont.empty()); -// return 0 == arr_elements; -// } -// -// size_t size() const +// inline size_t size() const // { // return arr_elements + cont.size(); // } @@ -103,42 +155,43 @@ struct find : public boost::static_visitor<> inline void operator()(internal_node const& n) { - /*typedef typename internal_node::children_type children_type; + //typedef typename internal_node::children_type children_type; - array_semi_dynamic<512, std::deque > nodes; - - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) - { - if ( geometry::intersects(it->first, geom) ) - { - nodes.push_back(it->second); - } - } + //array_semi_dynamic<1024, std::deque > nodes; + ////array<1024, node*> nodes; + ////dynamic< std::deque > nodes; + // + //for (typename children_type::const_iterator it = n.children.begin(); + // it != n.children.end(); ++it) + //{ + // if ( geometry::intersects(it->first, geom) ) + // { + // nodes.push(it->second); + // } + //} - while ( !nodes.empty() ) - { - node *n = nodes.back(); - nodes.pop_back(); + //while ( !nodes.empty() ) + //{ + // node *n = nodes.pop(); - if ( !boost::apply_visitor(visitors::is_leaf(), *n) ) - { - internal_node &in = boost::get(*n); + // if ( !boost::apply_visitor(visitors::is_leaf(), *n) ) + // { + // internal_node &in = boost::get(*n); - for (typename children_type::const_iterator it = in.children.begin(); - it != in.children.end(); ++it) - { - if ( geometry::intersects(it->first, geom) ) - { - nodes.push_back(it->second); - } - } - } - else - { - operator()(boost::get(*n)); - } - }*/ + // for (typename children_type::const_iterator it = in.children.begin(); + // it != in.children.end(); ++it) + // { + // if ( geometry::intersects(it->first, geom) ) + // { + // nodes.push(it->second); + // } + // } + // } + // else + // { + // operator()(boost::get(*n)); + // } + //} typedef typename internal_node::children_type children_type; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index a4cd11e42..3398d8d71 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -12,8 +12,12 @@ int main() { boost::timer tim; - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; + namespace bg = boost::geometry; + namespace bgi = bg::index; + + typedef bg::model::point P; + typedef bg::model::box

B; + typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; std::ifstream file_cfg("config.txt"); size_t max_elems = 4; @@ -41,7 +45,7 @@ int main() std::cout << "inserting time test...\n"; tim.restart(); - boost::geometry::index::rtree< std::pair > t(max_elems, min_elems); + RT t(max_elems, min_elems); for (size_t i = 0 ; i < values_count ; ++i ) { float x = coords[i].first; @@ -78,11 +82,11 @@ int main() std::cout << "saving...\n"; std::ofstream file("save_new.txt", std::ofstream::trunc); file << std::fixed; - boost::geometry::index::detail::rtree::visitors::save< - boost::geometry::index::rtree< std::pair >::value_type, - boost::geometry::index::rtree< std::pair >::translator_type, - boost::geometry::index::rtree< std::pair >::box_type, - boost::geometry::index::rtree< std::pair >::tag_type + bgi::detail::rtree::visitors::save< + RT::value_type, + RT::translator_type, + RT::box_type, + RT::tag_type > saving_v(file, t.get_translator()); t.apply_visitor(saving_v); std::cout << "saved...\n"; From 919c6286b8cfeb4a028dff27c0f0720fdede9363 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 May 2011 21:33:15 +0000 Subject: [PATCH 016/366] remove algorithm added + some other changes [SVN r71726] --- .../extensions/index/algorithms/area.hpp | 42 ++- .../rtree/linear/redistribute_elements.hpp | 112 +++--- .../index/rtree/quadratic/quadratic.hpp | 21 ++ .../rtree/quadratic/redistribute_elements.hpp | 87 +++++ .../index/rtree/rstar/choose_next_node.hpp | 10 +- .../extensions/index/rtree/rstar/insert.hpp | 258 +++++++++++-- .../index/rtree/rstar/insert_impl.hpp | 338 ------------------ .../extensions/index/rtree/rstar/rstar.hpp | 2 + .../geometry/extensions/index/rtree/rtree.hpp | 47 ++- .../index/rtree/visitors/insert.hpp | 183 ++++++++-- .../index/rtree/visitors/remove.hpp | 191 +++++++++- .../extensions/index/translator/def.hpp | 16 +- .../extensions/index/translator/helpers.hpp | 104 +++--- .../extensions/index/translator/index.hpp | 6 +- tests/additional_glut_vis.cpp | 27 +- tests/additional_sizes_and_times.cpp | 122 +++++-- tests/main.cpp | 37 +- 17 files changed, 1013 insertions(+), 590 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/area.hpp b/include/boost/geometry/extensions/index/algorithms/area.hpp index dbfe23376..8d49a4e0e 100644 --- a/include/boost/geometry/extensions/index/algorithms/area.hpp +++ b/include/boost/geometry/extensions/index/algorithms/area.hpp @@ -12,11 +12,11 @@ namespace boost { namespace geometry { namespace index { -template +template struct default_area_result { typedef typename select_most_precise< - typename coordinate_type::type, + typename traits::coordinate_type::type, long double >::type type; }; @@ -32,7 +32,7 @@ struct area_for_each_dimension static inline typename default_area_result::type apply(Box const& b) { return area_for_each_dimension::apply(b) * - ( geometry::get(b) - geometry::get(b) ); + ( index::get(b) - index::get(b) ); } }; @@ -41,16 +41,44 @@ struct area_for_each_dimension { static inline typename default_area_result::type apply(Box const& b) { - return geometry::get(b) - geometry::get(b); + return index::get(b) - index::get(b); } }; } // namespace detail -template -typename default_area_result::type area(Box const& b) +namespace dispatch { + +template +struct area { - return detail::area_for_each_dimension::value>::apply(b); + // TODO: awulkiew - static assert? +}; + +template +struct area +{ + static typename default_area_result::type apply(Indexable const&) + { + return 0; + } +}; + +template +struct area +{ + static typename default_area_result::type apply(Indexable const& b) + { + return detail::area_for_each_dimension::value>::apply(b); + } +}; + +} // namespace dispatch + +template +typename default_area_result::type area(Indexable const& b) +{ + return dispatch::area::type>::apply(b); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index de53a04f7..def7bb102 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -30,6 +30,10 @@ namespace detail { namespace linear { +// TODO: awulkiew - there are loops inside find_greatest_normalized_separation::apply() +// iteration is done for each DimensionIndex. +// Separations and seeds for all DimensionIndex(es) could be calculated at once, stored, then the greatest would be choosen. + // from void find_normalized_separations(std::vector const& boxes, T& separation, unsigned int& first, unsigned int& second) const template @@ -96,7 +100,7 @@ struct find_greatest_normalized_separation }; template -struct choose_axis_impl +struct pick_seeds_impl { BOOST_STATIC_ASSERT(0 < DimensionIndex); @@ -106,30 +110,28 @@ struct choose_axis_impl static inline void apply(Elements const& elements, Translator const& tr, - size_t & axis, coordinate_type & separation, size_t & seed1, size_t & seed2) { - choose_axis_impl::apply(elements, tr, axis, separation, seed1, seed2); + pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); coordinate_type current_separation; size_t s1, s2; find_greatest_normalized_separation::apply(elements, tr, current_separation, s1, s2); - // in the old implementation different operator was used: <= + // in the old implementation different operator was used: <= (y axis prefered) if ( separation < current_separation ) { separation = current_separation; seed1 = s1; seed2 = s2; - axis = DimensionIndex - 1; } } }; template -struct choose_axis_impl +struct pick_seeds_impl { typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; @@ -137,36 +139,32 @@ struct choose_axis_impl static inline void apply(Elements const& elements, Translator const& tr, - size_t & axis, coordinate_type & separation, size_t & seed1, size_t & seed2) { find_greatest_normalized_separation::apply(elements, tr, separation, seed1, seed2); - axis = 0; } }; // from void linear_pick_seeds(node_pointer const& n, unsigned int &seed1, unsigned int &seed2) const template -struct choose_axis +struct pick_seeds { typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; - + static const size_t dimension = index::traits::dimension::value; - static inline size_t apply(Elements const& elements, - Translator const& tr, - size_t & seed1, - size_t & seed2) + static inline void apply(Elements const& elements, + Translator const& tr, + size_t & seed1, + size_t & seed2) { - size_t axis = 0; coordinate_type separation = 0; - choose_axis_impl::apply(elements, tr, axis, separation, seed1, seed2); - return axis; + pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); } }; @@ -205,7 +203,7 @@ struct redistribute_elements // calculate initial seeds size_t seed1 = 0; size_t seed2 = 0; - linear::choose_axis::apply(elements_copy, tr, seed1, seed2); + linear::pick_seeds::apply(elements_copy, tr, seed1, seed2); // prepare nodes' elements containers elements_type & elements1 = rtree::elements_get(n); @@ -236,59 +234,45 @@ struct redistribute_elements element_type const& elem = elements_copy[i]; indexable_type const& indexable = rtree::element_indexable(elem, tr); - // TODO: awulkiew - is this needed? + // if there is small number of elements left and the number of elements in node is lesser than min_elems + // just insert them to this node if ( elements1.size() + remaining == min_elems ) { elements1.push_back(elem); geometry::expand(box1, indexable); area1 = index::area(box1); - continue; } - if ( elements2.size() + remaining == min_elems ) + else if ( elements2.size() + remaining == min_elems ) { elements2.push_back(elem); geometry::expand(box2, indexable); area2 = index::area(box2); - continue; - } - - assert(0 < remaining); - remaining--; - - // calculate enlarged boxes and areas - Box enlarged_box1(box1); - Box enlarged_box2(box2); - geometry::expand(enlarged_box1, indexable); - geometry::expand(enlarged_box2, indexable); - area_type enlarged_area1 = index::area(enlarged_box1); - area_type enlarged_area2 = index::area(enlarged_box2); - - area_type areas_diff1 = enlarged_area1 - area1; - area_type areas_diff2 = enlarged_area2 - area2; - - // choose group which box area have to be enlarged least - if ( areas_diff1 < areas_diff2 ) - { - elements1.push_back(elem); - box1 = enlarged_box1; - area1 = enlarged_area1; - } - else if ( areas_diff2 < areas_diff1 ) - { - elements2.push_back(elem); - box2 = enlarged_box2; - area2 = enlarged_area2; } + // choose better node and insert element else { - // choose group which box has smaller area - if ( area1 < area2 ) + assert(0 < remaining); + remaining--; + + // calculate enlarged boxes and areas + Box enlarged_box1(box1); + Box enlarged_box2(box2); + geometry::expand(enlarged_box1, indexable); + geometry::expand(enlarged_box2, indexable); + area_type enlarged_area1 = index::area(enlarged_box1); + area_type enlarged_area2 = index::area(enlarged_box2); + + area_type areas_diff1 = enlarged_area1 - area1; + area_type areas_diff2 = enlarged_area2 - area2; + + // choose group which box area have to be enlarged least + if ( areas_diff1 < areas_diff2 ) { elements1.push_back(elem); box1 = enlarged_box1; area1 = enlarged_area1; } - else if ( area2 < area1 ) + else if ( areas_diff2 < areas_diff1 ) { elements2.push_back(elem); box2 = enlarged_box2; @@ -296,19 +280,35 @@ struct redistribute_elements } else { - // choose group with fewer elements - if ( elements1.size() <= elements2.size() ) + // choose group which box has smaller area + if ( area1 < area2 ) { elements1.push_back(elem); box1 = enlarged_box1; area1 = enlarged_area1; } - else + else if ( area2 < area1 ) { elements2.push_back(elem); box2 = enlarged_box2; area2 = enlarged_area2; } + else + { + // choose group with fewer elements + if ( elements1.size() <= elements2.size() ) + { + elements1.push_back(elem); + box1 = enlarged_box1; + area1 = enlarged_area1; + } + else + { + elements2.push_back(elem); + box2 = enlarged_box2; + area2 = enlarged_area2; + } + } } } } diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp new file mode 100644 index 000000000..fed52522e --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp @@ -0,0 +1,21 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP + +namespace boost { namespace geometry { namespace index { + +struct quadratic_tag {}; + +}}} // namespace boost::geometry::index + +#include + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp new file mode 100644 index 000000000..4babab5d1 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -0,0 +1,87 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree quadratic split algorithm implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP + +#include + +#include + +#include +#include + +#include +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +namespace detail { + +namespace quadratic { + +template +struct pick_seeds +{ + typedef typename Elements::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + typedef Box box_type; + typedef typename index::default_area_result::type area_type; + + static inline void apply(Elements const& elements, + Translator const& tr, + size_t & seed1, + size_t & seed2) + { + size_t elements_count = elements.size(); + + assert(2 <= elements_count); + + seed1 = 0; + seed2 = 1; + area_type greatest_free_area = 0; + for ( size_t i = 0 ; i < elements_count ; ++i ) + { + for ( size_t j = i + 1 ; j < elements_count ; ++j ) + { + indexable_type & ind1 = rtree::element_indexable(elements[i], tr); + indexable_type & ind2 = rtree::element_indexable(elements[j], tr); + + box_type enlarged_box; + geometry::convert(ind1); + geometry::expand(enlarged_box, ind2); + + area_type free_area = index::area(enlarged_box) - index::area(ind1) - index::area(ind2); + + if ( greatest_free_area < free_area ) + { + greatest_free_area = free_area; + seed1 = i; + seed2 = j; + } + } + } + } +}; + +} // namespace quadratic + +// TODO: awulkiew - redistribute + +} // namespace detail + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 785b7f24f..eb1302ca4 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -23,10 +23,12 @@ namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace rstar { +namespace detail { namespace rtree { namespace visitors { + +namespace detail { template -class choose_next_node +class choose_next_node { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -235,7 +237,9 @@ private: //}; }; -}}} // namespace detail::rtree:rstar +} // namespace detail + +}}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index dfd204540..451054c04 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -10,6 +10,12 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP +#include + +#include +#include +#include + #include #include #include @@ -19,44 +25,234 @@ #include #include -#include +#include +#include + +//TEST +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -class insert : public boost::static_visitor<> -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; +namespace detail { -public: - inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) - : m_root(root) - , m_impl(root, v, min_elements, max_elements, t) - { - // TODO - // assert - check if Box is correct - } +//template +//class insert : public boost::static_visitor<> +//{ +//protected: +// typedef typename rtree::node::type node; +// typedef typename rtree::internal_node::type internal_node; +// typedef typename rtree::leaf::type leaf; +// +// inline insert(node* & root, +// Element const& el, +// size_t min_elements, +// size_t max_elements, +// Translator const& tr, +// size_t level = std::numeric_limits::max() +// ) +// : m_element(el) +// , m_tr(tr) +// , m_min_elems_per_node(min_elements) +// , m_max_elems_per_node(max_elements) +// , m_reinserted_elements_count(size_t(max_elements * 0.3f)) +// , m_level(level) +// , m_root_node(root) +// , m_parent(0), m_current_child_index(0), m_current_level(0) +// {} +// +// template +// inline void traverse(Derived & d, internal_node & n) +// { +// // choose next node, where value insert traversing should go +// size_t choosen_node_index = rstar::choose_next_node:: +// apply(n, rtree::element_indexable(m_element, m_tr)); +// +// //TEST +// /*{ +// std::ofstream log("log.txt", std::ofstream::trunc); +// log << std::fixed << "internal node " << m_current_level << " " << m_level << '\n'; +// boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, rtree::element_indexable(m_element, m_tr)); +// log << '\n' << "choosen node: " << choosen_node_index << "\n"; +// log << "before: "; +// boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); +// log << "\n"; +// }*/ +// +// // expand the node to contain value +// geometry::expand( +// n.children[choosen_node_index].first, +// rtree::element_indexable(m_element, m_tr)); +// +// //TEST +// /*{ +// std::ofstream log("log.txt", std::ofstream::app); +// log << std::fixed << choosen_node_index << "after: "; +// boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); +// log << '\n'; +// boost::geometry::index::detail::rtree::visitors::print print_v(log, m_tr); +// boost::apply_visitor(print_v, *m_root_node); +// }*/ +// +// // apply traversing visitor +// traverse_apply_visitor(d, n, choosen_node_index); +// } +// +// template +// inline void post_traverse_handle_oveflow(Node &n) +// { +// // handle overflow +// if ( m_max_elems_per_node < rtree::elements_get(n).size() ) +// { +// detail::overflow_treatment:: +// apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); +// } +// } +// +// template +// inline void traverse_apply_visitor(Derived & d, internal_node &n, size_t choosen_node_index) +// { +// // save previous traverse inputs and set new ones +// internal_node * parent_bckup = m_parent; +// size_t current_child_index_bckup = m_current_child_index; +// size_t current_level_bckup = m_current_level; +// +// m_parent = &n; +// m_current_child_index = choosen_node_index; +// ++m_current_level; +// +// // next traversing step +// boost::apply_visitor(d, *n.children[choosen_node_index].second); +// +// // restore previous traverse inputs +// m_parent = parent_bckup; +// m_current_child_index = current_child_index_bckup; +// m_current_level = current_level_bckup; +// } +// +// // before calling overflow_treatment all nodes have aabbs expanded +// // and the number of elements in the current node is max + 1 +// template +// inline void overflow_treatment(Node & n) +// { +// // TODO: awulkiew - replace this condition with tag dispatched template +// +// // first time insert +// /*if ( m_parent != 0 && +// m_level == std::numeric_limits::max() && +// 0 < m_reinserted_elements_count ) +// { +// reinsert(n); +// } +// // second time insert +// else +// {*/ +// rstar::split:: +// apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); +// //} +// } +// +// template +// static inline bool distances_asc( +// std::pair const& d1, +// std::pair const& d2) +// { +// return d1.first < d2.first; +// } +// +// template +// static inline bool distances_dsc( +// std::pair const& d1, +// std::pair const& d2) +// { +// return d1.first > d2.first; +// } +// +// template +// inline void reinsert(Node & n) +// { +// typedef typename index::detail::rtree::elements_type::type elements_type; +// typedef typename index::detail::rtree::element_type::type element_type; +// typedef typename geometry::point_type::type point_type; +// // TODO: awulkiew - use distance_result +// typedef typename index::traits::coordinate_type::type distance_type; +// +// assert(m_parent != 0); +// assert(0 < m_reinserted_elements_count); +// +// point_type node_center; +// geometry::centroid(m_parent->children[m_current_child_index].first, node_center); +// +// elements_type & elements = index::detail::rtree::elements_get(n); +// +// size_t elements_count = elements.size(); +// std::vector< std::pair > distances(elements_count); +// for ( size_t i = 0 ; i < elements_count ; ++i ) +// { +// // TODO: awulkiew - use distance_sqr +// // (use select_calculation_type if distance_sqr must be implemented in geometry::index) +// // change point type for this geometry +// point_type element_center; +// geometry::centroid( index::detail::rtree::element_indexable( +// elements[i], +// m_tr +// ), element_center); +// +// distances[i].first = geometry::distance(node_center, element_center); +// distances[i].second = elements[i]; +// } +// +// // sort elements by distances from center +// std::partial_sort( +// distances.begin(), +// distances.begin() + m_reinserted_elements_count, +// distances.end(), +// distances_dsc); +// +// // copy elements which will be reinserted +// elements_type elements_to_reinsert(m_reinserted_elements_count); +// for ( size_t i = 0 ; i < m_reinserted_elements_count ; ++i ) +// elements_to_reinsert[i] = distances[i].second; +// +// // copy elements to the current node +// elements.resize(elements_count - m_reinserted_elements_count); +// for ( size_t i = m_reinserted_elements_count ; i < elements_count ; ++i ) +// elements[i - m_reinserted_elements_count] = distances[i].second; +// +// // calulate node's new box +// m_parent->children[m_current_child_index].first = +// elements_box(elements.begin(), elements.end(), m_tr); +// +// // reinsert children starting from the minimum distance +// for ( size_t i = m_reinserted_elements_count ; 0 < i ; --i ) +// { +// insert_impl insert_v( +// m_root_node, elements_to_reinsert[i - 1], +// m_min_elems_per_node, m_max_elems_per_node, +// m_tr, m_current_level); +// boost::apply_visitor(insert_v, *m_root_node); +// } +// } +// +// Element const& m_element; +// Translator const& m_tr; +// const size_t m_min_elems_per_node; +// const size_t m_max_elems_per_node; +// const size_t m_reinserted_elements_count; +// +// const size_t m_level; +// +// node* & m_root_node; +// +// // traversing input parameters +// internal_node *m_parent; +// size_t m_current_child_index; +// size_t m_current_level; +//}; - inline void operator()(internal_node & n) - { - assert(&n == &boost::get(*m_root)); - boost::apply_visitor(m_impl, *m_root); - } - - inline void operator()(leaf & n) - { - assert(&n == &boost::get(*m_root)); - boost::apply_visitor(m_impl, *m_root); - } - -private: - node* & m_root; - index::detail::rtree::rstar::insert_impl m_impl; -}; +} // namespace detail }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp deleted file mode 100644 index 90e163d34..000000000 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert_impl.hpp +++ /dev/null @@ -1,338 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R*-tree reinsert algorithm implementation -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_IMPL_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_IMPL_HPP - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -//TEST -#include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace rstar { - -template -class insert_base; - -template -class insert_impl : public insert_base -{ - typedef insert_base base; - typedef typename base::node node; - typedef typename base::internal_node internal_node; - typedef typename base::leaf leaf; - -public: - inline insert_impl( - node* & root, - Element const& el, - size_t min_elements, - size_t max_elements, - Translator const& t, - size_t level = std::numeric_limits::max() - ) - : base(root, el, min_elements, max_elements, t, level) - {} - - inline void operator()(internal_node & n) - { - if ( base::m_current_level < base::m_level ) - { - // next traversing step - base::traverse(*this, n); - } - else - { - assert( base::m_level == base::m_current_level ); - - // push new child node - n.children.push_back(base::m_element); - } - - if ( base::m_max_elems_per_node < n.children.size() ) - base::overflow_treatment(n); - } - - inline void operator()(leaf & n) - { - assert(false); - } -}; - -template -class insert_impl : public insert_base -{ - typedef insert_base base; - typedef typename base::node node; - typedef typename base::internal_node internal_node; - typedef typename base::leaf leaf; - -public: - inline insert_impl( - node* & root, - Value const& v, - size_t min_elements, - size_t max_elements, - Translator const& t, - size_t level = std::numeric_limits::max() - ) - : base(root, v, min_elements, max_elements, t, level) - {} - - inline void operator()(internal_node & n) - { - assert(base::m_current_level < base::m_level); - - // next traversing step - base::traverse(*this, n); - - if ( base::m_max_elems_per_node < n.children.size() ) - base::overflow_treatment(n); - } - - inline void operator()(leaf & n) - { - assert( base::m_level == base::m_current_level || - base::m_level == std::numeric_limits::max() ); - - n.values.push_back(base::m_element); - - if ( base::m_max_elems_per_node < n.values.size() ) - base::overflow_treatment(n); - } -}; - -template -class insert_base : public boost::static_visitor<> -{ -protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - inline insert_base( - node* & root, - Element const& el, - size_t min_elements, - size_t max_elements, - Translator const& t, - size_t level = std::numeric_limits::max() - ) - : m_element(el) - , m_tr(t) - , m_min_elems_per_node(min_elements) - , m_max_elems_per_node(max_elements) - , m_reinserted_elements_count(size_t(max_elements * 0.3f)) - , m_level(level) - , m_root_node(root) - , m_parent(0), m_current_child_index(0), m_current_level(0) - {} - - template - inline void traverse(Derived & d, internal_node & n) - { - // choose next node, where value insert traversing should go - size_t choosen_node_index = rstar::choose_next_node:: - apply(n, rtree::element_indexable(m_element, m_tr)); - - //TEST - /*{ - std::ofstream log("log.txt", std::ofstream::trunc); - log << std::fixed << "internal node " << m_current_level << " " << m_level << '\n'; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, rtree::element_indexable(m_element, m_tr)); - log << '\n' << "choosen node: " << choosen_node_index << "\n"; - log << "before: "; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); - log << "\n"; - }*/ - - // expand the node to contain value - geometry::expand( - n.children[choosen_node_index].first, - rtree::element_indexable(m_element, m_tr)); - - //TEST - /*{ - std::ofstream log("log.txt", std::ofstream::app); - log << std::fixed << choosen_node_index << "after: "; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); - log << '\n'; - boost::geometry::index::detail::rtree::visitors::print print_v(log, m_tr); - boost::apply_visitor(print_v, *m_root_node); - }*/ - - // apply traversing visitor - traverse_apply_visitor(d, n, choosen_node_index); - } - - template - inline void traverse_apply_visitor(Derived & d, internal_node &n, size_t choosen_node_index) - { - // save previous traverse inputs and set new ones - internal_node * parent_bckup = m_parent; - size_t current_child_index_bckup = m_current_child_index; - size_t current_level_bckup = m_current_level; - - m_parent = &n; - m_current_child_index = choosen_node_index; - ++m_current_level; - - // next traversing step - boost::apply_visitor(d, *n.children[choosen_node_index].second); - - // restore previous traverse inputs - m_parent = parent_bckup; - m_current_child_index = current_child_index_bckup; - m_current_level = current_level_bckup; - } - - // before calling overflow_treatment all nodes have aabbs expanded - // and the number of elements in the current node is max + 1 - template - inline void overflow_treatment(Node & n) - { - // TODO: awulkiew - replace this condition with tag dispatched template - - // first time insert - /*if ( m_parent != 0 && - m_level == std::numeric_limits::max() && - 0 < m_reinserted_elements_count ) - { - reinsert(n); - } - // second time insert - else - {*/ - rstar::split:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - //} - } - - template - static inline bool distances_asc( - std::pair const& d1, - std::pair const& d2) - { - return d1.first < d2.first; - } - - template - static inline bool distances_dsc( - std::pair const& d1, - std::pair const& d2) - { - return d1.first > d2.first; - } - - template - inline void reinsert(Node & n) - { - typedef typename index::detail::rtree::elements_type::type elements_type; - typedef typename index::detail::rtree::element_type::type element_type; - typedef typename geometry::point_type::type point_type; - // TODO: awulkiew - use distance_result - typedef typename index::traits::coordinate_type::type distance_type; - - assert(m_parent != 0); - assert(0 < m_reinserted_elements_count); - - point_type node_center; - geometry::centroid(m_parent->children[m_current_child_index].first, node_center); - - elements_type & elements = index::detail::rtree::elements_get(n); - - size_t elements_count = elements.size(); - std::vector< std::pair > distances(elements_count); - for ( size_t i = 0 ; i < elements_count ; ++i ) - { - // TODO: awulkiew - use distance_sqr - // (use select_calculation_type if distance_sqr must be implemented in geometry::index) - // change point type for this geometry - point_type element_center; - geometry::centroid( index::detail::rtree::element_indexable( - elements[i], - m_tr - ), element_center); - - distances[i].first = geometry::distance(node_center, element_center); - distances[i].second = elements[i]; - } - - // sort elements by distances from center - std::partial_sort( - distances.begin(), - distances.begin() + m_reinserted_elements_count, - distances.end(), - distances_dsc); - - // copy elements which will be reinserted - elements_type elements_to_reinsert(m_reinserted_elements_count); - for ( size_t i = 0 ; i < m_reinserted_elements_count ; ++i ) - elements_to_reinsert[i] = distances[i].second; - - // copy elements to the current node - elements.resize(elements_count - m_reinserted_elements_count); - for ( size_t i = m_reinserted_elements_count ; i < elements_count ; ++i ) - elements[i - m_reinserted_elements_count] = distances[i].second; - - // calulate node's new box - m_parent->children[m_current_child_index].first = - elements_box(elements.begin(), elements.end(), m_tr); - - // reinsert children starting from the minimum distance - for ( size_t i = m_reinserted_elements_count ; 0 < i ; --i ) - { - insert_impl insert_v( - m_root_node, elements_to_reinsert[i - 1], - m_min_elems_per_node, m_max_elems_per_node, - m_tr, m_current_level); - boost::apply_visitor(insert_v, *m_root_node); - } - } - - Element const& m_element; - Translator const& m_tr; - const size_t m_min_elems_per_node; - const size_t m_max_elems_per_node; - const size_t m_reinserted_elements_count; - - const size_t m_level; - - node* & m_root_node; - - // traversing input parameters - internal_node *m_parent; - size_t m_current_child_index; - size_t m_current_level; -}; - -}}} // namespace detail::rtree::rstar - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_IMPL_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index 53b901ba1..972f570e5 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -16,6 +16,8 @@ struct rstar_tag {}; }}} // namespace boost::geometry::index +#include + #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 77428920f..48bb46488 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -17,9 +17,14 @@ #include #include +#include +#include #include -#include + +// TODO: awulkiew - correct implementation +//#include +//#include namespace boost { namespace geometry { namespace index { @@ -80,7 +85,9 @@ public: void insert(value_type const& value) { - detail::rtree::visitors::insert + // TODO: awulkiew - assert for correct value + + detail::rtree::visitors::insert insert_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); boost::apply_visitor(insert_v, *m_root); @@ -88,6 +95,36 @@ public: ++m_values_count; } + void remove(value_type const& value) + { + // TODO: awulkiew - assert for correct value + assert(0 < m_values_count); + + detail::rtree::visitors::remove + remove_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); + + boost::apply_visitor(remove_v, *m_root); + + --m_values_count; + } + + size_t size() const + { + return m_values_count; + } + + bool empty() const + { + // TODO: awulkiew - take root into consideration + return 0 == m_values_count; + } + + void clear() + { + // TODO: awulkiew - implement + assert(false); + } + template typename Visitor::result_type apply_visitor(Visitor & visitor) const { @@ -118,6 +155,12 @@ void insert(rtree & tree, Value const& v) tree.insert(v); } +template +void remove(rtree & tree, Value const& v) +{ + tree.remove(v); +} + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RSTREE_RSTREE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 9362f2a1b..a962d7c34 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -10,6 +10,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP +#include + #include namespace boost { namespace geometry { namespace index { @@ -26,16 +28,18 @@ struct choose_next_node typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename internal_node::children_type children_type; + typedef typename rtree::elements_type::type children_type; typedef typename index::default_area_result::type area_type; template static inline size_t apply(internal_node & n, Indexable const& indexable) { - assert(!n.children.empty()); + children_type & children = rtree::elements_get(n); - size_t children_count = n.children.size(); + assert(!children.empty()); + + size_t children_count = children.size(); // choose index with smallest area change or smallest area size_t choosen_index = 0; @@ -46,7 +50,7 @@ struct choose_next_node for ( size_t i = 0 ; i < children_count ; ++i ) { typedef typename children_type::value_type child_type; - child_type const& ch_i = n.children[i]; + child_type const& ch_i = children[i]; Box box_exp(ch_i.first); geometry::expand(box_exp, indexable); @@ -73,7 +77,7 @@ struct redistribute_elements; // Default split algorithm template -class split +struct split { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -81,7 +85,6 @@ class split static const size_t dimension = index::traits::dimension::value; -public: template static inline void apply( Node & n, @@ -131,7 +134,6 @@ struct overflow_treatment typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; -public: template static inline void apply( Node & n, @@ -146,21 +148,31 @@ public: } }; -} // namespace detail - -// Default insert algorithm -template +// Default insert visitor +template class insert : public boost::static_visitor<> { +public: typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; -public: - inline explicit insert(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) - : m_value(v), m_tr(t), m_min_elems_per_node(min_elements), m_max_elems_per_node(max_elements) + inline insert(node* & root, + Element const& element, + size_t min_elements, + size_t max_elements, + Translator const& t, + size_t level = std::numeric_limits::max() + ) + : m_element(element) + , m_tr(t) + , m_min_elems_per_node(min_elements) + , m_max_elems_per_node(max_elements) + , m_level(level) , m_root_node(root) - , m_parent(0), m_current_child_index(0), m_current_level(0) + , m_parent(0) + , m_current_child_index(0) + , m_current_level(0) { // TODO // assert - check if Box is correct @@ -168,39 +180,52 @@ public: inline void operator()(internal_node & n) { - // choose next node - size_t choosen_node_index = detail::choose_next_node:: - apply(n, rtree::element_indexable(m_value, m_tr)); + // traverse + traverse(*this, n); - // expand the node to contain value - geometry::expand(n.children[choosen_node_index].first, m_tr(m_value)); - - // next traversing step - traverse_apply_visitor(n, choosen_node_index); - - // handle overflow - if ( m_max_elems_per_node < n.children.size() ) - { - detail::overflow_treatment:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); - } + post_traverse(n); } inline void operator()(leaf & n) { // push value - n.values.push_back(m_value); + rtree::elements_get(n).push_back(m_element); + post_traverse(n); + } + +protected: + template + inline void traverse(Visitor & visitor, internal_node & n) + { + // choose next node + size_t choosen_node_index = detail::choose_next_node:: + apply(n, rtree::element_indexable(m_element, m_tr)); + + // expand the node to contain value + geometry::expand( + n.children[choosen_node_index].first, + rtree::element_indexable(m_element, m_tr)); + + // next traversing step + traverse_apply_visitor(visitor, n, choosen_node_index); + } + + // TODO: awulkiew - change name to handle_overflow or overflow_treatment? + + template + inline void post_traverse(Node &n) + { // handle overflow - if ( m_max_elems_per_node < n.values.size() ) + if ( m_max_elems_per_node < rtree::elements_get(n).size() ) { detail::overflow_treatment:: apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); } } -private: - inline void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) + template + inline void traverse_apply_visitor(Visitor & visitor, internal_node &n, size_t choosen_node_index) { // save previous traverse inputs and set new ones internal_node * parent_bckup = m_parent; @@ -212,7 +237,7 @@ private: ++m_current_level; // next traversing step - boost::apply_visitor(*this, *n.children[choosen_node_index].second); + boost::apply_visitor(visitor, *rtree::elements_get(n)[choosen_node_index].second); // restore previous traverse inputs m_parent = parent_bckup; @@ -220,10 +245,11 @@ private: m_current_level = current_level_bckup; } - Value const& m_value; + Element const& m_element; Translator const& m_tr; const size_t m_min_elems_per_node; const size_t m_max_elems_per_node; + const size_t m_level; node* & m_root_node; @@ -233,6 +259,91 @@ private: size_t m_current_level; }; +} // namespace detail + +// Default insert visitor +template +struct insert : public detail::insert +{ + typedef detail::insert base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; + + inline insert(node* & root, + Element const& element, + size_t min_elements, + size_t max_elements, + Translator const& tr, + size_t level = std::numeric_limits::max() + ) + : base(root, element, min_elements, max_elements, tr, level) + {} + + inline void operator()(internal_node & n) + { + if ( base::m_current_level < base::m_level ) + { + // next traversing step + base::traverse(*this, n); + } + else + { + assert( base::m_level == base::m_current_level ); + + // push new child node + rtree::elements_get(n).push_back(base::m_element); + } + + base::post_traverse(n); + } + + inline void operator()(leaf & n) + { + assert(false); + } +}; + +// Default insert visitor specialized for Values elements +template +struct insert : public detail::insert +{ + typedef detail::insert base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; + + inline insert(node* & root, + Value const& v, + size_t min_elements, + size_t max_elements, + Translator const& t, + size_t level = std::numeric_limits::max() + ) + : base(root, v, min_elements, max_elements, t, level) + {} + + inline void operator()(internal_node & n) + { + assert(base::m_current_level < base::m_level); + + // next traversing step + base::traverse(*this, n); + + base::post_traverse(n); + } + + inline void operator()(leaf & n) + { + assert( base::m_level == base::m_current_level || + base::m_level == std::numeric_limits::max() ); + + rtree::elements_get(n).push_back(base::m_element); + + base::post_traverse(n); + } +}; + }}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index d5e9a07a4..1f6b0b472 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -12,14 +12,201 @@ #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { +// Default remove algorithm template -struct rtree_remove +class remove : public boost::static_visitor<> { - // not implemented here + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + +public: + inline explicit remove(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) + : m_value(v) + , m_tr(t) + , m_min_elems_per_node(min_elements) + , m_max_elems_per_node(max_elements) + , m_root_node(root) + , m_is_value_removed(false) + , m_parent(0) + , m_current_child_index(0) + , m_current_level(0) + , m_is_underflow(false) + { + // TODO + // assert - check if Value/Box is correct + } + + inline void operator()(internal_node & n) + { + typedef typename rtree::elements_type::type children_type; + children_type & children = rtree::elements_get(n); + + size_t child_node_index = 0; + for ( ; child_node_index < children.size() ; ++child_node_index ) + { + if ( geometry::intersects(children[child_node_index].first, m_tr(m_value)) ) + { + // next traversing step + traverse_apply_visitor(n, child_node_index); + + if ( m_is_value_removed ) + break; + } + } + + // value was found and removed + if ( m_is_value_removed ) + { + typedef typename rtree::elements_type::type elements_type; + typedef typename elements_type::iterator element_iterator; + elements_type & elements = rtree::elements_get(n); + + // underflow occured - child node should be removed + if ( m_is_underflow ) + { + element_iterator underfl_el_it = elements.begin() + child_node_index; + + // move node to the container + m_underflowed_nodes.push_back(std::make_pair(m_current_level + 1, underfl_el_it->second)); + elements.erase(underfl_el_it); + + // calc underflow + m_is_underflow = elements.size() < m_min_elems_per_node; + } + + // test - underflow state should be ok here + assert(elements.size() < m_min_elems_per_node == m_is_underflow); + + // n is not root - adjust aabb + if ( 0 != m_parent ) + { + rtree::elements_get(*m_parent)[m_current_child_index].first + = rtree::elements_box(elements.begin(), elements.end(), m_tr); + } + // n is root node + else + { + // current node must be a root + assert(&n == boost::get(m_root_node)); + + // value not found + assert(m_is_value_removed); + + // reinsert elements from removed nodes + // begin with levels closer to the root + for ( std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); + it != m_underflowed_nodes.rend() ; ++it ) + { + if ( boost::apply_visitor(is_leaf(), *it->second) ) + reinsert_elements(boost::get(*it->second), it->first); + else + reinsert_elements(boost::get(*it->second), it->first); + } + + // shorten the tree + if ( rtree::elements_get(n).size() == 1 ) + { + m_root_node = rtree::elements_get(n)[0].second; + } + } + } + } + + inline void operator()(leaf & n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type & elements = rtree::elements_get(n); + + // find value and remove it + for ( elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it ) + { + if ( m_tr.equals(*it, m_value) ) + { + elements.erase(it); + m_is_value_removed = true; + break; + } + } + + // if value was removed + if ( m_is_value_removed ) + { + // calc underflow + m_is_underflow = elements.size() < m_min_elems_per_node; + + // n is not root - adjust aabb + if ( 0 != m_parent ) + { + rtree::elements_get(*m_parent)[m_current_child_index].first + = rtree::elements_box(elements.begin(), elements.end(), m_tr); + } + } + } + +private: + inline void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) + { + // save previous traverse inputs and set new ones + internal_node * parent_bckup = m_parent; + size_t current_child_index_bckup = m_current_child_index; + size_t current_level_bckup = m_current_level; + + m_parent = &n; + m_current_child_index = choosen_node_index; + ++m_current_level; + + // next traversing step + boost::apply_visitor(*this, *n.children[choosen_node_index].second); + + // restore previous traverse inputs + m_parent = parent_bckup; + m_current_child_index = current_child_index_bckup; + m_current_level = current_level_bckup; + } + + template + void reinsert_elements(Node &n, size_t level) + { + typedef typename rtree::elements_type::type elements_type; + elements_type & elements = rtree::elements_get(n); + for ( typename elements_type::iterator it = elements.begin(); + it != elements.end() ; ++it ) + { + visitors::insert insert_v( + m_root_node, + *it, + m_min_elems_per_node, + m_max_elems_per_node, + m_tr, + level); + + boost::apply_visitor(insert_v, *m_root_node); + } + } + + Value const& m_value; + Translator const& m_tr; + const size_t m_min_elems_per_node; + const size_t m_max_elems_per_node; + + node* & m_root_node; + bool m_is_value_removed; + std::vector< std::pair > m_underflowed_nodes; + + // traversing input parameters + internal_node *m_parent; + size_t m_current_child_index; + size_t m_current_level; + + // traversing output parameters + bool m_is_underflow; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index 4780d45be..e3c9cfcae 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -29,10 +29,10 @@ struct def return detail::extract_indexable::get(v); } - /*bool equals(Value const& v1, Value const& v2) const + bool equals(Value const& v1, Value const& v2) const { return detail::equals::apply(v1, v2); - }*/ + } }; // Iterator @@ -46,10 +46,10 @@ struct def return detail::extract_indexable::get(*v); } - /*bool equals(Value const& v1, Value const& v2) const + bool equals(Value const& v1, Value const& v2) const { return v1 == v2; - }*/ + } }; // SmartPtr @@ -63,10 +63,10 @@ struct def return detail::extract_indexable::get(*v); } - /*bool equals(Value const& v1, Value const& v2) const + bool equals(Value const& v1, Value const& v2) const { return v1 == v2; - }*/ + } }; } // namespace dispatch @@ -92,10 +92,10 @@ struct def return detail::extract_indexable::get(*v); } - /*bool equals(const Value* v1, const Value* v2) const + bool equals(const Value* v1, const Value* v2) const { return v1 == v2; - }*/ + } }; }}}} // namespace boost::geometry::index::translator diff --git a/include/boost/geometry/extensions/index/translator/helpers.hpp b/include/boost/geometry/extensions/index/translator/helpers.hpp index b68ab9fd9..44b364650 100644 --- a/include/boost/geometry/extensions/index/translator/helpers.hpp +++ b/include/boost/geometry/extensions/index/translator/helpers.hpp @@ -17,6 +17,8 @@ #include #include +#include + #include namespace boost { namespace geometry { namespace index { namespace translator { @@ -132,60 +134,58 @@ struct is_smart_ptr } // namespace detail -//namespace dispatch { -// -//template -//struct equals -//{ -// static bool apply(Geometry const& g1, Geometry const& g2) -// { -// return geometry::equals(g1, g2); -// } -//}; -// -//template -//struct equals -//{ -// static bool apply(T const& v1, T const& v2) -// { -// return v1 == v2; -// } -//}; -// -//} // namespace dispatch -// -//namespace detail { -// -//template -//struct equals -//{ -// static bool apply(Geometry const& g1, Geometry const& g2) -// { -// return geometry::equals(g1, g2); -// } -//}; -// -//template -//struct equals< std::pair > -//{ -// static bool apply(std::pair const& p1, std::pair const& p2) -// { -// return -// dispatch::equals< -// First, -// typename traits::tag::type -// >::apply(p1.first, p2.first) -// && -// dispatch::equals< -// Second, -// typename traits::tag::type -// >::apply(p1.second, p2.second); -// } -//}; -// -//} // namespace detail +namespace dispatch { +template +struct equals +{ + static bool apply(Geometry const& g1, Geometry const& g2) + { + return geometry::equals(g1, g2); + } +}; +template +struct equals +{ + static bool apply(T const& v1, T const& v2) + { + return v1 == v2; + } +}; + +} // namespace dispatch + +namespace detail { + +template +struct equals +{ + static bool apply(Geometry const& g1, Geometry const& g2) + { + return geometry::equals(g1, g2); + } +}; + +template +struct equals< std::pair > +{ + static bool apply(std::pair const& p1, std::pair const& p2) + { + return + dispatch::equals< + First, + typename traits::tag::type + >::apply(p1.first, p2.first) + && + dispatch::equals< + Second, + typename traits::tag::type + >::apply(p1.second, p2.second); + } +}; + +} // namespace detail }}}} // namespace boost::geometry::index::translator diff --git a/include/boost/geometry/extensions/index/translator/index.hpp b/include/boost/geometry/extensions/index/translator/index.hpp index b0759393d..f96d0d433 100644 --- a/include/boost/geometry/extensions/index/translator/index.hpp +++ b/include/boost/geometry/extensions/index/translator/index.hpp @@ -29,10 +29,10 @@ public: ::get(m_c[i]); } - /*bool equals(size_t i1, size_t i2) const + bool equals(size_t i1, size_t i2) const { - return i1 == i2; - }*/ + return i1 == i2; + } private: Container const& m_c; diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index db01250fc..1e8cf323d 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -10,6 +10,7 @@ typedef boost::geometry::model::point typedef boost::geometry::model::box

B; //boost::geometry::index::rtree t(2, 1); boost::geometry::index::rtree t(4, 2); +std::vector vect; void render_scene(void) { @@ -39,7 +40,7 @@ void resize(int w, int h) void mouse(int button, int state, int x, int y) { - if ( state == GLUT_DOWN ) + if ( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) { float x = ( rand() % 100 ); float y = ( rand() % 100 ); @@ -49,13 +50,35 @@ void mouse(int button, int state, int x, int y) B b(P(x - w, y - h),P(x + w, y + h)); boost::geometry::index::insert(t, b); + vect.push_back(b); - std::cout << "\n\n\n" << t << "\n\n"; + /*std::cout << t << "\n\n"; std::cout << "inserted: "; boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); + std::cout << "\n\n\n";*/ + + glutPostRedisplay(); + } + else if ( button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN ) + { + if ( vect.empty() ) + return; + + size_t i = rand() % vect.size(); + B b = vect[i]; + + boost::geometry::index::remove(t, b); + vect.erase(vect.begin() + i); + + /*std::cout << '\n' << t << "\n\n"; + std::cout << "removed: "; + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); + std::cout << '\n'; + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); + std::cout << "\n\n\n";*/ glutPostRedisplay(); } diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 3398d8d71..5174149cd 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -43,39 +43,21 @@ int main() } std::cout << "loaded\n"; - std::cout << "inserting time test...\n"; - tim.restart(); RT t(max_elems, min_elems); - for (size_t i = 0 ; i < values_count ; ++i ) + { - float x = coords[i].first; - float y = coords[i].second; - B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - - // Zle wyswietla dane, obcina czesc ulamkowa - // Zle buduje drzewo dla i == 228 - - //TEST - /*if ( i == 228 ) + std::cout << "inserting time test...\n"; + tim.restart(); + for (size_t i = 0 ; i < values_count ; ++i ) { - std::cout << std::fixed << x << ", " << y << "\n"; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); - }*/ + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - t.insert(std::make_pair(b, i)); - - //TEST - /*if ( !boost::geometry::index::are_boxes_ok(t) ) - { - std::ofstream log("log1.txt", std::ofstream::trunc); - log << std::fixed << i << " - " << x << ", " << y << " - inserted: "; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, b); - log << '\n'; - log << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); - log << '\n' << t; - }*/ + t.insert(std::make_pair(b, i)); + } + std::cout << "time: " << tim.elapsed() << "s\n"; } - std::cout << "time: " << tim.elapsed() << "s\n"; if ( save_ch == 's' ) { @@ -92,19 +74,81 @@ int main() std::cout << "saved...\n"; } - std::cout << "searching time test...\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); - temp += result.size(); + std::cout << "searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << temp << "\n"; + } + + { + std::cout << "removing time test...\n"; + tim.restart(); + for (size_t i = 0 ; i < values_count / 2 ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + t.remove(std::make_pair(b, i)); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + } + + { + std::cout << "searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << temp << "\n"; + } + + { + std::cout << "inserting time test...\n"; + tim.restart(); + for (size_t i = 0 ; i < values_count / 2 ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + t.insert(std::make_pair(b, i)); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + } + + { + std::cout << "searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << temp << "\n"; } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << temp << "\n"; std::cin.get(); diff --git a/tests/main.cpp b/tests/main.cpp index 4a7e696dd..3966633e3 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -2,25 +2,40 @@ #include #include +#include + int main() { tests_translators_hpp(); tests_rtree_native_hpp(); - tests_rtree_native_hpp(); + //tests_rtree_native_hpp(); tests_rtree_filters_hpp(); - /*namespace g = boost::geometry; - typedef g::model::point P; - typedef g::model::box

B; + { + namespace bg = boost::geometry; + namespace bgi = boost::geometry::index; + typedef bg::model::point P; + typedef bg::model::box

B; + typedef std::pair V; - g::index::rtree tree(4, 2); - g::index::insert(tree, B(P(1, 6),P(6, 19))); - g::index::insert(tree, B(P(10, 1),P(18, 18))); - g::index::insert(tree, B(P(22, 6),P(27, 20))); - g::index::insert(tree, B(P(29, 2),P(34, 18))); - g::index::insert(tree, B(P(35, 3),P(39, 19))); + bgi::rtree t(4, 2); + const int m = 15; + for ( int i = 0 ; i < m ; ++i ) + { + bgi::insert(t, V(B(P(i*2, i*2), P(i*2+1, i*2+1)), i)); + } + std::cout << t << "\n------------------------------------\n"; + std::cin.get(); - std::cout << tree;*/ + for ( int i = 0 ; i < m ; ++i ) + { + bgi::remove(t, V(B(P(i*2, i*2), P(i*2+1, i*2+1)), i)); + std::cout << t << '\n'; + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); + std::cout << "\n------------------------------------\n"; + std::cin.get(); + } + } #ifdef _MSC_VER std::cin.get(); From e09f022a2d31cd9741dec354ad1a60e3285bf12a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 6 May 2011 00:51:49 +0000 Subject: [PATCH 017/366] quadratic split algorithm added, error in linear split corrected [SVN r71755] --- .../rtree/linear/redistribute_elements.hpp | 87 +++------ .../rtree/quadratic/redistribute_elements.hpp | 184 +++++++++++++++++- .../geometry/extensions/index/rtree/rtree.hpp | 3 +- .../index/rtree/visitors/insert.hpp | 2 +- .../index/rtree/visitors/remove.hpp | 3 + tests/additional_glut_vis.cpp | 2 +- tests/additional_sizes_and_times.cpp | 3 +- 7 files changed, 221 insertions(+), 63 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index def7bb102..bdaf2804f 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -193,8 +193,6 @@ struct redistribute_elements typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; typedef typename index::default_area_result::type area_type; - - static const size_t dimension = index::traits::dimension::value; // copy original elements elements_type elements_copy = rtree::elements_get(n); @@ -233,27 +231,21 @@ struct redistribute_elements { element_type const& elem = elements_copy[i]; indexable_type const& indexable = rtree::element_indexable(elem, tr); + bool insert_into_group1 = false; // if there is small number of elements left and the number of elements in node is lesser than min_elems // just insert them to this node - if ( elements1.size() + remaining == min_elems ) + if ( elements1.size() + remaining <= min_elems ) { - elements1.push_back(elem); - geometry::expand(box1, indexable); - area1 = index::area(box1); + insert_into_group1 = true; } - else if ( elements2.size() + remaining == min_elems ) + else if ( elements2.size() + remaining <= min_elems ) { - elements2.push_back(elem); - geometry::expand(box2, indexable); - area2 = index::area(box2); + insert_into_group1 = false; } // choose better node and insert element else { - assert(0 < remaining); - remaining--; - // calculate enlarged boxes and areas Box enlarged_box1(box1); Box enlarged_box2(box2); @@ -262,57 +254,42 @@ struct redistribute_elements area_type enlarged_area1 = index::area(enlarged_box1); area_type enlarged_area2 = index::area(enlarged_box2); - area_type areas_diff1 = enlarged_area1 - area1; - area_type areas_diff2 = enlarged_area2 - area2; + area_type area_increase1 = enlarged_area1 - area1; + area_type area_increase2 = enlarged_area2 - area2; - // choose group which box area have to be enlarged least - if ( areas_diff1 < areas_diff2 ) + // choose group which box area have to be enlarged least or has smaller area or has fewer elements + if ( area_increase1 < area_increase2 || + ( area_increase1 == area_increase2 && area1 < area2 ) || + ( area1 == area2 && elements1.size() <= elements2.size() ) ) { - elements1.push_back(elem); - box1 = enlarged_box1; - area1 = enlarged_area1; - } - else if ( areas_diff2 < areas_diff1 ) - { - elements2.push_back(elem); - box2 = enlarged_box2; - area2 = enlarged_area2; + insert_into_group1 = true; } else { - // choose group which box has smaller area - if ( area1 < area2 ) - { - elements1.push_back(elem); - box1 = enlarged_box1; - area1 = enlarged_area1; - } - else if ( area2 < area1 ) - { - elements2.push_back(elem); - box2 = enlarged_box2; - area2 = enlarged_area2; - } - else - { - // choose group with fewer elements - if ( elements1.size() <= elements2.size() ) - { - elements1.push_back(elem); - box1 = enlarged_box1; - area1 = enlarged_area1; - } - else - { - elements2.push_back(elem); - box2 = enlarged_box2; - area2 = enlarged_area2; - } - } + insert_into_group1 = false; } } + + if ( insert_into_group1 ) + { + elements1.push_back(elem); + geometry::expand(box1, indexable); + area1 = index::area(box1); + } + else + { + elements2.push_back(elem); + geometry::expand(box2, indexable); + area2 = index::area(box2); + } + + assert(0 < remaining); + --remaining; } } + + assert(min_elems <= elements1.size() && elements1.size() <= max_elems); + assert(min_elems <= elements2.size() && elements2.size() <= max_elems); } }; diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 4babab5d1..3f594e55f 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -54,11 +54,11 @@ struct pick_seeds { for ( size_t j = i + 1 ; j < elements_count ; ++j ) { - indexable_type & ind1 = rtree::element_indexable(elements[i], tr); - indexable_type & ind2 = rtree::element_indexable(elements[j], tr); + indexable_type const& ind1 = rtree::element_indexable(elements[i], tr); + indexable_type const& ind2 = rtree::element_indexable(elements[j], tr); box_type enlarged_box; - geometry::convert(ind1); + geometry::convert(ind1, enlarged_box); geometry::expand(enlarged_box, ind2); area_type free_area = index::area(enlarged_box) - index::area(ind1) - index::area(ind2); @@ -76,7 +76,183 @@ struct pick_seeds } // namespace quadratic -// TODO: awulkiew - redistribute +template +struct redistribute_elements +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename index::default_area_result::type area_type; + + template + static inline void apply(Node & n, + Node & second_node, + Box & box1, + Box & box2, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename rtree::elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + + // copy original elements + elements_type elements_copy = rtree::elements_get(n); + + // calculate initial seeds + size_t seed1 = 0; + size_t seed2 = 0; + quadratic::pick_seeds::apply(elements_copy, tr, seed1, seed2); + + // prepare nodes' elements containers + elements_type & elements1 = rtree::elements_get(n); + elements_type & elements2 = rtree::elements_get(second_node); + elements1.clear(); + assert(elements2.empty()); + + // add seeds + elements1.push_back(elements_copy[seed1]); + elements2.push_back(elements_copy[seed2]); + + // calculate boxes + geometry::convert(rtree::element_indexable(elements_copy[seed1], tr), box1); + geometry::convert(rtree::element_indexable(elements_copy[seed2], tr), box2); + + // remove seeds + if (seed1 < seed2) + { + elements_copy.erase(elements_copy.begin() + seed2); + elements_copy.erase(elements_copy.begin() + seed1); + } + else + { + elements_copy.erase(elements_copy.begin() + seed1); + elements_copy.erase(elements_copy.begin() + seed2); + } + + // initialize areas + area_type area1 = index::area(box1); + area_type area2 = index::area(box2); + + size_t remaining = elements_copy.size(); + + // redistribute the rest of the elements + while ( !elements_copy.empty() ) + { + elements_type::reverse_iterator el_it = elements_copy.rbegin(); + bool insert_into_group1 = false; + + size_t elements1_count = elements1.size(); + size_t elements2_count = elements2.size(); + + // if there is small number of elements left and the number of elements in node is lesser than min_elems + // just insert them to this node + if ( elements1_count + remaining <= min_elems ) + { + insert_into_group1 = true; + } + else if ( elements2_count + remaining <= min_elems ) + { + insert_into_group1 = false; + } + // insert the best element + else + { + // find element with minimum groups areas increses differences + area_type area_increase1 = 0; + area_type area_increase2 = 0; + pick_next(elements_copy.rbegin(), elements_copy.rend(), + box1, box2, area1, area2, tr, + el_it, area_increase1, area_increase2); + + if ( area_increase1 < area_increase2 || + ( area_increase1 == area_increase2 && area1 < area2 ) || + ( area1 == area2 && elements1_count <= elements2_count ) ) + { + insert_into_group1 = true; + } + else + { + insert_into_group1 = false; + } + } + + // move element to the choosen group + element_type const& elem = *el_it; + indexable_type const& indexable = rtree::element_indexable(elem, tr); + + if ( insert_into_group1 ) + { + elements1.push_back(elem); + geometry::expand(box1, indexable); + area1 = index::area(box1); + } + else + { + elements2.push_back(elem); + geometry::expand(box2, indexable); + area2 = index::area(box2); + } + + assert(!elements_copy.empty()); + elements_copy.erase(elements_copy.begin() + elements_copy.size() - 1); + + assert(0 < remaining); + --remaining; + } + + assert(min_elems <= elements1.size() && elements1.size() <= max_elems); + assert(min_elems <= elements2.size() && elements2.size() <= max_elems); + } + + template + static inline void pick_next(It first, It last, + Box const& box1, Box const& box2, + area_type const& area1, area_type const& area2, + Translator const& tr, + It out_it, area_type & out_area_increase1, area_type & out_area_increase2) + { + typedef typename boost::iterator_value::type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + + area_type greatest_area_incrase_diff = 0; + out_it = first; + out_area_increase1 = 0; + out_area_increase2 = 0; + + for ( It el_it = first ; el_it != last ; ++el_it ) + { + indexable_type const& indexable = rtree::element_indexable(*el_it, tr); + + // calculate enlarged boxes and areas + Box enlarged_box1(box1); + Box enlarged_box2(box2); + geometry::expand(enlarged_box1, indexable); + geometry::expand(enlarged_box2, indexable); + area_type enlarged_area1 = index::area(enlarged_box1); + area_type enlarged_area2 = index::area(enlarged_box2); + + area_type area_incrase1 = (enlarged_area1 - area1); + area_type area_incrase2 = (enlarged_area2 - area2); + + area_type area_incrase_diff = area_incrase1 < area_incrase2 ? + area_incrase2 - area_incrase1 : area_incrase1 - area_incrase2; + + if ( greatest_area_incrase_diff < area_incrase_diff ) + { + greatest_area_incrase_diff = area_incrase_diff; + out_it = el_it; + out_area_increase1 = area_incrase1; + out_area_increase2 = area_incrase2; + } + + break; + } + } +}; } // namespace detail diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 48bb46488..decfe5f48 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -22,8 +22,9 @@ #include +#include + // TODO: awulkiew - correct implementation -//#include //#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index a962d7c34..b0a358d17 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -211,7 +211,7 @@ protected: traverse_apply_visitor(visitor, n, choosen_node_index); } - // TODO: awulkiew - change name to handle_overflow or overflow_treatment? + // TODO: awulkiew - change post_traverse name to handle_overflow or overflow_treatment? template inline void post_traverse(Node &n) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 1f6b0b472..875896ffb 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -48,9 +48,12 @@ public: typedef typename rtree::elements_type::type children_type; children_type & children = rtree::elements_get(n); + // traverse children which boxes intersects value's box size_t child_node_index = 0; for ( ; child_node_index < children.size() ; ++child_node_index ) { + // TODO: awulkiew - change intersects to within + if ( geometry::intersects(children[child_node_index].first, m_tr(m_value)) ) { // next traversing step diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 1e8cf323d..8e68e8da2 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -9,7 +9,7 @@ typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; //boost::geometry::index::rtree t(2, 1); -boost::geometry::index::rtree t(4, 2); +boost::geometry::index::rtree t(4, 2); std::vector vect; void render_scene(void) diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 5174149cd..cdcab5eed 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -17,7 +17,8 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; - typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; + //typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; + typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; std::ifstream file_cfg("config.txt"); size_t max_elems = 4; From 4d82c421acd70a4d75f197063bd6addfd34b90df Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 6 May 2011 13:36:37 +0000 Subject: [PATCH 018/366] quadratic split error corrected [SVN r71763] --- .../rtree/linear/redistribute_elements.hpp | 30 +++++++--------- .../rtree/quadratic/redistribute_elements.hpp | 34 +++++++++++-------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index bdaf2804f..a04b95521 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -231,17 +231,20 @@ struct redistribute_elements { element_type const& elem = elements_copy[i]; indexable_type const& indexable = rtree::element_indexable(elem, tr); - bool insert_into_group1 = false; // if there is small number of elements left and the number of elements in node is lesser than min_elems // just insert them to this node if ( elements1.size() + remaining <= min_elems ) { - insert_into_group1 = true; + elements1.push_back(elem); + geometry::expand(box1, indexable); + area1 = index::area(box1); } else if ( elements2.size() + remaining <= min_elems ) { - insert_into_group1 = false; + elements2.push_back(elem); + geometry::expand(box2, indexable); + area2 = index::area(box2); } // choose better node and insert element else @@ -262,26 +265,17 @@ struct redistribute_elements ( area_increase1 == area_increase2 && area1 < area2 ) || ( area1 == area2 && elements1.size() <= elements2.size() ) ) { - insert_into_group1 = true; + elements1.push_back(elem); + box1 = enlarged_box1; + area1 = enlarged_area1; } else { - insert_into_group1 = false; + elements2.push_back(elem); + box2 = enlarged_box2; + area2 = enlarged_area2; } } - - if ( insert_into_group1 ) - { - elements1.push_back(elem); - geometry::expand(box1, indexable); - area1 = index::area(box1); - } - else - { - elements2.push_back(elem); - geometry::expand(box2, indexable); - area2 = index::area(box2); - } assert(0 < remaining); --remaining; diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 3f594e55f..75fcfec14 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -47,10 +47,11 @@ struct pick_seeds assert(2 <= elements_count); + area_type greatest_free_area = 0; seed1 = 0; seed2 = 1; - area_type greatest_free_area = 0; - for ( size_t i = 0 ; i < elements_count ; ++i ) + + for ( size_t i = 0 ; i < elements_count - 1 ; ++i ) { for ( size_t j = i + 1 ; j < elements_count ; ++j ) { @@ -164,9 +165,9 @@ struct redistribute_elements // find element with minimum groups areas increses differences area_type area_increase1 = 0; area_type area_increase2 = 0; - pick_next(elements_copy.rbegin(), elements_copy.rend(), - box1, box2, area1, area2, tr, - el_it, area_increase1, area_increase2); + el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(), + box1, box2, area1, area2, tr, + area_increase1, area_increase2); if ( area_increase1 < area_increase2 || ( area_increase1 == area_increase2 && area1 < area2 ) || @@ -198,7 +199,7 @@ struct redistribute_elements } assert(!elements_copy.empty()); - elements_copy.erase(elements_copy.begin() + elements_copy.size() - 1); + elements_copy.erase(--el_it.base()); assert(0 < remaining); --remaining; @@ -208,21 +209,24 @@ struct redistribute_elements assert(min_elems <= elements2.size() && elements2.size() <= max_elems); } + // sprawdzic szukanie najmniejszego powiekszenia wezla dla grupy1 i grupy2 + template - static inline void pick_next(It first, It last, - Box const& box1, Box const& box2, - area_type const& area1, area_type const& area2, - Translator const& tr, - It out_it, area_type & out_area_increase1, area_type & out_area_increase2) + static inline It pick_next(It first, It last, + Box const& box1, Box const& box2, + area_type const& area1, area_type const& area2, + Translator const& tr, + area_type & out_area_increase1, area_type & out_area_increase2) { typedef typename boost::iterator_value::type element_type; typedef typename rtree::element_indexable_type::type indexable_type; area_type greatest_area_incrase_diff = 0; - out_it = first; + It out_it = first; out_area_increase1 = 0; out_area_increase2 = 0; - + + // find element with greatest difference between increased group's boxes areas for ( It el_it = first ; el_it != last ; ++el_it ) { indexable_type const& indexable = rtree::element_indexable(*el_it, tr); @@ -248,9 +252,9 @@ struct redistribute_elements out_area_increase1 = area_incrase1; out_area_increase2 = area_incrase2; } - - break; } + + return out_it; } }; From 9dcca981e2280941e9ce2dfd5a77631bd52c1397 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 6 May 2011 15:04:03 +0000 Subject: [PATCH 019/366] corrected: gcc compile errors, wrong assert in remove; + minor changes [SVN r71764] --- .../extensions/index/rtree/linear/linear.hpp | 3 +++ .../index/rtree/linear/redistribute_elements.hpp | 3 --- .../index/rtree/quadratic/redistribute_elements.hpp | 5 +---- .../extensions/index/rtree/visitors/insert.hpp | 7 ++++++- .../extensions/index/rtree/visitors/remove.hpp | 13 +++++++------ .../extensions/index/rtree/visitors/save.hpp | 2 +- tests/additional_sizes_and_times.cpp | 4 ++-- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp index 7bb7879c4..67e0a5e8d 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp @@ -16,6 +16,9 @@ struct linear_tag {}; }}} // namespace boost::geometry::index +//TEST +// TODO + #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index a04b95521..cbbc197b2 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -281,9 +281,6 @@ struct redistribute_elements --remaining; } } - - assert(min_elems <= elements1.size() && elements1.size() <= max_elems); - assert(min_elems <= elements2.size() && elements2.size() <= max_elems); } }; diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 75fcfec14..a75b3a93d 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -143,7 +143,7 @@ struct redistribute_elements // redistribute the rest of the elements while ( !elements_copy.empty() ) { - elements_type::reverse_iterator el_it = elements_copy.rbegin(); + typename elements_type::reverse_iterator el_it = elements_copy.rbegin(); bool insert_into_group1 = false; size_t elements1_count = elements1.size(); @@ -204,9 +204,6 @@ struct redistribute_elements assert(0 < remaining); --remaining; } - - assert(min_elems <= elements1.size() && elements1.size() <= max_elems); - assert(min_elems <= elements2.size() && elements2.size() <= max_elems); } // sprawdzic szukanie najmniejszego powiekszenia wezla dla grupy1 i grupy2 diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index b0a358d17..8ece15db2 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -96,11 +96,16 @@ struct split Translator const& tr) { node * second_node = rtree::create_node(Node()); + Node & n2 = boost::get(*second_node); // redistribute elements Box box1, box2; redistribute_elements:: - apply(n, boost::get(*second_node), box1, box2, min_elems, max_elems, tr); + apply(n, n2, box1, box2, min_elems, max_elems, tr); + + // check numbers of elements + assert(min_elems <= rtree::elements_get(n).size() && rtree::elements_get(n).size() <= max_elems); + assert(min_elems <= rtree::elements_get(n2).size() && rtree::elements_get(n2).size() <= max_elems); // node is not the root if ( parent != 0 ) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 875896ffb..5647ad6fc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -84,12 +84,13 @@ public: m_is_underflow = elements.size() < m_min_elems_per_node; } - // test - underflow state should be ok here - assert(elements.size() < m_min_elems_per_node == m_is_underflow); - // n is not root - adjust aabb if ( 0 != m_parent ) { + // test underflow state should be ok here + // note that there may be less than min_elems elements in root + assert((elements.size() < m_min_elems_per_node) == m_is_underflow); + rtree::elements_get(*m_parent)[m_current_child_index].first = rtree::elements_box(elements.begin(), elements.end(), m_tr); } @@ -104,7 +105,7 @@ public: // reinsert elements from removed nodes // begin with levels closer to the root - for ( std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); + for ( typename std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); it != m_underflowed_nodes.rend() ; ++it ) { if ( boost::apply_visitor(is_leaf(), *it->second) ) @@ -128,7 +129,7 @@ public: elements_type & elements = rtree::elements_get(n); // find value and remove it - for ( elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it ) + for ( typename elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it ) { if ( m_tr.equals(*it, m_value) ) { @@ -182,7 +183,7 @@ private: for ( typename elements_type::iterator it = elements.begin(); it != elements.end() ; ++it ) { - visitors::insert insert_v( + visitors::insert insert_v( m_root_node, *it, m_min_elems_per_node, diff --git a/include/boost/geometry/extensions/index/rtree/visitors/save.hpp b/include/boost/geometry/extensions/index/rtree/visitors/save.hpp index 47925e6ad..29652a7f1 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/save.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/save.hpp @@ -29,7 +29,7 @@ struct save< >, size_t >, - typename Translator, + Translator, Box, Tag > diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index cdcab5eed..958170ba7 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -17,8 +17,8 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; - //typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; - typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; + typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; + //typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; std::ifstream file_cfg("config.txt"); size_t max_elems = 4; From c06e620e28ebb7b5ad2457576fefb85fc2c04eb1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 6 May 2011 23:59:05 +0000 Subject: [PATCH 020/366] cleanup [SVN r71775] --- .../extensions/index/rtree/linear/linear.hpp | 3 -- .../geometry/extensions/index/rtree/node.hpp | 35 +++++------------- .../index/rtree/visitors/are_boxes_ok.hpp | 26 ++++++++------ .../index/rtree/visitors/destroy.hpp | 7 ++-- .../extensions/index/rtree/visitors/find.hpp | 14 ++++---- .../index/rtree/visitors/gl_draw.hpp | 18 +++++----- .../index/rtree/visitors/insert.hpp | 10 +++--- .../extensions/index/rtree/visitors/print.hpp | 22 ++++++------ .../index/rtree/visitors/remove.hpp | 2 +- .../extensions/index/rtree/visitors/save.hpp | 36 +++++++++++-------- tests/main.cpp | 10 +++--- 11 files changed, 90 insertions(+), 93 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp index 67e0a5e8d..7bb7879c4 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp @@ -16,9 +16,6 @@ struct linear_tag {}; }}} // namespace boost::geometry::index -//TEST -// TODO - #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node.hpp b/include/boost/geometry/extensions/index/rtree/node.hpp index 95cafd568..a151134b5 100644 --- a/include/boost/geometry/extensions/index/rtree/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node.hpp @@ -30,16 +30,16 @@ struct internal_node_def Box, typename node::type * > - > children_type; + > elements_type; - children_type children; + elements_type elements; }; template struct leaf_def { - typedef std::vector values_type; - values_type values; + typedef std::vector elements_type; + elements_type elements; }; // nodes traits @@ -73,18 +73,6 @@ struct elements_type typedef typename Node::elements_type type; }; -template -struct elements_type< internal_node_def > -{ - typedef typename internal_node_def::children_type type; -}; - -template -struct elements_type< leaf_def > -{ - typedef typename leaf_def::values_type type; -}; - template typename elements_type::type & elements_get(Node & n) @@ -92,18 +80,11 @@ elements_get(Node & n) return n.elements; } -template -typename internal_node_def::children_type & -elements_get(internal_node_def & n) +template +typename elements_type::type const& +elements_get(Node const& n) { - return n.children; -} - -template -typename leaf_def::values_type & -elements_get(leaf_def & n) -{ - return n.values; + return n.elements; } //template diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index af242e945..e87a16d55 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -30,7 +30,10 @@ public: inline bool operator()(internal_node const& n) { - if (n.children.empty()) + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); + + if (elements.empty()) return false; Box box_bckup = m_box; @@ -38,8 +41,8 @@ public: m_is_root = false; - for ( internal_node::children_type::const_iterator it = n.children.begin(); - it != n.children.end() ; ++it) + for ( typename elements_type::const_iterator it = elements.begin(); + it != elements.end() ; ++it) { m_box = it->first; @@ -51,9 +54,9 @@ public: m_is_root = is_root_bckup; Box result; - geometry::convert(n.children.front().first, result); - for(internal_node::children_type::const_iterator it = n.children.begin() + 1; - it != n.children.end() ; ++it) + geometry::convert(elements.front().first, result); + for( typename elements_type::const_iterator it = elements.begin() + 1; + it != elements.end() ; ++it) { geometry::expand(result, it->first); } @@ -63,13 +66,16 @@ public: inline bool operator()(leaf const& n) { - if (n.values.empty()) + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); + + if (elements.empty()) return false; Box result; - geometry::convert(m_tr(n.values.front()), result); - for(leaf::values_type::const_iterator it = n.values.begin() + 1; - it != n.values.end() ; ++it) + geometry::convert(m_tr(elements.front()), result); + for(typename elements_type::const_iterator it = elements.begin() + 1; + it != elements.end() ; ++it) { geometry::expand(result, m_tr(*it)); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 71af3b99c..b4229ee82 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -24,10 +24,11 @@ struct destroy : public boost::static_visitor<> inline void operator()(internal_node & n) const { - typedef typename internal_node::children_type children_type; + typedef typename rtree::elements_type::type elements_type; + elements_type & elements = rtree::elements_get(n); - for (typename children_type::iterator it = n.children.begin(); - it != n.children.end(); ++it) + for (typename elements_type::iterator it = elements.begin(); + it != elements.end(); ++it) { boost::apply_visitor(*this, *it->second); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 5cdc65e12..8d00a9e08 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -193,10 +193,11 @@ struct find : public boost::static_visitor<> // } //} - typedef typename internal_node::children_type children_type; + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { if ( geometry::intersects(it->first, geom) ) boost::apply_visitor(*this, *it->second); @@ -205,10 +206,11 @@ struct find : public boost::static_visitor<> inline void operator()(leaf const& n) { - typedef typename leaf::values_type values_type; + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); - for (typename values_type::const_iterator it = n.values.begin(); - it != n.values.end(); ++it) + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { if ( geometry::intersects(tr(*it), geom) ) { 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 7acddd13c..bae32690e 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -114,7 +114,8 @@ struct gl_draw : public boost::static_visitor<> inline void operator()(internal_node const& n) { - typedef typename internal_node::children_type children_type; + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); if ( level_f <= level ) { @@ -135,8 +136,8 @@ struct gl_draw : public boost::static_visitor<> else glColor3f(0.5f, 0.5f, 0.5f); - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { detail::gl_draw_indexable(it->first, level_rel * z_mul); } @@ -147,8 +148,8 @@ struct gl_draw : public boost::static_visitor<> if ( level < level_l ) { - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { boost::apply_visitor(*this, *it->second); } @@ -159,7 +160,8 @@ struct gl_draw : public boost::static_visitor<> inline void operator()(leaf const& n) { - typedef typename leaf::values_type values_type; + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); if ( level_f <= level ) { @@ -167,8 +169,8 @@ struct gl_draw : public boost::static_visitor<> glColor3f(1.0f, 1.0f, 1.0f); - for (typename values_type::const_iterator it = n.values.begin(); - it != n.values.end(); ++it) + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { detail::gl_draw_indexable(tr(*it), level_rel * z_mul); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 8ece15db2..928f33ade 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -111,9 +111,9 @@ struct split if ( parent != 0 ) { // update old node's box - parent->children[current_child_index].first = box1; + rtree::elements_get(*parent)[current_child_index].first = box1; // add new node to the parent's children - parent->children.push_back(std::make_pair(box2, second_node)); + rtree::elements_get(*parent).push_back(std::make_pair(box2, second_node)); } // node is the root else @@ -123,8 +123,8 @@ struct split // create new root and add nodes node * new_root = rtree::create_node(internal_node()); - boost::get(*new_root).children.push_back(std::make_pair(box1, root)); - boost::get(*new_root).children.push_back(std::make_pair(box2, second_node)); + rtree::elements_get(boost::get(*new_root)).push_back(std::make_pair(box1, root)); + rtree::elements_get(boost::get(*new_root)).push_back(std::make_pair(box2, second_node)); root = new_root; } @@ -209,7 +209,7 @@ protected: // expand the node to contain value geometry::expand( - n.children[choosen_node_index].first, + rtree::elements_get(n)[choosen_node_index].first, rtree::element_indexable(m_element, m_tr)); // next traversing step diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index b208ea36d..e39be12ae 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -125,12 +125,13 @@ struct print : public boost::static_visitor<> inline void operator()(internal_node const& n) { - typedef typename internal_node::children_type children_type; + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); - spaces(level) << "INTERNAL NODE - L:" << level << " Ch:" << n.children.size() << " @:" << &n << '\n'; + spaces(level) << "INTERNAL NODE - L:" << level << " Ch:" << elements.size() << " @:" << &n << '\n'; - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { spaces(level); detail::print_indexable(os, it->first); @@ -140,8 +141,8 @@ struct print : public boost::static_visitor<> size_t level_backup = level; ++level; - for (typename children_type::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { boost::apply_visitor(*this, *it->second); } @@ -151,11 +152,12 @@ struct print : public boost::static_visitor<> inline void operator()(leaf const& n) { - typedef typename leaf::values_type values_type; + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements_get(n); - spaces(level) << "LEAF - L:" << level << " V:" << n.values.size() << " @:" << &n << '\n'; - for (typename values_type::const_iterator it = n.values.begin(); - it != n.values.end(); ++it) + spaces(level) << "LEAF - L:" << level << " V:" << elements.size() << " @:" << &n << '\n'; + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) { spaces(level); detail::print_indexable(os, tr(*it)); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 5647ad6fc..fb4f95121 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -167,7 +167,7 @@ private: ++m_current_level; // next traversing step - boost::apply_visitor(*this, *n.children[choosen_node_index].second); + boost::apply_visitor(*this, *rtree::elements_get(n)[choosen_node_index].second); // restore previous traverse inputs m_parent = parent_bckup; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/save.hpp b/include/boost/geometry/extensions/index/rtree/visitors/save.hpp index 29652a7f1..156d83a69 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/save.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/save.hpp @@ -54,35 +54,41 @@ struct save< inline void operator()(internal_node & n) { - os << n.children.size() << '\n'; + typedef typename rtree::elements_type::type elements_type; + elements_type & elements = rtree::elements_get(n); - for ( size_t i = 0 ; i < n.children.size() ; ++i ) + os << elements.size() << '\n'; + + for ( size_t i = 0 ; i < elements.size() ; ++i ) { - if ( boost::apply_visitor(visitors::is_leaf(), *(n.children[i].second)) ) + if ( boost::apply_visitor(visitors::is_leaf(), *(elements[i].second)) ) os << "l "; else os << "i "; - os << geometry::get(n.children[i].first) << ' '; - os << geometry::get(n.children[i].first) << ' '; - os << geometry::get(n.children[i].first) << ' '; - os << geometry::get(n.children[i].first) << ' '; + os << geometry::get(elements[i].first) << ' '; + os << geometry::get(elements[i].first) << ' '; + os << geometry::get(elements[i].first) << ' '; + os << geometry::get(elements[i].first) << ' '; - boost::apply_visitor(*this, *(n.children[i].second)); + boost::apply_visitor(*this, *(elements[i].second)); } } inline void operator()(leaf & n) { - os << n.values.size() << '\n'; + typedef typename rtree::elements_type::type elements_type; + elements_type & elements = rtree::elements_get(n); - for ( size_t i = 0 ; i < n.values.size() ; ++i ) + os << elements.size() << '\n'; + + for ( size_t i = 0 ; i < elements.size() ; ++i ) { os << "v "; - os << geometry::get(n.values[i].first) << ' '; - os << geometry::get(n.values[i].first) << ' '; - os << geometry::get(n.values[i].first) << ' '; - os << geometry::get(n.values[i].first) << ' '; - os << n.values[i].second << '\n'; + os << geometry::get(elements[i].first) << ' '; + os << geometry::get(elements[i].first) << ' '; + os << geometry::get(elements[i].first) << ' '; + os << geometry::get(elements[i].first) << ' '; + os << elements[i].second << '\n'; } } diff --git a/tests/main.cpp b/tests/main.cpp index 3966633e3..2af71fd58 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -8,9 +8,9 @@ int main() { tests_translators_hpp(); tests_rtree_native_hpp(); - //tests_rtree_native_hpp(); + tests_rtree_native_hpp(); tests_rtree_filters_hpp(); - + /* { namespace bg = boost::geometry; namespace bgi = boost::geometry::index; @@ -22,21 +22,21 @@ int main() const int m = 15; for ( int i = 0 ; i < m ; ++i ) { - bgi::insert(t, V(B(P(i*2, i*2), P(i*2+1, i*2+1)), i)); + bgi::insert(t, V(B(P(i*2.0f, i*2.0f), P(i*2.0f+1, i*2.0f+1)), i)); } std::cout << t << "\n------------------------------------\n"; std::cin.get(); for ( int i = 0 ; i < m ; ++i ) { - bgi::remove(t, V(B(P(i*2, i*2), P(i*2+1, i*2+1)), i)); + bgi::remove(t, V(B(P(i*2.0f, i*2.0f), P(i*2.0f+1, i*2.0f+1)), i)); std::cout << t << '\n'; std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); std::cout << "\n------------------------------------\n"; std::cin.get(); } } - + */ #ifdef _MSC_VER std::cin.get(); #endif From e30a6f451559ed37fabf1658d301a46d41f579d7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 11 May 2011 21:15:00 +0000 Subject: [PATCH 021/366] rstar partially implemented [SVN r71880] --- .../rtree/quadratic/redistribute_elements.hpp | 2 - .../index/rtree/rstar/choose_next_node.hpp | 98 +------- .../rtree/rstar/redistribute_elements.hpp | 212 ++++++++++++++++++ .../extensions/index/rtree/rstar/rstar.hpp | 3 +- .../geometry/extensions/index/rtree/rtree.hpp | 3 - tests/additional_sizes_and_times.cpp | 7 +- 6 files changed, 229 insertions(+), 96 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index a75b3a93d..901ff758d 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -12,8 +12,6 @@ #include -#include - #include #include diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index eb1302ca4..b5f14f152 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -34,7 +34,7 @@ class choose_next_node typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename internal_node::children_type children_type; + typedef typename rtree::elements_type::type children_type; typedef typename index::default_area_result::type area_type; typedef typename index::default_overlap_result::type overlap_type; @@ -43,25 +43,26 @@ public: template static inline size_t apply(internal_node & n, Indexable const& indexable) { - assert(!n.children.empty()); + children_type & children = rtree::elements_get(n); + assert(!children.empty()); bool has_leaves = boost::apply_visitor( visitors::is_leaf(), - *n.children.front().second); + *children.front().second); if ( has_leaves ) return branch_impl(n, indexable); - //return impl(n, indexable); else return internal_node_impl(n, indexable); - //return impl(n, indexable); } private: template static inline size_t branch_impl(internal_node & n, Indexable const& indexable) { - size_t children_count = n.children.size(); + children_type & children = rtree::elements_get(n); + size_t children_count = children.size(); + // overlaps values of all nodes' boxes, // overlaps and areas of extended boxes are stored at indexes i + children_count std::vector overlaps(children_count * 2, overlap_type(0)); @@ -70,7 +71,7 @@ private: for (size_t i = 0 ; i < children_count ; ++i ) { typedef typename children_type::value_type child_type; - child_type const& ch_i = n.children[i]; + child_type const& ch_i = children[i]; Box ch_ext; // calculate expanded box fo node ch_i @@ -82,7 +83,7 @@ private: for (size_t j = i + 1 ; j < children_count ; ++j ) { - child_type const& ch_j = n.children[j]; + child_type const& ch_j = children[j]; // add overlap of both boxes overlap_type ovl = index::overlap(ch_i.first, ch_j.first); @@ -128,7 +129,8 @@ private: template static inline size_t internal_node_impl(internal_node & n, Indexable const& indexable) { - size_t children_count = n.children.size(); + children_type & children = rtree::elements_get(n); + size_t children_count = children.size(); // choose index with smallest area change or smallest area size_t choosen_index = 0; @@ -139,7 +141,7 @@ private: for ( size_t i = 0 ; i < children_count ; ++i ) { typedef typename children_type::value_type child_type; - child_type const& ch_i = n.children[i]; + child_type const& ch_i = children[i]; Box ch_exp; geometry::convert(ch_i.first, ch_exp); @@ -159,82 +161,6 @@ private: return choosen_index; } - - //template - //static inline size_t impl(internal_node & n, Indexable const& indexable) - //{ - // typedef typename children_type::iterator children_iterator; - - // //assert(!n.children.empty()); - - // children_iterator temp_it = n.children.begin(); - // children_iterator child_it = temp_it; - // Areas min_areas(n.children, child_it, indexable); - - // for (children_iterator it = ++temp_it; - // it != n.children.end(); ++it) - // { - // Areas areas(n.children, it, indexable); - - // if ( areas < min_areas ) - // { - // child_it = it; - // min_areas = areas; - // } - // } - - // return child_it - n.children.begin(); - //} - - //struct branch_areas - //{ - // typedef typename index::area_result::type area_type; - - // template - // inline branch_areas(children_type const& ch, typename children_type::iterator const& k_it, Indexable const& indexable) - // { - // overlap_area = 0; - // for (typename children_type::const_iterator it = ch.begin(); it != ch.end(); ++it) - // if ( it != k_it ) - // overlap_area += index::overlap(k_it->first, it->first); - - // area = index::area(k_it->first); - - // diff_area = index::union_area(k_it->first, indexable) - area; - // } - - // inline bool operator<(branch_areas &a) const - // { - // return overlap_area < a.overlap_area || - // ( overlap_area == a.overlap_area && diff_area < a.diff_area ) || - // ( diff_area == a.diff_area && area < a.area ); - // } - - // area_type overlap_area; - // area_type diff_area; - // area_type area; - //}; - - //struct internal_node_areas - //{ - // typedef typename area_result::type area_type; - - // template - // inline internal_node_areas(children_type const&, typename children_type::iterator const& k_it, Indexable const& indexable) - // { - // area = index::area(k_it->first); - // diff_area = index::union_area(k_it->first, indexable) - area; - // } - - // inline bool operator<(internal_node_areas &a) const - // { - // return diff_area < a.diff_area || - // ( diff_area == a.diff_area && area < a.area ); - // } - - // area_type diff_area; - // area_type area; - //}; }; } // namespace detail diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp new file mode 100644 index 000000000..7210ef6fe --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -0,0 +1,212 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree quadratic split algorithm implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP + +#include + +#include +#include + +#include +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +namespace detail { + +template +struct redistribute_elements +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename index::default_area_result::type area_type; + + template + static inline void apply(Node & n, + Node & second_node, + Box & box1, + Box & box2, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename rtree::elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename index::traits::coordinate_type::type coordinate_type; + + // copy original elements + elements_type elements_copy = rtree::elements_get(n); + + // calculate initial seeds + size_t seed1 = 0; + size_t seed2 = 0; + quadratic::pick_seeds::apply(elements_copy, tr, seed1, seed2); + + // prepare nodes' elements containers + elements_type & elements1 = rtree::elements_get(n); + elements_type & elements2 = rtree::elements_get(second_node); + elements1.clear(); + assert(elements2.empty()); + + // add seeds + elements1.push_back(elements_copy[seed1]); + elements2.push_back(elements_copy[seed2]); + + // calculate boxes + geometry::convert(rtree::element_indexable(elements_copy[seed1], tr), box1); + geometry::convert(rtree::element_indexable(elements_copy[seed2], tr), box2); + + // remove seeds + if (seed1 < seed2) + { + elements_copy.erase(elements_copy.begin() + seed2); + elements_copy.erase(elements_copy.begin() + seed1); + } + else + { + elements_copy.erase(elements_copy.begin() + seed1); + elements_copy.erase(elements_copy.begin() + seed2); + } + + // initialize areas + area_type area1 = index::area(box1); + area_type area2 = index::area(box2); + + size_t remaining = elements_copy.size(); + + // redistribute the rest of the elements + while ( !elements_copy.empty() ) + { + typename elements_type::reverse_iterator el_it = elements_copy.rbegin(); + bool insert_into_group1 = false; + + size_t elements1_count = elements1.size(); + size_t elements2_count = elements2.size(); + + // if there is small number of elements left and the number of elements in node is lesser than min_elems + // just insert them to this node + if ( elements1_count + remaining <= min_elems ) + { + insert_into_group1 = true; + } + else if ( elements2_count + remaining <= min_elems ) + { + insert_into_group1 = false; + } + // insert the best element + else + { + // find element with minimum groups areas increses differences + area_type area_increase1 = 0; + area_type area_increase2 = 0; + el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(), + box1, box2, area1, area2, tr, + area_increase1, area_increase2); + + if ( area_increase1 < area_increase2 || + ( area_increase1 == area_increase2 && area1 < area2 ) || + ( area1 == area2 && elements1_count <= elements2_count ) ) + { + insert_into_group1 = true; + } + else + { + insert_into_group1 = false; + } + } + + // move element to the choosen group + element_type const& elem = *el_it; + indexable_type const& indexable = rtree::element_indexable(elem, tr); + + if ( insert_into_group1 ) + { + elements1.push_back(elem); + geometry::expand(box1, indexable); + area1 = index::area(box1); + } + else + { + elements2.push_back(elem); + geometry::expand(box2, indexable); + area2 = index::area(box2); + } + + assert(!elements_copy.empty()); + elements_copy.erase(--el_it.base()); + + assert(0 < remaining); + --remaining; + } + } + + // sprawdzic szukanie najmniejszego powiekszenia wezla dla grupy1 i grupy2 + + template + static inline It pick_next(It first, It last, + Box const& box1, Box const& box2, + area_type const& area1, area_type const& area2, + Translator const& tr, + area_type & out_area_increase1, area_type & out_area_increase2) + { + typedef typename boost::iterator_value::type element_type; + typedef typename rtree::element_indexable_type::type indexable_type; + + area_type greatest_area_incrase_diff = 0; + It out_it = first; + out_area_increase1 = 0; + out_area_increase2 = 0; + + // find element with greatest difference between increased group's boxes areas + for ( It el_it = first ; el_it != last ; ++el_it ) + { + indexable_type const& indexable = rtree::element_indexable(*el_it, tr); + + // calculate enlarged boxes and areas + Box enlarged_box1(box1); + Box enlarged_box2(box2); + geometry::expand(enlarged_box1, indexable); + geometry::expand(enlarged_box2, indexable); + area_type enlarged_area1 = index::area(enlarged_box1); + area_type enlarged_area2 = index::area(enlarged_box2); + + area_type area_incrase1 = (enlarged_area1 - area1); + area_type area_incrase2 = (enlarged_area2 - area2); + + area_type area_incrase_diff = area_incrase1 < area_incrase2 ? + area_incrase2 - area_incrase1 : area_incrase1 - area_incrase2; + + if ( greatest_area_incrase_diff < area_incrase_diff ) + { + greatest_area_incrase_diff = area_incrase_diff; + out_it = el_it; + out_area_increase1 = area_incrase1; + out_area_increase2 = area_incrase2; + } + } + + return out_it; + } +}; + +} // namespace detail + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index 972f570e5..6ed2c7920 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -17,7 +17,6 @@ struct rstar_tag {}; }}} // namespace boost::geometry::index #include - -#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index decfe5f48..88a34af59 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -21,10 +21,7 @@ #include #include - #include - -// TODO: awulkiew - correct implementation //#include namespace boost { namespace geometry { namespace index { diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 958170ba7..fadcc6774 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -6,7 +6,7 @@ #include #include -#include +//#include int main() { @@ -19,6 +19,7 @@ int main() typedef bg::model::box

B; typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; //typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; + //typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; std::ifstream file_cfg("config.txt"); size_t max_elems = 4; @@ -60,7 +61,7 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } - if ( save_ch == 's' ) + /*if ( save_ch == 's' ) { std::cout << "saving...\n"; std::ofstream file("save_new.txt", std::ofstream::trunc); @@ -73,7 +74,7 @@ int main() > saving_v(file, t.get_translator()); t.apply_visitor(saving_v); std::cout << "saved...\n"; - } + }*/ { std::cout << "searching time test...\n"; From 9ca18483228827a8a9a37d8c4900b5ae8fba23ff Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 May 2011 10:59:49 +0000 Subject: [PATCH 022/366] polymorphic node type added and used as default [SVN r71915] --- .../rtree/linear/redistribute_elements.hpp | 6 +- .../geometry/extensions/index/rtree/node.hpp | 152 ++------------ .../extensions/index/rtree/node/node_poly.hpp | 197 ++++++++++++++++++ .../index/rtree/node/node_variant.hpp | 176 ++++++++++++++++ .../rtree/quadratic/redistribute_elements.hpp | 8 +- .../index/rtree/rstar/choose_next_node.hpp | 109 +++++----- .../rtree/rstar/redistribute_elements.hpp | 8 +- .../geometry/extensions/index/rtree/rtree.hpp | 14 +- .../index/rtree/visitors/are_boxes_ok.hpp | 50 +++-- .../index/rtree/visitors/destroy.hpp | 10 +- .../extensions/index/rtree/visitors/find.hpp | 8 +- .../index/rtree/visitors/gl_draw.hpp | 8 +- .../index/rtree/visitors/insert.hpp | 48 ++--- .../index/rtree/visitors/is_leaf.hpp | 12 +- .../extensions/index/rtree/visitors/load.hpp | 111 ---------- .../extensions/index/rtree/visitors/print.hpp | 8 +- .../index/rtree/visitors/remove.hpp | 32 +-- .../extensions/index/rtree/visitors/save.hpp | 103 --------- tests/additional_sizes_and_times.cpp | 37 ++-- 19 files changed, 561 insertions(+), 536 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node/node_poly.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/node/node_variant.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/visitors/load.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/visitors/save.hpp diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index cbbc197b2..cdd9eacec 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -195,7 +195,7 @@ struct redistribute_elements typedef typename index::default_area_result::type area_type; // copy original elements - elements_type elements_copy = rtree::elements_get(n); + elements_type elements_copy = rtree::elements(n); size_t elements_count = elements_copy.size(); // calculate initial seeds @@ -204,8 +204,8 @@ struct redistribute_elements linear::pick_seeds::apply(elements_copy, tr, seed1, seed2); // prepare nodes' elements containers - elements_type & elements1 = rtree::elements_get(n); - elements_type & elements2 = rtree::elements_get(second_node); + elements_type & elements1 = rtree::elements(n); + elements_type & elements2 = rtree::elements(second_node); elements1.clear(); assert(elements2.empty()); diff --git a/include/boost/geometry/extensions/index/rtree/node.hpp b/include/boost/geometry/extensions/index/rtree/node.hpp index a151134b5..93d67355c 100644 --- a/include/boost/geometry/extensions/index/rtree/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R-tree default nodes +// Boost.Index - R-tree nodes // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, @@ -10,62 +10,21 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP -#include -#include +#ifndef BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES + +#include + +#else + +#include + +#endif // BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { -template -struct node; - -// nodes default types - -template -struct internal_node_def -{ - typedef std::vector< - std::pair< - Box, - typename node::type * - > - > elements_type; - - elements_type elements; -}; - -template -struct leaf_def -{ - typedef std::vector elements_type; - elements_type elements; -}; - -// nodes traits - -template -struct node -{ - typedef boost::variant< - leaf_def, - internal_node_def - > type; -}; - -template -struct internal_node -{ - typedef internal_node_def type; -}; - -template -struct leaf -{ - typedef leaf_def type; -}; - -// nodes elements extractor +// nodes elements template struct elements_type @@ -74,67 +33,24 @@ struct elements_type }; template -typename elements_type::type & -elements_get(Node & n) +inline typename elements_type::type & +elements(Node & n) { return n.elements; } template -typename elements_type::type const& -elements_get(Node const& n) +inline typename elements_type::type const& +elements(Node const& n) { return n.elements; } -//template -//struct element_type -//{ -// typedef typename elements_type::type::value_type type; -//}; - -// uniform indexable type for child node element's box and value's indexable - -template -struct element_indexable_type -{ - typedef typename Translator::indexable_type type; -}; - -template -struct element_indexable_type< - std::pair< - Box, - boost::variant< - leaf_def, - internal_node_def - > * - >, - Translator -> -{ - typedef Box type; -}; - // uniform indexable getter for child node element's box and value's indexable - -template -Box const& -element_indexable( - std::pair< - Box, - boost::variant< - leaf_def, - internal_node_def - > * - > const& el, - Translator const&) -{ - return el.first; -} +// value's indexable version template -typename Translator::indexable_type const& +inline typename Translator::indexable_type const& element_indexable(Value const& el, Translator const& tr) { return tr(el); @@ -162,40 +78,6 @@ inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) return result; } -// create leaf node - -template -typename node::type * -create_node(leaf_def const& l) -{ - typedef typename node::type node; - node * n = new node(l); - return n; -} - -// create internal node - -template -typename node::type * -create_node(internal_node_def const& in) -{ - typedef typename node::type node; - node * n = new node(in); - return n; -} - -// default node - -template -void delete_node( - boost::variant< - leaf_def, - internal_node_def - > * n) -{ - delete n; -} - }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/node/node_poly.hpp b/include/boost/geometry/extensions/index/rtree/node/node_poly.hpp new file mode 100644 index 000000000..7f9d2022d --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/node_poly.hpp @@ -0,0 +1,197 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree polymorphic nodes +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +// visitor forward declaration +template +struct visitor_poly; + +// nodes types + +template +struct node_poly +{ + virtual ~node_poly() {} + virtual void apply_visitor(visitor_poly &) = 0; + virtual void apply_visitor(visitor_poly &) const = 0; +}; + +template +struct internal_node_poly : public node_poly +{ + typedef std::vector< + std::pair *> + > elements_type; + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } + + elements_type elements; +}; + +template +struct leaf_poly : public node_poly +{ + typedef std::vector elements_type; + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } + + elements_type elements; +}; + +// nodes traits + +template +struct node +{ + typedef node_poly type; +}; + +template +struct internal_node +{ + typedef internal_node_poly type; +}; + +template +struct leaf +{ + typedef leaf_poly type; +}; + +// nodes conversion + +template +inline Derived & get(node_poly & n) +{ + assert(dynamic_cast(&n)); + return dynamic_cast(n); +} + +template +inline Derived * get(node_poly * n) +{ + assert(dynamic_cast(n)); + return dynamic_cast(n); +} + +// visitor + +template +struct visitor_poly +{ + typedef typename internal_node::type internal_node; + typedef typename leaf::type leaf; + + virtual ~visitor_poly() {} + + virtual void operator()(internal_node const&) = 0; + virtual void operator()(leaf const&) = 0; +}; + +template +struct visitor_poly +{ + typedef typename internal_node::type internal_node; + typedef typename leaf::type leaf; + + virtual ~visitor_poly() {} + + virtual void operator()(internal_node &) = 0; + virtual void operator()(leaf &) = 0; +}; + +// visitor traits + +template +struct visitor +{ + typedef visitor_poly type; +}; + +template +inline void apply_visitor(Visitor &v, Visitable & n) +{ + n.apply_visitor(v); +} + +// uniform indexable for child node element's box and value's indexable + +// value's indexable version + +template +struct element_indexable_type +{ + typedef typename Translator::indexable_type type; +}; + +// node element's indexable specialization + +template +struct element_indexable_type< + std::pair *>, + Translator +> +{ + typedef Box type; +}; + +template +inline Box const& +element_indexable( + std::pair< Box, node_poly *> const& el, + Translator const&) +{ + return el.first; +} + +// create leaf node + +template +inline typename node::type * + create_node(leaf_poly const& l) +{ + typedef typename node::type node; + node * n = new leaf_poly(l); + return n; +} + +// create internal node + +template +inline typename node::type * + create_node(internal_node_poly const& in) +{ + typedef typename node::type node; + node * n = new internal_node_poly(in); + return n; +} + +// default node + +template +inline void delete_node(node_poly * n) +{ + delete n; +} + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_variant.hpp new file mode 100644 index 000000000..4a73da430 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/node_variant.hpp @@ -0,0 +1,176 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree variant nodes +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +struct node; + +// nodes default types + +template +struct internal_node_variant +{ + typedef std::vector< + std::pair< + Box, + typename node::type * + > + > elements_type; + + elements_type elements; +}; + +template +struct leaf_variant +{ + typedef std::vector elements_type; + elements_type elements; +}; + +// nodes traits + +template +struct node +{ + typedef boost::variant< + leaf_variant, + internal_node_variant + > type; +}; + +template +struct internal_node +{ + typedef internal_node_variant type; +}; + +template +struct leaf +{ + typedef leaf_variant type; +}; + +// nodes conversion + +template +inline V & get(Variant &v) +{ + return boost::get(v); +} + +template +inline V * get(Variant *v) +{ + return boost::get(v); +} + +// visitor traits + +template +struct visitor +{ + typedef static_visitor<> type; +}; + +template +inline void apply_visitor(Visitor &v, Visitable &n) +{ + boost::apply_visitor(v, n); +} + +// uniform indexable for child node element's box and value's indexable + +// value's indexable version + +template +struct element_indexable_type +{ + typedef typename Translator::indexable_type type; +}; + +// node element's indexable specialization + +template +struct element_indexable_type< + std::pair< + Box, + boost::variant< + leaf_variant, + internal_node_variant + > * + >, + Translator +> +{ + typedef Box type; +}; + +template +inline Box const& +element_indexable( + std::pair< + Box, + boost::variant< + leaf_variant, + internal_node_variant + > * + > const& el, + Translator const&) +{ + return el.first; +} + +// create leaf node + +template +inline typename node::type * +create_node(leaf_variant const& l) +{ + typedef typename node::type node; + node * n = new node(l); + return n; +} + +// create internal node + +template +inline typename node::type * +create_node(internal_node_variant const& in) +{ + typedef typename node::type node; + node * n = new node(in); + return n; +} + +// default node + +template +inline void delete_node( + boost::variant< + leaf_variant, + internal_node_variant + > * n) +{ + delete n; +} + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 901ff758d..8d2b43d58 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -99,7 +99,7 @@ struct redistribute_elements typedef typename index::traits::coordinate_type::type coordinate_type; // copy original elements - elements_type elements_copy = rtree::elements_get(n); + elements_type elements_copy = rtree::elements(n); // calculate initial seeds size_t seed1 = 0; @@ -107,8 +107,8 @@ struct redistribute_elements quadratic::pick_seeds::apply(elements_copy, tr, seed1, seed2); // prepare nodes' elements containers - elements_type & elements1 = rtree::elements_get(n); - elements_type & elements2 = rtree::elements_get(second_node); + elements_type & elements1 = rtree::elements(n); + elements_type & elements2 = rtree::elements(second_node); elements1.clear(); assert(elements2.empty()); @@ -204,7 +204,7 @@ struct redistribute_elements } } - // sprawdzic szukanie najmniejszego powiekszenia wezla dla grupy1 i grupy2 + // TODO: awulkiew - change following function to static member of the pick_next class? template static inline It pick_next(It first, It last, diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index b5f14f152..a3009d4e7 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -43,81 +43,68 @@ public: template static inline size_t apply(internal_node & n, Indexable const& indexable) { - children_type & children = rtree::elements_get(n); + children_type & children = rtree::elements(n); assert(!children.empty()); - bool has_leaves = boost::apply_visitor( - visitors::is_leaf(), - *children.front().second); + visitors::is_leaf ilv; + rtree::apply_visitor(ilv, *children.front().second); - if ( has_leaves ) - return branch_impl(n, indexable); + if ( ilv.result ) + return choose_by_minimum_overlap_cost(children, indexable); else - return internal_node_impl(n, indexable); + return choose_by_minimum_area_cost(children, indexable); } private: template - static inline size_t branch_impl(internal_node & n, Indexable const& indexable) + static inline size_t choose_by_minimum_overlap_cost(children_type const& children, Indexable const& indexable) { - children_type & children = rtree::elements_get(n); size_t children_count = children.size(); - // overlaps values of all nodes' boxes, - // overlaps and areas of extended boxes are stored at indexes i + children_count - std::vector overlaps(children_count * 2, overlap_type(0)); - std::vector areas(children_count * 2); - // caculate overlaps and areas of all nodes' boxes + // choose index with smallest overlap change value, or area change or smallest area + size_t choosen_index = 0; + overlap_type smallest_overlap_diff = std::numeric_limits::max(); + area_type smallest_area_diff = std::numeric_limits::max(); + area_type smallest_area = std::numeric_limits::max(); + + // for each child node for (size_t i = 0 ; i < children_count ; ++i ) { typedef typename children_type::value_type child_type; child_type const& ch_i = children[i]; - Box ch_ext; + Box box_exp(ch_i.first); // calculate expanded box fo node ch_i - geometry::convert(ch_i.first, ch_ext); - geometry::expand(ch_ext, indexable); + geometry::expand(box_exp, indexable); - areas[i] = index::area(ch_i.first); - areas[i + children_count] = index::area(ch_ext); + // calculate area and area diff + area_type area = index::area(ch_i.first); + area_type area_diff = index::area(box_exp) - area; - for (size_t j = i + 1 ; j < children_count ; ++j ) + overlap_type overlap = 0; + overlap_type overlap_exp = 0; + + // calculate overlap + for ( size_t j = 0 ; j < children_count ; ++j ) { - child_type const& ch_j = children[j]; - - // add overlap of both boxes - overlap_type ovl = index::overlap(ch_i.first, ch_j.first); - overlaps[i] += ovl; - overlaps[j] += ovl; + if ( i != j ) + { + child_type const& ch_j = children[j]; - // add overlap of expanded box i and box j - overlaps[i + children_count] = index::overlap(ch_ext, ch_j.first); - - // add overlap of expanded box j and box i - geometry::convert(ch_j.first, ch_ext); - geometry::expand(ch_ext, indexable); - overlaps[j + children_count] = index::overlap(ch_ext, ch_i.first); + overlap += index::overlap(ch_i.first, ch_j.first); + overlap_exp += index::overlap(box_exp, ch_j.first); + } } - } - // choose index with smallest overlap change value, or area change or smallest area - size_t choosen_index = 0; - overlap_type smallest_overlap_change = std::numeric_limits::max(); - area_type smallest_area_change = std::numeric_limits::max(); - area_type smallest_area = std::numeric_limits::max(); + overlap_type overlap_diff = overlap_exp - overlap; - for ( size_t i = 0 ; i < children_count ; ++i ) - { - overlap_type overlap_change = overlaps[i + children_count] - overlaps[i]; - area_type area_change = areas[i + children_count] - areas[i]; - area_type area = areas[i + children_count]; - - if ( overlap_change < smallest_overlap_change || - ( overlap_change == smallest_overlap_change && area_change < smallest_area_change ) || - ( area_change == smallest_area_change && smallest_area < area ) ) + // update result + if ( overlap_diff < smallest_overlap_diff || + ( overlap_diff == smallest_overlap_diff && area_diff < smallest_area_diff ) || + ( area_diff == smallest_area_diff && area < smallest_area ) ) { - smallest_overlap_change = overlap_change; - smallest_area_change = area_change; + smallest_overlap_diff = overlap_diff; + smallest_area_diff = area_diff; smallest_area = area; choosen_index = i; } @@ -127,14 +114,13 @@ private: } template - static inline size_t internal_node_impl(internal_node & n, Indexable const& indexable) + static inline size_t choose_by_minimum_area_cost(children_type const& children, Indexable const& indexable) { - children_type & children = rtree::elements_get(n); size_t children_count = children.size(); // choose index with smallest area change or smallest area size_t choosen_index = 0; - area_type smallest_area_change = std::numeric_limits::max(); + area_type smallest_area_diff = std::numeric_limits::max(); area_type smallest_area = std::numeric_limits::max(); // caculate areas and areas of all nodes' boxes @@ -143,17 +129,16 @@ private: typedef typename children_type::value_type child_type; child_type const& ch_i = children[i]; - Box ch_exp; - geometry::convert(ch_i.first, ch_exp); - geometry::expand(ch_exp, indexable); + Box box_exp(ch_i.first); + geometry::expand(box_exp, indexable); - area_type area = index::area(ch_exp); - area_type area_change = area - index::area(ch_i.first); - - if ( area_change < smallest_area_change || - ( area_change == smallest_area_change && smallest_area < area ) ) + area_type area = index::area(box_exp); + area_type area_diff = area - index::area(ch_i.first); + + if ( area_diff < smallest_area_diff || + ( area_diff == smallest_area_diff && area < smallest_area ) ) { - smallest_area_change = area_change; + smallest_area_diff = area_diff; smallest_area = area; choosen_index = i; } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 7210ef6fe..36dadd9bc 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -49,7 +49,7 @@ struct redistribute_elements typedef typename index::traits::coordinate_type::type coordinate_type; // copy original elements - elements_type elements_copy = rtree::elements_get(n); + elements_type elements_copy = rtree::elements(n); // calculate initial seeds size_t seed1 = 0; @@ -57,8 +57,8 @@ struct redistribute_elements quadratic::pick_seeds::apply(elements_copy, tr, seed1, seed2); // prepare nodes' elements containers - elements_type & elements1 = rtree::elements_get(n); - elements_type & elements2 = rtree::elements_get(second_node); + elements_type & elements1 = rtree::elements(n); + elements_type & elements2 = rtree::elements(second_node); elements1.clear(); assert(elements2.empty()); @@ -154,8 +154,6 @@ struct redistribute_elements } } - // sprawdzic szukanie najmniejszego powiekszenia wezla dla grupy1 i grupy2 - template static inline It pick_next(It first, It last, Box const& box1, Box const& box2, diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 88a34af59..66755d992 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -22,7 +22,7 @@ #include #include -//#include +#include namespace boost { namespace geometry { namespace index { @@ -67,7 +67,7 @@ public: ~rtree() { detail::rtree::visitors::destroy del_v; - boost::apply_visitor(del_v, *m_root); + detail::rtree::apply_visitor(del_v, *m_root); } // TODO: awulkiew - change name to query? @@ -78,7 +78,7 @@ public: detail::rtree::visitors::find find_v(m_translator, geom, out_it); - boost::apply_visitor(find_v, *m_root); + detail::rtree::apply_visitor(find_v, *m_root); } void insert(value_type const& value) @@ -88,7 +88,7 @@ public: detail::rtree::visitors::insert insert_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); - boost::apply_visitor(insert_v, *m_root); + detail::rtree::apply_visitor(insert_v, *m_root); ++m_values_count; } @@ -101,7 +101,7 @@ public: detail::rtree::visitors::remove remove_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); - boost::apply_visitor(remove_v, *m_root); + detail::rtree::apply_visitor(remove_v, *m_root); --m_values_count; } @@ -124,9 +124,9 @@ public: } template - typename Visitor::result_type apply_visitor(Visitor & visitor) const + void apply_visitor(Visitor & visitor) const { - return boost::apply_visitor(visitor, *m_root); + detail::rtree::apply_visitor(visitor, *m_root); } translator_type const& get_translator() const diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index e87a16d55..c22cee550 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -18,23 +18,26 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -class are_boxes_ok : public boost::static_visitor +class are_boxes_ok : public rtree::visitor::type { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; public: inline are_boxes_ok(Translator const& tr) - : m_tr(tr), m_is_root(true) + : result(false), m_tr(tr), m_is_root(true) {} - inline bool operator()(internal_node const& n) + inline void operator()(internal_node const& n) { typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); if (elements.empty()) - return false; + { + result = false; + return; + } Box box_bckup = m_box; bool is_root_bckup = m_is_root; @@ -46,43 +49,50 @@ public: { m_box = it->first; - if ( false == boost::apply_visitor(*this, *it->second) ) - return false; + rtree::apply_visitor(*this, *it->second); + + if ( result == false ) + return; } m_box = box_bckup; m_is_root = is_root_bckup; - Box result; - geometry::convert(elements.front().first, result); + Box box_exp; + geometry::convert(elements.front().first, box_exp); for( typename elements_type::const_iterator it = elements.begin() + 1; it != elements.end() ; ++it) { - geometry::expand(result, it->first); + geometry::expand(box_exp, it->first); } - return m_is_root || geometry::equals(result, m_box); + result = m_is_root || geometry::equals(box_exp, m_box); } - inline bool operator()(leaf const& n) + inline void operator()(leaf const& n) { typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); if (elements.empty()) - return false; + { + result = false; + return; + } - Box result; - geometry::convert(m_tr(elements.front()), result); + Box box_exp; + geometry::convert(m_tr(elements.front()), box_exp); for(typename elements_type::const_iterator it = elements.begin() + 1; it != elements.end() ; ++it) { - geometry::expand(result, m_tr(*it)); + geometry::expand(box_exp, m_tr(*it)); } - return m_is_root || geometry::equals(result, m_box); + result = m_is_root || geometry::equals(box_exp, m_box); } + bool result; + private: Translator const& m_tr; Box m_box; @@ -101,7 +111,9 @@ bool are_boxes_ok(rtree const& tree) typename rt::box_type, typename rt::tag_type> v(tree.get_translator()); - return tree.apply_visitor(v); + tree.apply_visitor(v); + + return v.result; } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index b4229ee82..111d82352 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -17,26 +17,26 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -struct destroy : public boost::static_visitor<> +struct destroy : public rtree::visitor::type { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - inline void operator()(internal_node & n) const + inline void operator()(internal_node & n) { typedef typename rtree::elements_type::type elements_type; - elements_type & elements = rtree::elements_get(n); + elements_type & elements = rtree::elements(n); for (typename elements_type::iterator it = elements.begin(); it != elements.end(); ++it) { - boost::apply_visitor(*this, *it->second); + rtree::apply_visitor(*this, *it->second); rtree::delete_node(it->second); } } - inline void operator()(leaf & n) const + inline void operator()(leaf &) { } }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 8d00a9e08..e3c88abdb 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -143,7 +143,7 @@ namespace detail { namespace rtree { namespace visitors { // rtree spatial query visitor template -struct find : public boost::static_visitor<> +struct find : public rtree::visitor::type { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -194,20 +194,20 @@ struct find : public boost::static_visitor<> //} typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { if ( geometry::intersects(it->first, geom) ) - boost::apply_visitor(*this, *it->second); + rtree::apply_visitor(*this, *it->second); } } inline void operator()(leaf const& n) { typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) 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 bae32690e..38278e4bc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -95,7 +95,7 @@ inline void gl_draw_indexable(Indexable const& i, typename index::traits::coordi } // namespace detail template -struct gl_draw : public boost::static_visitor<> +struct gl_draw : public rtree::visitor::type { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -115,7 +115,7 @@ struct gl_draw : public boost::static_visitor<> inline void operator()(internal_node const& n) { typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); if ( level_f <= level ) { @@ -151,7 +151,7 @@ struct gl_draw : public boost::static_visitor<> for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - boost::apply_visitor(*this, *it->second); + rtree::apply_visitor(*this, *it->second); } } @@ -161,7 +161,7 @@ struct gl_draw : public boost::static_visitor<> inline void operator()(leaf const& n) { typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); if ( level_f <= level ) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 928f33ade..a5185cea8 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -35,7 +35,7 @@ struct choose_next_node template static inline size_t apply(internal_node & n, Indexable const& indexable) { - children_type & children = rtree::elements_get(n); + children_type & children = rtree::elements(n); assert(!children.empty()); @@ -96,7 +96,7 @@ struct split Translator const& tr) { node * second_node = rtree::create_node(Node()); - Node & n2 = boost::get(*second_node); + Node & n2 = rtree::get(*second_node); // redistribute elements Box box1, box2; @@ -104,27 +104,27 @@ struct split apply(n, n2, box1, box2, min_elems, max_elems, tr); // check numbers of elements - assert(min_elems <= rtree::elements_get(n).size() && rtree::elements_get(n).size() <= max_elems); - assert(min_elems <= rtree::elements_get(n2).size() && rtree::elements_get(n2).size() <= max_elems); + assert(min_elems <= rtree::elements(n).size() && rtree::elements(n).size() <= max_elems); + assert(min_elems <= rtree::elements(n2).size() && rtree::elements(n2).size() <= max_elems); // node is not the root if ( parent != 0 ) { // update old node's box - rtree::elements_get(*parent)[current_child_index].first = box1; + rtree::elements(*parent)[current_child_index].first = box1; // add new node to the parent's children - rtree::elements_get(*parent).push_back(std::make_pair(box2, second_node)); + rtree::elements(*parent).push_back(std::make_pair(box2, second_node)); } // node is the root else { - assert(&n == boost::get(root)); + assert(&n == rtree::get(root)); // create new root and add nodes node * new_root = rtree::create_node(internal_node()); - rtree::elements_get(boost::get(*new_root)).push_back(std::make_pair(box1, root)); - rtree::elements_get(boost::get(*new_root)).push_back(std::make_pair(box2, second_node)); + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, root)); + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); root = new_root; } @@ -155,7 +155,7 @@ struct overflow_treatment // Default insert visitor template -class insert : public boost::static_visitor<> +class insert : public rtree::visitor::type { public: typedef typename rtree::node::type node; @@ -183,22 +183,6 @@ public: // assert - check if Box is correct } - inline void operator()(internal_node & n) - { - // traverse - traverse(*this, n); - - post_traverse(n); - } - - inline void operator()(leaf & n) - { - // push value - rtree::elements_get(n).push_back(m_element); - - post_traverse(n); - } - protected: template inline void traverse(Visitor & visitor, internal_node & n) @@ -209,7 +193,7 @@ protected: // expand the node to contain value geometry::expand( - rtree::elements_get(n)[choosen_node_index].first, + rtree::elements(n)[choosen_node_index].first, rtree::element_indexable(m_element, m_tr)); // next traversing step @@ -222,7 +206,7 @@ protected: inline void post_traverse(Node &n) { // handle overflow - if ( m_max_elems_per_node < rtree::elements_get(n).size() ) + if ( m_max_elems_per_node < rtree::elements(n).size() ) { detail::overflow_treatment:: apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); @@ -242,7 +226,7 @@ protected: ++m_current_level; // next traversing step - boost::apply_visitor(visitor, *rtree::elements_get(n)[choosen_node_index].second); + rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // restore previous traverse inputs m_parent = parent_bckup; @@ -297,13 +281,13 @@ struct insert : public detail::insert assert( base::m_level == base::m_current_level ); // push new child node - rtree::elements_get(n).push_back(base::m_element); + rtree::elements(n).push_back(base::m_element); } base::post_traverse(n); } - inline void operator()(leaf & n) + inline void operator()(leaf &) { assert(false); } @@ -343,7 +327,7 @@ struct insert : public detail::insert::max() ); - rtree::elements_get(n).push_back(base::m_element); + rtree::elements(n).push_back(base::m_element); base::post_traverse(n); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index ef8a65249..e637ae6fb 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -17,20 +17,22 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -struct is_leaf : public boost::static_visitor +struct is_leaf : public rtree::visitor::type { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - inline bool operator()(internal_node const&) const + inline void operator()(internal_node const&) { - return false; + result = false; } - inline bool operator()(leaf const&) const + inline void operator()(leaf const&) { - return true; + result = true; } + + bool result; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/visitors/load.hpp b/include/boost/geometry/extensions/index/rtree/visitors/load.hpp deleted file mode 100644 index ffbedffa9..000000000 --- a/include/boost/geometry/extensions/index/rtree/visitors/load.hpp +++ /dev/null @@ -1,111 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R-tree loading visitor -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_LOAD_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_LOAD_HPP - -#include - -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace visitors { - -template -struct load; - -template -struct load< - std::pair< - boost::geometry::model::box< - boost::geometry::model::point - >, - size_t - >, - typename Translator, - Box, - Tag -> -: public boost::static_visitor<> -{ - typedef boost::geometry::model::point point_type; - - typedef std::pair< - boost::geometry::model::box< - point_type - >, - size_t - > value_type; - - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - inline load(std::istream & i, Translator const& t) - : is(i), tr(t) - {} - - inline void operator()(internal_node & n) - { - std::string node_type; - float min_x, min_y, max_x, max_y; - size_t c; - - is >> node_type; - is >> min_x; - is >> min_y; - is >> max_x; - is >> max_y; - is >> c; - - Box b(point_type(min_x, min_y), point_type(max_x, max_y)); - node * new_n = 0; - - if ( node_type == "i" ) - new_n = rtree::create_node(internal_node()); - else if ( node_type == "l" ) - new_n = rtree::create_node(leaf()); - else - assert(0); - - n.children.push_back(std::make_pair(b, new_n)); - - for ( size_t i = 0 ; i < c ; ++i ) - boost::apply_visitor(*this, *new_n); - } - - inline void operator()(leaf & n) - { - std::string node_type; - float min_x, min_y, max_x, max_y; - size_t id; - - is >> node_type; - is >> min_x; - is >> min_y; - is >> max_x; - is >> max_y; - is >> id; - - assert(id == "v"); - - Box b(point_type(min_x, min_y), point_type(max_x, max_y)); - n.values.push_back(std::make_pair(b, id)); - } - - std::istream & is; - Translator const& tr; -}; - -}}} // namespace detail::rtree::visitors - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_LOAD_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index e39be12ae..933b86851 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -114,7 +114,7 @@ inline void print_indexable(std::ostream & os, Indexable const& i) } // namespace detail template -struct print : public boost::static_visitor<> +struct print : public rtree::visitor::type { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -126,7 +126,7 @@ struct print : public boost::static_visitor<> inline void operator()(internal_node const& n) { typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); spaces(level) << "INTERNAL NODE - L:" << level << " Ch:" << elements.size() << " @:" << &n << '\n'; @@ -144,7 +144,7 @@ struct print : public boost::static_visitor<> for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - boost::apply_visitor(*this, *it->second); + rtree::apply_visitor(*this, *it->second); } level = level_backup; @@ -153,7 +153,7 @@ struct print : public boost::static_visitor<> inline void operator()(leaf const& n) { typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements_get(n); + elements_type const& elements = rtree::elements(n); spaces(level) << "LEAF - L:" << level << " V:" << elements.size() << " @:" << &n << '\n'; for (typename elements_type::const_iterator it = elements.begin(); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index fb4f95121..623132356 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -20,7 +20,7 @@ namespace detail { namespace rtree { namespace visitors { // Default remove algorithm template -class remove : public boost::static_visitor<> +class remove : public rtree::visitor::type { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -46,7 +46,7 @@ public: inline void operator()(internal_node & n) { typedef typename rtree::elements_type::type children_type; - children_type & children = rtree::elements_get(n); + children_type & children = rtree::elements(n); // traverse children which boxes intersects value's box size_t child_node_index = 0; @@ -69,7 +69,7 @@ public: { typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::iterator element_iterator; - elements_type & elements = rtree::elements_get(n); + elements_type & elements = rtree::elements(n); // underflow occured - child node should be removed if ( m_is_underflow ) @@ -91,14 +91,14 @@ public: // note that there may be less than min_elems elements in root assert((elements.size() < m_min_elems_per_node) == m_is_underflow); - rtree::elements_get(*m_parent)[m_current_child_index].first + rtree::elements(*m_parent)[m_current_child_index].first = rtree::elements_box(elements.begin(), elements.end(), m_tr); } // n is root node else { // current node must be a root - assert(&n == boost::get(m_root_node)); + assert(&n == rtree::get(m_root_node)); // value not found assert(m_is_value_removed); @@ -108,16 +108,18 @@ public: for ( typename std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); it != m_underflowed_nodes.rend() ; ++it ) { - if ( boost::apply_visitor(is_leaf(), *it->second) ) - reinsert_elements(boost::get(*it->second), it->first); + is_leaf ilv; + rtree::apply_visitor(ilv, *it->second); + if ( ilv.result ) + reinsert_elements(rtree::get(*it->second), it->first); else - reinsert_elements(boost::get(*it->second), it->first); + reinsert_elements(rtree::get(*it->second), it->first); } // shorten the tree - if ( rtree::elements_get(n).size() == 1 ) + if ( rtree::elements(n).size() == 1 ) { - m_root_node = rtree::elements_get(n)[0].second; + m_root_node = rtree::elements(n)[0].second; } } } @@ -126,7 +128,7 @@ public: inline void operator()(leaf & n) { typedef typename rtree::elements_type::type elements_type; - elements_type & elements = rtree::elements_get(n); + elements_type & elements = rtree::elements(n); // find value and remove it for ( typename elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it ) @@ -148,7 +150,7 @@ public: // n is not root - adjust aabb if ( 0 != m_parent ) { - rtree::elements_get(*m_parent)[m_current_child_index].first + rtree::elements(*m_parent)[m_current_child_index].first = rtree::elements_box(elements.begin(), elements.end(), m_tr); } } @@ -167,7 +169,7 @@ private: ++m_current_level; // next traversing step - boost::apply_visitor(*this, *rtree::elements_get(n)[choosen_node_index].second); + rtree::apply_visitor(*this, *rtree::elements(n)[choosen_node_index].second); // restore previous traverse inputs m_parent = parent_bckup; @@ -179,7 +181,7 @@ private: void reinsert_elements(Node &n, size_t level) { typedef typename rtree::elements_type::type elements_type; - elements_type & elements = rtree::elements_get(n); + elements_type & elements = rtree::elements(n); for ( typename elements_type::iterator it = elements.begin(); it != elements.end() ; ++it ) { @@ -191,7 +193,7 @@ private: m_tr, level); - boost::apply_visitor(insert_v, *m_root_node); + rtree::apply_visitor(insert_v, *m_root_node); } } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/save.hpp b/include/boost/geometry/extensions/index/rtree/visitors/save.hpp deleted file mode 100644 index 156d83a69..000000000 --- a/include/boost/geometry/extensions/index/rtree/visitors/save.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R-tree saving visitor -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SAVE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SAVE_HPP - -#include - -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace visitors { - -template -struct save; - -template -struct save< - std::pair< - boost::geometry::model::box< - boost::geometry::model::point - >, - size_t - >, - Translator, - Box, - Tag -> -: public boost::static_visitor<> -{ - typedef boost::geometry::model::point point_type; - - typedef std::pair< - boost::geometry::model::box< - point_type - >, - size_t - > value_type; - - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - inline save(std::ostream & o, Translator const& t) - : os(o), tr(t) - {} - - inline void operator()(internal_node & n) - { - typedef typename rtree::elements_type::type elements_type; - elements_type & elements = rtree::elements_get(n); - - os << elements.size() << '\n'; - - for ( size_t i = 0 ; i < elements.size() ; ++i ) - { - if ( boost::apply_visitor(visitors::is_leaf(), *(elements[i].second)) ) - os << "l "; - else - os << "i "; - os << geometry::get(elements[i].first) << ' '; - os << geometry::get(elements[i].first) << ' '; - os << geometry::get(elements[i].first) << ' '; - os << geometry::get(elements[i].first) << ' '; - - boost::apply_visitor(*this, *(elements[i].second)); - } - } - - inline void operator()(leaf & n) - { - typedef typename rtree::elements_type::type elements_type; - elements_type & elements = rtree::elements_get(n); - - os << elements.size() << '\n'; - - for ( size_t i = 0 ; i < elements.size() ; ++i ) - { - os << "v "; - os << geometry::get(elements[i].first) << ' '; - os << geometry::get(elements[i].first) << ' '; - os << geometry::get(elements[i].first) << ' '; - os << geometry::get(elements[i].first) << ' '; - os << elements[i].second << '\n'; - } - } - - std::ostream & os; - Translator const& tr; -}; - -}}} // namespace detail::rtree::visitors - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SAVE_HPP diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index fadcc6774..ce9348af8 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -1,13 +1,14 @@ +//#define BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES #include +#include + #include #include #include #include -//#include - int main() { boost::timer tim; @@ -17,9 +18,9 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; - typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; + //typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; //typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; - //typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; + typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; std::ifstream file_cfg("config.txt"); size_t max_elems = 4; @@ -61,20 +62,10 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } - /*if ( save_ch == 's' ) - { - std::cout << "saving...\n"; - std::ofstream file("save_new.txt", std::ofstream::trunc); - file << std::fixed; - bgi::detail::rtree::visitors::save< - RT::value_type, - RT::translator_type, - RT::box_type, - RT::tag_type - > saving_v(file, t.get_translator()); - t.apply_visitor(saving_v); - std::cout << "saved...\n"; - }*/ + if ( bgi::are_boxes_ok(t) ) + std::cout << "BOXES OK\n"; + else + std::cout << "WRONG BOXES\n"; { std::cout << "searching time test...\n"; @@ -106,6 +97,11 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } + if ( bgi::are_boxes_ok(t) ) + std::cout << "BOXES OK\n"; + else + std::cout << "WRONG BOXES\n"; + { std::cout << "searching time test...\n"; tim.restart(); @@ -136,6 +132,11 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } + if ( bgi::are_boxes_ok(t) ) + std::cout << "BOXES OK\n"; + else + std::cout << "WRONG BOXES\n"; + { std::cout << "searching time test...\n"; tim.restart(); From dd6447f6abeece4a5d5dee2f9302bc7e170ef510 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 May 2011 11:04:31 +0000 Subject: [PATCH 023/366] comment added [SVN r71916] --- tests/additional_sizes_and_times.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index ce9348af8..e2bf02487 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -18,9 +18,9 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; - //typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; + typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; //typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; - typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; + //typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; std::ifstream file_cfg("config.txt"); size_t max_elems = 4; From 0465fa31b94f76638861ab4ba7c9c7d195fc44cf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 May 2011 19:16:46 +0000 Subject: [PATCH 024/366] example program improved [SVN r71926] --- .../index/rtree/rstar/choose_next_node.hpp | 3 + tests/additional_sizes_and_times.cpp | 84 +++++++++++++++---- 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index a3009d4e7..a3a1c68ec 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -46,11 +46,14 @@ public: children_type & children = rtree::elements(n); assert(!children.empty()); + // check if children are leafs visitors::is_leaf ilv; rtree::apply_visitor(ilv, *children.front().second); + // children are leafs if ( ilv.result ) return choose_by_minimum_overlap_cost(children, indexable); + // children are internal nodes else return choose_by_minimum_area_cost(children, indexable); } diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index e2bf02487..35a5e14f5 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -8,6 +8,7 @@ #include #include +#include int main() { @@ -22,32 +23,79 @@ int main() //typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; //typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; + // load config file std::ifstream file_cfg("config.txt"); size_t max_elems = 4; size_t min_elems = 2; size_t values_count = 0; + size_t remove_count = 0; size_t queries_count = 0; - char save_ch = 'n'; + std::string file_name(""); file_cfg >> max_elems; file_cfg >> min_elems; file_cfg >> values_count; + file_cfg >> remove_count; file_cfg >> queries_count; - file_cfg >> save_ch; + file_cfg >> file_name; std::cout << "max: " << max_elems << ", min: " << min_elems << "\n"; - std::cout << "v: " << values_count << ", q: " << queries_count << "\n"; + std::cout << "v: " << values_count << ", r: " << remove_count << ", q: " << queries_count << "\n"; - std::ifstream file("test_coords.txt"); - std::cout << "loading data\n"; - std::vector< std::pair > coords(values_count); - for ( size_t i = 0 ; i < values_count ; ++i ) + if ( values_count < remove_count ) { - file >> coords[i].first; - file >> coords[i].second; + std::cout << "can't remove more data than was inserted\n"; + return 0; } - std::cout << "loaded\n"; + + // prepare data buffer + std::vector< std::pair > coords; + coords.reserve(values_count); + // load test coordinates + if ( file_name != "" ) + { + std::ifstream file(file_name.c_str()); + if ( !file.is_open() ) + { + std::cout << "can't open file containing coordinates\n"; + return 0; + } + + std::cout << "loading data\n"; + for ( size_t i = 0 ; i < values_count ; ++i ) + { + std::pair v; + file >> v.first; + file >> v.second; + coords.push_back(v); + } + std::cout << "loaded\n"; + + if ( coords.size() != values_count || coords.size() < remove_count ) + { + std::cout << "not enough coordinates loaded\n"; + return 0; + } + } + // randomize + else + { + boost::mt19937 rng; + float max_val = values_count / 2; + boost::uniform_real range(-max_val, max_val); + boost::variate_generator > rnd(rng, range); + + std::cout << "randomizing data\n"; + for ( size_t i = 0 ; i < values_count ; ++i ) + { + coords.push_back(std::make_pair(rnd(), rnd())); + } + std::cout << "randomized\n"; + } + + // create rtree RT t(max_elems, min_elems); + // elements inserting test { std::cout << "inserting time test...\n"; tim.restart(); @@ -62,11 +110,13 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } + // check if ( bgi::are_boxes_ok(t) ) std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; + // searching test { std::cout << "searching time test...\n"; tim.restart(); @@ -80,13 +130,14 @@ int main() temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << temp << "\n"; + std::cout << "found: " << temp << "\n"; } + // elements removing test { std::cout << "removing time test...\n"; tim.restart(); - for (size_t i = 0 ; i < values_count / 2 ; ++i ) + for (size_t i = 0 ; i < remove_count ; ++i ) { float x = coords[i].first; float y = coords[i].second; @@ -97,11 +148,13 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } + // check if ( bgi::are_boxes_ok(t) ) std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; + // searching test { std::cout << "searching time test...\n"; tim.restart(); @@ -115,9 +168,10 @@ int main() temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << temp << "\n"; + std::cout << "found: " << temp << "\n"; } + // inserting test { std::cout << "inserting time test...\n"; tim.restart(); @@ -132,11 +186,13 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } + // test if ( bgi::are_boxes_ok(t) ) std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; + // searching test { std::cout << "searching time test...\n"; tim.restart(); @@ -150,7 +206,7 @@ int main() temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << temp << "\n"; + std::cout << "found: " << temp << "\n"; } std::cin.get(); From 9dbb67ed82adf7335992ef6fd2d84f7ece94302f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 13 May 2011 20:23:16 +0000 Subject: [PATCH 025/366] intersects changed to within in remove visitor + some comments added [SVN r71927] --- .../extensions/index/algorithms/within.hpp | 131 ++++++++++++++++++ .../index/rtree/rstar/choose_next_node.hpp | 7 +- .../index/rtree/visitors/insert.hpp | 5 + .../index/rtree/visitors/remove.hpp | 6 +- tests/additional_glut_vis.cpp | 9 ++ tests/additional_sizes_and_times.cpp | 9 ++ tests/main.cpp | 9 ++ 7 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 include/boost/geometry/extensions/index/algorithms/within.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/within.hpp b/include/boost/geometry/extensions/index/algorithms/within.hpp new file mode 100644 index 000000000..eec2291c8 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/within.hpp @@ -0,0 +1,131 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - n-dimensional within box +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_WITHIN_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_WITHIN_HPP + +namespace boost { namespace geometry { namespace index { + +namespace dispatch { + +template +struct within_compare +{ + // TODO: awulkiew - static assert? +}; + +template +struct within_compare +{ + template + static inline bool apply(Box const& b1, Indexable const& b2) + { + return index::get(b1) <= index::get(b2); + } +}; + +template +struct within_compare +{ + template + static inline bool apply(Box const& b1, Indexable const& b2) + { + return index::get(b2) <= index::get(b1); + } +}; + +template +struct within_compare +{ + template + static inline bool apply(Box const& b, Indexable const& p) + { + return index::get(b) <= index::get(p); + } +}; + +template +struct within_compare +{ + template + static inline bool apply(Box const& b, Indexable const& p) + { + return index::get(p) <= index::get(b); + } +}; + +} // namespace dispatch + +namespace detail { + +template +struct within_for_each_dimension +{ + BOOST_STATIC_ASSERT(0 < CurrentDimension); + BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); + BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); + + static inline bool apply(Box const& b, Indexable const& i) + { + return + within_for_each_dimension< + Box, + Indexable, + CurrentDimension - 1 + >::apply(b, i) && + dispatch::within_compare< + min_corner, + CurrentDimension - 1, + Indexable, + typename traits::tag::type + >::apply(b, i) && + dispatch::within_compare< + max_corner, + CurrentDimension - 1, + Indexable, + typename traits::tag::type + >::apply(b, i); + } +}; + +template +struct within_for_each_dimension +{ + BOOST_STATIC_ASSERT(1 <= traits::dimension::value); + BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); + + static inline bool apply(Box const& b, Indexable const& i) + { + return + dispatch::within_compare< + min_corner, + 0, + Indexable, + typename traits::tag::type + >::apply(b, i) && + dispatch::within_compare< + max_corner, + 0, + Indexable, + typename traits::tag::type + >::apply(b, i); + } +}; + +} // namespace detail + +template +bool within(Box const& box, Indexable const& i) +{ + return detail::within_for_each_dimension::value>::apply(box, i); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_WITHIN_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index a3a1c68ec..9bacd7eb8 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -77,7 +77,7 @@ private: child_type const& ch_i = children[i]; Box box_exp(ch_i.first); - // calculate expanded box fo node ch_i + // calculate expanded box of child node ch_i geometry::expand(box_exp, indexable); // calculate area and area diff @@ -126,18 +126,21 @@ private: area_type smallest_area_diff = std::numeric_limits::max(); area_type smallest_area = std::numeric_limits::max(); - // caculate areas and areas of all nodes' boxes + // choose the child which requires smallest box expansion to store the indexable for ( size_t i = 0 ; i < children_count ; ++i ) { typedef typename children_type::value_type child_type; child_type const& ch_i = children[i]; + // expanded child node's box Box box_exp(ch_i.first); geometry::expand(box_exp, indexable); + // areas difference area_type area = index::area(box_exp); area_type area_diff = area - index::area(ch_i.first); + // update the result if ( area_diff < smallest_area_diff || ( area_diff == smallest_area_diff && area < smallest_area ) ) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index a5185cea8..7a5b23da3 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -52,12 +52,15 @@ struct choose_next_node typedef typename children_type::value_type child_type; child_type const& ch_i = children[i]; + // expanded child node's box Box box_exp(ch_i.first); geometry::expand(box_exp, indexable); + // areas difference area_type area = index::area(box_exp); area_type area_diff = area - index::area(ch_i.first); + // update the result if ( area_diff < smallest_area_diff || ( area_diff == smallest_area_diff && area < smallest_area ) ) { @@ -95,6 +98,7 @@ struct split size_t max_elems, Translator const& tr) { + // create additional node node * second_node = rtree::create_node(Node()); Node & n2 = rtree::get(*second_node); @@ -221,6 +225,7 @@ protected: size_t current_child_index_bckup = m_current_child_index; size_t current_level_bckup = m_current_level; + // calculate new traverse inputs m_parent = &n; m_current_child_index = choosen_node_index; ++m_current_level; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 623132356..fac9efee2 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -14,6 +14,8 @@ #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { @@ -52,9 +54,7 @@ public: size_t child_node_index = 0; for ( ; child_node_index < children.size() ; ++child_node_index ) { - // TODO: awulkiew - change intersects to within - - if ( geometry::intersects(children[child_node_index].first, m_tr(m_value)) ) + if ( index::within(children[child_node_index].first, m_tr(m_value)) ) { // next traversing step traverse_apply_visitor(n, child_node_index); diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 8e68e8da2..d9864a7d9 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -1,3 +1,12 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - example +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #include #include diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 35a5e14f5..c2c5fb5e6 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -1,3 +1,12 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - example +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + //#define BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES #include diff --git a/tests/main.cpp b/tests/main.cpp index 2af71fd58..d30121b65 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,3 +1,12 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - example +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #include #include #include From 2f477241e3dd916793b663b48782f4b68f4aa9a5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 9 Jun 2011 23:55:58 +0000 Subject: [PATCH 026/366] reinserting insert visitor corrected, insert visitors now relies on relative level, levels check added, boxes check corrected. [SVN r72531] --- .../index/algorithms/distance_sqr.hpp | 78 ++ .../extensions/index/algorithms/within.hpp | 4 +- .../extensions/index/rtree/rstar/insert.hpp | 736 ++++++++++++------ .../rtree/rstar/redistribute_elements.hpp | 5 +- .../extensions/index/rtree/rstar/rstar.hpp | 1 + .../extensions/index/rtree/rstar/split.hpp | 345 -------- .../geometry/extensions/index/rtree/rtree.hpp | 6 +- .../index/rtree/visitors/are_boxes_ok.hpp | 32 +- .../index/rtree/visitors/are_levels_ok.hpp | 105 +++ .../index/rtree/visitors/insert.hpp | 62 +- .../index/rtree/visitors/remove.hpp | 22 +- tests/additional_glut_vis.cpp | 21 +- tests/additional_sizes_and_times.cpp | 60 +- 13 files changed, 824 insertions(+), 653 deletions(-) create mode 100644 include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/rstar/split.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp b/include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp new file mode 100644 index 000000000..0a27cbf5e --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp @@ -0,0 +1,78 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - n-dimensional distance_sqr between points +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DISTANCE_SQR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DISTANCE_SQR_HPP + +namespace boost { namespace geometry { namespace index { + +template +class default_distance_sqr_result +{ + typedef typename select_most_precise< + typename traits::coordinate_type::type, + long double + >::type intermediate_type; + +public: + typedef typename select_most_precise< + typename traits::coordinate_type::type, + intermediate_type + >::type type; +}; + +namespace detail { + +template +struct distance_sqr_for_each_dimension +{ + BOOST_STATIC_ASSERT(0 < CurrentDimension); + BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); + + typedef typename default_distance_sqr_result::type result_type; + + static inline result_type apply(Point1 const& p1, Point2 const& p2) + { + result_type temp = geometry::get(p1) - geometry::get(p2); + return distance_sqr_for_each_dimension::apply(p1, p2) + + temp * temp; + } +}; + +template +struct distance_sqr_for_each_dimension +{ + BOOST_STATIC_ASSERT(1 <= traits::dimension::value); + + typedef typename default_distance_sqr_result::type result_type; + + static inline result_type apply(Point1 const& p1, Point2 const& p2) + { + result_type temp = geometry::get<0>(p1) - geometry::get<0>(p2); + return temp * temp; + } +}; + +} // namespace detail + +template +typename default_distance_sqr_result::type distance_sqr(Point1 const& p1, Point2 const& p2) +{ + BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); + + return detail::distance_sqr_for_each_dimension< + Point1, + Point2, + index::traits::dimension::value + >::apply(p1, p2); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DISTANCE_SQR_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/within.hpp b/include/boost/geometry/extensions/index/algorithms/within.hpp index eec2291c8..b75986a27 100644 --- a/include/boost/geometry/extensions/index/algorithms/within.hpp +++ b/include/boost/geometry/extensions/index/algorithms/within.hpp @@ -46,7 +46,7 @@ struct within_compare template static inline bool apply(Box const& b, Indexable const& p) { - return index::get(b) <= index::get(p); + return index::get(b) <= geometry::get(p); } }; @@ -56,7 +56,7 @@ struct within_compare template static inline bool apply(Box const& b, Indexable const& p) { - return index::get(p) <= index::get(b); + return geometry::get(p) <= index::get(b); } }; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 451054c04..384289964 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R*-tree insert algorithm implementation +// Boost.Index - R*-tree insert // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, @@ -10,27 +10,12 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP -#include - -#include #include -#include #include -#include -#include -#include +#include #include -#include -#include - -#include -#include - -//TEST -#include -#include namespace boost { namespace geometry { namespace index { @@ -38,222 +23,513 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { -//template -//class insert : public boost::static_visitor<> -//{ -//protected: -// typedef typename rtree::node::type node; -// typedef typename rtree::internal_node::type internal_node; -// typedef typename rtree::leaf::type leaf; -// -// inline insert(node* & root, -// Element const& el, -// size_t min_elements, -// size_t max_elements, -// Translator const& tr, -// size_t level = std::numeric_limits::max() -// ) -// : m_element(el) -// , m_tr(tr) -// , m_min_elems_per_node(min_elements) -// , m_max_elems_per_node(max_elements) -// , m_reinserted_elements_count(size_t(max_elements * 0.3f)) -// , m_level(level) -// , m_root_node(root) -// , m_parent(0), m_current_child_index(0), m_current_level(0) -// {} -// -// template -// inline void traverse(Derived & d, internal_node & n) -// { -// // choose next node, where value insert traversing should go -// size_t choosen_node_index = rstar::choose_next_node:: -// apply(n, rtree::element_indexable(m_element, m_tr)); -// -// //TEST -// /*{ -// std::ofstream log("log.txt", std::ofstream::trunc); -// log << std::fixed << "internal node " << m_current_level << " " << m_level << '\n'; -// boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, rtree::element_indexable(m_element, m_tr)); -// log << '\n' << "choosen node: " << choosen_node_index << "\n"; -// log << "before: "; -// boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); -// log << "\n"; -// }*/ -// -// // expand the node to contain value -// geometry::expand( -// n.children[choosen_node_index].first, -// rtree::element_indexable(m_element, m_tr)); -// -// //TEST -// /*{ -// std::ofstream log("log.txt", std::ofstream::app); -// log << std::fixed << choosen_node_index << "after: "; -// boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, n.children[choosen_node_index].first); -// log << '\n'; -// boost::geometry::index::detail::rtree::visitors::print print_v(log, m_tr); -// boost::apply_visitor(print_v, *m_root_node); -// }*/ -// -// // apply traversing visitor -// traverse_apply_visitor(d, n, choosen_node_index); -// } -// -// template -// inline void post_traverse_handle_oveflow(Node &n) -// { -// // handle overflow -// if ( m_max_elems_per_node < rtree::elements_get(n).size() ) -// { -// detail::overflow_treatment:: -// apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); -// } -// } -// -// template -// inline void traverse_apply_visitor(Derived & d, internal_node &n, size_t choosen_node_index) -// { -// // save previous traverse inputs and set new ones -// internal_node * parent_bckup = m_parent; -// size_t current_child_index_bckup = m_current_child_index; -// size_t current_level_bckup = m_current_level; -// -// m_parent = &n; -// m_current_child_index = choosen_node_index; -// ++m_current_level; -// -// // next traversing step -// boost::apply_visitor(d, *n.children[choosen_node_index].second); -// -// // restore previous traverse inputs -// m_parent = parent_bckup; -// m_current_child_index = current_child_index_bckup; -// m_current_level = current_level_bckup; -// } -// -// // before calling overflow_treatment all nodes have aabbs expanded -// // and the number of elements in the current node is max + 1 -// template -// inline void overflow_treatment(Node & n) -// { -// // TODO: awulkiew - replace this condition with tag dispatched template -// -// // first time insert -// /*if ( m_parent != 0 && -// m_level == std::numeric_limits::max() && -// 0 < m_reinserted_elements_count ) -// { -// reinsert(n); -// } -// // second time insert -// else -// {*/ -// rstar::split:: -// apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); -// //} -// } -// -// template -// static inline bool distances_asc( -// std::pair const& d1, -// std::pair const& d2) -// { -// return d1.first < d2.first; -// } -// -// template -// static inline bool distances_dsc( -// std::pair const& d1, -// std::pair const& d2) -// { -// return d1.first > d2.first; -// } -// -// template -// inline void reinsert(Node & n) -// { -// typedef typename index::detail::rtree::elements_type::type elements_type; -// typedef typename index::detail::rtree::element_type::type element_type; -// typedef typename geometry::point_type::type point_type; -// // TODO: awulkiew - use distance_result -// typedef typename index::traits::coordinate_type::type distance_type; -// -// assert(m_parent != 0); -// assert(0 < m_reinserted_elements_count); -// -// point_type node_center; -// geometry::centroid(m_parent->children[m_current_child_index].first, node_center); -// -// elements_type & elements = index::detail::rtree::elements_get(n); -// -// size_t elements_count = elements.size(); -// std::vector< std::pair > distances(elements_count); -// for ( size_t i = 0 ; i < elements_count ; ++i ) -// { -// // TODO: awulkiew - use distance_sqr -// // (use select_calculation_type if distance_sqr must be implemented in geometry::index) -// // change point type for this geometry -// point_type element_center; -// geometry::centroid( index::detail::rtree::element_indexable( -// elements[i], -// m_tr -// ), element_center); -// -// distances[i].first = geometry::distance(node_center, element_center); -// distances[i].second = elements[i]; -// } -// -// // sort elements by distances from center -// std::partial_sort( -// distances.begin(), -// distances.begin() + m_reinserted_elements_count, -// distances.end(), -// distances_dsc); -// -// // copy elements which will be reinserted -// elements_type elements_to_reinsert(m_reinserted_elements_count); -// for ( size_t i = 0 ; i < m_reinserted_elements_count ; ++i ) -// elements_to_reinsert[i] = distances[i].second; -// -// // copy elements to the current node -// elements.resize(elements_count - m_reinserted_elements_count); -// for ( size_t i = m_reinserted_elements_count ; i < elements_count ; ++i ) -// elements[i - m_reinserted_elements_count] = distances[i].second; -// -// // calulate node's new box -// m_parent->children[m_current_child_index].first = -// elements_box(elements.begin(), elements.end(), m_tr); -// -// // reinsert children starting from the minimum distance -// for ( size_t i = m_reinserted_elements_count ; 0 < i ; --i ) -// { -// insert_impl insert_v( -// m_root_node, elements_to_reinsert[i - 1], -// m_min_elems_per_node, m_max_elems_per_node, -// m_tr, m_current_level); -// boost::apply_visitor(insert_v, *m_root_node); -// } -// } -// -// Element const& m_element; -// Translator const& m_tr; -// const size_t m_min_elems_per_node; -// const size_t m_max_elems_per_node; -// const size_t m_reinserted_elements_count; -// -// const size_t m_level; -// -// node* & m_root_node; -// -// // traversing input parameters -// internal_node *m_parent; -// size_t m_current_child_index; -// size_t m_current_level; -//}; +namespace rstar { + +template +class remove_elements_to_reinsert +{ +public: + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + template + static inline void apply( + typename rtree::elements_type::type & result_elements, + Node & n, + internal_node *parent, + size_t current_child_index, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename rtree::elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + typedef typename geometry::point_type::type point_type; + // TODO: awulkiew - change second point_type to the point type of the Indexable? + typedef typename index::default_distance_sqr_result::type distance_sqr_type; + + assert(parent != 0); + + const size_t reinserted_elements_count = static_cast(max_elems * 0.3f); + assert(0 < reinserted_elements_count); + + // calculate current node's center + point_type node_center; + geometry::centroid(rtree::elements(*parent)[current_child_index].first, node_center); + + // fill the container of centers' distances of children from current node's center + elements_type & elements = rtree::elements(n); + size_t elements_count = elements.size(); + std::vector< std::pair > sorted_elements(elements_count); + for ( size_t i = 0 ; i < elements_count ; ++i ) + { + point_type element_center; + geometry::centroid( rtree::element_indexable(elements[i], tr), + element_center); + sorted_elements[i].first = index::distance_sqr(node_center, element_center); + sorted_elements[i].second = elements[i]; + } + + // sort elements by distances from center + std::partial_sort( + sorted_elements.begin(), + sorted_elements.begin() + reinserted_elements_count, + sorted_elements.end(), + distances_dsc); + + // copy elements which will be reinserted + result_elements.resize(reinserted_elements_count); + for ( size_t i = 0 ; i < reinserted_elements_count ; ++i ) + result_elements[i] = sorted_elements[i].second; + + // copy remaining elements to the current node + elements.resize(elements_count - reinserted_elements_count); + for ( size_t i = reinserted_elements_count ; i < elements_count ; ++i ) + elements[i - reinserted_elements_count] = sorted_elements[i].second; + } + +private: + template + static inline bool distances_asc( + std::pair const& d1, + std::pair const& d2) + { + return d1.first < d2.first; + } + + template + static inline bool distances_dsc( + std::pair const& d1, + std::pair const& d2) + { + return d1.first > d2.first; + } +}; + +template +struct reinsert_or_split_root +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + template + static inline void apply( + typename rtree::elements_type::type & result_elements, + Node & n, + internal_node *parent, + size_t current_child_index, + node* & root_node, + size_t & leafs_level, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + // node isn't root node + if ( parent ) + { + rstar::remove_elements_to_reinsert::apply( + result_elements, n, + parent, current_child_index, + min_elems, max_elems, tr); + } + // node is root node + else + { + // it's really the root node + assert(&rtree::get(n) == root_node); + + detail::split::apply( + n, + parent, current_child_index, + root_node, leafs_level, + min_elems, max_elems, tr); + } + } +}; + +template +struct level_insert + : public detail::insert +{ + typedef detail::insert base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; + + typedef typename rtree::elements_type::type result_type; + + inline level_insert(node* & root, + size_t & leafs_level, + Element const& element, + size_t min_elements, + size_t max_elements, + Translator const& tr, + size_t relative_level) + : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) + , result_relative_level(0) + {} + + inline void operator()(internal_node & n) + { + assert(base::m_current_level < base::m_leafs_level); + + if ( base::m_current_level < base::m_level ) + { + // next traversing step + base::traverse(*this, n); + + // further insert + if ( 0 < InsertIndex ) + { + assert(0 < base::m_level); + + if ( base::m_current_level == base::m_level - 1 ) + { + result_relative_level = base::m_leafs_level - base::m_current_level; + + // overflow + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + rstar::reinsert_or_split_root::apply( + result_elements, n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + } + } + } + else + { + assert( base::m_level == base::m_current_level ); + + // push new child node + rtree::elements(n).push_back(base::m_element); + + // first insert + if ( 0 == InsertIndex ) + { + result_relative_level = base::m_leafs_level - base::m_current_level; + + // overflow + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + rstar::reinsert_or_split_root::apply( + result_elements, n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + } + // not the first insert + else + { + // overflow + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + detail::split::apply( + n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + } + } + + if ( !result_elements.empty() && base::m_parent ) + { + // calulate node's new box + rtree::elements(*base::m_parent)[base::m_current_child_index].first = + elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); + } + } + + inline void operator()(leaf &) + { + assert(false); + } + + size_t result_relative_level; + result_type result_elements; +}; + +template +struct level_insert + : public detail::insert +{ + typedef detail::insert base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; + + typedef typename rtree::elements_type::type result_type; + + inline level_insert(node* & root, + size_t & leafs_level, + Value const& v, + size_t min_elements, + size_t max_elements, + Translator const& t, + size_t relative_level) + : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) + , result_relative_level(0) + {} + + inline void operator()(internal_node & n) + { + assert(base::m_current_level < base::m_leafs_level); + assert(base::m_current_level < base::m_level); + + // next traversing step + base::traverse(*this, n); + + assert(0 < base::m_level); + + if ( base::m_current_level == base::m_level - 1 ) + { + result_relative_level = base::m_leafs_level - base::m_current_level; + + // overflow + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + rstar::reinsert_or_split_root::apply( + result_elements, n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + } + + if ( !result_elements.empty() && base::m_parent ) + { + // calulate node's new box + rtree::elements(*base::m_parent)[base::m_current_child_index].first = + elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); + } + } + + inline void operator()(leaf & n) + { + assert(base::m_current_level == base::m_leafs_level); + assert(base::m_level == base::m_current_level || + base::m_level == std::numeric_limits::max()); + + rtree::elements(n).push_back(base::m_element); + + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + detail::split::apply( + n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + } + + size_t result_relative_level; + result_type result_elements; +}; + +template +struct level_insert<0, Value, Value, Translator, Box> + : public detail::insert +{ + typedef detail::insert base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; + + typedef typename rtree::elements_type::type result_type; + + inline level_insert(node* & root, + size_t & leafs_level, + Value const& v, + size_t min_elements, + size_t max_elements, + Translator const& t, + size_t relative_level) + : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) + , result_relative_level(0) + {} + + inline void operator()(internal_node & n) + { + assert(base::m_current_level < base::m_leafs_level); + assert(base::m_current_level < base::m_level); + + // next traversing step + base::traverse(*this, n); + + if ( !result_elements.empty() && base::m_parent ) + { + // calulate node's new box + rtree::elements(*base::m_parent)[base::m_current_child_index].first = + elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); + } + } + + inline void operator()(leaf & n) + { + assert(base::m_current_level == base::m_leafs_level); + assert(base::m_level == base::m_current_level || + base::m_level == std::numeric_limits::max()); + + rtree::elements(n).push_back(base::m_element); + + result_relative_level = base::m_leafs_level - base::m_current_level; + + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + rstar::reinsert_or_split_root::apply( + result_elements, n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + + if ( !result_elements.empty() && base::m_parent ) + { + // calulate node's new box + rtree::elements(*base::m_parent)[base::m_current_child_index].first = + elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); + } + } + + size_t result_relative_level; + result_type result_elements; +}; + +// R*-tree insert visitor +template +class insert : public rtree::visitor::type +{ +protected: + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + +public: + inline insert(node* & root, + size_t & leafs_level, + Element const& element, + size_t min_elements, + size_t max_elements, + Translator const& tr, + size_t relative_level = 0 + ) + : m_root(root), m_leafs_level(leafs_level), m_element(element) + , m_min_elements(min_elements), m_max_elements(max_elements) + , m_tr(tr), m_relative_level(relative_level) + {} + + inline void operator()(internal_node & n) + { + typedef typename elements_type::type elements_type; + + rstar::level_insert<0, Element, Value, Translator, Box> lins_v( + m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); + + rtree::apply_visitor(lins_v, n); + + if ( !lins_v.result_elements.empty() ) + { + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); + } + } + + inline void operator()(leaf & n) + { + rstar::level_insert<0, Element, Value, Translator, Box> lins_v( + m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); + + rtree::apply_visitor(lins_v, n); + + // we're in the root, so root should be split and there should be no elements to reinsert + assert(lins_v.result_elements.empty()); + } + +protected: + template + inline void recursive_reinsert(Elements const& elements, size_t relative_level) + { + typedef typename Elements::value_type element_type; + + // reinsert children starting from the minimum distance + for ( typename Elements::const_reverse_iterator it = elements.rbegin(); + it != elements.rend(); ++it) + { + rstar::level_insert<1, element_type, Value, Translator, Box> lins_v( + m_root, m_leafs_level, *it, m_min_elements, m_max_elements, m_tr, relative_level); + + rtree::apply_visitor(lins_v, *m_root); + + assert(relative_level + 1 == lins_v.result_relative_level); + + // non-root relative level + if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty()) + { + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); + } + } + } + + node* & m_root; + size_t & m_leafs_level; + Element const& m_element; + size_t m_min_elements; + size_t m_max_elements; + Translator const& m_tr; + size_t m_relative_level; +}; + +} // namespace rstar } // namespace detail +// R*-tree insert visitor +template +class insert + : public detail::rstar::insert +{ + typedef detail::rstar::insert base; + typedef typename base::node node; + +public: + inline insert(node* & root, + size_t & leafs_level, + Element const& element, + size_t min_elements, + size_t max_elements, + Translator const& tr, + size_t relative_level = 0 + ) + : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) + {} +}; + +// R*-tree insert visitor +template +class insert + : public detail::rstar::insert +{ + typedef detail::rstar::insert base; + typedef typename base::node node; + +public: + inline insert(node* & root, + size_t & leafs_level, + Value const& element, + size_t min_elements, + size_t max_elements, + Translator const& tr, + size_t relative_level = 0 + ) + : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) + {} +}; + }}} // namespace detail::rtree::visitors }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 36dadd9bc..9cb09c43e 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R-tree quadratic split algorithm implementation +// Boost.Index - R*-tree split algorithm implementation // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, @@ -35,7 +35,8 @@ struct redistribute_elements typedef typename index::default_area_result::type area_type; template - static inline void apply(Node & n, + static inline void apply( + Node & n, Node & second_node, Box & box1, Box & box2, diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index 6ed2c7920..a8878636a 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -16,6 +16,7 @@ struct rstar_tag {}; }}} // namespace boost::geometry::index +#include #include #include diff --git a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp b/include/boost/geometry/extensions/index/rtree/rstar/split.hpp deleted file mode 100644 index c91c131f1..000000000 --- a/include/boost/geometry/extensions/index/rtree/rstar/split.hpp +++ /dev/null @@ -1,345 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R*-tree split algorithm implementation -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_SPLIT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_SPLIT_HPP - -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace rstar { - -// elements less - -template -class elements_less -{ - typedef typename Elements::value_type element_type; -public: - inline elements_less(Translator const& tr) - : m_tr(tr) - {} - - inline bool operator()(element_type const& e1, element_type const e2) const - { - return - index::get( - rtree::element_indexable(e1, m_tr) - ) - < - index::get( - rtree::element_indexable(e2, m_tr) - ); - } - -private: - Translator const& m_tr; -}; - -// rstar split axis data - -template -struct split_axis_data -{ - typedef typename default_margin_result::type margin_type; - typedef typename default_overlap_result::type overlap_type; - typedef typename default_area_result::type area_type; - - inline split_axis_data() - : margins_sum(0) - , smallest_overlap(std::numeric_limits::max()) - , smallest_area(std::numeric_limits::max()) - {} - - inline void update( - size_t corner, - size_t median_index, - Box const& left_box, - Box const& right_box, - margin_type const& margin, - overlap_type const& overlap, - area_type const& area) - { - margins_sum += margin; - - if ( overlap < smallest_overlap || - ( overlap == smallest_overlap && area < smallest_area ) ) - { - choosen_corner = corner; - choosen_median_index = median_index; - choosen_left_box = left_box; - choosen_right_box = right_box; - smallest_overlap = overlap; - smallest_area = area; - } - } - - size_t choosen_corner; - size_t choosen_median_index; - Box choosen_left_box; - Box choosen_right_box; - margin_type margins_sum; - overlap_type smallest_overlap; - area_type smallest_area; -}; - -// update axis data for given axis and corner - -template -class split_update_axis_data_for_corner -{ - typedef typename split_axis_data::margin_type margin_type; - typedef typename split_axis_data::overlap_type overlap_type; - typedef typename split_axis_data::area_type area_type; - - BOOST_STATIC_ASSERT(Corner < 2); - -public: - template - static inline void apply( - split_axis_data & sad, - Elements const& sorted_elements, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - size_t median_index_last = max_elems - min_elems + 2; - for ( size_t median_index = min_elems ; median_index < median_index_last ; ++median_index ) - { - Box left_box = rtree::elements_box(sorted_elements.begin(), sorted_elements.begin() + median_index, tr); - Box right_box = rtree::elements_box(sorted_elements.begin() + median_index, sorted_elements.end(), tr); - - margin_type margin = index::margin(left_box) + index::margin(right_box); - overlap_type overlap = index::overlap(left_box, right_box); - area_type area = index::area(left_box) + index::area(right_box); - - sad.update(Corner, median_index, left_box, right_box, margin, overlap, area); - } - } -}; - -// split data - -template -struct split_data -{ - typedef typename default_margin_result::type margin_type; - typedef typename default_overlap_result::type overlap_type; - typedef typename default_area_result::type area_type; - - inline split_data() - : smallest_margins_sum(std::numeric_limits::max()) - {} - - inline void update( - size_t axis, - size_t corner, - size_t median_index, - Box const& left_box, - Box const& right_box, - margin_type const& margins_sum, - Elements const& distribution) - { - if ( margins_sum < smallest_margins_sum ) - { - choosen_axis = axis; - choosen_corner = corner; - choosen_median_index = median_index; - choosen_left_box = left_box; - choosen_right_box = right_box; - smallest_margins_sum = margins_sum; - choosen_distribution = distribution; - } - } - - size_t choosen_axis; - size_t choosen_corner; - size_t choosen_median_index; - Box choosen_left_box; - Box choosen_right_box; - margin_type smallest_margins_sum; - Elements choosen_distribution; -}; - -// update split data for given axis and corner - -template -class split_update_data_for_axis_and_corner -{ - typedef typename split_axis_data::margin_type margin_type; - typedef typename split_axis_data::overlap_type overlap_type; - typedef typename split_axis_data::area_type area_type; - -public: - template - static inline void apply( - split_data & split_data, - Elements & elements, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - split_axis_data sad; - - elements_less less_min(tr); - std::sort(elements.begin(), elements.end(), less_min); - - split_update_axis_data_for_corner:: - apply(sad, elements, min_elems, max_elems, tr); - - split_data.update( - AxisIndex, - sad.choosen_corner, - sad.choosen_median_index, - sad.choosen_left_box, - sad.choosen_right_box, - sad.margins_sum, - elements); - } -}; - -// for each dimension and corner update split data - -template -struct split_update_data -{ - BOOST_STATIC_ASSERT(0 < Dimension); - - template - static inline void apply( - split_data & sd, - Elements & elements, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - split_update_data:: - apply(sd, elements, min_elems, max_elems, tr); - - split_update_data_for_axis_and_corner:: - apply(sd, elements, min_elems, max_elems, tr); - split_update_data_for_axis_and_corner:: - apply(sd, elements, min_elems, max_elems, tr); - } -}; - -template -struct split_update_data -{ - template - static inline void apply( - split_data & sd, - Elements & elements, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - split_update_data_for_axis_and_corner:: - apply(sd, elements, min_elems, max_elems, tr); - split_update_data_for_axis_and_corner:: - apply(sd, elements, min_elems, max_elems, tr); - } -}; - -// split - -template -class split -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - static const size_t dimension = index::traits::dimension::value; - -public: - template - static inline void apply( - Node & n, - internal_node *parent, - size_t current_child_index, - node *& root, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - typedef typename rtree::elements_type::type elements_type; - typedef typename elements_type::value_type element_type; - - elements_type & elements = rtree::elements_get(n); - - assert(elements.size() == max_elems + 1); - - // get split data - split_data sd; - split_update_data:: - apply(sd, elements, min_elems, max_elems, tr); - - assert(min_elems <= sd.choosen_median_index); - assert(sd.choosen_median_index <= max_elems + 1 - min_elems); - - // create new node - node * right_node = rtree::create_node(Node()); - elements_type & new_elems = rtree::elements_get(boost::get(*right_node)); - - // update new node's elements - new_elems.resize(max_elems + 1 - sd.choosen_median_index); - std::copy( - sd.choosen_distribution.begin() + sd.choosen_median_index, - sd.choosen_distribution.end(), - new_elems.begin()); - - // update elements of the current node - elements.resize(sd.choosen_median_index); - std::copy( - sd.choosen_distribution.begin(), - sd.choosen_distribution.begin() + sd.choosen_median_index, - elements.begin()); - - // node is not the root - if ( parent != 0 ) - { - // update old node's box - parent->children[current_child_index].first = sd.choosen_left_box; - // add new node to the parent's children - parent->children.push_back(std::make_pair(sd.choosen_right_box, right_node)); - } - // node is the root - else - { - assert(&n == boost::get(root)); - - // create new root and add nodes - node * new_root = rtree::create_node(internal_node()); - - boost::get(*new_root).children.push_back(std::make_pair(sd.choosen_left_box, root)); - boost::get(*new_root).children.push_back(std::make_pair(sd.choosen_right_box, right_node)); - - root = new_root; - } - } -}; - -}}} // namespace detail::rtree:rstar - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_SPLIT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 66755d992..56f6a4061 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -54,6 +54,7 @@ public: , m_max_elems_per_node(max_elems_per_node) , m_min_elems_per_node(min_elems_per_node) , m_root(0) + , m_leafs_level(0) , m_translator(translator) { if ( m_min_elems_per_node < 1 ) @@ -86,7 +87,7 @@ public: // TODO: awulkiew - assert for correct value detail::rtree::visitors::insert - insert_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); + insert_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); detail::rtree::apply_visitor(insert_v, *m_root); @@ -99,7 +100,7 @@ public: assert(0 < m_values_count); detail::rtree::visitors::remove - remove_v(m_root, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); + remove_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); detail::rtree::apply_visitor(remove_v, *m_root); @@ -144,6 +145,7 @@ private: size_t m_max_elems_per_node; size_t m_min_elems_per_node; node *m_root; + size_t m_leafs_level; translator_type m_translator; }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index c22cee550..0154198ed 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -74,21 +74,27 @@ public: typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - if (elements.empty()) + // non-root node + if (!m_is_root) { - result = false; - return; - } + if ( elements.empty() ) + { + result = false; + return; + } + + Box box_exp; + geometry::convert(m_tr(elements.front()), box_exp); + for(typename elements_type::const_iterator it = elements.begin() + 1; + it != elements.end() ; ++it) + { + geometry::expand(box_exp, m_tr(*it)); + } - Box box_exp; - geometry::convert(m_tr(elements.front()), box_exp); - for(typename elements_type::const_iterator it = elements.begin() + 1; - it != elements.end() ; ++it) - { - geometry::expand(box_exp, m_tr(*it)); - } - - result = m_is_root || geometry::equals(box_exp, m_box); + result = geometry::equals(box_exp, m_box); + } + else + result = true; } bool result; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp new file mode 100644 index 000000000..8c00b9612 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -0,0 +1,105 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree levels checking visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +class are_levels_ok : public rtree::visitor::type +{ + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + +public: + inline are_levels_ok(Translator const& tr) + : result(true), m_tr(tr), m_leafs_level(std::numeric_limits::max()), m_current_level(0) + {} + + inline void operator()(internal_node const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + if (elements.empty()) + { + result = false; + return; + } + + size_t current_level_backup = m_current_level; + ++m_current_level; + + for ( typename elements_type::const_iterator it = elements.begin(); + it != elements.end() ; ++it) + { + rtree::apply_visitor(*this, *it->second); + + if ( result == false ) + return; + } + + m_current_level = current_level_backup; + } + + inline void operator()(leaf const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + // empty leaf in non-root node + if (0 < m_current_level && elements.empty()) + { + result = false; + return; + } + + if ( m_leafs_level == std::numeric_limits::max() ) + { + m_leafs_level = m_current_level; + } + else if ( m_leafs_level != m_current_level ) + { + result = false; + } + } + + bool result; + +private: + Translator const& m_tr; + size_t m_leafs_level; + size_t m_current_level; +}; + +}}} // namespace detail::rtree::visitors + +template +bool are_levels_ok(rtree const& tree) +{ + typedef rtree rt; + detail::rtree::visitors::are_levels_ok< + typename rt::value_type, + typename rt::translator_type, + typename rt::box_type, + typename rt::tag_type> v(tree.get_translator()); + + tree.apply_visitor(v); + + return v.result; +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 7a5b23da3..df21da888 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -94,6 +94,7 @@ struct split internal_node *parent, size_t current_child_index, node *& root, + size_t & leafs_level, size_t min_elems, size_t max_elems, Translator const& tr) @@ -111,7 +112,7 @@ struct split assert(min_elems <= rtree::elements(n).size() && rtree::elements(n).size() <= max_elems); assert(min_elems <= rtree::elements(n2).size() && rtree::elements(n2).size() <= max_elems); - // node is not the root + // node is not the root - just add the new node if ( parent != 0 ) { // update old node's box @@ -119,7 +120,7 @@ struct split // add new node to the parent's children rtree::elements(*parent).push_back(std::make_pair(box2, second_node)); } - // node is the root + // node is the root - add level else { assert(&n == rtree::get(root)); @@ -131,32 +132,11 @@ struct split rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); root = new_root; + ++leafs_level; } } }; -// Default overflow treatment algorithm -template -struct overflow_treatment -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - template - static inline void apply( - Node & n, - internal_node *parent, - size_t current_child_index, - node *& root, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - split::apply(n, parent, current_child_index, root, min_elems, max_elems, tr); - } -}; - // Default insert visitor template class insert : public rtree::visitor::type @@ -167,22 +147,27 @@ public: typedef typename rtree::leaf::type leaf; inline insert(node* & root, + size_t & leafs_level, Element const& element, size_t min_elements, size_t max_elements, Translator const& t, - size_t level = std::numeric_limits::max() + size_t relative_level = 0 ) : m_element(element) , m_tr(t) , m_min_elems_per_node(min_elements) , m_max_elems_per_node(max_elements) - , m_level(level) + , m_relative_level(relative_level) + , m_level(leafs_level - relative_level) , m_root_node(root) + , m_leafs_level(leafs_level) , m_parent(0) , m_current_child_index(0) , m_current_level(0) { + assert(m_relative_level <= leafs_level); + assert(m_level <= m_leafs_level); // TODO // assert - check if Box is correct } @@ -209,11 +194,16 @@ protected: template inline void post_traverse(Node &n) { + // if node isn't a root check if parent and current_child_index isn't corrupted + assert(0 == m_parent || &n == rtree::get(rtree::elements(*m_parent)[m_current_child_index].second)); + // handle overflow if ( m_max_elems_per_node < rtree::elements(n).size() ) { - detail::overflow_treatment:: - apply(n, m_parent, m_current_child_index, m_root_node, m_min_elems_per_node, m_max_elems_per_node, m_tr); + split::apply( + n, m_parent, m_current_child_index, + m_root_node, m_leafs_level, + m_min_elems_per_node, m_max_elems_per_node, m_tr); } } @@ -243,9 +233,11 @@ protected: Translator const& m_tr; const size_t m_min_elems_per_node; const size_t m_max_elems_per_node; + const size_t m_relative_level; const size_t m_level; node* & m_root_node; + size_t & m_leafs_level; // traversing input parameters internal_node *m_parent; @@ -265,17 +257,20 @@ struct insert : public detail::insert typedef typename base::leaf leaf; inline insert(node* & root, + size_t & leafs_level, Element const& element, size_t min_elements, size_t max_elements, Translator const& tr, - size_t level = std::numeric_limits::max() + size_t relative_level = 0 ) - : base(root, element, min_elements, max_elements, tr, level) + : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) {} inline void operator()(internal_node & n) { + assert(base::m_current_level < base::m_leafs_level); + if ( base::m_current_level < base::m_level ) { // next traversing step @@ -308,17 +303,19 @@ struct insert : public detail::insert::max() + size_t relative_level = 0 ) - : base(root, v, min_elements, max_elements, t, level) + : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) {} inline void operator()(internal_node & n) { + assert(base::m_current_level < base::m_leafs_level); assert(base::m_current_level < base::m_level); // next traversing step @@ -329,6 +326,7 @@ struct insert : public detail::insert::max() ); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index fac9efee2..a7e777e11 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -29,12 +29,18 @@ class remove : public rtree::visitor::type typedef typename rtree::leaf::type leaf; public: - inline explicit remove(node* & root, Value const& v, size_t min_elements, size_t max_elements, Translator const& t) + inline remove(node* & root, + size_t & leafs_level, + Value const& v, + size_t min_elements, + size_t max_elements, + Translator const& t) : m_value(v) , m_tr(t) , m_min_elems_per_node(min_elements) , m_max_elems_per_node(max_elements) , m_root_node(root) + , m_leafs_level(leafs_level) , m_is_value_removed(false) , m_parent(0) , m_current_child_index(0) @@ -76,8 +82,8 @@ public: { element_iterator underfl_el_it = elements.begin() + child_node_index; - // move node to the container - m_underflowed_nodes.push_back(std::make_pair(m_current_level + 1, underfl_el_it->second)); + // move node to the container - store node's relative level as well + m_underflowed_nodes.push_back(std::make_pair(m_leafs_level - m_current_level, underfl_el_it->second)); elements.erase(underfl_el_it); // calc underflow @@ -87,8 +93,9 @@ public: // n is not root - adjust aabb if ( 0 != m_parent ) { - // test underflow state should be ok here + // underflow state should be ok here // note that there may be less than min_elems elements in root + // so this condition should be checked only here assert((elements.size() < m_min_elems_per_node) == m_is_underflow); rtree::elements(*m_parent)[m_current_child_index].first @@ -120,6 +127,7 @@ public: if ( rtree::elements(n).size() == 1 ) { m_root_node = rtree::elements(n)[0].second; + --m_leafs_level; } } } @@ -178,7 +186,7 @@ private: } template - void reinsert_elements(Node &n, size_t level) + void reinsert_elements(Node &n, size_t node_relative_level) { typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); @@ -187,11 +195,12 @@ private: { visitors::insert insert_v( m_root_node, + m_leafs_level, *it, m_min_elems_per_node, m_max_elems_per_node, m_tr, - level); + node_relative_level - 1); rtree::apply_visitor(insert_v, *m_root_node); } @@ -203,6 +212,7 @@ private: const size_t m_max_elems_per_node; node* & m_root_node; + size_t & m_leafs_level; bool m_is_value_removed; std::vector< std::pair > m_underflowed_nodes; diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index d9864a7d9..65abf56ba 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -9,16 +9,21 @@ #include +//#define BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES #include #include #include #include +#include typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; //boost::geometry::index::rtree t(2, 1); -boost::geometry::index::rtree t(4, 2); +boost::geometry::index::rtree< + B, + boost::geometry::index::default_parameter, + boost::geometry::index::rstar_tag> t(4, 2); std::vector vect; void render_scene(void) @@ -61,13 +66,14 @@ void mouse(int button, int state, int x, int y) boost::geometry::index::insert(t, b); vect.push_back(b); - /*std::cout << t << "\n\n"; + std::cout << t << "\n\n"; std::cout << "inserted: "; boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); - std::cout << "\n\n\n";*/ + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); + std::cout << "\n\n"; glutPostRedisplay(); } @@ -82,12 +88,13 @@ void mouse(int button, int state, int x, int y) boost::geometry::index::remove(t, b); vect.erase(vect.begin() + i); - /*std::cout << '\n' << t << "\n\n"; + std::cout << '\n' << t << "\n\n"; std::cout << "removed: "; boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); - std::cout << "\n\n\n";*/ + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); + std::cout << "\n\n"; glutPostRedisplay(); } diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index c2c5fb5e6..9dd52e7a8 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -28,9 +29,9 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; - typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; + //typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; //typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; - //typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; + typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; // load config file std::ifstream file_cfg("config.txt"); @@ -89,7 +90,7 @@ int main() else { boost::mt19937 rng; - float max_val = values_count / 2; + float max_val = static_cast(values_count / 2); boost::uniform_real range(-max_val, max_val); boost::variate_generator > rnd(rng, range); @@ -114,6 +115,25 @@ int main() float y = coords[i].second; B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + //if ( 341700 <= i ) + // std::cout << i << "\n"; + + // Czy mozliwe, ze w czasie powtornego reinserta + // nagle drzewo sie powieksza o jeden poziom? + // Tak, drzewo sie rozrasta, powinno sie wstawiac w poziomie liczac od lisci + // TODO: relative_level zamiast level + + // TODO: asserty w operator(leaf) + // current_level == leaf_level + + // Swoja droga to dziwne ze przy drzewie 4,2 + // dzieje sie to samo dopiero dla obiektow o indeksie 300k a nie wczesniej + // Dlaczego? + // Przy 32 obiektach powtornie wstawianych jest 9 a przy 4 tylko 1 + + // TODO: Zrobic kolejnego visitora sprawdzajacego czy odpowiednie wezly zostaly wstawione w dobrym miejscu + // Np sprawdzajacego czy wszystkie liscie sa na tym samym poziomie + t.insert(std::make_pair(b, i)); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -124,6 +144,10 @@ int main() std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; + if ( bgi::are_levels_ok(t) ) + std::cout << "LEVELS OK\n"; + else + std::cout << "WRONG LEVELS\n"; // searching test { @@ -157,11 +181,15 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } - // check - if ( bgi::are_boxes_ok(t) ) - std::cout << "BOXES OK\n"; - else - std::cout << "WRONG BOXES\n"; + // check + if ( bgi::are_boxes_ok(t) ) + std::cout << "BOXES OK\n"; + else + std::cout << "WRONG BOXES\n"; + if ( bgi::are_levels_ok(t) ) + std::cout << "LEVELS OK\n"; + else + std::cout << "WRONG LEVELS\n"; // searching test { @@ -184,7 +212,7 @@ int main() { std::cout << "inserting time test...\n"; tim.restart(); - for (size_t i = 0 ; i < values_count / 2 ; ++i ) + for (size_t i = 0 ; i < remove_count ; ++i ) { float x = coords[i].first; float y = coords[i].second; @@ -195,11 +223,15 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } - // test - if ( bgi::are_boxes_ok(t) ) - std::cout << "BOXES OK\n"; - else - std::cout << "WRONG BOXES\n"; + // check + if ( bgi::are_boxes_ok(t) ) + std::cout << "BOXES OK\n"; + else + std::cout << "WRONG BOXES\n"; + if ( bgi::are_levels_ok(t) ) + std::cout << "LEVELS OK\n"; + else + std::cout << "WRONG LEVELS\n"; // searching test { From eb1cd72e937e3899b188738a48635c197ccafda3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 12 Jun 2011 11:10:12 +0000 Subject: [PATCH 027/366] r* split fully implemented [SVN r72549] --- .../index/algorithms/intersection_area.hpp | 36 ++ .../index/algorithms/union_area.hpp | 2 +- .../extensions/index/rtree/rstar/insert.hpp | 257 +++++----- .../rtree/rstar/redistribute_elements.hpp | 470 ++++++++++++------ 4 files changed, 473 insertions(+), 292 deletions(-) create mode 100644 include/boost/geometry/extensions/index/algorithms/intersection_area.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/intersection_area.hpp b/include/boost/geometry/extensions/index/algorithms/intersection_area.hpp new file mode 100644 index 000000000..5d4e69a8d --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/intersection_area.hpp @@ -0,0 +1,36 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - boxes union/intersection area/volume +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +/** + * \brief Compute the area of the intersection of b1 and b2 + */ +template +inline typename default_area_result::type intersection_area(Box const& box1, Box const& box2) +{ + typename default_area_result::type result = 0; + if ( geometry::intersects(box1, box2) ) + { + Box box_intersection; + geometry::intersection(box1, box2, box_intersection); + result = index::area(box_intersection); + } + return result; +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/union_area.hpp b/include/boost/geometry/extensions/index/algorithms/union_area.hpp index 8beee71a5..ba804ec85 100644 --- a/include/boost/geometry/extensions/index/algorithms/union_area.hpp +++ b/include/boost/geometry/extensions/index/algorithms/union_area.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.SpatialIndex - boxes union/intersection area/volume +// Boost.SpatialIndex - boxes union/sum area/volume // // Copyright 2008 Federico J. Fernandez. // Copyright 2011 Adam Wulkiewicz. diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 384289964..703909cac 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -107,58 +107,117 @@ private: } }; -template -struct reinsert_or_split_root +template +struct level_insert_result_type { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::elements_type< + typename rtree::internal_node::type + >::type type; +}; - template - static inline void apply( - typename rtree::elements_type::type & result_elements, - Node & n, - internal_node *parent, - size_t current_child_index, - node* & root_node, - size_t & leafs_level, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - // node isn't root node - if ( parent ) - { - rstar::remove_elements_to_reinsert::apply( - result_elements, n, - parent, current_child_index, - min_elems, max_elems, tr); - } - // node is root node - else - { - // it's really the root node - assert(&rtree::get(n) == root_node); +template +struct level_insert_result_type<0, Value, Value, Box> +{ + typedef typename rtree::elements_type< + typename rtree::leaf::type + >::type type; +}; - detail::split::apply( - n, - parent, current_child_index, - root_node, leafs_level, - min_elems, max_elems, tr); - } - } +template +struct level_insert_base + : public detail::insert +{ + typedef detail::insert base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; + + typedef typename level_insert_result_type::type result_type; + + inline level_insert_base(node* & root, + size_t & leafs_level, + Element const& element, + size_t min_elements, + size_t max_elements, + Translator const& tr, + size_t relative_level) + : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) + , result_relative_level(0) + {} + + template + inline void handle_possible_reinsert_or_split_of_root(Node &n) + { + // reinsert should be handled only once for level + assert(result_elements.empty()); + + result_relative_level = base::m_leafs_level - base::m_current_level; + + // overflow + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + // node isn't root node + if ( base::m_parent ) + { + rstar::remove_elements_to_reinsert::apply( + result_elements, n, + base::m_parent, base::m_current_child_index, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + // node is root node + else + { + // it's really the root node + assert(&rtree::get(n) == base::m_root_node); + + detail::split::apply( + n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + } + } + + template + inline void handle_possible_split(Node &n) const + { + // overflow + if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + { + detail::split::apply( + n, + base::m_parent, base::m_current_child_index, + base::m_root_node, base::m_leafs_level, + base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + } + } + + template + inline void recalculate_aabb_if_necessary(Node &n) const + { + if ( !result_elements.empty() && base::m_parent ) + { + // calulate node's new box + rtree::elements(*base::m_parent)[base::m_current_child_index].first = + elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); + } + } + + size_t result_relative_level; + result_type result_elements; }; template struct level_insert - : public detail::insert + : public level_insert_base { - typedef detail::insert base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename rtree::elements_type::type result_type; + typedef typename base::result_type result_type; inline level_insert(node* & root, size_t & leafs_level, @@ -168,7 +227,6 @@ struct level_insert Translator const& tr, size_t relative_level) : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) - , result_relative_level(0) {} inline void operator()(internal_node & n) @@ -187,17 +245,7 @@ struct level_insert if ( base::m_current_level == base::m_level - 1 ) { - result_relative_level = base::m_leafs_level - base::m_current_level; - - // overflow - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) - { - rstar::reinsert_or_split_root::apply( - result_elements, n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); - } + base::handle_possible_reinsert_or_split_of_root(n); } } } @@ -211,60 +259,34 @@ struct level_insert // first insert if ( 0 == InsertIndex ) { - result_relative_level = base::m_leafs_level - base::m_current_level; - - // overflow - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) - { - rstar::reinsert_or_split_root::apply( - result_elements, n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); - } + base::handle_possible_reinsert_or_split_of_root(n); } // not the first insert else { - // overflow - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) - { - detail::split::apply( - n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); - } + base::handle_possible_split(n); } } - if ( !result_elements.empty() && base::m_parent ) - { - // calulate node's new box - rtree::elements(*base::m_parent)[base::m_current_child_index].first = - elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); - } + base::recalculate_aabb_if_necessary(n); } inline void operator()(leaf &) { assert(false); } - - size_t result_relative_level; - result_type result_elements; }; template struct level_insert - : public detail::insert + : public level_insert_base { - typedef detail::insert base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename rtree::elements_type::type result_type; + typedef typename base::result_type result_type; inline level_insert(node* & root, size_t & leafs_level, @@ -274,7 +296,6 @@ struct level_insert Translator const& t, size_t relative_level) : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) - , result_relative_level(0) {} inline void operator()(internal_node & n) @@ -289,25 +310,10 @@ struct level_insert if ( base::m_current_level == base::m_level - 1 ) { - result_relative_level = base::m_leafs_level - base::m_current_level; - - // overflow - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) - { - rstar::reinsert_or_split_root::apply( - result_elements, n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); - } + base::handle_possible_reinsert_or_split_of_root(n); } - if ( !result_elements.empty() && base::m_parent ) - { - // calulate node's new box - rtree::elements(*base::m_parent)[base::m_current_child_index].first = - elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); - } + base::recalculate_aabb_if_necessary(n); } inline void operator()(leaf & n) @@ -318,30 +324,20 @@ struct level_insert rtree::elements(n).push_back(base::m_element); - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) - { - detail::split::apply( - n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); - } + base::handle_possible_split(n); } - - size_t result_relative_level; - result_type result_elements; }; template struct level_insert<0, Value, Value, Translator, Box> - : public detail::insert + : public level_insert_base<0, Value, Value, Translator, Box> { - typedef detail::insert base; + typedef level_insert_base<0, Value, Value, Translator, Box> base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename rtree::elements_type::type result_type; + typedef typename base::result_type result_type; inline level_insert(node* & root, size_t & leafs_level, @@ -351,7 +347,6 @@ struct level_insert<0, Value, Value, Translator, Box> Translator const& t, size_t relative_level) : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) - , result_relative_level(0) {} inline void operator()(internal_node & n) @@ -362,12 +357,7 @@ struct level_insert<0, Value, Value, Translator, Box> // next traversing step base::traverse(*this, n); - if ( !result_elements.empty() && base::m_parent ) - { - // calulate node's new box - rtree::elements(*base::m_parent)[base::m_current_child_index].first = - elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); - } + base::recalculate_aabb_if_necessary(n); } inline void operator()(leaf & n) @@ -378,27 +368,10 @@ struct level_insert<0, Value, Value, Translator, Box> rtree::elements(n).push_back(base::m_element); - result_relative_level = base::m_leafs_level - base::m_current_level; + base::handle_possible_reinsert_or_split_of_root(n); - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) - { - rstar::reinsert_or_split_root::apply( - result_elements, n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); - } - - if ( !result_elements.empty() && base::m_parent ) - { - // calulate node's new box - rtree::elements(*base::m_parent)[base::m_current_child_index].first = - elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_tr); - } + base::recalculate_aabb_if_necessary(n); } - - size_t result_relative_level; - result_type result_elements; }; // R*-tree insert visitor diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 9cb09c43e..574704ee9 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -12,8 +12,11 @@ #include -#include +#include #include +#include + +#include #include #include @@ -25,6 +28,289 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { +namespace rstar { + +template +class element_axis_corner_less +{ +public: + element_axis_corner_less(Translator const& tr) + : m_tr(tr) + {} + + bool operator()(Element const& e1, Element const& e2) const + { + return index::get(rtree::element_indexable(e1, m_tr)) + < index::get(rtree::element_indexable(e2, m_tr)); + } + +private: + Translator const& m_tr; +}; + +template +struct choose_split_axis_and_index_for_corner +{ + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_area_result::type area_type; + + template + static inline void apply(Elements const& elements, + size_t & choosen_index, + margin_type & sum_of_margins, + area_type & smallest_overlap, + area_type & smallest_area, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename Elements::value_type element_type; + + // copy elements + Elements elements_copy = elements; + assert(elements_copy.size() == max_elems + 1); + + // sort elements + element_axis_corner_less elements_less(tr); + std::sort(elements_copy.begin(), elements_copy.end(), elements_less); + + // init outputs + choosen_index = min_elems; + sum_of_margins = 0; + smallest_overlap = std::numeric_limits::max(); + smallest_area = std::numeric_limits::max(); + + // calculate sum of margins for all distributions + size_t index_last = max_elems - min_elems + 2; + for ( size_t i = min_elems ; i < index_last ; ++i ) + { + // TODO - awulkiew: may be optimized - box of group 1 may be initialized with + // box of min_elems number of elements and expanded for each iteration by another element + + Box box1 = rtree::elements_box(elements_copy.begin(), elements_copy.begin() + i, tr); + Box box2 = rtree::elements_box(elements_copy.begin() + i, elements_copy.end(), tr); + + sum_of_margins += index::margin(box1) + index::margin(box2); + + area_type ovl = index::intersection_area(box1, box2); + area_type ar = index::area(box1) + index::area(box2); + + if ( ovl < smallest_overlap || (ovl == smallest_overlap && ar <= smallest_area) ) + { + choosen_index = i; + smallest_overlap = ovl; + smallest_area = ar; + } + } + } +}; + +template +struct choose_split_axis_and_index_for_axis +{ + //BOOST_STATIC_ASSERT(0); +}; + +template +struct choose_split_axis_and_index_for_axis +{ + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_area_result::type area_type; + + template + static inline void apply(Elements const& elements, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & sum_of_margins, + area_type & smallest_overlap, + area_type & smallest_area, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + size_t index1 = 0; + margin_type som1 = 0; + area_type ovl1 = std::numeric_limits::max(); + area_type ar1 = std::numeric_limits::max(); + + choose_split_axis_and_index_for_corner:: + apply(elements, index1, + som1, ovl1, ar1, + min_elems, max_elems, tr); + + size_t index2 = 0; + margin_type som2 = 0; + area_type ovl2 = std::numeric_limits::max(); + area_type ar2 = std::numeric_limits::max(); + + choose_split_axis_and_index_for_corner:: + apply(elements, index2, + som2, ovl2, ar2, + min_elems, max_elems, tr); + + sum_of_margins = som1 + som2; + + if ( ovl1 < ovl2 || (ovl1 == ovl2 && ar1 <= ar2) ) + { + choosen_corner = min_corner; + choosen_index = index1; + smallest_overlap = ovl1; + smallest_area = ar1; + } + else + { + choosen_corner = max_corner; + choosen_index = index2; + smallest_overlap = ovl2; + smallest_area = ar2; + } + } +}; + +template +struct choose_split_axis_and_index_for_axis +{ + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_area_result::type area_type; + + template + static inline void apply(Elements const& elements, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & sum_of_margins, + area_type & smallest_overlap, + area_type & smallest_area, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + choose_split_axis_and_index_for_corner:: + apply(elements, choosen_index, + sum_of_margins, smallest_overlap, smallest_area, + min_elems, max_elems, tr); + + choosen_corner = min_corner; + } +}; + +template +struct choose_split_axis_and_index +{ + BOOST_STATIC_ASSERT(0 < Dimension); + + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_area_result::type area_type; + + template + static inline void apply(Elements const& elements, + size_t & choosen_axis, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & smallest_sum_of_margins, + area_type & smallest_overlap, + area_type & smallest_area, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename rtree::element_indexable_type::type element_indexable_type; + + choose_split_axis_and_index::apply(elements, choosen_axis, choosen_corner, choosen_index, + smallest_sum_of_margins, smallest_overlap, smallest_area, + min_elems, max_elems, tr); + margin_type sum_of_margins = 0; + + size_t corner = min_corner; + size_t index = 0; + + area_type overlap_val = std::numeric_limits::max(); + area_type area_val = std::numeric_limits::max(); + + choose_split_axis_and_index_for_axis< + Box, + Dimension - 1, + typename index::traits::tag::type + >::apply(elements, corner, index, sum_of_margins, overlap_val, area_val, min_elems, max_elems, tr); + + if ( sum_of_margins < smallest_sum_of_margins ) + { + choosen_axis = Dimension - 1; + choosen_corner = corner; + choosen_index = index; + smallest_sum_of_margins = sum_of_margins; + smallest_overlap = overlap_val; + smallest_area = area_val; + } + } +}; + +template +struct choose_split_axis_and_index +{ + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_area_result::type area_type; + + template + static inline void apply(Elements const& elements, + size_t & choosen_axis, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & smallest_sum_of_margins, + area_type & smallest_overlap, + area_type & smallest_area, + size_t min_elems, + size_t max_elems, + Translator const& tr) + { + typedef typename rtree::element_indexable_type::type element_indexable_type; + + choosen_axis = 0; + + choose_split_axis_and_index_for_axis< + Box, + 0, + typename index::traits::tag::type + >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_area, min_elems, max_elems, tr); + } +}; + +template +struct partial_sort +{ + BOOST_STATIC_ASSERT(0 < Dimension); + + template + static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) + { + if ( axis < Dimension - 1 ) + { + partial_sort::apply(elements, axis, index, tr); + } + else + { + assert(axis == Dimension - 1); + typedef typename Elements::value_type element_type; + element_axis_corner_less less(tr); + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); + } + } +}; + +template +struct partial_sort +{ + template + static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) + { + assert(axis == 0); + typedef typename Elements::value_type element_type; + element_axis_corner_less less(tr); + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); + } +}; + +} // namespace rstar + template struct redistribute_elements { @@ -32,6 +318,9 @@ struct redistribute_elements typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; + static const size_t dimension = index::traits::dimension::value; + + typedef typename index::default_margin_result::type margin_type; typedef typename index::default_area_result::type area_type; template @@ -44,161 +333,44 @@ struct redistribute_elements size_t max_elems, Translator const& tr) { - typedef typename rtree::elements_type::type elements_type; - typedef typename elements_type::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; - - // copy original elements - elements_type elements_copy = rtree::elements(n); - - // calculate initial seeds - size_t seed1 = 0; - size_t seed2 = 0; - quadratic::pick_seeds::apply(elements_copy, tr, seed1, seed2); - - // prepare nodes' elements containers + typedef typename rtree::elements_type::type elements_type; + elements_type & elements1 = rtree::elements(n); - elements_type & elements2 = rtree::elements(second_node); - elements1.clear(); - assert(elements2.empty()); + elements_type & elements2 = rtree::elements(second_node); - // add seeds - elements1.push_back(elements_copy[seed1]); - elements2.push_back(elements_copy[seed2]); + size_t split_axis = 0; + size_t split_corner = 0; + size_t split_index = min_elems; + margin_type smallest_sum_of_margins = std::numeric_limits::max(); + area_type smallest_overlap = std::numeric_limits::max(); + area_type smallest_area = std::numeric_limits::max(); - // calculate boxes - geometry::convert(rtree::element_indexable(elements_copy[seed1], tr), box1); - geometry::convert(rtree::element_indexable(elements_copy[seed2], tr), box2); + rstar::choose_split_axis_and_index::value>:: + apply(elements1, + split_axis, split_corner, split_index, + smallest_sum_of_margins, smallest_overlap, smallest_area, + min_elems, max_elems, tr); - // remove seeds - if (seed1 < seed2) - { - elements_copy.erase(elements_copy.begin() + seed2); - elements_copy.erase(elements_copy.begin() + seed1); - } - else - { - elements_copy.erase(elements_copy.begin() + seed1); - elements_copy.erase(elements_copy.begin() + seed2); - } + // TODO: awulkiew - get rid of following static_casts? - // initialize areas - area_type area1 = index::area(box1); - area_type area2 = index::area(box2); + assert(split_axis < index::traits::dimension::value); + assert(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner)); + assert(min_elems <= split_index && split_index <= max_elems - min_elems + 1); + + // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort + if ( split_corner == static_cast(min_corner) ) + rstar::partial_sort::apply(elements1, split_axis, split_index, tr); + else + rstar::partial_sort::apply(elements1, split_axis, split_index, tr); - size_t remaining = elements_copy.size(); + // copy elements to node 2 and remove from node 1 + elements2.resize(max_elems + 1 - split_index); + std::copy(elements1.begin() + split_index, elements1.end(), elements2.begin()); + elements1.resize(split_index); - // redistribute the rest of the elements - while ( !elements_copy.empty() ) - { - typename elements_type::reverse_iterator el_it = elements_copy.rbegin(); - bool insert_into_group1 = false; - - size_t elements1_count = elements1.size(); - size_t elements2_count = elements2.size(); - - // if there is small number of elements left and the number of elements in node is lesser than min_elems - // just insert them to this node - if ( elements1_count + remaining <= min_elems ) - { - insert_into_group1 = true; - } - else if ( elements2_count + remaining <= min_elems ) - { - insert_into_group1 = false; - } - // insert the best element - else - { - // find element with minimum groups areas increses differences - area_type area_increase1 = 0; - area_type area_increase2 = 0; - el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(), - box1, box2, area1, area2, tr, - area_increase1, area_increase2); - - if ( area_increase1 < area_increase2 || - ( area_increase1 == area_increase2 && area1 < area2 ) || - ( area1 == area2 && elements1_count <= elements2_count ) ) - { - insert_into_group1 = true; - } - else - { - insert_into_group1 = false; - } - } - - // move element to the choosen group - element_type const& elem = *el_it; - indexable_type const& indexable = rtree::element_indexable(elem, tr); - - if ( insert_into_group1 ) - { - elements1.push_back(elem); - geometry::expand(box1, indexable); - area1 = index::area(box1); - } - else - { - elements2.push_back(elem); - geometry::expand(box2, indexable); - area2 = index::area(box2); - } - - assert(!elements_copy.empty()); - elements_copy.erase(--el_it.base()); - - assert(0 < remaining); - --remaining; - } - } - - template - static inline It pick_next(It first, It last, - Box const& box1, Box const& box2, - area_type const& area1, area_type const& area2, - Translator const& tr, - area_type & out_area_increase1, area_type & out_area_increase2) - { - typedef typename boost::iterator_value::type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; - - area_type greatest_area_incrase_diff = 0; - It out_it = first; - out_area_increase1 = 0; - out_area_increase2 = 0; - - // find element with greatest difference between increased group's boxes areas - for ( It el_it = first ; el_it != last ; ++el_it ) - { - indexable_type const& indexable = rtree::element_indexable(*el_it, tr); - - // calculate enlarged boxes and areas - Box enlarged_box1(box1); - Box enlarged_box2(box2); - geometry::expand(enlarged_box1, indexable); - geometry::expand(enlarged_box2, indexable); - area_type enlarged_area1 = index::area(enlarged_box1); - area_type enlarged_area2 = index::area(enlarged_box2); - - area_type area_incrase1 = (enlarged_area1 - area1); - area_type area_incrase2 = (enlarged_area2 - area2); - - area_type area_incrase_diff = area_incrase1 < area_incrase2 ? - area_incrase2 - area_incrase1 : area_incrase1 - area_incrase2; - - if ( greatest_area_incrase_diff < area_incrase_diff ) - { - greatest_area_incrase_diff = area_incrase_diff; - out_it = el_it; - out_area_increase1 = area_incrase1; - out_area_increase2 = area_incrase2; - } - } - - return out_it; + // calculate boxes + box1 = rtree::elements_box(elements1.begin(), elements1.end(), tr); + box2 = rtree::elements_box(elements2.begin(), elements2.end(), tr); } }; From a3166316a8a966a0196f61f77206c6c36f29fc64 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 12 Jun 2011 11:23:31 +0000 Subject: [PATCH 028/366] dirty check of children nodes (is_leaf) removed from rstar* choose_next_node, replaced by passing additional parameter [SVN r72550] --- .../extensions/index/rtree/rstar/choose_next_node.hpp | 9 ++------- .../geometry/extensions/index/rtree/visitors/insert.hpp | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 9bacd7eb8..eb34a346a 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -41,17 +41,12 @@ class choose_next_node public: template - static inline size_t apply(internal_node & n, Indexable const& indexable) + static inline size_t apply(internal_node & n, Indexable const& indexable, size_t node_relative_level) { children_type & children = rtree::elements(n); - assert(!children.empty()); - // check if children are leafs - visitors::is_leaf ilv; - rtree::apply_visitor(ilv, *children.front().second); - // children are leafs - if ( ilv.result ) + if ( node_relative_level <= 1 ) return choose_by_minimum_overlap_cost(children, indexable); // children are internal nodes else diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index df21da888..c37d05174 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -33,7 +33,7 @@ struct choose_next_node typedef typename index::default_area_result::type area_type; template - static inline size_t apply(internal_node & n, Indexable const& indexable) + static inline size_t apply(internal_node & n, Indexable const& indexable, size_t /*node_relative_level*/) { children_type & children = rtree::elements(n); @@ -178,7 +178,7 @@ protected: { // choose next node size_t choosen_node_index = detail::choose_next_node:: - apply(n, rtree::element_indexable(m_element, m_tr)); + apply(n, rtree::element_indexable(m_element, m_tr), m_leafs_level - m_current_level); // expand the node to contain value geometry::expand( From 58105add5f3a17fafecdb9b4ac8b8218b4c80dd3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 12 Jun 2011 18:51:12 +0000 Subject: [PATCH 029/366] rtree template parameters sequence changed [SVN r72556] --- .../extensions/index/default_parameter.hpp | 62 ------------------- .../geometry/extensions/index/indexable.hpp | 12 ++++ .../geometry/extensions/index/rtree/rtree.hpp | 14 +++-- tests/additional_glut_vis.cpp | 1 - tests/additional_sizes_and_times.cpp | 6 +- tests/rtree_native.hpp | 16 ++--- 6 files changed, 32 insertions(+), 79 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/default_parameter.hpp diff --git a/include/boost/geometry/extensions/index/default_parameter.hpp b/include/boost/geometry/extensions/index/default_parameter.hpp deleted file mode 100644 index beda15349..000000000 --- a/include/boost/geometry/extensions/index/default_parameter.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - default indexes parameters -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP - -#include -#include -#include - -namespace boost { namespace geometry { namespace index { - -// TODO: awulkiew - move this elsewhere -struct default_parameter {}; - -namespace detail { - -template -struct geometry_box_type -{ - typedef geometry::model::box< - geometry::model::point< - typename index::traits::coordinate_type::type, - index::traits::dimension::value, - typename index::traits::coordinate_system::type - > - > type; -}; - -template -struct default_translator_type -{ - typedef Translator type; -}; -template -struct default_translator_type -{ - typedef translator::def type; -}; - -template -struct default_box_type -{ - typedef Box type; -}; -template -struct default_box_type -{ - typedef typename detail::geometry_box_type::type type; -}; - -} // namespace detail - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DEFAULT_PARAMETER_HPP diff --git a/include/boost/geometry/extensions/index/indexable.hpp b/include/boost/geometry/extensions/index/indexable.hpp index 932bf9a92..7553c46c2 100644 --- a/include/boost/geometry/extensions/index/indexable.hpp +++ b/include/boost/geometry/extensions/index/indexable.hpp @@ -159,6 +159,18 @@ typename traits::coordinate_type::type get(Indexable const& i) >::get(i); } +template +struct default_box_type +{ + typedef geometry::model::box< + geometry::model::point< + typename traits::coordinate_type::type, + traits::dimension::value, + typename traits::coordinate_system::type + > + > type; +}; + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 56f6a4061..66b536330 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -11,7 +11,10 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP -#include +#include +#include + +#include #include @@ -30,15 +33,16 @@ namespace boost { namespace geometry { namespace index { template < typename Value, - typename Translator = default_parameter, - typename Tag = linear_tag + typename Tag = linear_tag, + typename Translator = translator::def > class rtree { public: typedef Value value_type; - typedef typename detail::default_translator_type::type translator_type; - typedef typename detail::geometry_box_type::type box_type; + typedef Translator translator_type; + typedef typename translator_type::indexable_type indexable_type; + typedef typename index::default_box_type::type box_type; typedef Tag tag_type; typedef typename detail::rtree::node::type node; diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 65abf56ba..71843a2a8 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -22,7 +22,6 @@ typedef boost::geometry::model::box

B; //boost::geometry::index::rtree t(2, 1); boost::geometry::index::rtree< B, - boost::geometry::index::default_parameter, boost::geometry::index::rstar_tag> t(4, 2); std::vector vect; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 9dd52e7a8..d93387440 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -29,9 +29,9 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; - //typedef bgi::rtree, bgi::default_parameter, bgi::linear_tag> RT; - //typedef bgi::rtree, bgi::default_parameter, bgi::quadratic_tag> RT; - typedef bgi::rtree, bgi::default_parameter, bgi::rstar_tag> RT; + //typedef bgi::rtree, bgi::linear_tag> RT; + //typedef bgi::rtree, bgi::quadratic_tag> RT; + typedef bgi::rtree, bgi::rstar_tag> RT; // load config file std::ifstream file_cfg("config.txt"); diff --git a/tests/rtree_native.hpp b/tests/rtree_native.hpp index 62e322e94..41b5fc446 100644 --- a/tests/rtree_native.hpp +++ b/tests/rtree_native.hpp @@ -23,7 +23,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, B(P(0, 0, 0), P(1, 1, 1))); boost::geometry::index::insert(t, B(P(2, 2, 2), P(3, 3, 3))); boost::geometry::index::insert(t, B(P(4, 4, 4), P(5, 5, 5))); @@ -40,7 +40,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); @@ -57,7 +57,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, P(0, 0)); boost::geometry::index::insert(t, P(2, 2)); boost::geometry::index::insert(t, P(4, 4)); @@ -75,7 +75,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::box

B; typedef std::pair V; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, V(B(P(0, 0), P(1, 1)), 0)); boost::geometry::index::insert(t, V(B(P(2, 2), P(3, 3)), 1)); boost::geometry::index::insert(t, V(B(P(4, 4), P(5, 5)), 2)); @@ -100,7 +100,7 @@ void tests_rtree_native_hpp() V v4( new std::pair(B(P(6, 6), P(7, 7)), 3) ); V v5( new std::pair(B(P(8, 8), P(9, 9)), 4) ); - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); boost::geometry::index::insert(t, v1); boost::geometry::index::insert(t, v2); boost::geometry::index::insert(t, v3); @@ -126,7 +126,7 @@ void tests_rtree_native_hpp() m.insert(std::pair(3, B(P(6, 6), P(7, 7)))); m.insert(std::pair(4, B(P(8, 8), P(9, 9)))); - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t(4, 2); V vit = m.begin(); boost::geometry::index::insert(t, vit++); boost::geometry::index::insert(t, vit++); @@ -145,7 +145,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::box

B; typedef size_t V; - typedef boost::geometry::index::translator::index > T; + typedef boost::geometry::index::translator::index > Tr; std::vector v; v.push_back(B(P(0, 0), P(1, 1))); @@ -154,7 +154,7 @@ void tests_rtree_native_hpp() v.push_back(B(P(6, 6), P(7, 7))); v.push_back(B(P(8, 8), P(9, 9))); - boost::geometry::index::rtree t(4, 2, T(v)); + boost::geometry::index::rtree t(4, 2, Tr(v)); boost::geometry::index::insert(t, 0u); boost::geometry::index::insert(t, 1u); From 8e23f2aa6b795d0951252cd6a7b6f6bdedf8bae2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 12 Jun 2011 19:29:56 +0000 Subject: [PATCH 030/366] split functionality (creation of the new node, parent setting, creating of the new root) moved to the default insert visitor [SVN r72557] --- .../extensions/index/rtree/rstar/insert.hpp | 13 +-- .../index/rtree/visitors/insert.hpp | 107 +++++++----------- 2 files changed, 44 insertions(+), 76 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 703909cac..649956a74 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -169,12 +169,7 @@ struct level_insert_base { // it's really the root node assert(&rtree::get(n) == base::m_root_node); - - detail::split::apply( - n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + base::split(n); } } } @@ -185,11 +180,7 @@ struct level_insert_base // overflow if ( base::m_max_elems_per_node < rtree::elements(n).size() ) { - detail::split::apply( - n, - base::m_parent, base::m_current_child_index, - base::m_root_node, base::m_leafs_level, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + base::split(n); } } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index c37d05174..9f45eab0d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -78,70 +78,11 @@ struct choose_next_node template struct redistribute_elements; -// Default split algorithm -template -struct split -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - static const size_t dimension = index::traits::dimension::value; - - template - static inline void apply( - Node & n, - internal_node *parent, - size_t current_child_index, - node *& root, - size_t & leafs_level, - size_t min_elems, - size_t max_elems, - Translator const& tr) - { - // create additional node - node * second_node = rtree::create_node(Node()); - Node & n2 = rtree::get(*second_node); - - // redistribute elements - Box box1, box2; - redistribute_elements:: - apply(n, n2, box1, box2, min_elems, max_elems, tr); - - // check numbers of elements - assert(min_elems <= rtree::elements(n).size() && rtree::elements(n).size() <= max_elems); - assert(min_elems <= rtree::elements(n2).size() && rtree::elements(n2).size() <= max_elems); - - // node is not the root - just add the new node - if ( parent != 0 ) - { - // update old node's box - rtree::elements(*parent)[current_child_index].first = box1; - // add new node to the parent's children - rtree::elements(*parent).push_back(std::make_pair(box2, second_node)); - } - // node is the root - add level - else - { - assert(&n == rtree::get(root)); - - // create new root and add nodes - node * new_root = rtree::create_node(internal_node()); - - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, root)); - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); - - root = new_root; - ++leafs_level; - } - } -}; - // Default insert visitor template class insert : public rtree::visitor::type { -public: +protected: typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -172,7 +113,6 @@ public: // assert - check if Box is correct } -protected: template inline void traverse(Visitor & visitor, internal_node & n) { @@ -200,10 +140,7 @@ protected: // handle overflow if ( m_max_elems_per_node < rtree::elements(n).size() ) { - split::apply( - n, m_parent, m_current_child_index, - m_root_node, m_leafs_level, - m_min_elems_per_node, m_max_elems_per_node, m_tr); + split(n); } } @@ -229,6 +166,46 @@ protected: m_current_level = current_level_bckup; } + template + inline void split(Node &n) const + { + // create additional node + node * second_node = rtree::create_node(Node()); + Node & n2 = rtree::get(*second_node); + + // redistribute elements + Box box1, box2; + redistribute_elements:: + apply(n, n2, box1, box2, m_min_elems_per_node, m_max_elems_per_node, m_tr); + + // check numbers of elements + assert(m_min_elems_per_node <= rtree::elements(n).size() && rtree::elements(n).size() <= m_max_elems_per_node); + assert(m_min_elems_per_node <= rtree::elements(n2).size() && rtree::elements(n2).size() <= m_max_elems_per_node); + + // node is not the root - just add the new node + if ( m_parent != 0 ) + { + // update old node's box + rtree::elements(*m_parent)[m_current_child_index].first = box1; + // add new node to the parent's children + rtree::elements(*m_parent).push_back(std::make_pair(box2, second_node)); + } + // node is the root - add level + else + { + assert(&n == rtree::get(m_root_node)); + + // create new root and add nodes + node * new_root = rtree::create_node(internal_node()); + + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, m_root_node)); + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); + + m_root_node = new_root; + ++m_leafs_level; + } + } + Element const& m_element; Translator const& m_tr; const size_t m_min_elems_per_node; From dd731e101a51250fe0767fbb3f06050ec654e3e4 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 13 Jun 2011 00:26:38 +0000 Subject: [PATCH 031/366] simple Tag template parameter replaced by Algo traits containing tags of some number of algorithms. User now may use a combination of implemented algorithms or just use one of the predefined. [SVN r72562] --- .../geometry/extensions/index/rtree/algo.hpp | 45 +++++++++ .../extensions/index/rtree/filters.hpp | 2 +- .../extensions/index/rtree/linear/algo.hpp | 29 ++++++ .../extensions/index/rtree/linear/linear.hpp | 7 +- .../rtree/linear/redistribute_elements.hpp | 10 +- .../extensions/index/rtree/quadratic/algo.hpp | 29 ++++++ .../index/rtree/quadratic/quadratic.hpp | 7 +- .../rtree/quadratic/redistribute_elements.hpp | 22 ++--- .../extensions/index/rtree/rstar/algo.hpp | 31 ++++++ .../index/rtree/rstar/choose_next_node.hpp | 10 +- .../extensions/index/rtree/rstar/insert.hpp | 97 +++++++++---------- .../rtree/rstar/redistribute_elements.hpp | 10 +- .../extensions/index/rtree/rstar/rstar.hpp | 7 +- .../geometry/extensions/index/rtree/rtree.hpp | 31 +++--- .../index/rtree/visitors/are_boxes_ok.hpp | 18 ++-- .../index/rtree/visitors/are_levels_ok.hpp | 18 ++-- .../index/rtree/visitors/destroy.hpp | 8 +- .../extensions/index/rtree/visitors/find.hpp | 10 +- .../index/rtree/visitors/gl_draw.hpp | 24 ++--- .../index/rtree/visitors/insert.hpp | 46 +++++---- .../index/rtree/visitors/is_leaf.hpp | 8 +- .../extensions/index/rtree/visitors/print.hpp | 22 ++--- .../index/rtree/visitors/remove.hpp | 14 +-- tests/additional_sizes_and_times.cpp | 4 + tests/translators.hpp | 1 + 25 files changed, 322 insertions(+), 188 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/algo.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/linear/algo.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/rstar/algo.hpp diff --git a/include/boost/geometry/extensions/index/rtree/algo.hpp b/include/boost/geometry/extensions/index/rtree/algo.hpp new file mode 100644 index 000000000..b3a8e83e8 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/algo.hpp @@ -0,0 +1,45 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - rtree variants algorithms +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ALGO_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ALGO_HPP + +namespace boost { namespace geometry { namespace index { + +struct default_tag {}; +struct analyze_area_tag {}; + +namespace detail { namespace rtree { + +template +struct algo +{ + typedef InsertTag insert_tag; + typedef ChooseNextNodeTag choose_next_node_tag; + typedef RedistributeTag redistribute_tag; + typedef NodeTag node_tag; +}; + +template +struct algo_type +{ + typedef void type; +}; + +template +struct algo_type< algo > +{ + typedef algo type; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 1f3a610b4..5673cc504 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -20,7 +20,7 @@ namespace boost { namespace geometry { namespace index { -template +template class rtree; namespace filters { diff --git a/include/boost/geometry/extensions/index/rtree/linear/algo.hpp b/include/boost/geometry/extensions/index/rtree/linear/algo.hpp new file mode 100644 index 000000000..52b24da63 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/linear/algo.hpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - rtree variants algorithms +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_ALGO_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_ALGO_HPP + +namespace boost { namespace geometry { namespace index { + +struct linear_tag {}; + +namespace detail { namespace rtree { + +template <> +struct algo_type +{ + typedef algo type; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp index 7bb7879c4..5850102f9 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp @@ -10,12 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP -namespace boost { namespace geometry { namespace index { - -struct linear_tag {}; - -}}} // namespace boost::geometry::index - +#include #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index cdd9eacec..29812132f 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -172,12 +172,12 @@ struct pick_seeds // from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; template static inline void apply(Node & n, diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp new file mode 100644 index 000000000..b27ad22a8 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - rtree variants algorithms +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_ALGO_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_ALGO_HPP + +namespace boost { namespace geometry { namespace index { + +struct quadratic_tag {}; + +namespace detail { namespace rtree { + +template <> +struct algo_type +{ + typedef algo type; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp index fed52522e..6a236759a 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp @@ -10,12 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP -namespace boost { namespace geometry { namespace index { - -struct quadratic_tag {}; - -}}} // namespace boost::geometry::index - +#include #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 8d2b43d58..774b736d8 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -75,23 +75,23 @@ struct pick_seeds } // namespace quadratic -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename index::default_area_result::type area_type; template static inline void apply(Node & n, - Node & second_node, - Box & box1, - Box & box2, - size_t min_elems, - size_t max_elems, - Translator const& tr) + Node & second_node, + Box & box1, + Box & box2, + size_t min_elems, + size_t max_elems, + Translator const& tr) { typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::value_type element_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/algo.hpp b/include/boost/geometry/extensions/index/rtree/rstar/algo.hpp new file mode 100644 index 000000000..20847c132 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/rstar/algo.hpp @@ -0,0 +1,31 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - rtree variants algorithms +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_ALGO_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_ALGO_HPP + +namespace boost { namespace geometry { namespace index { + +struct with_reinsert_tag {}; +struct find_minimum_cost_tag {}; +struct rstar_tag {}; + +namespace detail { namespace rtree { + +template <> +struct algo_type +{ + typedef algo type; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index eb34a346a..7778fe379 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -27,12 +27,12 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { -template -class choose_next_node +template +class choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 649956a74..d59c71e3d 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -25,23 +25,22 @@ namespace detail { namespace rstar { -template +template class remove_elements_to_reinsert { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; template - static inline void apply( - typename rtree::elements_type::type & result_elements, - Node & n, - internal_node *parent, - size_t current_child_index, - size_t min_elems, - size_t max_elems, - Translator const& tr) + static inline void apply(typename rtree::elements_type::type & result_elements, + Node & n, + internal_node *parent, + size_t current_child_index, + size_t min_elems, + size_t max_elems, + Translator const& tr) { typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::value_type element_type; @@ -107,32 +106,32 @@ private: } }; -template +template struct level_insert_result_type { typedef typename rtree::elements_type< - typename rtree::internal_node::type + typename rtree::internal_node::type >::type type; }; -template -struct level_insert_result_type<0, Value, Value, Box> +template +struct level_insert_result_type<0, Value, Value, Algo, Box> { typedef typename rtree::elements_type< - typename rtree::leaf::type + typename rtree::leaf::type >::type type; }; -template +template struct level_insert_base - : public detail::insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename level_insert_result_type::type result_type; + typedef typename level_insert_result_type::type result_type; inline level_insert_base(node* & root, size_t & leafs_level, @@ -159,7 +158,7 @@ struct level_insert_base // node isn't root node if ( base::m_parent ) { - rstar::remove_elements_to_reinsert::apply( + rstar::remove_elements_to_reinsert::apply( result_elements, n, base::m_parent, base::m_current_child_index, base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); @@ -199,11 +198,11 @@ struct level_insert_base result_type result_elements; }; -template +template struct level_insert - : public level_insert_base + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -268,11 +267,11 @@ struct level_insert } }; -template -struct level_insert - : public level_insert_base +template +struct level_insert + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -319,11 +318,11 @@ struct level_insert } }; -template -struct level_insert<0, Value, Value, Translator, Box> - : public level_insert_base<0, Value, Value, Translator, Box> +template +struct level_insert<0, Value, Value, Algo, Translator, Box> + : public level_insert_base<0, Value, Value, Algo, Translator, Box> { - typedef level_insert_base<0, Value, Value, Translator, Box> base; + typedef level_insert_base<0, Value, Value, Algo, Translator, Box> base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -366,13 +365,13 @@ struct level_insert<0, Value, Value, Translator, Box> }; // R*-tree insert visitor -template -class insert : public rtree::visitor::type +template +class insert : public rtree::visitor::type { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline insert(node* & root, @@ -392,7 +391,7 @@ public: { typedef typename elements_type::type elements_type; - rstar::level_insert<0, Element, Value, Translator, Box> lins_v( + rstar::level_insert<0, Element, Value, Algo, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); rtree::apply_visitor(lins_v, n); @@ -405,7 +404,7 @@ public: inline void operator()(leaf & n) { - rstar::level_insert<0, Element, Value, Translator, Box> lins_v( + rstar::level_insert<0, Element, Value, Algo, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); rtree::apply_visitor(lins_v, n); @@ -424,7 +423,7 @@ protected: for ( typename Elements::const_reverse_iterator it = elements.rbegin(); it != elements.rend(); ++it) { - rstar::level_insert<1, element_type, Value, Translator, Box> lins_v( + rstar::level_insert<1, element_type, Value, Algo, Translator, Box> lins_v( m_root, m_leafs_level, *it, m_min_elements, m_max_elements, m_tr, relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -453,11 +452,11 @@ protected: } // namespace detail // R*-tree insert visitor -template -class insert - : public detail::rstar::insert +template +class insert + : public detail::rstar::insert { - typedef detail::rstar::insert base; + typedef detail::rstar::insert base; typedef typename base::node node; public: @@ -474,11 +473,11 @@ public: }; // R*-tree insert visitor -template -class insert - : public detail::rstar::insert +template +class insert + : public detail::rstar::insert { - typedef detail::rstar::insert base; + typedef detail::rstar::insert base; typedef typename base::node node; public: diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 574704ee9..7619a0366 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -311,12 +311,12 @@ struct partial_sort } // namespace rstar -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; static const size_t dimension = index::traits::dimension::value; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index a8878636a..4e435de1f 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -10,12 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP -namespace boost { namespace geometry { namespace index { - -struct rstar_tag {}; - -}}} // namespace boost::geometry::index - +#include #include #include #include diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 66b536330..87fa0c6b9 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -16,6 +16,7 @@ #include +#include #include #include @@ -33,7 +34,7 @@ namespace boost { namespace geometry { namespace index { template < typename Value, - typename Tag = linear_tag, + typename Algo = linear_tag, typename Translator = translator::def > class rtree @@ -43,11 +44,13 @@ public: typedef Translator translator_type; typedef typename translator_type::indexable_type indexable_type; typedef typename index::default_box_type::type box_type; - typedef Tag tag_type; + + typedef typename detail::rtree::algo_type::type algo_type; + typedef typename algo_type::node_tag node_tag; - typedef typename detail::rtree::node::type node; - typedef typename detail::rtree::internal_node::type internal_node; - typedef typename detail::rtree::leaf::type leaf; + typedef typename detail::rtree::node::type node; + typedef typename detail::rtree::internal_node::type internal_node; + typedef typename detail::rtree::leaf::type leaf; inline explicit rtree( size_t max_elems_per_node = 4, @@ -71,7 +74,7 @@ public: ~rtree() { - detail::rtree::visitors::destroy del_v; + detail::rtree::visitors::destroy del_v; detail::rtree::apply_visitor(del_v, *m_root); } @@ -80,7 +83,7 @@ public: template inline void find(Geometry const& geom, OutIter out_it) const { - detail::rtree::visitors::find + detail::rtree::visitors::find find_v(m_translator, geom, out_it); detail::rtree::apply_visitor(find_v, *m_root); @@ -90,7 +93,7 @@ public: { // TODO: awulkiew - assert for correct value - detail::rtree::visitors::insert + detail::rtree::visitors::insert insert_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); detail::rtree::apply_visitor(insert_v, *m_root); @@ -103,7 +106,7 @@ public: // TODO: awulkiew - assert for correct value assert(0 < m_values_count); - detail::rtree::visitors::remove + detail::rtree::visitors::remove remove_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); detail::rtree::apply_visitor(remove_v, *m_root); @@ -153,18 +156,18 @@ private: translator_type m_translator; }; -template -void insert(rtree & tree, Value const& v) +template +void insert(rtree & tree, Value const& v) { tree.insert(v); } -template -void remove(rtree & tree, Value const& v) +template +void remove(rtree & tree, Value const& v) { tree.remove(v); } }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RSTREE_RSTREE_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 0154198ed..ac4b7a903 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -17,11 +17,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -class are_boxes_ok : public rtree::visitor::type +template +class are_boxes_ok : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_boxes_ok(Translator const& tr) @@ -107,15 +107,15 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_boxes_ok(rtree const& tree) +template +bool are_boxes_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; detail::rtree::visitors::are_boxes_ok< typename rt::value_type, + typename rt::algo_type, typename rt::translator_type, - typename rt::box_type, - typename rt::tag_type> v(tree.get_translator()); + typename rt::box_type> v(tree.get_translator()); tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index 8c00b9612..e8ed8bf51 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -16,11 +16,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -class are_levels_ok : public rtree::visitor::type +template +class are_levels_ok : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_levels_ok(Translator const& tr) @@ -85,15 +85,15 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_levels_ok(rtree const& tree) +template +bool are_levels_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; detail::rtree::visitors::are_levels_ok< typename rt::value_type, + typename rt::algo_type, typename rt::translator_type, - typename rt::box_type, - typename rt::tag_type> v(tree.get_translator()); + typename rt::box_type> v(tree.get_translator()); tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 111d82352..19d7ee0bf 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -16,11 +16,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct destroy : public rtree::visitor::type +template +struct destroy : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node & n) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index e3c88abdb..9b4a9b046 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -142,12 +142,12 @@ namespace detail { namespace rtree { namespace visitors { // rtree spatial query visitor -template -struct find : public rtree::visitor::type +template +struct find : public rtree::visitor::type { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline find(Translator const& t, Geometry const& g, OutIter out_it) : tr(t), geom(g), out_iter(out_it) 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 38278e4bc..dacb3523a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -94,11 +94,11 @@ inline void gl_draw_indexable(Indexable const& i, typename index::traits::coordi } // namespace detail -template -struct gl_draw : public rtree::visitor::type +template +struct gl_draw : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline gl_draw(Translator const& t, size_t level_first = 0, @@ -187,23 +187,23 @@ struct gl_draw : public rtree::visitor::type }}} // namespace detail::rtree::visitors -template -void gl_draw(rtree const& tree, +template +void gl_draw(rtree const& tree, size_t level_first = 0, size_t level_last = std::numeric_limits::max(), typename index::traits::coordinate_type< - typename rtree::box_type + typename rtree::box_type >::type z_coord_level_multiplier = 1 ) { - typedef typename rtree::value_type value_type; - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; - typedef typename rtree::tag_type tag_type; + typedef typename rtree::value_type value_type; + typedef typename rtree::algo_type algo_type; + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; glClear(GL_COLOR_BUFFER_BIT); - detail::rtree::visitors::gl_draw + detail::rtree::visitors::gl_draw gl_draw_v(tree.get_translator(), level_first, level_last, z_coord_level_multiplier); tree.apply_visitor(gl_draw_v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 9f45eab0d..0af63db5b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -21,12 +21,15 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { // Default choose_next_node -template -struct choose_next_node +template +struct choose_next_node; + +template +struct choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; @@ -75,17 +78,17 @@ struct choose_next_node }; // Not implemented here -template +template struct redistribute_elements; // Default insert visitor -template -class insert : public rtree::visitor::type +template +class insert : public rtree::visitor::type { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline insert(node* & root, size_t & leafs_level, @@ -117,7 +120,7 @@ protected: inline void traverse(Visitor & visitor, internal_node & n) { // choose next node - size_t choosen_node_index = detail::choose_next_node:: + size_t choosen_node_index = detail::choose_next_node:: apply(n, rtree::element_indexable(m_element, m_tr), m_leafs_level - m_current_level); // expand the node to contain value @@ -175,7 +178,7 @@ protected: // redistribute elements Box box1, box2; - redistribute_elements:: + redistribute_elements:: apply(n, n2, box1, box2, m_min_elems_per_node, m_max_elems_per_node, m_tr); // check numbers of elements @@ -224,11 +227,15 @@ protected: } // namespace detail +template +struct insert; + // Default insert visitor -template -struct insert : public detail::insert +template +struct insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -271,10 +278,11 @@ struct insert : public detail::insert }; // Default insert visitor specialized for Values elements -template -struct insert : public detail::insert +template +struct insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index e637ae6fb..2d3b8ca8f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -16,11 +16,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct is_leaf : public rtree::visitor::type +template +struct is_leaf : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node const&) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 933b86851..1b83eae23 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -113,11 +113,11 @@ inline void print_indexable(std::ostream & os, Indexable const& i) } // namespace detail -template -struct print : public rtree::visitor::type +template +struct print : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline print(std::ostream & o, Translator const& t) : os(o), tr(t), level(0) @@ -180,14 +180,14 @@ struct print : public rtree::visitor::type }}} // namespace detail::rtree::visitors -template -std::ostream & operator<<(std::ostream & os, rtree const& tree) +template +std::ostream & operator<<(std::ostream & os, rtree const& tree) { - typedef typename rtree::value_type value_type; - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; - typedef typename rtree::tag_type tag_type; - detail::rtree::visitors::print print_v(os, tree.get_translator()); + typedef typename rtree::value_type value_type; + typedef typename rtree::algo_type algo_type; + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; + detail::rtree::visitors::print print_v(os, tree.get_translator()); tree.apply_visitor(print_v); return os; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index a7e777e11..d1d8b7354 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -21,12 +21,12 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { // Default remove algorithm -template -class remove : public rtree::visitor::type +template +class remove : public rtree::visitor::type { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline remove(node* & root, @@ -115,7 +115,7 @@ public: for ( typename std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); it != m_underflowed_nodes.rend() ; ++it ) { - is_leaf ilv; + is_leaf ilv; rtree::apply_visitor(ilv, *it->second); if ( ilv.result ) reinsert_elements(rtree::get(*it->second), it->first); @@ -193,7 +193,7 @@ private: for ( typename elements_type::iterator it = elements.begin(); it != elements.end() ; ++it ) { - visitors::insert insert_v( + visitors::insert insert_v( m_root_node, m_leafs_level, *it, diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index d93387440..1d4a9e32c 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -32,6 +32,10 @@ int main() //typedef bgi::rtree, bgi::linear_tag> RT; //typedef bgi::rtree, bgi::quadratic_tag> RT; typedef bgi::rtree, bgi::rstar_tag> RT; + /*typedef bgi::rtree< + std::pair, + bgi::detail::rtree::algo + > RT;*/ // load config file std::ifstream file_cfg("config.txt"); diff --git a/tests/translators.hpp b/tests/translators.hpp index f53681c8c..ab5abceac 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -2,6 +2,7 @@ #define TESTS_TRANSLATORS_HPP #include +#include #include #include From 7ae26e7c0fea1ed467c10a3ec7be4cbd58933c49 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 13 Jun 2011 16:34:49 +0000 Subject: [PATCH 032/366] Algo-related names changed to Options-related names. All options gathered in one file /rtree/options.hpp instead of defining them separately for all rtree variants in /rtree/[variant]/options.hpp. [SVN r72569] --- .../geometry/extensions/index/rtree/algo.hpp | 45 ---------- .../extensions/index/rtree/filters.hpp | 8 +- .../extensions/index/rtree/linear/algo.hpp | 29 ------- .../extensions/index/rtree/linear/linear.hpp | 1 - .../rtree/linear/redistribute_elements.hpp | 10 +-- .../extensions/index/rtree/options.hpp | 76 +++++++++++++++++ .../extensions/index/rtree/quadratic/algo.hpp | 29 ------- .../index/rtree/quadratic/quadratic.hpp | 1 - .../rtree/quadratic/redistribute_elements.hpp | 10 +-- .../extensions/index/rtree/rstar/algo.hpp | 31 ------- .../index/rtree/rstar/choose_next_node.hpp | 10 +-- .../extensions/index/rtree/rstar/insert.hpp | 82 +++++++++---------- .../rtree/rstar/redistribute_elements.hpp | 10 +-- .../extensions/index/rtree/rstar/rstar.hpp | 1 - .../geometry/extensions/index/rtree/rtree.hpp | 24 +++--- .../index/rtree/visitors/are_boxes_ok.hpp | 16 ++-- .../index/rtree/visitors/are_levels_ok.hpp | 16 ++-- .../index/rtree/visitors/destroy.hpp | 8 +- .../extensions/index/rtree/visitors/find.hpp | 10 +-- .../index/rtree/visitors/gl_draw.hpp | 24 +++--- .../index/rtree/visitors/insert.hpp | 46 +++++------ .../index/rtree/visitors/is_leaf.hpp | 8 +- .../extensions/index/rtree/visitors/print.hpp | 22 ++--- .../index/rtree/visitors/remove.hpp | 14 ++-- tests/additional_sizes_and_times.cpp | 2 +- 25 files changed, 236 insertions(+), 297 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/rtree/algo.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/linear/algo.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/options.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/rstar/algo.hpp diff --git a/include/boost/geometry/extensions/index/rtree/algo.hpp b/include/boost/geometry/extensions/index/rtree/algo.hpp deleted file mode 100644 index b3a8e83e8..000000000 --- a/include/boost/geometry/extensions/index/rtree/algo.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - rtree variants algorithms -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ALGO_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ALGO_HPP - -namespace boost { namespace geometry { namespace index { - -struct default_tag {}; -struct analyze_area_tag {}; - -namespace detail { namespace rtree { - -template -struct algo -{ - typedef InsertTag insert_tag; - typedef ChooseNextNodeTag choose_next_node_tag; - typedef RedistributeTag redistribute_tag; - typedef NodeTag node_tag; -}; - -template -struct algo_type -{ - typedef void type; -}; - -template -struct algo_type< algo > -{ - typedef algo type; -}; - -}} // namespace detail::rtree - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 5673cc504..4cee0bfa1 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -20,20 +20,20 @@ namespace boost { namespace geometry { namespace index { -template +template class rtree; namespace filters { -template -class spatial_filter< index::rtree > +template +class spatial_filter< index::rtree > { public: typedef typename std::deque::iterator iterator; typedef typename std::deque::const_iterator const_iterator; template - inline spatial_filter(index::rtree const& rtree, Geometry const& geom) + inline spatial_filter(index::rtree const& rtree, Geometry const& geom) { rtree.find(geom, std::back_inserter(m_result)); } diff --git a/include/boost/geometry/extensions/index/rtree/linear/algo.hpp b/include/boost/geometry/extensions/index/rtree/linear/algo.hpp deleted file mode 100644 index 52b24da63..000000000 --- a/include/boost/geometry/extensions/index/rtree/linear/algo.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - rtree variants algorithms -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_ALGO_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_ALGO_HPP - -namespace boost { namespace geometry { namespace index { - -struct linear_tag {}; - -namespace detail { namespace rtree { - -template <> -struct algo_type -{ - typedef algo type; -}; - -}} // namespace detail::rtree - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp index 5850102f9..bf8db77ca 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp @@ -10,7 +10,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP -#include #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 29812132f..0c65c4333 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -172,12 +172,12 @@ struct pick_seeds // from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; template static inline void apply(Node & n, diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp new file mode 100644 index 000000000..de5b971aa --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -0,0 +1,76 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - rtree variants options +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP + +namespace boost { namespace geometry { namespace index { + +// InsertTag +struct insert_tag {}; +struct reinsert_tag {}; + +// ChooseNextNodeTag +struct choose_by_area_diff_tag {}; +struct choose_by_overlap_diff_tag {}; + +// RedistributeTag +struct linear_tag {}; +struct quadratic_tag {}; +struct rstar_tag {}; + +// NodeTag +struct default_tag {}; + +namespace detail { namespace rtree { + +template +struct options +{ + typedef InsertTag insert_tag; + typedef ChooseNextNodeTag choose_next_node_tag; + typedef RedistributeTag redistribute_tag; + typedef NodeTag node_tag; +}; + +template +struct options_type +{ + typedef void type; +}; + +template +struct options_type< options > +{ + typedef options type; +}; + +template <> +struct options_type +{ + typedef options type; +}; + +template <> +struct options_type +{ + typedef options type; +}; + +template <> +struct options_type +{ + typedef options type; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp deleted file mode 100644 index b27ad22a8..000000000 --- a/include/boost/geometry/extensions/index/rtree/quadratic/algo.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - rtree variants algorithms -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_ALGO_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_ALGO_HPP - -namespace boost { namespace geometry { namespace index { - -struct quadratic_tag {}; - -namespace detail { namespace rtree { - -template <> -struct algo_type -{ - typedef algo type; -}; - -}} // namespace detail::rtree - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp index 6a236759a..5927a2b27 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp @@ -10,7 +10,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP -#include #include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 774b736d8..23b602747 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -75,12 +75,12 @@ struct pick_seeds } // namespace quadratic -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename index::default_area_result::type area_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/algo.hpp b/include/boost/geometry/extensions/index/rtree/rstar/algo.hpp deleted file mode 100644 index 20847c132..000000000 --- a/include/boost/geometry/extensions/index/rtree/rstar/algo.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - rtree variants algorithms -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_ALGO_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_ALGO_HPP - -namespace boost { namespace geometry { namespace index { - -struct with_reinsert_tag {}; -struct find_minimum_cost_tag {}; -struct rstar_tag {}; - -namespace detail { namespace rtree { - -template <> -struct algo_type -{ - typedef algo type; -}; - -}} // namespace detail::rtree - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_ALGO_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 7778fe379..f6152cdc5 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -27,12 +27,12 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { -template -class choose_next_node +template +class choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index d59c71e3d..b361815f6 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -25,13 +25,13 @@ namespace detail { namespace rstar { -template +template class remove_elements_to_reinsert { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; template static inline void apply(typename rtree::elements_type::type & result_elements, @@ -106,32 +106,32 @@ private: } }; -template +template struct level_insert_result_type { typedef typename rtree::elements_type< - typename rtree::internal_node::type + typename rtree::internal_node::type >::type type; }; -template -struct level_insert_result_type<0, Value, Value, Algo, Box> +template +struct level_insert_result_type<0, Value, Value, Options, Box> { typedef typename rtree::elements_type< - typename rtree::leaf::type + typename rtree::leaf::type >::type type; }; -template +template struct level_insert_base - : public detail::insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename level_insert_result_type::type result_type; + typedef typename level_insert_result_type::type result_type; inline level_insert_base(node* & root, size_t & leafs_level, @@ -158,7 +158,7 @@ struct level_insert_base // node isn't root node if ( base::m_parent ) { - rstar::remove_elements_to_reinsert::apply( + rstar::remove_elements_to_reinsert::apply( result_elements, n, base::m_parent, base::m_current_child_index, base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); @@ -198,11 +198,11 @@ struct level_insert_base result_type result_elements; }; -template +template struct level_insert - : public level_insert_base + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -267,11 +267,11 @@ struct level_insert } }; -template -struct level_insert - : public level_insert_base +template +struct level_insert + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -318,11 +318,11 @@ struct level_insert } }; -template -struct level_insert<0, Value, Value, Algo, Translator, Box> - : public level_insert_base<0, Value, Value, Algo, Translator, Box> +template +struct level_insert<0, Value, Value, Options, Translator, Box> + : public level_insert_base<0, Value, Value, Options, Translator, Box> { - typedef level_insert_base<0, Value, Value, Algo, Translator, Box> base; + typedef level_insert_base<0, Value, Value, Options, Translator, Box> base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -365,13 +365,13 @@ struct level_insert<0, Value, Value, Algo, Translator, Box> }; // R*-tree insert visitor -template -class insert : public rtree::visitor::type +template +class insert : public rtree::visitor::type { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline insert(node* & root, @@ -391,7 +391,7 @@ public: { typedef typename elements_type::type elements_type; - rstar::level_insert<0, Element, Value, Algo, Translator, Box> lins_v( + rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); rtree::apply_visitor(lins_v, n); @@ -404,7 +404,7 @@ public: inline void operator()(leaf & n) { - rstar::level_insert<0, Element, Value, Algo, Translator, Box> lins_v( + rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); rtree::apply_visitor(lins_v, n); @@ -423,7 +423,7 @@ protected: for ( typename Elements::const_reverse_iterator it = elements.rbegin(); it != elements.rend(); ++it) { - rstar::level_insert<1, element_type, Value, Algo, Translator, Box> lins_v( + rstar::level_insert<1, element_type, Value, Options, Translator, Box> lins_v( m_root, m_leafs_level, *it, m_min_elements, m_max_elements, m_tr, relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -452,11 +452,11 @@ protected: } // namespace detail // R*-tree insert visitor -template -class insert - : public detail::rstar::insert +template +class insert + : public detail::rstar::insert { - typedef detail::rstar::insert base; + typedef detail::rstar::insert base; typedef typename base::node node; public: @@ -473,11 +473,11 @@ public: }; // R*-tree insert visitor -template -class insert - : public detail::rstar::insert +template +class insert + : public detail::rstar::insert { - typedef detail::rstar::insert base; + typedef detail::rstar::insert base; typedef typename base::node node; public: diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 7619a0366..caa33f6d8 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -311,12 +311,12 @@ struct partial_sort } // namespace rstar -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; static const size_t dimension = index::traits::dimension::value; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index 4e435de1f..973d9a572 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -10,7 +10,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP -#include #include #include #include diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 87fa0c6b9..125b4ed9c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -34,7 +34,7 @@ namespace boost { namespace geometry { namespace index { template < typename Value, - typename Algo = linear_tag, + typename Options = linear_tag, typename Translator = translator::def > class rtree @@ -45,8 +45,8 @@ public: typedef typename translator_type::indexable_type indexable_type; typedef typename index::default_box_type::type box_type; - typedef typename detail::rtree::algo_type::type algo_type; - typedef typename algo_type::node_tag node_tag; + typedef typename detail::rtree::options_type::type options_type; + typedef typename options_type::node_tag node_tag; typedef typename detail::rtree::node::type node; typedef typename detail::rtree::internal_node::type internal_node; @@ -74,7 +74,7 @@ public: ~rtree() { - detail::rtree::visitors::destroy del_v; + detail::rtree::visitors::destroy del_v; detail::rtree::apply_visitor(del_v, *m_root); } @@ -83,7 +83,7 @@ public: template inline void find(Geometry const& geom, OutIter out_it) const { - detail::rtree::visitors::find + detail::rtree::visitors::find find_v(m_translator, geom, out_it); detail::rtree::apply_visitor(find_v, *m_root); @@ -93,7 +93,7 @@ public: { // TODO: awulkiew - assert for correct value - detail::rtree::visitors::insert + detail::rtree::visitors::insert insert_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); detail::rtree::apply_visitor(insert_v, *m_root); @@ -106,7 +106,7 @@ public: // TODO: awulkiew - assert for correct value assert(0 < m_values_count); - detail::rtree::visitors::remove + detail::rtree::visitors::remove remove_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); detail::rtree::apply_visitor(remove_v, *m_root); @@ -156,14 +156,14 @@ private: translator_type m_translator; }; -template -void insert(rtree & tree, Value const& v) +template +void insert(rtree & tree, Value const& v) { tree.insert(v); } -template -void remove(rtree & tree, Value const& v) +template +void remove(rtree & tree, Value const& v) { tree.remove(v); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index ac4b7a903..0feca1992 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -17,11 +17,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -class are_boxes_ok : public rtree::visitor::type +template +class are_boxes_ok : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_boxes_ok(Translator const& tr) @@ -107,13 +107,13 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_boxes_ok(rtree const& tree) +template +bool are_boxes_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; detail::rtree::visitors::are_boxes_ok< typename rt::value_type, - typename rt::algo_type, + typename rt::options_type, typename rt::translator_type, typename rt::box_type> v(tree.get_translator()); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index e8ed8bf51..a85c8feab 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -16,11 +16,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -class are_levels_ok : public rtree::visitor::type +template +class are_levels_ok : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_levels_ok(Translator const& tr) @@ -85,13 +85,13 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_levels_ok(rtree const& tree) +template +bool are_levels_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; detail::rtree::visitors::are_levels_ok< typename rt::value_type, - typename rt::algo_type, + typename rt::options_type, typename rt::translator_type, typename rt::box_type> v(tree.get_translator()); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 19d7ee0bf..244464fd7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -16,11 +16,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct destroy : public rtree::visitor::type +template +struct destroy : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node & n) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 9b4a9b046..b067664af 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -142,12 +142,12 @@ namespace detail { namespace rtree { namespace visitors { // rtree spatial query visitor -template -struct find : public rtree::visitor::type +template +struct find : public rtree::visitor::type { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline find(Translator const& t, Geometry const& g, OutIter out_it) : tr(t), geom(g), out_iter(out_it) 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 dacb3523a..3bb736423 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -94,11 +94,11 @@ inline void gl_draw_indexable(Indexable const& i, typename index::traits::coordi } // namespace detail -template -struct gl_draw : public rtree::visitor::type +template +struct gl_draw : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline gl_draw(Translator const& t, size_t level_first = 0, @@ -187,23 +187,23 @@ struct gl_draw : public rtree::visitor -void gl_draw(rtree const& tree, +template +void gl_draw(rtree const& tree, size_t level_first = 0, size_t level_last = std::numeric_limits::max(), typename index::traits::coordinate_type< - typename rtree::box_type + typename rtree::box_type >::type z_coord_level_multiplier = 1 ) { - typedef typename rtree::value_type value_type; - typedef typename rtree::algo_type algo_type; - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; + typedef typename rtree::value_type value_type; + typedef typename rtree::options_type options_type; + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; glClear(GL_COLOR_BUFFER_BIT); - detail::rtree::visitors::gl_draw + detail::rtree::visitors::gl_draw gl_draw_v(tree.get_translator(), level_first, level_last, z_coord_level_multiplier); tree.apply_visitor(gl_draw_v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 0af63db5b..246bc09e7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -21,15 +21,15 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { // Default choose_next_node -template +template struct choose_next_node; -template -struct choose_next_node +template +struct choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; @@ -78,17 +78,17 @@ struct choose_next_node }; // Not implemented here -template +template struct redistribute_elements; // Default insert visitor -template -class insert : public rtree::visitor::type +template +class insert : public rtree::visitor::type { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline insert(node* & root, size_t & leafs_level, @@ -120,7 +120,7 @@ protected: inline void traverse(Visitor & visitor, internal_node & n) { // choose next node - size_t choosen_node_index = detail::choose_next_node:: + size_t choosen_node_index = detail::choose_next_node:: apply(n, rtree::element_indexable(m_element, m_tr), m_leafs_level - m_current_level); // expand the node to contain value @@ -178,7 +178,7 @@ protected: // redistribute elements Box box1, box2; - redistribute_elements:: + redistribute_elements:: apply(n, n2, box1, box2, m_min_elems_per_node, m_max_elems_per_node, m_tr); // check numbers of elements @@ -227,15 +227,15 @@ protected: } // namespace detail -template +template struct insert; // Default insert visitor -template -struct insert - : public detail::insert +template +struct insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -278,11 +278,11 @@ struct insert }; // Default insert visitor specialized for Values elements -template -struct insert - : public detail::insert +template +struct insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index 2d3b8ca8f..44d7b37d0 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -16,11 +16,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct is_leaf : public rtree::visitor::type +template +struct is_leaf : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node const&) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 1b83eae23..20cd48b8b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -113,11 +113,11 @@ inline void print_indexable(std::ostream & os, Indexable const& i) } // namespace detail -template -struct print : public rtree::visitor::type +template +struct print : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline print(std::ostream & o, Translator const& t) : os(o), tr(t), level(0) @@ -180,14 +180,14 @@ struct print : public rtree::visitor: }}} // namespace detail::rtree::visitors -template -std::ostream & operator<<(std::ostream & os, rtree const& tree) +template +std::ostream & operator<<(std::ostream & os, rtree const& tree) { - typedef typename rtree::value_type value_type; - typedef typename rtree::algo_type algo_type; - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; - detail::rtree::visitors::print print_v(os, tree.get_translator()); + typedef typename rtree::value_type value_type; + typedef typename rtree::options_type options_type; + typedef typename rtree::translator_type translator_type; + typedef typename rtree::box_type box_type; + detail::rtree::visitors::print print_v(os, tree.get_translator()); tree.apply_visitor(print_v); return os; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index d1d8b7354..aeec42d4d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -21,12 +21,12 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { // Default remove algorithm -template -class remove : public rtree::visitor::type +template +class remove : public rtree::visitor::type { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline remove(node* & root, @@ -115,7 +115,7 @@ public: for ( typename std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); it != m_underflowed_nodes.rend() ; ++it ) { - is_leaf ilv; + is_leaf ilv; rtree::apply_visitor(ilv, *it->second); if ( ilv.result ) reinsert_elements(rtree::get(*it->second), it->first); @@ -193,7 +193,7 @@ private: for ( typename elements_type::iterator it = elements.begin(); it != elements.end() ; ++it ) { - visitors::insert insert_v( + visitors::insert insert_v( m_root_node, m_leafs_level, *it, diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 1d4a9e32c..e75d49ded 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -34,7 +34,7 @@ int main() typedef bgi::rtree, bgi::rstar_tag> RT; /*typedef bgi::rtree< std::pair, - bgi::detail::rtree::algo + bgi::detail::rtree::options > RT;*/ // load config file From 7a36d65bab9abc8864dfbd9dae62087ca15ce3a5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 13 Jun 2011 21:04:55 +0000 Subject: [PATCH 033/366] translator::getter added + some cleanup e.g. in /rstar/insert.hpp visitors::insert replaced by detail::rstar::insert. [SVN r72573] --- .../extensions/index/rtree/rstar/insert.hpp | 188 +++++++----------- .../geometry/extensions/index/rtree/rtree.hpp | 2 +- .../index/rtree/visitors/insert.hpp | 3 +- .../extensions/index/translator/getter.hpp | 33 +++ .../index/translator/translator.hpp | 17 ++ tests/translators.hpp | 18 +- 6 files changed, 142 insertions(+), 119 deletions(-) create mode 100644 include/boost/geometry/extensions/index/translator/getter.hpp create mode 100644 include/boost/geometry/extensions/index/translator/translator.hpp diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index b361815f6..ac2d74739 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -364,89 +364,6 @@ struct level_insert<0, Value, Value, Options, Translator, Box> } }; -// R*-tree insert visitor -template -class insert : public rtree::visitor::type -{ -protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - -public: - inline insert(node* & root, - size_t & leafs_level, - Element const& element, - size_t min_elements, - size_t max_elements, - Translator const& tr, - size_t relative_level = 0 - ) - : m_root(root), m_leafs_level(leafs_level), m_element(element) - , m_min_elements(min_elements), m_max_elements(max_elements) - , m_tr(tr), m_relative_level(relative_level) - {} - - inline void operator()(internal_node & n) - { - typedef typename elements_type::type elements_type; - - rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); - - rtree::apply_visitor(lins_v, n); - - if ( !lins_v.result_elements.empty() ) - { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); - } - } - - inline void operator()(leaf & n) - { - rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); - - rtree::apply_visitor(lins_v, n); - - // we're in the root, so root should be split and there should be no elements to reinsert - assert(lins_v.result_elements.empty()); - } - -protected: - template - inline void recursive_reinsert(Elements const& elements, size_t relative_level) - { - typedef typename Elements::value_type element_type; - - // reinsert children starting from the minimum distance - for ( typename Elements::const_reverse_iterator it = elements.rbegin(); - it != elements.rend(); ++it) - { - rstar::level_insert<1, element_type, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, *it, m_min_elements, m_max_elements, m_tr, relative_level); - - rtree::apply_visitor(lins_v, *m_root); - - assert(relative_level + 1 == lins_v.result_relative_level); - - // non-root relative level - if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty()) - { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); - } - } - } - - node* & m_root; - size_t & m_leafs_level; - Element const& m_element; - size_t m_min_elements; - size_t m_max_elements; - Translator const& m_tr; - size_t m_relative_level; -}; - } // namespace rstar } // namespace detail @@ -454,43 +371,84 @@ protected: // R*-tree insert visitor template class insert - : public detail::rstar::insert + : public rtree::visitor::type { - typedef detail::rstar::insert base; - typedef typename base::node node; +private: + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: - inline insert(node* & root, - size_t & leafs_level, - Element const& element, - size_t min_elements, - size_t max_elements, - Translator const& tr, - size_t relative_level = 0 - ) - : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) - {} -}; + inline insert(node* & root, + size_t & leafs_level, + Element const& element, + size_t min_elements, + size_t max_elements, + Translator const& tr, + size_t relative_level = 0) + : m_root(root), m_leafs_level(leafs_level), m_element(element) + , m_min_elements(min_elements), m_max_elements(max_elements) + , m_tr(tr), m_relative_level(relative_level) + {} -// R*-tree insert visitor -template -class insert - : public detail::rstar::insert -{ - typedef detail::rstar::insert base; - typedef typename base::node node; + inline void operator()(internal_node & n) + { + typedef typename elements_type::type elements_type; -public: - inline insert(node* & root, - size_t & leafs_level, - Value const& element, - size_t min_elements, - size_t max_elements, - Translator const& tr, - size_t relative_level = 0 - ) - : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) - {} + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( + m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); + + rtree::apply_visitor(lins_v, n); + + if ( !lins_v.result_elements.empty() ) + { + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); + } + } + + inline void operator()(leaf & n) + { + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( + m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); + + rtree::apply_visitor(lins_v, n); + + // we're in the root, so root should be split and there should be no elements to reinsert + assert(lins_v.result_elements.empty()); + } + +private: + template + inline void recursive_reinsert(Elements const& elements, size_t relative_level) + { + typedef typename Elements::value_type element_type; + + // reinsert children starting from the minimum distance + for ( typename Elements::const_reverse_iterator it = elements.rbegin(); + it != elements.rend(); ++it) + { + detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box> lins_v( + m_root, m_leafs_level, *it, m_min_elements, m_max_elements, m_tr, relative_level); + + rtree::apply_visitor(lins_v, *m_root); + + assert(relative_level + 1 == lins_v.result_relative_level); + + // non-root relative level + if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty()) + { + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); + } + } + } + + node* & m_root; + size_t & m_leafs_level; + Element const& m_element; + size_t m_min_elements; + size_t m_max_elements; + Translator const& m_tr; + size_t m_relative_level; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 125b4ed9c..b7499918c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 246bc09e7..8c2e180fc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -227,10 +227,11 @@ protected: } // namespace detail +// Insert visitor forward declaration template struct insert; -// Default insert visitor +// Default insert visitor used for nodes elements template struct insert : public detail::insert diff --git a/include/boost/geometry/extensions/index/translator/getter.hpp b/include/boost/geometry/extensions/index/translator/getter.hpp new file mode 100644 index 000000000..a3cacdfea --- /dev/null +++ b/include/boost/geometry/extensions/index/translator/getter.hpp @@ -0,0 +1,33 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - value to bounding object translation as a getter (object's member function) +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_GETTER_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_GETTER_HPP + +namespace boost { namespace geometry { namespace index { namespace translator { + +template +struct getter +{ + typedef Indexable indexable_type; + + indexable_type const& operator()(Value const& v) const + { + return (v.*Getter)(); + } + + bool equals(Value const& v1, Value const& v2) const + { + return geometry::equals(operator()(v1), operator()(v2)); + } +}; + +}}}} // namespace boost::geometry::index::translator + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_GETTER_HPP diff --git a/include/boost/geometry/extensions/index/translator/translator.hpp b/include/boost/geometry/extensions/index/translator/translator.hpp new file mode 100644 index 000000000..349e394f1 --- /dev/null +++ b/include/boost/geometry/extensions/index/translator/translator.hpp @@ -0,0 +1,17 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - translators +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_TRANSLATOR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_TRANSLATOR_HPP + +#include +#include +#include + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_TRANSLATOR_HPP diff --git a/tests/translators.hpp b/tests/translators.hpp index ab5abceac..929499f4e 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -5,8 +5,7 @@ #include #include -#include -#include +#include #include #include @@ -14,6 +13,17 @@ #include #include +template +struct tests_translators_val +{ + Indexable const& get_box() const + { + return i; + } + + Indexable i; +}; + void tests_translators_hpp() { std::cout << "tests/translators.hpp\n"; @@ -68,6 +78,10 @@ void tests_translators_hpp() B tmp_b; tmp_b = d( std::pair, B>() ); tmp_b = dd( std::pair >() ); + + tests_translators_val

val_p; + index::translator::getter, P, &tests_translators_val

::get_box> tr_get_p; + tmp_p = tr_get_p(val_p); } #endif // TESTS_TRANSLATORS_HPP From 269c0b5eb3bad3922fc01f83455cbc3ec463f826 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 13 Jun 2011 21:16:15 +0000 Subject: [PATCH 034/366] options moved from index::detail::rtree::options<...> to index::options::rtree<...> [SVN r72574] --- .../extensions/index/rtree/options.hpp | 18 +++++++++++------- tests/additional_sizes_and_times.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index de5b971aa..5baf94cf4 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -28,10 +28,10 @@ struct rstar_tag {}; // NodeTag struct default_tag {}; -namespace detail { namespace rtree { +namespace options { template -struct options +struct rtree { typedef InsertTag insert_tag; typedef ChooseNextNodeTag choose_next_node_tag; @@ -39,6 +39,10 @@ struct options typedef NodeTag node_tag; }; +} // namespace options + +namespace detail { namespace rtree { + template struct options_type { @@ -46,27 +50,27 @@ struct options_type }; template -struct options_type< options > +struct options_type< options::rtree > { - typedef options type; + typedef options::rtree type; }; template <> struct options_type { - typedef options type; + typedef options::rtree type; }; template <> struct options_type { - typedef options type; + typedef options::rtree type; }; template <> struct options_type { - typedef options type; + typedef options::rtree type; }; }} // namespace detail::rtree diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index e75d49ded..3328667d7 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -34,7 +34,7 @@ int main() typedef bgi::rtree, bgi::rstar_tag> RT; /*typedef bgi::rtree< std::pair, - bgi::detail::rtree::options + bgi::options::rtree > RT;*/ // load config file From 550823d1fec3c08227c92ff2e7df814a36baaf6d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 13 Jun 2011 22:25:35 +0000 Subject: [PATCH 035/366] translator::getter::equals() changed. Value::operator== used instead of geometry::equals(...). [SVN r72575] --- .../boost/geometry/extensions/index/translator/getter.hpp | 5 ++++- tests/translators.hpp | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/translator/getter.hpp b/include/boost/geometry/extensions/index/translator/getter.hpp index a3cacdfea..be0c6ea55 100644 --- a/include/boost/geometry/extensions/index/translator/getter.hpp +++ b/include/boost/geometry/extensions/index/translator/getter.hpp @@ -24,10 +24,13 @@ struct getter bool equals(Value const& v1, Value const& v2) const { - return geometry::equals(operator()(v1), operator()(v2)); + //return geometry::equals(operator()(v1), operator()(v2)); + return v1 == v2; } }; +// TODO: awulkiew - implement specialization for Value* ? + }}}} // namespace boost::geometry::index::translator #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_GETTER_HPP diff --git a/tests/translators.hpp b/tests/translators.hpp index 929499f4e..062f7e886 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -21,6 +21,11 @@ struct tests_translators_val return i; } + bool operator==(tests_translators_val const& v2) + { + return boost::geometry::equals(i, v2.i); + } + Indexable i; }; From c93fad9c6e41be5f5183cad411c46d5fc94130c9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 14 Jun 2011 22:53:56 +0000 Subject: [PATCH 036/366] r* insert corrected to handle boost::variant nodes [SVN r72600] --- .../extensions/index/rtree/rstar/insert.hpp | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index ac2d74739..7356e3e78 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -107,7 +107,7 @@ private: }; template -struct level_insert_result_type +struct level_insert_elements_type { typedef typename rtree::elements_type< typename rtree::internal_node::type @@ -115,7 +115,7 @@ struct level_insert_result_type }; template -struct level_insert_result_type<0, Value, Value, Options, Box> +struct level_insert_elements_type<0, Value, Value, Options, Box> { typedef typename rtree::elements_type< typename rtree::leaf::type @@ -131,7 +131,7 @@ struct level_insert_base typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename level_insert_result_type::type result_type; + typedef typename level_insert_elements_type::type elements_type; inline level_insert_base(node* & root, size_t & leafs_level, @@ -167,7 +167,7 @@ struct level_insert_base else { // it's really the root node - assert(&rtree::get(n) == base::m_root_node); + assert(&n == rtree::get(base::m_root_node)); base::split(n); } } @@ -195,7 +195,7 @@ struct level_insert_base } size_t result_relative_level; - result_type result_elements; + elements_type result_elements; }; template @@ -207,8 +207,6 @@ struct level_insert typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename base::result_type result_type; - inline level_insert(node* & root, size_t & leafs_level, Element const& element, @@ -276,8 +274,6 @@ struct level_insert typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename base::result_type result_type; - inline level_insert(node* & root, size_t & leafs_level, Value const& v, @@ -327,8 +323,6 @@ struct level_insert<0, Value, Value, Options, Translator, Box> typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename base::result_type result_type; - inline level_insert(node* & root, size_t & leafs_level, Value const& v, @@ -393,12 +387,13 @@ public: inline void operator()(internal_node & n) { - typedef typename elements_type::type elements_type; - + // current node should be the root + assert(&n == rtree::get(m_root)); + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); - rtree::apply_visitor(lins_v, n); + rtree::apply_visitor(lins_v, *m_root); if ( !lins_v.result_elements.empty() ) { @@ -408,10 +403,13 @@ public: inline void operator()(leaf & n) { + // current node should be the root + assert(&n == rtree::get(m_root)); + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); - rtree::apply_visitor(lins_v, n); + rtree::apply_visitor(lins_v, *m_root); // we're in the root, so root should be split and there should be no elements to reinsert assert(lins_v.result_elements.empty()); From e6256090e92eb442f377ac33168853f6225e95b2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 15 Jun 2011 18:11:59 +0000 Subject: [PATCH 037/366] node_poly is now default node, node_variant is enabled by tag dispatching instead of #define. default_variant_tag added. Asserts implemented as macro BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG). [SVN r72604] --- .../geometry/extensions/index/assert.hpp | 27 +++++ .../rtree/linear/redistribute_elements.hpp | 4 +- .../geometry/extensions/index/rtree/node.hpp | 85 -------------- .../extensions/index/rtree/node/node.hpp | 16 +++ .../node/{node_poly.hpp => node_default.hpp} | 91 +++++++++++---- ...e_variant.hpp => node_default_variant.hpp} | 107 ++++++++++-------- .../extensions/index/rtree/options.hpp | 1 + .../rtree/quadratic/redistribute_elements.hpp | 4 +- .../index/rtree/rstar/choose_next_node.hpp | 2 +- .../extensions/index/rtree/rstar/insert.hpp | 53 ++++----- .../rtree/rstar/redistribute_elements.hpp | 17 +-- .../geometry/extensions/index/rtree/rtree.hpp | 9 +- .../index/rtree/visitors/are_boxes_ok.hpp | 2 +- .../index/rtree/visitors/are_levels_ok.hpp | 2 +- .../index/rtree/visitors/destroy.hpp | 2 +- .../extensions/index/rtree/visitors/find.hpp | 4 +- .../index/rtree/visitors/insert.hpp | 37 +++--- .../index/rtree/visitors/is_leaf.hpp | 2 +- .../index/rtree/visitors/remove.hpp | 5 +- tests/additional_sizes_and_times.cpp | 15 ++- 20 files changed, 252 insertions(+), 233 deletions(-) create mode 100644 include/boost/geometry/extensions/index/assert.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/node.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/node/node.hpp rename include/boost/geometry/extensions/index/rtree/node/{node_poly.hpp => node_default.hpp} (71%) rename include/boost/geometry/extensions/index/rtree/node/{node_variant.hpp => node_default_variant.hpp} (51%) diff --git a/include/boost/geometry/extensions/index/assert.hpp b/include/boost/geometry/extensions/index/assert.hpp new file mode 100644 index 000000000..c40a9cf49 --- /dev/null +++ b/include/boost/geometry/extensions/index/assert.hpp @@ -0,0 +1,27 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - ASSERT +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_ASSERT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_ASSERT_HPP + +#ifdef NDEBUG + +#define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM) + +#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) + +#else + +#define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM) PARAM + +#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) assert((CONDITION) && (TEXT_MSG)) + +#endif + +#endif // BOOST_GEOMETRY_EXTENSIONS_ASSERT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 0c65c4333..4743584ac 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -51,7 +51,7 @@ struct find_greatest_normalized_separation { size_t elements_count = elements.size(); - assert(2 <= elements_count); + BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "wrong number of elements"); // find the lowest low, highest high coordinate_type lowest_low = index::get(rtree::element_indexable(elements[0], tr)); diff --git a/include/boost/geometry/extensions/index/rtree/node.hpp b/include/boost/geometry/extensions/index/rtree/node.hpp deleted file mode 100644 index 93d67355c..000000000 --- a/include/boost/geometry/extensions/index/rtree/node.hpp +++ /dev/null @@ -1,85 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R-tree nodes -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP - -#ifndef BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES - -#include - -#else - -#include - -#endif // BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { - -// nodes elements - -template -struct elements_type -{ - typedef typename Node::elements_type type; -}; - -template -inline typename elements_type::type & -elements(Node & n) -{ - return n.elements; -} - -template -inline typename elements_type::type const& -elements(Node const& n) -{ - return n.elements; -} - -// uniform indexable getter for child node element's box and value's indexable -// value's indexable version - -template -inline typename Translator::indexable_type const& -element_indexable(Value const& el, Translator const& tr) -{ - return tr(el); -}; - -// elements box - -template -inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) -{ - Box result; - - if (first == last) - { - geometry::assign_zero(result); - return result; - } - - geometry::convert(element_indexable(*first, tr), result); - ++first; - - for ( ; first != last ; ++first ) - geometry::expand(result, element_indexable(*first, tr)); - - return result; -} - -}} // namespace detail::rtree - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp new file mode 100644 index 000000000..f2710da33 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -0,0 +1,16 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree nodes +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP + +#include +#include + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_poly.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp similarity index 71% rename from include/boost/geometry/extensions/index/rtree/node/node_poly.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_default.hpp index 7f9d2022d..cf0a6d1a6 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_poly.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -7,11 +7,13 @@ // 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_NODE_NODE_POLY_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -80,14 +82,14 @@ template inline Derived & get(node_poly & n) { assert(dynamic_cast(&n)); - return dynamic_cast(n); + return static_cast(n); } template inline Derived * get(node_poly * n) { assert(dynamic_cast(n)); - return dynamic_cast(n); + return static_cast(n); } // visitor @@ -130,18 +132,14 @@ inline void apply_visitor(Visitor &v, Visitable & n) n.apply_visitor(v); } -// uniform indexable for child node element's box and value's indexable - -// value's indexable version +// element's indexable type template struct element_indexable_type { - typedef typename Translator::indexable_type type; + typedef typename Translator::indexable_type type; }; -// node element's indexable specialization - template struct element_indexable_type< std::pair *>, @@ -151,6 +149,15 @@ struct element_indexable_type< typedef Box type; }; +// element's indexable getter + +template +inline typename Translator::indexable_type const& + element_indexable(Value const& el, Translator const& tr) +{ + return tr(el); +}; + template inline Box const& element_indexable( @@ -164,22 +171,22 @@ element_indexable( template inline typename node::type * - create_node(leaf_poly const& l) +create_node(leaf_poly const& l) { - typedef typename node::type node; - node * n = new leaf_poly(l); - return n; + typedef typename node::type node; + node * n = new leaf_poly(l); + return n; } // create internal node template inline typename node::type * - create_node(internal_node_poly const& in) +create_node(internal_node_poly const& in) { - typedef typename node::type node; - node * n = new internal_node_poly(in); - return n; + typedef typename node::type node; + node * n = new internal_node_poly(in); + return n; } // default node @@ -187,11 +194,55 @@ inline typename node::type * template inline void delete_node(node_poly * n) { - delete n; + delete n; +} + +// nodes elements + +template +struct elements_type +{ + typedef typename Node::elements_type type; +}; + +template +inline typename elements_type::type & + elements(Node & n) +{ + return n.elements; +} + +template +inline typename elements_type::type const& + elements(Node const& n) +{ + return n.elements; +} + +// elements box + +template +inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) +{ + Box result; + + if (first == last) + { + geometry::assign_zero(result); + return result; + } + + geometry::convert(element_indexable(*first, tr), result); + ++first; + + for ( ; first != last ; ++first ) + geometry::expand(result, element_indexable(*first, tr)); + + return result; } }} // namespace detail::rtree }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp similarity index 51% rename from include/boost/geometry/extensions/index/rtree/node/node_variant.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index 4a73da430..99ff6ef46 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -7,8 +7,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_NODE_NODE_VARIANT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP #include #include @@ -17,9 +17,6 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { -template -struct node; - // nodes default types template @@ -44,66 +41,78 @@ struct leaf_variant // nodes traits -template -struct node +template +struct node { - typedef boost::variant< - leaf_variant, - internal_node_variant - > type; + typedef boost::variant< + leaf_variant, + internal_node_variant + > type; }; -template -struct internal_node +template +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; -template -struct leaf +template +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // nodes conversion -template -inline V & get(Variant &v) +template +inline V & get( + boost::variant< + leaf_variant, + internal_node_variant + > &v +) { return boost::get(v); } -template -inline V * get(Variant *v) +template +inline V * get(boost::variant< + leaf_variant, + internal_node_variant + > *v) { return boost::get(v); } // visitor traits -template -struct visitor +template +struct visitor { typedef static_visitor<> type; }; -template -inline void apply_visitor(Visitor &v, Visitable &n) +template +inline void apply_visitor(Visitor & v, + boost::variant< + leaf_variant, + internal_node_variant + > & n) { boost::apply_visitor(v, n); } -// uniform indexable for child node element's box and value's indexable - -// value's indexable version - -template -struct element_indexable_type +template +inline void apply_visitor(Visitor & v, + boost::variant< + leaf_variant, + internal_node_variant + > const& n) { - typedef typename Translator::indexable_type type; -}; + boost::apply_visitor(v, n); +} -// node element's indexable specialization +// element's indexable type template struct element_indexable_type< @@ -120,17 +129,18 @@ struct element_indexable_type< typedef Box type; }; +// element's indexable getter + template inline Box const& -element_indexable( - std::pair< - Box, - boost::variant< - leaf_variant, - internal_node_variant - > * - > const& el, - Translator const&) +element_indexable(std::pair< + Box, + boost::variant< + leaf_variant, + internal_node_variant + > * + > const& el, + Translator const&) { return el.first; } @@ -160,11 +170,10 @@ create_node(internal_node_variant const& in) // default node template -inline void delete_node( - boost::variant< - leaf_variant, - internal_node_variant - > * n) +inline void delete_node(boost::variant< + leaf_variant, + internal_node_variant + > * n) { delete n; } @@ -173,4 +182,4 @@ inline void delete_node( }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 5baf94cf4..1eaf95cef 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -27,6 +27,7 @@ struct rstar_tag {}; // NodeTag struct default_tag {}; +struct default_variant_tag {}; namespace options { diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 23b602747..089fe85be 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include @@ -43,7 +43,7 @@ struct pick_seeds { size_t elements_count = elements.size(); - assert(2 <= elements_count); + BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "wrong number of elements"); area_type greatest_free_area = 0; seed1 = 0; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index f6152cdc5..2d494cd2e 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 7356e3e78..35b086124 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -15,8 +15,6 @@ #include #include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { @@ -48,10 +46,11 @@ public: // TODO: awulkiew - change second point_type to the point type of the Indexable? typedef typename index::default_distance_sqr_result::type distance_sqr_type; - assert(parent != 0); + BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node"); const size_t reinserted_elements_count = static_cast(max_elems * 0.3f); assert(0 < reinserted_elements_count); + BOOST_GEOMETRY_INDEX_ASSERT(0 < reinserted_elements_count, "wrong value of elements to reinsert"); // calculate current node's center point_type node_center; @@ -147,9 +146,8 @@ struct level_insert_base template inline void handle_possible_reinsert_or_split_of_root(Node &n) { - // reinsert should be handled only once for level - assert(result_elements.empty()); - + BOOST_GEOMETRY_INDEX_ASSERT(result_elements.empty(), "reinsert should be handled only once for level"); + result_relative_level = base::m_leafs_level - base::m_current_level; // overflow @@ -166,8 +164,7 @@ struct level_insert_base // node is root node else { - // it's really the root node - assert(&n == rtree::get(base::m_root_node)); + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(base::m_root_node), "node should be the root node"); base::split(n); } } @@ -219,7 +216,7 @@ struct level_insert inline void operator()(internal_node & n) { - assert(base::m_current_level < base::m_leafs_level); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); if ( base::m_current_level < base::m_level ) { @@ -229,7 +226,7 @@ struct level_insert // further insert if ( 0 < InsertIndex ) { - assert(0 < base::m_level); + BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex"); if ( base::m_current_level == base::m_level - 1 ) { @@ -239,7 +236,7 @@ struct level_insert } else { - assert( base::m_level == base::m_current_level ); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level"); // push new child node rtree::elements(n).push_back(base::m_element); @@ -286,13 +283,13 @@ struct level_insert inline void operator()(internal_node & n) { - assert(base::m_current_level < base::m_leafs_level); - assert(base::m_current_level < base::m_level); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level"); // next traversing step base::traverse(*this, n); - assert(0 < base::m_level); + BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex"); if ( base::m_current_level == base::m_level - 1 ) { @@ -304,10 +301,9 @@ struct level_insert inline void operator()(leaf & n) { - assert(base::m_current_level == base::m_leafs_level); - assert(base::m_level == base::m_current_level || - base::m_level == std::numeric_limits::max()); - + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits::max(), "unexpected level"); + rtree::elements(n).push_back(base::m_element); base::handle_possible_split(n); @@ -335,9 +331,9 @@ struct level_insert<0, Value, Value, Options, Translator, Box> inline void operator()(internal_node & n) { - assert(base::m_current_level < base::m_leafs_level); - assert(base::m_current_level < base::m_level); - + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level"); + // next traversing step base::traverse(*this, n); @@ -346,9 +342,8 @@ struct level_insert<0, Value, Value, Options, Translator, Box> inline void operator()(leaf & n) { - assert(base::m_current_level == base::m_leafs_level); - assert(base::m_level == base::m_current_level || - base::m_level == std::numeric_limits::max()); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits::max(), "unexpected level"); rtree::elements(n).push_back(base::m_element); @@ -385,10 +380,9 @@ public: , m_tr(tr), m_relative_level(relative_level) {} - inline void operator()(internal_node & n) + inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) { - // current node should be the root - assert(&n == rtree::get(m_root)); + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); @@ -401,10 +395,9 @@ public: } } - inline void operator()(leaf & n) + inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) { - // current node should be the root - assert(&n == rtree::get(m_root)); + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index caa33f6d8..f0d9a9fc5 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -18,7 +18,7 @@ #include -#include +#include #include #include @@ -68,7 +68,8 @@ struct choose_split_axis_and_index_for_corner // copy elements Elements elements_copy = elements; - assert(elements_copy.size() == max_elems + 1); + + BOOST_GEOMETRY_INDEX_ASSERT(elements_copy.size() == max_elems + 1, "wrong number of elements"); // sort elements element_axis_corner_less elements_less(tr); @@ -288,7 +289,8 @@ struct partial_sort } else { - assert(axis == Dimension - 1); + BOOST_GEOMETRY_INDEX_ASSERT(axis == Dimension - 1, "unexpected axis value"); + typedef typename Elements::value_type element_type; element_axis_corner_less less(tr); std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); @@ -302,7 +304,8 @@ struct partial_sort template static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) { - assert(axis == 0); + BOOST_GEOMETRY_INDEX_ASSERT(axis == 0, "unexpected axis value"); + typedef typename Elements::value_type element_type; element_axis_corner_less less(tr); std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); @@ -353,9 +356,9 @@ struct redistribute_elements // TODO: awulkiew - get rid of following static_casts? - assert(split_axis < index::traits::dimension::value); - assert(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner)); - assert(min_elems <= split_index && split_index <= max_elems - min_elems + 1); + BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension::value, "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner), "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(min_elems <= split_index && split_index <= max_elems - min_elems + 1, "unexpected value"); // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort if ( split_corner == static_cast(min_corner) ) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index b7499918c..b0953faba 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -14,11 +14,15 @@ #include #include +#include + #include #include #include +#include + #include #include #include @@ -104,7 +108,8 @@ public: void remove(value_type const& value) { // TODO: awulkiew - assert for correct value - assert(0 < m_values_count); + + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there is no elements in the rtree"); detail::rtree::visitors::remove remove_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); @@ -128,7 +133,7 @@ public: void clear() { // TODO: awulkiew - implement - assert(false); + BOOST_GEOMETRY_INDEX_ASSERT(false, "not implemented"); } template diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 0feca1992..ca3a345dd 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -11,7 +11,7 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index a85c8feab..c4585b1f2 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 244464fd7..8090358b9 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index b067664af..4fc5cf95d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -12,9 +12,9 @@ #include -#include +#include -#include +//#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 8c2e180fc..85d0c4ea7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -12,7 +12,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -40,7 +40,7 @@ struct choose_next_node { children_type & children = rtree::elements(n); - assert(!children.empty()); + BOOST_GEOMETRY_INDEX_ASSERT(!children.empty(), "can't choose the next node if children are empty"); size_t children_count = children.size(); @@ -110,8 +110,8 @@ protected: , m_current_child_index(0) , m_current_level(0) { - assert(m_relative_level <= leafs_level); - assert(m_level <= m_leafs_level); + BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); + BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value"); // TODO // assert - check if Box is correct } @@ -137,8 +137,8 @@ protected: template inline void post_traverse(Node &n) { - // if node isn't a root check if parent and current_child_index isn't corrupted - assert(0 == m_parent || &n == rtree::get(rtree::elements(*m_parent)[m_current_child_index].second)); + BOOST_GEOMETRY_INDEX_ASSERT(0 == m_parent || &n == rtree::get(rtree::elements(*m_parent)[m_current_child_index].second), + "if node isn't the root current_child_index should be valid"); // handle overflow if ( m_max_elems_per_node < rtree::elements(n).size() ) @@ -182,9 +182,11 @@ protected: apply(n, n2, box1, box2, m_min_elems_per_node, m_max_elems_per_node, m_tr); // check numbers of elements - assert(m_min_elems_per_node <= rtree::elements(n).size() && rtree::elements(n).size() <= m_max_elems_per_node); - assert(m_min_elems_per_node <= rtree::elements(n2).size() && rtree::elements(n2).size() <= m_max_elems_per_node); - + BOOST_GEOMETRY_INDEX_ASSERT(m_min_elems_per_node <= rtree::elements(n).size() && rtree::elements(n).size() <= m_max_elems_per_node, + "unexpected number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(m_min_elems_per_node <= rtree::elements(n2).size() && rtree::elements(n2).size() <= m_max_elems_per_node, + "unexpected number of elements"); + // node is not the root - just add the new node if ( m_parent != 0 ) { @@ -196,7 +198,7 @@ protected: // node is the root - add level else { - assert(&n == rtree::get(m_root_node)); + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); // create new root and add nodes node * new_root = rtree::create_node(internal_node()); @@ -254,7 +256,7 @@ struct insert inline void operator()(internal_node & n) { - assert(base::m_current_level < base::m_leafs_level); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); if ( base::m_current_level < base::m_level ) { @@ -263,7 +265,7 @@ struct insert } else { - assert( base::m_level == base::m_current_level ); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level"); // push new child node rtree::elements(n).push_back(base::m_element); @@ -301,8 +303,8 @@ struct insert inline void operator()(internal_node & n) { - assert(base::m_current_level < base::m_leafs_level); - assert(base::m_current_level < base::m_level); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level"); // next traversing step base::traverse(*this, n); @@ -312,10 +314,9 @@ struct insert inline void operator()(leaf & n) { - assert(base::m_current_level == base::m_leafs_level); - assert( base::m_level == base::m_current_level || - base::m_level == std::numeric_limits::max() ); - + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits::max(), "unexpected level"); + rtree::elements(n).push_back(base::m_element); base::post_traverse(n); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index 44d7b37d0..a3e7c17ec 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index aeec42d4d..7c84b7fa6 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP -#include +#include #include @@ -104,8 +104,7 @@ public: // n is root node else { - // current node must be a root - assert(&n == rtree::get(m_root_node)); + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); // value not found assert(m_is_value_removed); diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 3328667d7..878de69d3 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -7,15 +7,14 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -//#define BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES +#include +#include + #include #include #include -#include -#include - #include #include #include @@ -31,11 +30,11 @@ int main() typedef bg::model::box

B; //typedef bgi::rtree, bgi::linear_tag> RT; //typedef bgi::rtree, bgi::quadratic_tag> RT; - typedef bgi::rtree, bgi::rstar_tag> RT; - /*typedef bgi::rtree< + //typedef bgi::rtree, bgi::rstar_tag> RT; + typedef bgi::rtree< std::pair, - bgi::options::rtree - > RT;*/ + bgi::options::rtree + > RT; // load config file std::ifstream file_cfg("config.txt"); From c89a7d988fe0c0666c3f374dc46ea4b235045968 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 15 Jun 2011 19:37:13 +0000 Subject: [PATCH 038/366] broken #include fixed in gl_draw and print visitors [SVN r72605] --- .../boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp | 1 - .../boost/geometry/extensions/index/rtree/visitors/print.hpp | 2 -- 2 files changed, 3 deletions(-) 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 3bb736423..1defba7bc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -11,7 +11,6 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP #include -#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 20cd48b8b..8ce6244b7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -13,8 +13,6 @@ #include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { From 5c7f192f14b2e09945bf495e87a10483ee0a7de0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 15 Jun 2011 19:39:25 +0000 Subject: [PATCH 039/366] branch renamed [SVN r72606] From 523107a4faf4655d12c3bd3f6c079c0e08d69ec3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 16 Jun 2011 21:15:06 +0000 Subject: [PATCH 040/366] min and max elements numbers are now template parameters. New node type added - with arrays of static size. Various parameters are the first template parameter of options::rtree. [SVN r72618] --- .../extensions/index/algorithms/margin.hpp | 2 +- .../extensions/index/pushable_array.hpp | 139 ++++++++++++++++++ .../rtree/linear/redistribute_elements.hpp | 68 +++++---- .../extensions/index/rtree/node/node.hpp | 2 + .../index/rtree/node/node_default.hpp | 98 ++++++------ .../index/rtree/node/node_default_static.hpp | 50 +++++++ .../index/rtree/node/node_default_variant.hpp | 88 +++++------ .../extensions/index/rtree/options.hpp | 89 +++++++++-- .../rtree/quadratic/redistribute_elements.hpp | 6 +- .../index/rtree/rstar/choose_next_node.hpp | 23 ++- .../extensions/index/rtree/rstar/insert.hpp | 73 ++++----- .../rtree/rstar/redistribute_elements.hpp | 93 ++++++------ .../geometry/extensions/index/rtree/rtree.hpp | 12 +- .../index/rtree/visitors/are_boxes_ok.hpp | 6 +- .../index/rtree/visitors/are_levels_ok.hpp | 6 +- .../index/rtree/visitors/destroy.hpp | 6 +- .../extensions/index/rtree/visitors/find.hpp | 8 +- .../index/rtree/visitors/insert.hpp | 40 +++-- .../index/rtree/visitors/is_leaf.hpp | 6 +- .../index/rtree/visitors/remove.hpp | 28 ++-- tests/additional_sizes_and_times.cpp | 12 +- 21 files changed, 550 insertions(+), 305 deletions(-) create mode 100644 include/boost/geometry/extensions/index/pushable_array.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/margin.hpp b/include/boost/geometry/extensions/index/algorithms/margin.hpp index fb2f45722..ea235e9c9 100644 --- a/include/boost/geometry/extensions/index/algorithms/margin.hpp +++ b/include/boost/geometry/extensions/index/algorithms/margin.hpp @@ -61,7 +61,7 @@ struct margin_for_each_edge template struct margin_for_each_edge { - static inline typename default_margin_result::type apply(Box const& b) + static inline typename default_margin_result::type apply(Box const& /*b*/) { return 1; } diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp new file mode 100644 index 000000000..5366b1ce5 --- /dev/null +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -0,0 +1,139 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - pushable array +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +template +class pushable_array +{ + typedef typename boost::array array_type; + +public: + typedef typename array_type::value_type value_type; + typedef typename array_type::size_type size_type; + typedef typename array_type::iterator iterator; + typedef typename array_type::const_iterator const_iterator; + + inline pushable_array() + : m_size(0) + {} + + inline pushable_array(size_type s, Element const& v) + : m_size(s) + { + BOOST_GEOMETRY_INDEX_ASSERT(s < Capacity, "size too big"); + std::fill(m_array.begin(), m_array.begin() + s, v); + } + + inline Element & operator[](size_type i) + { + BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); + return m_array[i]; + } + + inline Element const& operator[](size_type i) const + { + BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); + return m_array[i]; + } + + inline Element const& front() const + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return m_array.front(); + } + + inline Element & front() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return m_array.front(); + } + + inline Element const& back() const + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return *(begin() + (m_size - 1)); + } + + inline Element & back() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return *(begin() + (m_size - 1)); + } + + inline iterator begin() + { + return m_array.begin(); + } + + inline iterator end() + { + return m_array.begin() + m_size; + } + + inline const_iterator begin() const + { + return m_array.begin(); + } + + inline const_iterator end() const + { + return m_array.begin() + m_size; + } + + inline void clear() + { + m_size = 0; + } + + inline void erase(iterator it) + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + BOOST_GEOMETRY_INDEX_ASSERT(begin() <= it && it < end(), "iterator points on the element outside the container"); + //std::copy(it + 1, end(), it); + *it = back(); + --m_size; + } + + inline void push_back(Element const& v) + { + BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container"); + m_array[m_size++] = v; + } + + inline bool empty() const + { + return m_size == 0; + } + + inline size_t size() const + { + return m_size; + } + + inline size_t capacity() const + { + return Capacity; + } + +private: + boost::array m_array; + size_type m_size; +}; + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 4743584ac..6271376e0 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -36,7 +36,7 @@ namespace linear { // from void find_normalized_separations(std::vector const& boxes, T& separation, unsigned int& first, unsigned int& second) const -template +template struct find_greatest_normalized_separation { typedef typename Elements::value_type element_type; @@ -49,9 +49,9 @@ struct find_greatest_normalized_separation size_t & seed1, size_t & seed2) { - size_t elements_count = elements.size(); - - BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "wrong number of elements"); + const size_t elements_count = Parameters::max_elements + 1; + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected number of elements"); + BOOST_STATIC_ASSERT(2 <= elements_count); // find the lowest low, highest high coordinate_type lowest_low = index::get(rtree::element_indexable(elements[0], tr)); @@ -99,7 +99,7 @@ struct find_greatest_normalized_separation } }; -template +template struct pick_seeds_impl { BOOST_STATIC_ASSERT(0 < DimensionIndex); @@ -114,11 +114,11 @@ struct pick_seeds_impl size_t & seed1, size_t & seed2) { - pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); + pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); coordinate_type current_separation; size_t s1, s2; - find_greatest_normalized_separation::apply(elements, tr, current_separation, s1, s2); + find_greatest_normalized_separation::apply(elements, tr, current_separation, s1, s2); // in the old implementation different operator was used: <= (y axis prefered) if ( separation < current_separation ) @@ -130,8 +130,8 @@ struct pick_seeds_impl } }; -template -struct pick_seeds_impl +template +struct pick_seeds_impl { typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; @@ -143,13 +143,13 @@ struct pick_seeds_impl size_t & seed1, size_t & seed2) { - find_greatest_normalized_separation::apply(elements, tr, separation, seed1, seed2); + find_greatest_normalized_separation::apply(elements, tr, separation, seed1, seed2); } }; // from void linear_pick_seeds(node_pointer const& n, unsigned int &seed1, unsigned int &seed2) const -template +template struct pick_seeds { typedef typename Elements::value_type element_type; @@ -159,12 +159,12 @@ struct pick_seeds static const size_t dimension = index::traits::dimension::value; static inline void apply(Elements const& elements, - Translator const& tr, - size_t & seed1, - size_t & seed2) + Translator const& tr, + size_t & seed1, + size_t & seed2) { coordinate_type separation = 0; - pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); + pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); } }; @@ -175,17 +175,17 @@ struct pick_seeds template struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename Options::parameters_type parameters_type; template static inline void apply(Node & n, Node & second_node, Box & box1, Box & box2, - size_t min_elems, - size_t max_elems, Translator const& tr) { typedef typename rtree::elements_type::type elements_type; @@ -194,18 +194,24 @@ struct redistribute_elements typedef typename index::traits::coordinate_type::type coordinate_type; typedef typename index::default_area_result::type area_type; - // copy original elements - elements_type elements_copy = rtree::elements(n); - size_t elements_count = elements_copy.size(); + elements_type & elements1 = rtree::elements(n); + elements_type & elements2 = rtree::elements(second_node); + const size_t elements1_count = parameters_type::max_elements + 1; + + BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected number of elements"); + + typedef boost::array elements_copy_type; + + // copy original elements + elements_copy_type elements_copy; + std::copy(elements1.begin(), elements1.end(), elements_copy.begin()); // calculate initial seeds size_t seed1 = 0; size_t seed2 = 0; - linear::pick_seeds::apply(elements_copy, tr, seed1, seed2); + linear::pick_seeds::apply(elements_copy, tr, seed1, seed2); // prepare nodes' elements containers - elements_type & elements1 = rtree::elements(n); - elements_type & elements2 = rtree::elements(second_node); elements1.clear(); assert(elements2.empty()); @@ -221,11 +227,11 @@ struct redistribute_elements area_type area1 = index::area(box1); area_type area2 = index::area(box2); - assert(2 <= elements_count); - size_t remaining = elements_count - 2; + BOOST_STATIC_ASSERT(2 <= elements1_count); + size_t remaining = elements1_count - 2; // redistribute the rest of the elements - for ( size_t i = 0 ; i < elements_count ; ++i ) + for ( size_t i = 0 ; i < elements1_count ; ++i ) { if (i != seed1 && i != seed2) { @@ -234,13 +240,13 @@ struct redistribute_elements // if there is small number of elements left and the number of elements in node is lesser than min_elems // just insert them to this node - if ( elements1.size() + remaining <= min_elems ) + if ( elements1.size() + remaining <= parameters_type::min_elements ) { elements1.push_back(elem); geometry::expand(box1, indexable); area1 = index::area(box1); } - else if ( elements2.size() + remaining <= min_elems ) + else if ( elements2.size() + remaining <= parameters_type::min_elements ) { elements2.push_back(elem); geometry::expand(box2, indexable); diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index f2710da33..1c9bc5da6 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -13,4 +13,6 @@ #include #include +#include + #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index cf0a6d1a6..2fc96b381 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -19,74 +19,74 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { // visitor forward declaration -template +template struct visitor_poly; // nodes types -template +template struct node_poly { virtual ~node_poly() {} - virtual void apply_visitor(visitor_poly &) = 0; - virtual void apply_visitor(visitor_poly &) const = 0; + virtual void apply_visitor(visitor_poly &) = 0; + virtual void apply_visitor(visitor_poly &) const = 0; }; -template -struct internal_node_poly : public node_poly +template +struct internal_node_poly : public node_poly { typedef std::vector< - std::pair *> + std::pair *> > elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; -template -struct leaf_poly : public node_poly +template +struct leaf_poly : public node_poly { typedef std::vector elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; // nodes traits -template +template struct node { - typedef node_poly type; + typedef node_poly type; }; -template +template struct internal_node { - typedef internal_node_poly type; + typedef internal_node_poly type; }; -template +template struct leaf { - typedef leaf_poly type; + typedef leaf_poly type; }; // nodes conversion -template -inline Derived & get(node_poly & n) +template +inline Derived & get(node_poly & n) { assert(dynamic_cast(&n)); return static_cast(n); } -template -inline Derived * get(node_poly * n) +template +inline Derived * get(node_poly * n) { assert(dynamic_cast(n)); return static_cast(n); @@ -94,11 +94,11 @@ inline Derived * get(node_poly * n) // visitor -template -struct visitor_poly +template +struct visitor_poly { - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; + typedef typename internal_node::type internal_node; + typedef typename leaf::type leaf; virtual ~visitor_poly() {} @@ -106,11 +106,11 @@ struct visitor_poly virtual void operator()(leaf const&) = 0; }; -template -struct visitor_poly +template +struct visitor_poly { - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; + typedef typename internal_node::type internal_node; + typedef typename leaf::type leaf; virtual ~visitor_poly() {} @@ -120,10 +120,10 @@ struct visitor_poly // visitor traits -template +template struct visitor { - typedef visitor_poly type; + typedef visitor_poly type; }; template @@ -140,9 +140,9 @@ struct element_indexable_type typedef typename Translator::indexable_type type; }; -template +template struct element_indexable_type< - std::pair *>, + std::pair *>, Translator > { @@ -158,10 +158,10 @@ inline typename Translator::indexable_type const& return tr(el); }; -template +template inline Box const& element_indexable( - std::pair< Box, node_poly *> const& el, + std::pair< Box, node_poly *> const& el, Translator const&) { return el.first; @@ -169,30 +169,30 @@ element_indexable( // create leaf node -template -inline typename node::type * -create_node(leaf_poly const& l) +template +inline typename node::type * +create_node(leaf_poly const& l) { - typedef typename node::type node; - node * n = new leaf_poly(l); + typedef typename node::type node; + node * n = new leaf_poly(l); return n; } // create internal node -template -inline typename node::type * -create_node(internal_node_poly const& in) +template +inline typename node::type * +create_node(internal_node_poly const& in) { - typedef typename node::type node; - node * n = new internal_node_poly(in); + typedef typename node::type node; + node * n = new internal_node_poly(in); return n; } // default node -template -inline void delete_node(node_poly * n) +template +inline void delete_node(node_poly * n) { delete n; } diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp new file mode 100644 index 000000000..c9d7d0bc9 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp @@ -0,0 +1,50 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree polymorphic nodes with static-size containers +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +struct internal_node_poly + : public node_poly +{ + typedef index::pushable_array< + std::pair *>, + Parameters::max_elements + 1 + > elements_type; + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } + + elements_type elements; +}; + +template +struct leaf_poly + : public node_poly +{ + typedef index::pushable_array elements_type; + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } + + elements_type elements; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index 99ff6ef46..89b76036e 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -19,20 +19,20 @@ namespace detail { namespace rtree { // nodes default types -template +template struct internal_node_variant { typedef std::vector< std::pair< Box, - typename node::type * + typename node::type * > > elements_type; elements_type elements; }; -template +template struct leaf_variant { typedef std::vector elements_type; @@ -41,44 +41,44 @@ struct leaf_variant // nodes traits -template -struct node +template +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; -template -struct internal_node +template +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; -template -struct leaf +template +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // nodes conversion -template +template inline V & get( boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > &v ) { return boost::get(v); } -template +template inline V * get(boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > *v) { return boost::get(v); @@ -86,27 +86,27 @@ inline V * get(boost::variant< // visitor traits -template -struct visitor +template +struct visitor { typedef static_visitor<> type; }; -template +template inline void apply_visitor(Visitor & v, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > & n) { boost::apply_visitor(v, n); } -template +template inline void apply_visitor(Visitor & v, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > const& n) { boost::apply_visitor(v, n); @@ -114,13 +114,13 @@ inline void apply_visitor(Visitor & v, // element's indexable type -template +template struct element_indexable_type< std::pair< Box, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > * >, Translator @@ -131,13 +131,13 @@ struct element_indexable_type< // element's indexable getter -template +template inline Box const& element_indexable(std::pair< Box, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > * > const& el, Translator const&) @@ -147,32 +147,32 @@ element_indexable(std::pair< // create leaf node -template -inline typename node::type * -create_node(leaf_variant const& l) +template +inline typename node::type * +create_node(leaf_variant const& l) { - typedef typename node::type node; + typedef typename node::type node; node * n = new node(l); return n; } // create internal node -template -inline typename node::type * -create_node(internal_node_variant const& in) +template +inline typename node::type * +create_node(internal_node_variant const& in) { - typedef typename node::type node; + typedef typename node::type node; node * n = new node(in); return n; } // default node -template +template inline void delete_node(boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > * n) { delete n; diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 1eaf95cef..8d42d702a 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -28,12 +28,51 @@ struct rstar_tag {}; // NodeTag struct default_tag {}; struct default_variant_tag {}; +struct default_static_tag {}; + +template +struct linear +{ + static const size_t max_elements = MaxElements; + static const size_t min_elements = MinElements; +}; + +template +struct quadratic +{ + static const size_t max_elements = MaxElements; + static const size_t min_elements = MinElements; +}; + +namespace options { namespace detail { + +template +struct default_rstar_reinserted_elements +{ + static const size_t value = MaxElements * 0.3f; +}; + +}} // namespace options::detail + +template ::value + > +struct rstar +{ + static const size_t max_elements = MaxElements; + static const size_t min_elements = MinElements; + static const size_t use_nearly_minimum_cost = UseNearlyMinimumCost; + static const size_t reinserted_elements = ReinsertedElements; +}; namespace options { -template +template struct rtree { + typedef Parameters parameters_type; typedef InsertTag insert_tag; typedef ChooseNextNodeTag choose_next_node_tag; typedef RedistributeTag redistribute_tag; @@ -50,28 +89,52 @@ struct options_type typedef void type; }; -template -struct options_type< options::rtree > +template +struct options_type< options::rtree > { - typedef options::rtree type; + typedef options::rtree< + Parameters, + InsertTag, + ChooseNextNodeTag, + RedistributeTag, + NodeTag + > type; }; -template <> -struct options_type +template +struct options_type< linear > { - typedef options::rtree type; + typedef options::rtree< + linear, + insert_tag, + choose_by_area_diff_tag, + linear_tag, + default_tag + > type; }; -template <> -struct options_type +template +struct options_type< quadratic > { - typedef options::rtree type; + typedef options::rtree< + quadratic, + insert_tag, + choose_by_area_diff_tag, + quadratic_tag, + default_tag + > type; }; -template <> -struct options_type +template +struct options_type< rstar > { - typedef options::rtree type; + typedef options::rtree< + rstar, + reinsert_tag, + choose_by_overlap_diff_tag, + rstar_tag, + default_tag + > type; }; }} // namespace detail::rtree diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 089fe85be..3c80f30f5 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -78,9 +78,9 @@ struct pick_seeds template struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename index::default_area_result::type area_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 2d494cd2e..d383fa1b0 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -30,12 +30,14 @@ namespace detail { template class choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; + typedef typename Options::parameters_type parameters_type; + typedef typename index::default_area_result::type area_type; typedef typename index::default_overlap_result::type overlap_type; @@ -47,7 +49,12 @@ public: // children are leafs if ( node_relative_level <= 1 ) - return choose_by_minimum_overlap_cost(children, indexable); + { + if ( parameters_type::use_nearly_minimum_cost ) + return choose_by_nearly_minimum_overlap_cost(children, indexable); + else + return choose_by_minimum_overlap_cost(children, indexable); + } // children are internal nodes else return choose_by_minimum_area_cost(children, indexable); @@ -111,6 +118,14 @@ private: return choosen_index; } + template + static inline size_t choose_by_nearly_minimum_overlap_cost(children_type const& children, Indexable const& indexable) + { + // TODO - awulkiew: implement this function + + return choose_by_minimum_overlap_cost(children, indexable); + } + template static inline size_t choose_by_minimum_area_cost(children_type const& children, Indexable const& indexable) { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 35b086124..8cfa1fdde 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -27,17 +27,17 @@ template class remove_elements_to_reinsert { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename Options::parameters_type parameters_type; template static inline void apply(typename rtree::elements_type::type & result_elements, Node & n, internal_node *parent, size_t current_child_index, - size_t min_elems, - size_t max_elems, Translator const& tr) { typedef typename rtree::elements_type::type elements_type; @@ -46,21 +46,22 @@ public: // TODO: awulkiew - change second point_type to the point type of the Indexable? typedef typename index::default_distance_sqr_result::type distance_sqr_type; - BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node"); + elements_type & elements = rtree::elements(n); - const size_t reinserted_elements_count = static_cast(max_elems * 0.3f); - assert(0 < reinserted_elements_count); - BOOST_GEOMETRY_INDEX_ASSERT(0 < reinserted_elements_count, "wrong value of elements to reinsert"); + const size_t elements_count = parameters_type::max_elements + 1; + const size_t reinserted_elements_count = parameters_type::reinserted_elements; + + BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node"); + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected elements number"); + BOOST_GEOMETRY_INDEX_ASSERT(0 < reinserted_elements_count, "wrong value of elements to reinsert"); // calculate current node's center point_type node_center; geometry::centroid(rtree::elements(*parent)[current_child_index].first, node_center); // fill the container of centers' distances of children from current node's center - elements_type & elements = rtree::elements(n); - size_t elements_count = elements.size(); - std::vector< std::pair > sorted_elements(elements_count); - for ( size_t i = 0 ; i < elements_count ; ++i ) + boost::array, elements_count> sorted_elements; + for ( size_t i = 0 ; i < elements_count ; ++i ) { point_type element_center; geometry::centroid( rtree::element_indexable(elements[i], tr), @@ -109,7 +110,7 @@ template ::type + typename rtree::internal_node::type >::type type; }; @@ -117,7 +118,7 @@ template struct level_insert_elements_type<0, Value, Value, Options, Box> { typedef typename rtree::elements_type< - typename rtree::leaf::type + typename rtree::leaf::type >::type type; }; @@ -131,15 +132,14 @@ struct level_insert_base typedef typename base::leaf leaf; typedef typename level_insert_elements_type::type elements_type; + typedef typename Options::parameters_type parameters_type; inline level_insert_base(node* & root, size_t & leafs_level, Element const& element, - size_t min_elements, - size_t max_elements, Translator const& tr, size_t relative_level) - : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) + : base(root, leafs_level, element, tr, relative_level) , result_relative_level(0) {} @@ -151,7 +151,7 @@ struct level_insert_base result_relative_level = base::m_leafs_level - base::m_current_level; // overflow - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + if ( parameters_type::max_elements < rtree::elements(n).size() ) { // node isn't root node if ( base::m_parent ) @@ -159,7 +159,7 @@ struct level_insert_base rstar::remove_elements_to_reinsert::apply( result_elements, n, base::m_parent, base::m_current_child_index, - base::m_min_elems_per_node, base::m_max_elems_per_node, base::m_tr); + base::m_tr); } // node is root node else @@ -174,7 +174,7 @@ struct level_insert_base inline void handle_possible_split(Node &n) const { // overflow - if ( base::m_max_elems_per_node < rtree::elements(n).size() ) + if ( parameters_type::max_elements < rtree::elements(n).size() ) { base::split(n); } @@ -207,11 +207,9 @@ struct level_insert inline level_insert(node* & root, size_t & leafs_level, Element const& element, - size_t min_elements, - size_t max_elements, Translator const& tr, size_t relative_level) - : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) + : base(root, leafs_level, element, tr, relative_level) {} inline void operator()(internal_node & n) @@ -274,11 +272,9 @@ struct level_insert inline level_insert(node* & root, size_t & leafs_level, Value const& v, - size_t min_elements, - size_t max_elements, Translator const& t, size_t relative_level) - : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) + : base(root, leafs_level, v, t, relative_level) {} inline void operator()(internal_node & n) @@ -322,11 +318,9 @@ struct level_insert<0, Value, Value, Options, Translator, Box> inline level_insert(node* & root, size_t & leafs_level, Value const& v, - size_t min_elements, - size_t max_elements, Translator const& t, size_t relative_level) - : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) + : base(root, leafs_level, v, t, relative_level) {} inline void operator()(internal_node & n) @@ -360,23 +354,20 @@ struct level_insert<0, Value, Value, Options, Translator, Box> // R*-tree insert visitor template class insert - : public rtree::visitor::type + : public rtree::visitor::type { private: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline insert(node* & root, size_t & leafs_level, Element const& element, - size_t min_elements, - size_t max_elements, Translator const& tr, size_t relative_level = 0) : m_root(root), m_leafs_level(leafs_level), m_element(element) - , m_min_elements(min_elements), m_max_elements(max_elements) , m_tr(tr), m_relative_level(relative_level) {} @@ -385,7 +376,7 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); + m_root, m_leafs_level, m_element, m_tr, m_relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -400,7 +391,7 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level); + m_root, m_leafs_level, m_element, m_tr, m_relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -419,7 +410,7 @@ private: it != elements.rend(); ++it) { detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, *it, m_min_elements, m_max_elements, m_tr, relative_level); + m_root, m_leafs_level, *it, m_tr, relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -436,8 +427,6 @@ private: node* & m_root; size_t & m_leafs_level; Element const& m_element; - size_t m_min_elements; - size_t m_max_elements; Translator const& m_tr; size_t m_relative_level; }; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index f0d9a9fc5..e4b4e57fa 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -48,7 +48,7 @@ private: Translator const& m_tr; }; -template +template struct choose_split_axis_and_index_for_corner { typedef typename index::default_margin_result::type margin_type; @@ -60,30 +60,29 @@ struct choose_split_axis_and_index_for_corner margin_type & sum_of_margins, area_type & smallest_overlap, area_type & smallest_area, - size_t min_elems, - size_t max_elems, Translator const& tr) { typedef typename Elements::value_type element_type; - - // copy elements - Elements elements_copy = elements; - - BOOST_GEOMETRY_INDEX_ASSERT(elements_copy.size() == max_elems + 1, "wrong number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == Parameters::max_elements + 1, "wrong number of elements"); + + // copy elements + boost::array elements_copy; + std::copy(elements.begin(), elements.end(), elements_copy.begin()); + // sort elements element_axis_corner_less elements_less(tr); std::sort(elements_copy.begin(), elements_copy.end(), elements_less); // init outputs - choosen_index = min_elems; + choosen_index = Parameters::min_elements; sum_of_margins = 0; smallest_overlap = std::numeric_limits::max(); smallest_area = std::numeric_limits::max(); // calculate sum of margins for all distributions - size_t index_last = max_elems - min_elems + 2; - for ( size_t i = min_elems ; i < index_last ; ++i ) + size_t index_last = Parameters::max_elements - Parameters::min_elements + 2; + for ( size_t i = Parameters::min_elements ; i < index_last ; ++i ) { // TODO - awulkiew: may be optimized - box of group 1 may be initialized with // box of min_elems number of elements and expanded for each iteration by another element @@ -106,14 +105,14 @@ struct choose_split_axis_and_index_for_corner } }; -template +template struct choose_split_axis_and_index_for_axis { //BOOST_STATIC_ASSERT(0); }; -template -struct choose_split_axis_and_index_for_axis +template +struct choose_split_axis_and_index_for_axis { typedef typename index::default_margin_result::type margin_type; typedef typename index::default_area_result::type area_type; @@ -125,8 +124,6 @@ struct choose_split_axis_and_index_for_axis margin_type & sum_of_margins, area_type & smallest_overlap, area_type & smallest_area, - size_t min_elems, - size_t max_elems, Translator const& tr) { size_t index1 = 0; @@ -134,20 +131,20 @@ struct choose_split_axis_and_index_for_axis area_type ovl1 = std::numeric_limits::max(); area_type ar1 = std::numeric_limits::max(); - choose_split_axis_and_index_for_corner:: + choose_split_axis_and_index_for_corner:: apply(elements, index1, som1, ovl1, ar1, - min_elems, max_elems, tr); + tr); size_t index2 = 0; margin_type som2 = 0; area_type ovl2 = std::numeric_limits::max(); area_type ar2 = std::numeric_limits::max(); - choose_split_axis_and_index_for_corner:: + choose_split_axis_and_index_for_corner:: apply(elements, index2, som2, ovl2, ar2, - min_elems, max_elems, tr); + tr); sum_of_margins = som1 + som2; @@ -168,8 +165,8 @@ struct choose_split_axis_and_index_for_axis } }; -template -struct choose_split_axis_and_index_for_axis +template +struct choose_split_axis_and_index_for_axis { typedef typename index::default_margin_result::type margin_type; typedef typename index::default_area_result::type area_type; @@ -181,20 +178,18 @@ struct choose_split_axis_and_index_for_axis margin_type & sum_of_margins, area_type & smallest_overlap, area_type & smallest_area, - size_t min_elems, - size_t max_elems, Translator const& tr) { - choose_split_axis_and_index_for_corner:: + choose_split_axis_and_index_for_corner:: apply(elements, choosen_index, sum_of_margins, smallest_overlap, smallest_area, - min_elems, max_elems, tr); + tr); choosen_corner = min_corner; } }; -template +template struct choose_split_axis_and_index { BOOST_STATIC_ASSERT(0 < Dimension); @@ -210,15 +205,15 @@ struct choose_split_axis_and_index margin_type & smallest_sum_of_margins, area_type & smallest_overlap, area_type & smallest_area, - size_t min_elems, - size_t max_elems, Translator const& tr) { typedef typename rtree::element_indexable_type::type element_indexable_type; - choose_split_axis_and_index::apply(elements, choosen_axis, choosen_corner, choosen_index, - smallest_sum_of_margins, smallest_overlap, smallest_area, - min_elems, max_elems, tr); + choose_split_axis_and_index:: + apply(elements, choosen_axis, choosen_corner, choosen_index, + smallest_sum_of_margins, smallest_overlap, smallest_area, + tr); + margin_type sum_of_margins = 0; size_t corner = min_corner; @@ -228,10 +223,11 @@ struct choose_split_axis_and_index area_type area_val = std::numeric_limits::max(); choose_split_axis_and_index_for_axis< + Parameters, Box, Dimension - 1, typename index::traits::tag::type - >::apply(elements, corner, index, sum_of_margins, overlap_val, area_val, min_elems, max_elems, tr); + >::apply(elements, corner, index, sum_of_margins, overlap_val, area_val, tr); if ( sum_of_margins < smallest_sum_of_margins ) { @@ -245,8 +241,8 @@ struct choose_split_axis_and_index } }; -template -struct choose_split_axis_and_index +template +struct choose_split_axis_and_index { typedef typename index::default_margin_result::type margin_type; typedef typename index::default_area_result::type area_type; @@ -259,8 +255,6 @@ struct choose_split_axis_and_index margin_type & smallest_sum_of_margins, area_type & smallest_overlap, area_type & smallest_area, - size_t min_elems, - size_t max_elems, Translator const& tr) { typedef typename rtree::element_indexable_type::type element_indexable_type; @@ -268,10 +262,11 @@ struct choose_split_axis_and_index choosen_axis = 0; choose_split_axis_and_index_for_axis< + Parameters, Box, 0, typename index::traits::tag::type - >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_area, min_elems, max_elems, tr); + >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_area, tr); } }; @@ -317,9 +312,11 @@ struct partial_sort template struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename Options::parameters_type parameters_type; static const size_t dimension = index::traits::dimension::value; @@ -332,8 +329,6 @@ struct redistribute_elements Node & second_node, Box & box1, Box & box2, - size_t min_elems, - size_t max_elems, Translator const& tr) { typedef typename rtree::elements_type::type elements_type; @@ -343,22 +338,22 @@ struct redistribute_elements size_t split_axis = 0; size_t split_corner = 0; - size_t split_index = min_elems; + size_t split_index = parameters_type::min_elements; margin_type smallest_sum_of_margins = std::numeric_limits::max(); area_type smallest_overlap = std::numeric_limits::max(); area_type smallest_area = std::numeric_limits::max(); - rstar::choose_split_axis_and_index::value>:: + rstar::choose_split_axis_and_index::value>:: apply(elements1, split_axis, split_corner, split_index, - smallest_sum_of_margins, smallest_overlap, smallest_area, - min_elems, max_elems, tr); + smallest_sum_of_margins, smallest_overlap, smallest_area, + tr); // TODO: awulkiew - get rid of following static_casts? BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension::value, "unexpected value"); BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner), "unexpected value"); - BOOST_GEOMETRY_INDEX_ASSERT(min_elems <= split_index && split_index <= max_elems - min_elems + 1, "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= split_index && split_index <= parameters_type::max_elements - parameters_type::min_elements + 1, "unexpected value"); // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort if ( split_corner == static_cast(min_corner) ) @@ -367,7 +362,7 @@ struct redistribute_elements rstar::partial_sort::apply(elements1, split_axis, split_index, tr); // copy elements to node 2 and remove from node 1 - elements2.resize(max_elems + 1 - split_index); + elements2.resize(parameters_type::max_elements + 1 - split_index); std::copy(elements1.begin() + split_index, elements1.end(), elements2.begin()); elements1.resize(split_index); diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index b0953faba..ef57c5958 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -38,7 +38,7 @@ namespace boost { namespace geometry { namespace index { template < typename Value, - typename Options = linear_tag, + typename Options, typename Translator = translator::def > class rtree @@ -52,9 +52,9 @@ public: typedef typename detail::rtree::options_type::type options_type; typedef typename options_type::node_tag node_tag; - typedef typename detail::rtree::node::type node; - typedef typename detail::rtree::internal_node::type internal_node; - typedef typename detail::rtree::leaf::type leaf; + typedef typename detail::rtree::node::type node; + typedef typename detail::rtree::internal_node::type internal_node; + typedef typename detail::rtree::leaf::type leaf; inline explicit rtree( size_t max_elems_per_node = 4, @@ -98,7 +98,7 @@ public: // TODO: awulkiew - assert for correct value detail::rtree::visitors::insert - insert_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); + insert_v(m_root, m_leafs_level, value, m_translator); detail::rtree::apply_visitor(insert_v, *m_root); @@ -112,7 +112,7 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there is no elements in the rtree"); detail::rtree::visitors::remove - remove_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator); + remove_v(m_root, m_leafs_level, value, m_translator); detail::rtree::apply_visitor(remove_v, *m_root); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index ca3a345dd..d20164bfc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -18,10 +18,10 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -class are_boxes_ok : public rtree::visitor::type +class are_boxes_ok : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_boxes_ok(Translator const& tr) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index c4585b1f2..3ec7f7820 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -17,10 +17,10 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -class are_levels_ok : public rtree::visitor::type +class are_levels_ok : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_levels_ok(Translator const& tr) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 8090358b9..719f17171 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -17,10 +17,10 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -struct destroy : public rtree::visitor::type +struct destroy : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node & n) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 4fc5cf95d..64ba69056 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -143,11 +143,11 @@ namespace detail { namespace rtree { namespace visitors { // rtree spatial query visitor template -struct find : public rtree::visitor::type +struct find : public rtree::visitor::type { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline find(Translator const& t, Geometry const& g, OutIter out_it) : tr(t), geom(g), out_iter(out_it) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 85d0c4ea7..86554d282 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -27,9 +27,9 @@ struct choose_next_node; template struct choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; @@ -83,25 +83,23 @@ struct redistribute_elements; // Default insert visitor template -class insert : public rtree::visitor::type +class insert : public rtree::visitor::type { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename Options::parameters_type parameters_type; inline insert(node* & root, size_t & leafs_level, Element const& element, - size_t min_elements, - size_t max_elements, Translator const& t, size_t relative_level = 0 ) : m_element(element) , m_tr(t) - , m_min_elems_per_node(min_elements) - , m_max_elems_per_node(max_elements) , m_relative_level(relative_level) , m_level(leafs_level - relative_level) , m_root_node(root) @@ -141,7 +139,7 @@ protected: "if node isn't the root current_child_index should be valid"); // handle overflow - if ( m_max_elems_per_node < rtree::elements(n).size() ) + if ( parameters_type::max_elements < rtree::elements(n).size() ) { split(n); } @@ -179,12 +177,14 @@ protected: // redistribute elements Box box1, box2; redistribute_elements:: - apply(n, n2, box1, box2, m_min_elems_per_node, m_max_elems_per_node, m_tr); + apply(n, n2, box1, box2, m_tr); // check numbers of elements - BOOST_GEOMETRY_INDEX_ASSERT(m_min_elems_per_node <= rtree::elements(n).size() && rtree::elements(n).size() <= m_max_elems_per_node, + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n).size() && + rtree::elements(n).size() <= parameters_type::max_elements, "unexpected number of elements"); - BOOST_GEOMETRY_INDEX_ASSERT(m_min_elems_per_node <= rtree::elements(n2).size() && rtree::elements(n2).size() <= m_max_elems_per_node, + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n2).size() && + rtree::elements(n2).size() <= parameters_type::max_elements, "unexpected number of elements"); // node is not the root - just add the new node @@ -213,8 +213,6 @@ protected: Element const& m_element; Translator const& m_tr; - const size_t m_min_elems_per_node; - const size_t m_max_elems_per_node; const size_t m_relative_level; const size_t m_level; @@ -246,12 +244,10 @@ struct insert inline insert(node* & root, size_t & leafs_level, Element const& element, - size_t min_elements, - size_t max_elements, Translator const& tr, size_t relative_level = 0 ) - : base(root, leafs_level, element, min_elements, max_elements, tr, relative_level) + : base(root, leafs_level, element, tr, relative_level) {} inline void operator()(internal_node & n) @@ -293,12 +289,10 @@ struct insert inline insert(node* & root, size_t & leafs_level, Value const& v, - size_t min_elements, - size_t max_elements, Translator const& t, size_t relative_level = 0 ) - : base(root, leafs_level, v, min_elements, max_elements, t, relative_level) + : base(root, leafs_level, v, t, relative_level) {} inline void operator()(internal_node & n) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index a3e7c17ec..529bd99c8 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -17,10 +17,10 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -struct is_leaf : public rtree::visitor::type +struct is_leaf : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node const&) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 7c84b7fa6..e159a200f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -22,23 +22,21 @@ namespace detail { namespace rtree { namespace visitors { // Default remove algorithm template -class remove : public rtree::visitor::type +class remove : public rtree::visitor::type { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename Options::parameters_type parameters_type; public: inline remove(node* & root, size_t & leafs_level, Value const& v, - size_t min_elements, - size_t max_elements, Translator const& t) : m_value(v) , m_tr(t) - , m_min_elems_per_node(min_elements) - , m_max_elems_per_node(max_elements) , m_root_node(root) , m_leafs_level(leafs_level) , m_is_value_removed(false) @@ -87,7 +85,7 @@ public: elements.erase(underfl_el_it); // calc underflow - m_is_underflow = elements.size() < m_min_elems_per_node; + m_is_underflow = elements.size() < parameters_type::min_elements; } // n is not root - adjust aabb @@ -96,7 +94,7 @@ public: // underflow state should be ok here // note that there may be less than min_elems elements in root // so this condition should be checked only here - assert((elements.size() < m_min_elems_per_node) == m_is_underflow); + assert((elements.size() < parameters_type::min_elements) == m_is_underflow); rtree::elements(*m_parent)[m_current_child_index].first = rtree::elements_box(elements.begin(), elements.end(), m_tr); @@ -105,9 +103,7 @@ public: else { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); - - // value not found - assert(m_is_value_removed); + BOOST_GEOMETRY_INDEX_ASSERT(m_is_value_removed, "value not found"); // reinsert elements from removed nodes // begin with levels closer to the root @@ -152,7 +148,7 @@ public: if ( m_is_value_removed ) { // calc underflow - m_is_underflow = elements.size() < m_min_elems_per_node; + m_is_underflow = elements.size() < parameters_type::min_elements; // n is not root - adjust aabb if ( 0 != m_parent ) @@ -196,8 +192,6 @@ private: m_root_node, m_leafs_level, *it, - m_min_elems_per_node, - m_max_elems_per_node, m_tr, node_relative_level - 1); @@ -207,8 +201,6 @@ private: Value const& m_value; Translator const& m_tr; - const size_t m_min_elems_per_node; - const size_t m_max_elems_per_node; node* & m_root_node; size_t & m_leafs_level; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 878de69d3..b11002cfb 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -28,13 +28,13 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; - //typedef bgi::rtree, bgi::linear_tag> RT; - //typedef bgi::rtree, bgi::quadratic_tag> RT; - //typedef bgi::rtree, bgi::rstar_tag> RT; - typedef bgi::rtree< + //typedef bgi::rtree, bgi::linear<32, 8> > RT; + //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; + typedef bgi::rtree, bgi::rstar<32, 8, true> > RT; + /*typedef bgi::rtree< std::pair, - bgi::options::rtree - > RT; + bgi::options::rtree, bgi::insert_tag, bgi::choose_by_area_diff_tag, bgi::linear_tag, bgi::default_static_tag> + > RT;*/ // load config file std::ifstream file_cfg("config.txt"); From 1e46876a0d13999994e07f5090937c488115a288 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 16 Jun 2011 23:10:10 +0000 Subject: [PATCH 041/366] Static parameters are now used everywhere in the code. Further optimizations implemented in quadratic redistribute_elements. Some errors corrected in pushable_array. [SVN r72619] --- .../extensions/index/pushable_array.hpp | 33 +++++++++++-- .../extensions/index/rtree/options.hpp | 7 +++ .../rtree/quadratic/redistribute_elements.hpp | 48 +++++++++++-------- .../geometry/extensions/index/rtree/rtree.hpp | 15 +----- .../index/rtree/visitors/gl_draw.hpp | 6 +-- .../extensions/index/rtree/visitors/print.hpp | 6 +-- tests/additional_glut_vis.cpp | 2 +- tests/additional_sizes_and_times.cpp | 6 +-- tests/main.cpp | 5 +- tests/rtree_filters.hpp | 2 +- tests/rtree_native.hpp | 17 +++---- tests/translators.hpp | 2 +- 12 files changed, 90 insertions(+), 59 deletions(-) diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index 5366b1ce5..566f86873 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -26,16 +26,23 @@ public: typedef typename array_type::size_type size_type; typedef typename array_type::iterator iterator; typedef typename array_type::const_iterator const_iterator; + typedef typename array_type::reverse_iterator reverse_iterator; + typedef typename array_type::const_reverse_iterator const_reverse_iterator; inline pushable_array() : m_size(0) {} - inline pushable_array(size_type s, Element const& v) + inline explicit pushable_array(size_type s) : m_size(s) { - BOOST_GEOMETRY_INDEX_ASSERT(s < Capacity, "size too big"); - std::fill(m_array.begin(), m_array.begin() + s, v); + BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); + } + + inline void resize(size_type s) + { + BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); + m_size = s; } inline Element & operator[](size_type i) @@ -94,6 +101,26 @@ public: return m_array.begin() + m_size; } + inline reverse_iterator rbegin() + { + return reverse_iterator(end()); + } + + inline reverse_iterator rend() + { + return reverse_iterator(begin()); + } + + inline const_reverse_iterator rbegin() const + { + return const_reverse_iterator(end()); + } + + inline const_reverse_iterator rend() const + { + return const_reverse_iterator(begin()); + } + inline void clear() { m_size = 0; diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 8d42d702a..a0fa00f3b 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -30,6 +30,12 @@ struct default_tag {}; struct default_variant_tag {}; struct default_static_tag {}; +// TODO: awulkiew - implement those: +//if ( m_min_elems_per_node < 1 ) +// m_min_elems_per_node = 1; +//if ( m_max_elems_per_node < 2 ) +// m_max_elems_per_node = 2; + template struct linear { @@ -86,6 +92,7 @@ namespace detail { namespace rtree { template struct options_type { + // TODO: awulkiew - use static assert typedef void type; }; diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 3c80f30f5..d8acfb731 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -27,7 +27,7 @@ namespace detail { namespace quadratic { -template +template struct pick_seeds { typedef typename Elements::value_type element_type; @@ -41,9 +41,9 @@ struct pick_seeds size_t & seed1, size_t & seed2) { - size_t elements_count = elements.size(); - - BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "wrong number of elements"); + const size_t elements_count = Parameters::max_elements + 1; + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "wrong number of elements"); + BOOST_STATIC_ASSERT(2 <= elements_count); area_type greatest_free_area = 0; seed1 = 0; @@ -78,9 +78,11 @@ struct pick_seeds template struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename Options::parameters_type parameters_type; + + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename index::default_area_result::type area_type; @@ -89,8 +91,6 @@ struct redistribute_elements Node & second_node, Box & box1, Box & box2, - size_t min_elems, - size_t max_elems, Translator const& tr) { typedef typename rtree::elements_type::type elements_type; @@ -98,19 +98,26 @@ struct redistribute_elements typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; + elements_type & elements1 = rtree::elements(n); + elements_type & elements2 = rtree::elements(second_node); + const size_t elements1_count = parameters_type::max_elements + 1; + + typedef index::pushable_array elements_copy_type; + + BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected elements number"); + // copy original elements - elements_type elements_copy = rtree::elements(n); + elements_copy_type elements_copy(elements1_count); + std::copy(elements1.begin(), elements1.end(), elements_copy.begin()); // calculate initial seeds size_t seed1 = 0; size_t seed2 = 0; - quadratic::pick_seeds::apply(elements_copy, tr, seed1, seed2); + quadratic::pick_seeds::apply(elements_copy, tr, seed1, seed2); // prepare nodes' elements containers - elements_type & elements1 = rtree::elements(n); - elements_type & elements2 = rtree::elements(second_node); elements1.clear(); - assert(elements2.empty()); + BOOST_GEOMETRY_INDEX_ASSERT(elements2.empty(), "second node's elements container should be empty"); // add seeds elements1.push_back(elements_copy[seed1]); @@ -141,7 +148,7 @@ struct redistribute_elements // redistribute the rest of the elements while ( !elements_copy.empty() ) { - typename elements_type::reverse_iterator el_it = elements_copy.rbegin(); + typename elements_copy_type::reverse_iterator el_it = elements_copy.rbegin(); bool insert_into_group1 = false; size_t elements1_count = elements1.size(); @@ -149,11 +156,11 @@ struct redistribute_elements // if there is small number of elements left and the number of elements in node is lesser than min_elems // just insert them to this node - if ( elements1_count + remaining <= min_elems ) + if ( elements1_count + remaining <= parameters_type::min_elements ) { insert_into_group1 = true; } - else if ( elements2_count + remaining <= min_elems ) + else if ( elements2_count + remaining <= parameters_type::min_elements ) { insert_into_group1 = false; } @@ -196,10 +203,11 @@ struct redistribute_elements area2 = index::area(box2); } - assert(!elements_copy.empty()); - elements_copy.erase(--el_it.base()); + BOOST_GEOMETRY_INDEX_ASSERT(!elements_copy.empty(), "expected more elements"); + typename elements_copy_type::iterator el_it_base = el_it.base(); + elements_copy.erase(--el_it_base); - assert(0 < remaining); + BOOST_GEOMETRY_INDEX_ASSERT(0 < remaining, "expected more remaining elements"); --remaining; } } diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index ef57c5958..5713563d2 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -56,23 +56,12 @@ public: typedef typename detail::rtree::internal_node::type internal_node; typedef typename detail::rtree::leaf::type leaf; - inline explicit rtree( - size_t max_elems_per_node = 4, - size_t min_elems_per_node = 2, - translator_type const& translator = translator_type() - ) + inline explicit rtree(translator_type const& translator = translator_type()) : m_values_count(0) - , m_max_elems_per_node(max_elems_per_node) - , m_min_elems_per_node(min_elems_per_node) , m_root(0) , m_leafs_level(0) , m_translator(translator) { - if ( m_min_elems_per_node < 1 ) - m_min_elems_per_node = 1; - if ( m_max_elems_per_node < 2 ) - m_max_elems_per_node = 2; - m_root = detail::rtree::create_node(leaf()); } @@ -154,8 +143,6 @@ public: private: size_t m_values_count; - size_t m_max_elems_per_node; - size_t m_min_elems_per_node; node *m_root; size_t m_leafs_level; translator_type m_translator; 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 1defba7bc..122cfedeb 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -94,10 +94,10 @@ inline void gl_draw_indexable(Indexable const& i, typename index::traits::coordi } // namespace detail template -struct gl_draw : public rtree::visitor::type +struct gl_draw : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline gl_draw(Translator const& t, size_t level_first = 0, diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 8ce6244b7..282f35553 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -112,10 +112,10 @@ inline void print_indexable(std::ostream & os, Indexable const& i) } // namespace detail template -struct print : public rtree::visitor::type +struct print : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline print(std::ostream & o, Translator const& t) : os(o), tr(t), level(0) diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 71843a2a8..c2576af9e 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -22,7 +22,7 @@ typedef boost::geometry::model::box

B; //boost::geometry::index::rtree t(2, 1); boost::geometry::index::rtree< B, - boost::geometry::index::rstar_tag> t(4, 2); + boost::geometry::index::rstar<4, 2> > t; std::vector vect; void render_scene(void) diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index b11002cfb..a980b1ab7 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -29,8 +29,8 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; //typedef bgi::rtree, bgi::linear<32, 8> > RT; - //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; - typedef bgi::rtree, bgi::rstar<32, 8, true> > RT; + typedef bgi::rtree, bgi::quadratic<32, 8> > RT; + //typedef bgi::rtree, bgi::rstar<32, 8, true> > RT; /*typedef bgi::rtree< std::pair, bgi::options::rtree, bgi::insert_tag, bgi::choose_by_area_diff_tag, bgi::linear_tag, bgi::default_static_tag> @@ -106,7 +106,7 @@ int main() } // create rtree - RT t(max_elems, min_elems); + RT t; // elements inserting test { diff --git a/tests/main.cpp b/tests/main.cpp index d30121b65..1f97014a0 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -16,8 +16,9 @@ int main() { tests_translators_hpp(); - tests_rtree_native_hpp(); - tests_rtree_native_hpp(); + tests_rtree_native_hpp >(); + tests_rtree_native_hpp >(); + tests_rtree_native_hpp >(); tests_rtree_filters_hpp(); /* { diff --git a/tests/rtree_filters.hpp b/tests/rtree_filters.hpp index 2162c6aa1..221b3ddd4 100644 --- a/tests/rtree_filters.hpp +++ b/tests/rtree_filters.hpp @@ -37,7 +37,7 @@ void tests_rtree_filters_hpp() typedef boost::geometry::model::box

B; { - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree > t; boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); diff --git a/tests/rtree_native.hpp b/tests/rtree_native.hpp index 41b5fc446..6f2a6a268 100644 --- a/tests/rtree_native.hpp +++ b/tests/rtree_native.hpp @@ -13,7 +13,7 @@ #include -template +template void tests_rtree_native_hpp() { std::cout << "tests/rtree_native.hpp\n"; @@ -23,7 +23,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t; boost::geometry::index::insert(t, B(P(0, 0, 0), P(1, 1, 1))); boost::geometry::index::insert(t, B(P(2, 2, 2), P(3, 3, 3))); boost::geometry::index::insert(t, B(P(4, 4, 4), P(5, 5, 5))); @@ -40,7 +40,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t; boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); @@ -57,7 +57,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t; boost::geometry::index::insert(t, P(0, 0)); boost::geometry::index::insert(t, P(2, 2)); boost::geometry::index::insert(t, P(4, 4)); @@ -75,7 +75,7 @@ void tests_rtree_native_hpp() typedef boost::geometry::model::box

B; typedef std::pair V; - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t; boost::geometry::index::insert(t, V(B(P(0, 0), P(1, 1)), 0)); boost::geometry::index::insert(t, V(B(P(2, 2), P(3, 3)), 1)); boost::geometry::index::insert(t, V(B(P(4, 4), P(5, 5)), 2)); @@ -100,7 +100,7 @@ void tests_rtree_native_hpp() V v4( new std::pair(B(P(6, 6), P(7, 7)), 3) ); V v5( new std::pair(B(P(8, 8), P(9, 9)), 4) ); - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t; boost::geometry::index::insert(t, v1); boost::geometry::index::insert(t, v2); boost::geometry::index::insert(t, v3); @@ -126,7 +126,7 @@ void tests_rtree_native_hpp() m.insert(std::pair(3, B(P(6, 6), P(7, 7)))); m.insert(std::pair(4, B(P(8, 8), P(9, 9)))); - boost::geometry::index::rtree t(4, 2); + boost::geometry::index::rtree t; V vit = m.begin(); boost::geometry::index::insert(t, vit++); boost::geometry::index::insert(t, vit++); @@ -154,7 +154,8 @@ void tests_rtree_native_hpp() v.push_back(B(P(6, 6), P(7, 7))); v.push_back(B(P(8, 8), P(9, 9))); - boost::geometry::index::rtree t(4, 2, Tr(v)); + Tr tr(v); + boost::geometry::index::rtree t(tr); boost::geometry::index::insert(t, 0u); boost::geometry::index::insert(t, 1u); diff --git a/tests/translators.hpp b/tests/translators.hpp index 062f7e886..39d059eec 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -35,7 +35,7 @@ void tests_translators_hpp() typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; - typedef boost::geometry::index::rtree I; + //typedef boost::geometry::index::rtree I; using namespace boost::geometry; From 6c593d13a9faa550bed2f4f3007a3dca2eb35eae Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 17 Jun 2011 09:46:03 +0000 Subject: [PATCH 042/366] c++98 errors fixed [SVN r72620] --- .../geometry/extensions/index/rtree/node/node_default.hpp | 2 +- include/boost/geometry/extensions/index/rtree/options.hpp | 7 +++---- tests/additional_sizes_and_times.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index 2fc96b381..b189a07b9 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -156,7 +156,7 @@ inline typename Translator::indexable_type const& element_indexable(Value const& el, Translator const& tr) { return tr(el); -}; +} template inline Box const& diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index a0fa00f3b..3e704c434 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -55,21 +55,21 @@ namespace options { namespace detail { template struct default_rstar_reinserted_elements { - static const size_t value = MaxElements * 0.3f; + static const size_t value = (MaxElements * 3) / 10; }; }} // namespace options::detail template ::value > struct rstar { static const size_t max_elements = MaxElements; static const size_t min_elements = MinElements; - static const size_t use_nearly_minimum_cost = UseNearlyMinimumCost; + static const bool use_nearly_minimum_cost = UseNearlyMinimumCost; static const size_t reinserted_elements = ReinsertedElements; }; @@ -93,7 +93,6 @@ template struct options_type { // TODO: awulkiew - use static assert - typedef void type; }; template diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index a980b1ab7..7b9a66492 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -29,12 +29,12 @@ int main() typedef bg::model::point P; typedef bg::model::box

B; //typedef bgi::rtree, bgi::linear<32, 8> > RT; - typedef bgi::rtree, bgi::quadratic<32, 8> > RT; + //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; //typedef bgi::rtree, bgi::rstar<32, 8, true> > RT; - /*typedef bgi::rtree< + typedef bgi::rtree< std::pair, - bgi::options::rtree, bgi::insert_tag, bgi::choose_by_area_diff_tag, bgi::linear_tag, bgi::default_static_tag> - > RT;*/ + bgi::options::rtree, bgi::insert_tag, bgi::choose_by_area_diff_tag, bgi::quadratic_tag, bgi::default_static_tag> + > RT; // load config file std::ifstream file_cfg("config.txt"); From 5e0d091ab6f5a4d4a6b9a4fa99332c30eb9f9c5f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 21 Jun 2011 19:29:44 +0000 Subject: [PATCH 043/366] Implemented R* choose_next_node algorithm version choosing by nearly min overlap cost [SVN r72714] --- .../extensions/index/rtree/options.hpp | 10 +-- .../index/rtree/rstar/choose_next_node.hpp | 81 +++++++++++++++++-- tests/additional_sizes_and_times.cpp | 17 ++-- 3 files changed, 90 insertions(+), 18 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 3e704c434..f29de951b 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -62,14 +62,14 @@ struct default_rstar_reinserted_elements template ::value > struct rstar { static const size_t max_elements = MaxElements; static const size_t min_elements = MinElements; - static const bool use_nearly_minimum_cost = UseNearlyMinimumCost; + static const size_t overlap_cost_threshold = OverlapCostThreshold; static const size_t reinserted_elements = ReinsertedElements; }; @@ -131,11 +131,11 @@ struct options_type< quadratic > > type; }; -template -struct options_type< rstar > +template +struct options_type< rstar > { typedef options::rtree< - rstar, + rstar, reinsert_tag, choose_by_overlap_diff_tag, rstar_tag, diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index d383fa1b0..240b940c8 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -35,6 +35,7 @@ class choose_next_node typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; + typedef typename children_type::value_type child_type; typedef typename Options::parameters_type parameters_type; @@ -50,7 +51,8 @@ public: // children are leafs if ( node_relative_level <= 1 ) { - if ( parameters_type::use_nearly_minimum_cost ) + if ( 0 < parameters_type::overlap_cost_threshold && + parameters_type::overlap_cost_threshold < children.size() ) return choose_by_nearly_minimum_overlap_cost(children, indexable); else return choose_by_minimum_overlap_cost(children, indexable); @@ -75,7 +77,6 @@ private: // for each child node for (size_t i = 0 ; i < children_count ; ++i ) { - typedef typename children_type::value_type child_type; child_type const& ch_i = children[i]; Box box_exp(ch_i.first); @@ -121,12 +122,81 @@ private: template static inline size_t choose_by_nearly_minimum_overlap_cost(children_type const& children, Indexable const& indexable) { - // TODO - awulkiew: implement this function + const size_t children_count = children.size(); - return choose_by_minimum_overlap_cost(children, indexable); + // create container of children sorted by area enlargement needed to include the new value + std::vector< boost::tuple > sorted_children(children_count); + for ( size_t i = 0 ; i < children_count ; ++i ) + { + child_type const& ch_i = children[i]; + + // expanded child node's box + Box box_exp(ch_i.first); + geometry::expand(box_exp, indexable); + + // areas difference + area_type area = index::area(box_exp); + area_type area_diff = area - index::area(ch_i.first); + + sorted_children[i] = boost::make_tuple(i, area_diff, area); + } + + // sort by area_diff + std::sort(sorted_children.begin(), sorted_children.end(), area_diff_less); + + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::overlap_cost_threshold <= children_count, "there are not enough children"); + + // for overlap_cost_threshold child nodes find the one with smallest overlap value + size_t choosen_index = 0; + overlap_type smallest_overlap_diff = std::numeric_limits::max(); + + // for each node + for (size_t i = 0 ; i < parameters_type::overlap_cost_threshold ; ++i ) + { + size_t child_index = boost::get<0>(sorted_children[i]); + + typedef typename children_type::value_type child_type; + child_type const& ch_i = children[child_index]; + + Box box_exp(ch_i.first); + // calculate expanded box of child node ch_i + geometry::expand(box_exp, indexable); + + overlap_type overlap = 0; + overlap_type overlap_exp = 0; + + // calculate overlap + for ( size_t j = 0 ; j < children_count ; ++j ) + { + if ( child_index != j ) + { + child_type const& ch_j = children[j]; + + overlap += index::overlap(ch_i.first, ch_j.first); + overlap_exp += index::overlap(box_exp, ch_j.first); + } + } + + overlap_type overlap_diff = overlap_exp - overlap; + + // update result + if ( overlap_diff < smallest_overlap_diff ) + { + smallest_overlap_diff = overlap_diff; + choosen_index = child_index; + } + } + + return choosen_index; } - template + static inline bool area_diff_less(boost::tuple const& p1, boost::tuple const& p2) + { + return boost::get<1>(p1) < boost::get<1>(p2) || + (boost::get<1>(p1) == boost::get<1>(p2) && boost::get<2>(p1) < boost::get<2>(p2)); + } + + template static inline size_t choose_by_minimum_area_cost(children_type const& children, Indexable const& indexable) { size_t children_count = children.size(); @@ -139,7 +209,6 @@ private: // choose the child which requires smallest box expansion to store the indexable for ( size_t i = 0 ; i < children_count ; ++i ) { - typedef typename children_type::value_type child_type; child_type const& ch_i = children[i]; // expanded child node's box diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 7b9a66492..2cc387f0b 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -30,11 +30,11 @@ int main() typedef bg::model::box

B; //typedef bgi::rtree, bgi::linear<32, 8> > RT; //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; - //typedef bgi::rtree, bgi::rstar<32, 8, true> > RT; - typedef bgi::rtree< + typedef bgi::rtree, bgi::rstar<32, 8> > RT; + /*typedef bgi::rtree< std::pair, - bgi::options::rtree, bgi::insert_tag, bgi::choose_by_area_diff_tag, bgi::quadratic_tag, bgi::default_static_tag> - > RT; + bgi::options::rtree, bgi::reinsert_tag, bgi::choose_by_area_diff_tag, bgi::rstar_tag, bgi::default_tag> + > RT;*/ // load config file std::ifstream file_cfg("config.txt"); @@ -93,10 +93,13 @@ int main() else { boost::mt19937 rng; - float max_val = static_cast(values_count / 2); + //rng.seed(static_cast(std::time(0))); + + float max_val = static_cast(values_count / 2); boost::uniform_real range(-max_val, max_val); - boost::variate_generator > rnd(rng, range); - + + boost::variate_generator > rnd(rng, range); + std::cout << "randomizing data\n"; for ( size_t i = 0 ; i < values_count ; ++i ) { From 3081e37140f238294dfe799a396b7ec5f680a35b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 13 Jul 2011 01:27:30 +0000 Subject: [PATCH 044/366] area-related names changed to content-related names. index::within parameters sequence corrected to match the geometry::within parameters sequence. [SVN r73027] --- .../algorithms/{area.hpp => content.hpp} | 34 ++++---- ...tion_area.hpp => intersection_content.hpp} | 14 +-- .../extensions/index/algorithms/overlap.hpp | 4 +- .../{union_area.hpp => union_content.hpp} | 12 +-- .../extensions/index/algorithms/within.hpp | 30 +++---- .../rtree/linear/redistribute_elements.hpp | 38 ++++---- .../extensions/index/rtree/options.hpp | 6 +- .../rtree/quadratic/redistribute_elements.hpp | 68 +++++++-------- .../index/rtree/rstar/choose_next_node.hpp | 64 +++++++------- .../extensions/index/rtree/rstar/insert.hpp | 13 ++- .../rtree/rstar/redistribute_elements.hpp | 86 +++++++++---------- .../geometry/extensions/index/rtree/rtree.hpp | 6 +- .../extensions/index/rtree/visitors/find.hpp | 2 - .../index/rtree/visitors/insert.hpp | 24 +++--- .../index/rtree/visitors/remove.hpp | 2 +- tests/additional_sizes_and_times.cpp | 22 +---- 16 files changed, 200 insertions(+), 225 deletions(-) rename include/boost/geometry/extensions/index/algorithms/{area.hpp => content.hpp} (56%) rename include/boost/geometry/extensions/index/algorithms/{intersection_area.hpp => intersection_content.hpp} (75%) rename include/boost/geometry/extensions/index/algorithms/{union_area.hpp => union_content.hpp} (62%) diff --git a/include/boost/geometry/extensions/index/algorithms/area.hpp b/include/boost/geometry/extensions/index/algorithms/content.hpp similarity index 56% rename from include/boost/geometry/extensions/index/algorithms/area.hpp rename to include/boost/geometry/extensions/index/algorithms/content.hpp index 8d49a4e0e..0dfa24d66 100644 --- a/include/boost/geometry/extensions/index/algorithms/area.hpp +++ b/include/boost/geometry/extensions/index/algorithms/content.hpp @@ -1,19 +1,19 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.SpatialIndex - n-dimensional box's area/volume +// Boost.SpatialIndex - n-dimensional box's content (2d-area/3d-volume/...) // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP namespace boost { namespace geometry { namespace index { template -struct default_area_result +struct default_content_result { typedef typename select_most_precise< typename traits::coordinate_type::type, @@ -24,20 +24,20 @@ struct default_area_result namespace detail { template -struct area_for_each_dimension +struct content_for_each_dimension { BOOST_STATIC_ASSERT(0 < CurrentDimension); BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); - static inline typename default_area_result::type apply(Box const& b) + static inline typename default_content_result::type apply(Box const& b) { - return area_for_each_dimension::apply(b) * + return content_for_each_dimension::apply(b) * ( index::get(b) - index::get(b) ); } }; template -struct area_for_each_dimension +struct content_for_each_dimension { static inline typename default_area_result::type apply(Box const& b) { @@ -50,37 +50,37 @@ struct area_for_each_dimension namespace dispatch { template -struct area +struct content { // TODO: awulkiew - static assert? }; template -struct area +struct content { - static typename default_area_result::type apply(Indexable const&) + static typename default_content_result::type apply(Indexable const&) { return 0; } }; template -struct area +struct content { - static typename default_area_result::type apply(Indexable const& b) + static typename default_content_result::type apply(Indexable const& b) { - return detail::area_for_each_dimension::value>::apply(b); + return detail::content_for_each_dimension::value>::apply(b); } }; } // namespace dispatch template -typename default_area_result::type area(Indexable const& b) +typename default_content_result::type content(Indexable const& b) { - return dispatch::area::type>::apply(b); + return dispatch::content::type>::apply(b); } }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_AREA_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/intersection_area.hpp b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp similarity index 75% rename from include/boost/geometry/extensions/index/algorithms/intersection_area.hpp rename to include/boost/geometry/extensions/index/algorithms/intersection_content.hpp index 5d4e69a8d..bb42ec79f 100644 --- a/include/boost/geometry/extensions/index/algorithms/intersection_area.hpp +++ b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp @@ -7,11 +7,11 @@ // 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_ALGORITHMS_INTERSECTION_AREA_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -19,18 +19,18 @@ namespace boost { namespace geometry { namespace index { * \brief Compute the area of the intersection of b1 and b2 */ template -inline typename default_area_result::type intersection_area(Box const& box1, Box const& box2) +inline typename default_content_result::type intersection_content(Box const& box1, Box const& box2) { - typename default_area_result::type result = 0; + typename default_content_result::type result = 0; if ( geometry::intersects(box1, box2) ) { Box box_intersection; geometry::intersection(box1, box2, box_intersection); - result = index::area(box_intersection); + result = index::content(box_intersection); } return result; } }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_AREA_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/overlap.hpp b/include/boost/geometry/extensions/index/algorithms/overlap.hpp index fd9882783..ce0e0a260 100644 --- a/include/boost/geometry/extensions/index/algorithms/overlap.hpp +++ b/include/boost/geometry/extensions/index/algorithms/overlap.hpp @@ -11,7 +11,7 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -27,7 +27,7 @@ typename default_overlap_result::type overlap(Box const& b1, Box const& b2) Box inters; geometry::assign_zero(inters); geometry::intersection(b1, b2, inters); - return index::area(inters); + return index::content(inters); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/algorithms/union_area.hpp b/include/boost/geometry/extensions/index/algorithms/union_content.hpp similarity index 62% rename from include/boost/geometry/extensions/index/algorithms/union_area.hpp rename to include/boost/geometry/extensions/index/algorithms/union_content.hpp index ba804ec85..b25f5e23d 100644 --- a/include/boost/geometry/extensions/index/algorithms/union_area.hpp +++ b/include/boost/geometry/extensions/index/algorithms/union_content.hpp @@ -8,11 +8,11 @@ // 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_ALGORITHMS_UNION_AREA_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -20,13 +20,13 @@ namespace boost { namespace geometry { namespace index { * \brief Compute the area of the union of b1 and b2 */ template -inline typename default_area_result::type union_area(Box const& b, Geometry const& g) +inline typename default_content_result::type union_content(Box const& b, Geometry const& g) { Box expanded_box(b); geometry::expand(expanded_box, g); - return index::area(expanded_box); + return index::content(expanded_box); } }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_AREA_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/within.hpp b/include/boost/geometry/extensions/index/algorithms/within.hpp index b75986a27..a65d8a6e3 100644 --- a/include/boost/geometry/extensions/index/algorithms/within.hpp +++ b/include/boost/geometry/extensions/index/algorithms/within.hpp @@ -24,9 +24,9 @@ template struct within_compare { template - static inline bool apply(Box const& b1, Indexable const& b2) + static inline bool apply(Indexable const& b1, Box const& b2) { - return index::get(b1) <= index::get(b2); + return index::get(b2) <= index::get(b1); } }; @@ -34,9 +34,9 @@ template struct within_compare { template - static inline bool apply(Box const& b1, Indexable const& b2) + static inline bool apply(Indexable const& b1, Box const& b2) { - return index::get(b2) <= index::get(b1); + return index::get(b1) <= index::get(b2); } }; @@ -44,7 +44,7 @@ template struct within_compare { template - static inline bool apply(Box const& b, Indexable const& p) + static inline bool apply(Indexable const& p, Box const& b) { return index::get(b) <= geometry::get(p); } @@ -54,7 +54,7 @@ template struct within_compare { template - static inline bool apply(Box const& b, Indexable const& p) + static inline bool apply(Indexable const& p, Box const& b) { return geometry::get(p) <= index::get(b); } @@ -71,26 +71,26 @@ struct within_for_each_dimension BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); - static inline bool apply(Box const& b, Indexable const& i) + static inline bool apply(Indexable const& i, Box const& b) { return within_for_each_dimension< Box, Indexable, CurrentDimension - 1 - >::apply(b, i) && + >::apply(i, b) && dispatch::within_compare< min_corner, CurrentDimension - 1, Indexable, typename traits::tag::type - >::apply(b, i) && + >::apply(i, b) && dispatch::within_compare< max_corner, CurrentDimension - 1, Indexable, typename traits::tag::type - >::apply(b, i); + >::apply(i, b); } }; @@ -100,7 +100,7 @@ struct within_for_each_dimension BOOST_STATIC_ASSERT(1 <= traits::dimension::value); BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); - static inline bool apply(Box const& b, Indexable const& i) + static inline bool apply(Indexable const& i, Box const& b) { return dispatch::within_compare< @@ -108,22 +108,22 @@ struct within_for_each_dimension 0, Indexable, typename traits::tag::type - >::apply(b, i) && + >::apply(i, b) && dispatch::within_compare< max_corner, 0, Indexable, typename traits::tag::type - >::apply(b, i); + >::apply(i, b); } }; } // namespace detail template -bool within(Box const& box, Indexable const& i) +bool within(Indexable const& i, Box const& box) { - return detail::within_for_each_dimension::value>::apply(box, i); + return detail::within_for_each_dimension::value>::apply(i, box); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 6271376e0..2e0e1d93f 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -11,12 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP -#include - -#include - -#include -#include +#include +#include #include #include @@ -192,7 +188,7 @@ struct redistribute_elements typedef typename elements_type::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; elements_type & elements1 = rtree::elements(n); elements_type & elements2 = rtree::elements(second_node); @@ -224,8 +220,8 @@ struct redistribute_elements geometry::convert(rtree::element_indexable(elements_copy[seed2], tr), box2); // initialize areas - area_type area1 = index::area(box1); - area_type area2 = index::area(box2); + content_type content1 = index::content(box1); + content_type content2 = index::content(box2); BOOST_STATIC_ASSERT(2 <= elements1_count); size_t remaining = elements1_count - 2; @@ -244,13 +240,13 @@ struct redistribute_elements { elements1.push_back(elem); geometry::expand(box1, indexable); - area1 = index::area(box1); + content1 = index::content(box1); } else if ( elements2.size() + remaining <= parameters_type::min_elements ) { elements2.push_back(elem); geometry::expand(box2, indexable); - area2 = index::area(box2); + content2 = index::content(box2); } // choose better node and insert element else @@ -260,26 +256,26 @@ struct redistribute_elements Box enlarged_box2(box2); geometry::expand(enlarged_box1, indexable); geometry::expand(enlarged_box2, indexable); - area_type enlarged_area1 = index::area(enlarged_box1); - area_type enlarged_area2 = index::area(enlarged_box2); + content_type enlarged_content1 = index::content(enlarged_box1); + content_type enlarged_content2 = index::content(enlarged_box2); - area_type area_increase1 = enlarged_area1 - area1; - area_type area_increase2 = enlarged_area2 - area2; + content_type content_increase1 = enlarged_content1 - content1; + content_type content_increase2 = enlarged_content2 - content2; - // choose group which box area have to be enlarged least or has smaller area or has fewer elements - if ( area_increase1 < area_increase2 || - ( area_increase1 == area_increase2 && area1 < area2 ) || - ( area1 == area2 && elements1.size() <= elements2.size() ) ) + // choose group which box content have to be enlarged least or has smaller content or has fewer elements + if ( content_increase1 < content_increase2 || + ( content_increase1 == content_increase2 && content1 < content2 ) || + ( content1 == content2 && elements1.size() <= elements2.size() ) ) { elements1.push_back(elem); box1 = enlarged_box1; - area1 = enlarged_area1; + content1 = enlarged_content1; } else { elements2.push_back(elem); box2 = enlarged_box2; - area2 = enlarged_area2; + content2 = enlarged_content2; } } diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index f29de951b..710a4d799 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -17,7 +17,7 @@ struct insert_tag {}; struct reinsert_tag {}; // ChooseNextNodeTag -struct choose_by_area_diff_tag {}; +struct choose_by_content_diff_tag {}; struct choose_by_overlap_diff_tag {}; // RedistributeTag @@ -113,7 +113,7 @@ struct options_type< linear > typedef options::rtree< linear, insert_tag, - choose_by_area_diff_tag, + choose_by_content_diff_tag, linear_tag, default_tag > type; @@ -125,7 +125,7 @@ struct options_type< quadratic > typedef options::rtree< quadratic, insert_tag, - choose_by_area_diff_tag, + choose_by_content_diff_tag, quadratic_tag, default_tag > type; diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index d8acfb731..df14cb154 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -12,8 +12,8 @@ #include -#include -#include +#include +#include #include #include @@ -34,7 +34,7 @@ struct pick_seeds typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; typedef Box box_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; static inline void apply(Elements const& elements, Translator const& tr, @@ -45,7 +45,7 @@ struct pick_seeds BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "wrong number of elements"); BOOST_STATIC_ASSERT(2 <= elements_count); - area_type greatest_free_area = 0; + content_type greatest_free_content = 0; seed1 = 0; seed2 = 1; @@ -60,11 +60,11 @@ struct pick_seeds geometry::convert(ind1, enlarged_box); geometry::expand(enlarged_box, ind2); - area_type free_area = index::area(enlarged_box) - index::area(ind1) - index::area(ind2); + content_type free_content = (index::content(enlarged_box) - index::content(ind1)) - index::content(ind2); - if ( greatest_free_area < free_area ) + if ( greatest_free_content < free_content ) { - greatest_free_area = free_area; + greatest_free_content = free_content; seed1 = i; seed2 = j; } @@ -84,7 +84,7 @@ struct redistribute_elements typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline void apply(Node & n, @@ -140,8 +140,8 @@ struct redistribute_elements } // initialize areas - area_type area1 = index::area(box1); - area_type area2 = index::area(box2); + content_type content1 = index::content(box1); + content_type content2 = index::content(box2); size_t remaining = elements_copy.size(); @@ -168,15 +168,15 @@ struct redistribute_elements else { // find element with minimum groups areas increses differences - area_type area_increase1 = 0; - area_type area_increase2 = 0; + content_type content_increase1 = 0; + content_type content_increase2 = 0; el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(), - box1, box2, area1, area2, tr, - area_increase1, area_increase2); + box1, box2, content1, content2, tr, + content_increase1, content_increase2); - if ( area_increase1 < area_increase2 || - ( area_increase1 == area_increase2 && area1 < area2 ) || - ( area1 == area2 && elements1_count <= elements2_count ) ) + if ( content_increase1 < content_increase2 || + ( content_increase1 == content_increase2 && content1 < content2 ) || + ( content1 == content2 && elements1_count <= elements2_count ) ) { insert_into_group1 = true; } @@ -194,13 +194,13 @@ struct redistribute_elements { elements1.push_back(elem); geometry::expand(box1, indexable); - area1 = index::area(box1); + content1 = index::content(box1); } else { elements2.push_back(elem); geometry::expand(box2, indexable); - area2 = index::area(box2); + content2 = index::content(box2); } BOOST_GEOMETRY_INDEX_ASSERT(!elements_copy.empty(), "expected more elements"); @@ -217,17 +217,17 @@ struct redistribute_elements template static inline It pick_next(It first, It last, Box const& box1, Box const& box2, - area_type const& area1, area_type const& area2, + content_type const& content1, content_type const& content2, Translator const& tr, - area_type & out_area_increase1, area_type & out_area_increase2) + content_type & out_content_increase1, content_type & out_content_increase2) { typedef typename boost::iterator_value::type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - area_type greatest_area_incrase_diff = 0; + content_type greatest_content_incrase_diff = 0; It out_it = first; - out_area_increase1 = 0; - out_area_increase2 = 0; + out_content_increase1 = 0; + out_content_increase2 = 0; // find element with greatest difference between increased group's boxes areas for ( It el_it = first ; el_it != last ; ++el_it ) @@ -239,21 +239,21 @@ struct redistribute_elements Box enlarged_box2(box2); geometry::expand(enlarged_box1, indexable); geometry::expand(enlarged_box2, indexable); - area_type enlarged_area1 = index::area(enlarged_box1); - area_type enlarged_area2 = index::area(enlarged_box2); + content_type enlarged_content1 = index::content(enlarged_box1); + content_type enlarged_content2 = index::content(enlarged_box2); - area_type area_incrase1 = (enlarged_area1 - area1); - area_type area_incrase2 = (enlarged_area2 - area2); + content_type content_incrase1 = (enlarged_content1 - content1); + content_type content_incrase2 = (enlarged_content2 - content2); - area_type area_incrase_diff = area_incrase1 < area_incrase2 ? - area_incrase2 - area_incrase1 : area_incrase1 - area_incrase2; + content_type content_incrase_diff = content_incrase1 < content_incrase2 ? + content_incrase2 - content_incrase1 : content_incrase1 - content_incrase2; - if ( greatest_area_incrase_diff < area_incrase_diff ) + if ( greatest_content_incrase_diff < content_incrase_diff ) { - greatest_area_incrase_diff = area_incrase_diff; + greatest_content_incrase_diff = content_incrase_diff; out_it = el_it; - out_area_increase1 = area_incrase1; - out_area_increase2 = area_incrase2; + out_content_increase1 = content_incrase1; + out_content_increase2 = content_incrase2; } } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 240b940c8..dab689d1a 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -14,9 +14,9 @@ #include -#include +#include #include -#include +#include #include #include @@ -39,7 +39,7 @@ class choose_next_node typedef typename Options::parameters_type parameters_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; typedef typename index::default_overlap_result::type overlap_type; public: @@ -59,7 +59,7 @@ public: } // children are internal nodes else - return choose_by_minimum_area_cost(children, indexable); + return choose_by_minimum_content_cost(children, indexable); } private: @@ -68,11 +68,11 @@ private: { size_t children_count = children.size(); - // choose index with smallest overlap change value, or area change or smallest area + // choose index with smallest overlap change value, or content change or smallest content size_t choosen_index = 0; overlap_type smallest_overlap_diff = std::numeric_limits::max(); - area_type smallest_area_diff = std::numeric_limits::max(); - area_type smallest_area = std::numeric_limits::max(); + content_type smallest_content_diff = std::numeric_limits::max(); + content_type smallest_content = std::numeric_limits::max(); // for each child node for (size_t i = 0 ; i < children_count ; ++i ) @@ -83,9 +83,9 @@ private: // calculate expanded box of child node ch_i geometry::expand(box_exp, indexable); - // calculate area and area diff - area_type area = index::area(ch_i.first); - area_type area_diff = index::area(box_exp) - area; + // calculate content and content diff + content_type content = index::content(ch_i.first); + content_type content_diff = index::content(box_exp) - content; overlap_type overlap = 0; overlap_type overlap_exp = 0; @@ -106,12 +106,12 @@ private: // update result if ( overlap_diff < smallest_overlap_diff || - ( overlap_diff == smallest_overlap_diff && area_diff < smallest_area_diff ) || - ( area_diff == smallest_area_diff && area < smallest_area ) ) + ( overlap_diff == smallest_overlap_diff && content_diff < smallest_content_diff ) || + ( content_diff == smallest_content_diff && content < smallest_content ) ) { smallest_overlap_diff = overlap_diff; - smallest_area_diff = area_diff; - smallest_area = area; + smallest_content_diff = content_diff; + smallest_content = content; choosen_index = i; } } @@ -124,8 +124,8 @@ private: { const size_t children_count = children.size(); - // create container of children sorted by area enlargement needed to include the new value - std::vector< boost::tuple > sorted_children(children_count); + // create container of children sorted by content enlargement needed to include the new value + std::vector< boost::tuple > sorted_children(children_count); for ( size_t i = 0 ; i < children_count ; ++i ) { child_type const& ch_i = children[i]; @@ -135,14 +135,14 @@ private: geometry::expand(box_exp, indexable); // areas difference - area_type area = index::area(box_exp); - area_type area_diff = area - index::area(ch_i.first); + content_type content = index::content(box_exp); + content_type content_diff = content - index::content(ch_i.first); - sorted_children[i] = boost::make_tuple(i, area_diff, area); + sorted_children[i] = boost::make_tuple(i, content_diff, content); } - // sort by area_diff - std::sort(sorted_children.begin(), sorted_children.end(), area_diff_less); + // sort by content_diff + std::sort(sorted_children.begin(), sorted_children.end(), content_diff_less); BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::overlap_cost_threshold <= children_count, "there are not enough children"); @@ -190,21 +190,21 @@ private: return choosen_index; } - static inline bool area_diff_less(boost::tuple const& p1, boost::tuple const& p2) + static inline bool content_diff_less(boost::tuple const& p1, boost::tuple const& p2) { return boost::get<1>(p1) < boost::get<1>(p2) || (boost::get<1>(p1) == boost::get<1>(p2) && boost::get<2>(p1) < boost::get<2>(p2)); } template - static inline size_t choose_by_minimum_area_cost(children_type const& children, Indexable const& indexable) + static inline size_t choose_by_minimum_content_cost(children_type const& children, Indexable const& indexable) { size_t children_count = children.size(); - // choose index with smallest area change or smallest area + // choose index with smallest content change or smallest content size_t choosen_index = 0; - area_type smallest_area_diff = std::numeric_limits::max(); - area_type smallest_area = std::numeric_limits::max(); + content_type smallest_content_diff = std::numeric_limits::max(); + content_type smallest_content = std::numeric_limits::max(); // choose the child which requires smallest box expansion to store the indexable for ( size_t i = 0 ; i < children_count ; ++i ) @@ -216,15 +216,15 @@ private: geometry::expand(box_exp, indexable); // areas difference - area_type area = index::area(box_exp); - area_type area_diff = area - index::area(ch_i.first); + content_type content = index::content(box_exp); + content_type content_diff = content - index::content(ch_i.first); // update the result - if ( area_diff < smallest_area_diff || - ( area_diff == smallest_area_diff && area < smallest_area ) ) + if ( content_diff < smallest_content_diff || + ( content_diff == smallest_content_diff && content < smallest_content ) ) { - smallest_area_diff = area_diff; - smallest_area = area; + smallest_content_diff = content_diff; + smallest_content = content; choosen_index = i; } } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 8cfa1fdde..352edcdc0 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -10,10 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP -#include - -#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -44,7 +41,7 @@ public: typedef typename elements_type::value_type element_type; typedef typename geometry::point_type::type point_type; // TODO: awulkiew - change second point_type to the point type of the Indexable? - typedef typename index::default_distance_sqr_result::type distance_sqr_type; + typedef typename geometry::default_distance_result::type distance_type; elements_type & elements = rtree::elements(n); @@ -60,13 +57,13 @@ public: geometry::centroid(rtree::elements(*parent)[current_child_index].first, node_center); // fill the container of centers' distances of children from current node's center - boost::array, elements_count> sorted_elements; + boost::array, elements_count> sorted_elements; for ( size_t i = 0 ; i < elements_count ; ++i ) { point_type element_center; geometry::centroid( rtree::element_indexable(elements[i], tr), element_center); - sorted_elements[i].first = index::distance_sqr(node_center, element_center); + sorted_elements[i].first = geometry::comparable_distance(node_center, element_center); sorted_elements[i].second = elements[i]; } @@ -75,7 +72,7 @@ public: sorted_elements.begin(), sorted_elements.begin() + reinserted_elements_count, sorted_elements.end(), - distances_dsc); + distances_dsc); // copy elements which will be reinserted result_elements.resize(reinserted_elements_count); diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index e4b4e57fa..94a070ed7 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -12,8 +12,8 @@ #include -#include -#include +#include +#include #include #include @@ -52,14 +52,14 @@ template struct choose_split_axis_and_index_for_corner { typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline void apply(Elements const& elements, size_t & choosen_index, margin_type & sum_of_margins, - area_type & smallest_overlap, - area_type & smallest_area, + content_type & smallest_overlap, + content_type & smallest_content, Translator const& tr) { typedef typename Elements::value_type element_type; @@ -77,8 +77,8 @@ struct choose_split_axis_and_index_for_corner // init outputs choosen_index = Parameters::min_elements; sum_of_margins = 0; - smallest_overlap = std::numeric_limits::max(); - smallest_area = std::numeric_limits::max(); + smallest_overlap = std::numeric_limits::max(); + smallest_content = std::numeric_limits::max(); // calculate sum of margins for all distributions size_t index_last = Parameters::max_elements - Parameters::min_elements + 2; @@ -92,14 +92,14 @@ struct choose_split_axis_and_index_for_corner sum_of_margins += index::margin(box1) + index::margin(box2); - area_type ovl = index::intersection_area(box1, box2); - area_type ar = index::area(box1) + index::area(box2); + content_type ovl = index::intersection_content(box1, box2); + content_type con = index::content(box1) + index::content(box2); - if ( ovl < smallest_overlap || (ovl == smallest_overlap && ar <= smallest_area) ) + if ( ovl < smallest_overlap || (ovl == smallest_overlap && con <= smallest_content) ) { choosen_index = i; smallest_overlap = ovl; - smallest_area = ar; + smallest_content = con; } } } @@ -115,52 +115,52 @@ template struct choose_split_axis_and_index_for_axis { typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline void apply(Elements const& elements, size_t & choosen_corner, size_t & choosen_index, margin_type & sum_of_margins, - area_type & smallest_overlap, - area_type & smallest_area, + content_type & smallest_overlap, + content_type & smallest_content, Translator const& tr) { size_t index1 = 0; margin_type som1 = 0; - area_type ovl1 = std::numeric_limits::max(); - area_type ar1 = std::numeric_limits::max(); + content_type ovl1 = std::numeric_limits::max(); + content_type con1 = std::numeric_limits::max(); choose_split_axis_and_index_for_corner:: apply(elements, index1, - som1, ovl1, ar1, + som1, ovl1, con1, tr); size_t index2 = 0; margin_type som2 = 0; - area_type ovl2 = std::numeric_limits::max(); - area_type ar2 = std::numeric_limits::max(); + content_type ovl2 = std::numeric_limits::max(); + content_type con2 = std::numeric_limits::max(); choose_split_axis_and_index_for_corner:: apply(elements, index2, - som2, ovl2, ar2, + som2, ovl2, con2, tr); sum_of_margins = som1 + som2; - if ( ovl1 < ovl2 || (ovl1 == ovl2 && ar1 <= ar2) ) + if ( ovl1 < ovl2 || (ovl1 == ovl2 && con1 <= con2) ) { choosen_corner = min_corner; choosen_index = index1; smallest_overlap = ovl1; - smallest_area = ar1; + smallest_content = con1; } else { choosen_corner = max_corner; choosen_index = index2; smallest_overlap = ovl2; - smallest_area = ar2; + smallest_content = con2; } } }; @@ -169,20 +169,20 @@ template struct choose_split_axis_and_index_for_axis { typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline void apply(Elements const& elements, size_t & choosen_corner, size_t & choosen_index, margin_type & sum_of_margins, - area_type & smallest_overlap, - area_type & smallest_area, + content_type & smallest_overlap, + content_type & smallest_content, Translator const& tr) { choose_split_axis_and_index_for_corner:: apply(elements, choosen_index, - sum_of_margins, smallest_overlap, smallest_area, + sum_of_margins, smallest_overlap, smallest_content, tr); choosen_corner = min_corner; @@ -195,7 +195,7 @@ struct choose_split_axis_and_index BOOST_STATIC_ASSERT(0 < Dimension); typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline void apply(Elements const& elements, @@ -203,15 +203,15 @@ struct choose_split_axis_and_index size_t & choosen_corner, size_t & choosen_index, margin_type & smallest_sum_of_margins, - area_type & smallest_overlap, - area_type & smallest_area, + content_type & smallest_overlap, + content_type & smallest_content, Translator const& tr) { typedef typename rtree::element_indexable_type::type element_indexable_type; choose_split_axis_and_index:: apply(elements, choosen_axis, choosen_corner, choosen_index, - smallest_sum_of_margins, smallest_overlap, smallest_area, + smallest_sum_of_margins, smallest_overlap, smallest_content, tr); margin_type sum_of_margins = 0; @@ -219,15 +219,15 @@ struct choose_split_axis_and_index size_t corner = min_corner; size_t index = 0; - area_type overlap_val = std::numeric_limits::max(); - area_type area_val = std::numeric_limits::max(); + content_type overlap_val = std::numeric_limits::max(); + content_type content_val = std::numeric_limits::max(); choose_split_axis_and_index_for_axis< Parameters, Box, Dimension - 1, typename index::traits::tag::type - >::apply(elements, corner, index, sum_of_margins, overlap_val, area_val, tr); + >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, tr); if ( sum_of_margins < smallest_sum_of_margins ) { @@ -236,7 +236,7 @@ struct choose_split_axis_and_index choosen_index = index; smallest_sum_of_margins = sum_of_margins; smallest_overlap = overlap_val; - smallest_area = area_val; + smallest_content = content_val; } } }; @@ -245,7 +245,7 @@ template struct choose_split_axis_and_index { typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline void apply(Elements const& elements, @@ -253,8 +253,8 @@ struct choose_split_axis_and_index size_t & choosen_corner, size_t & choosen_index, margin_type & smallest_sum_of_margins, - area_type & smallest_overlap, - area_type & smallest_area, + content_type & smallest_overlap, + content_type & smallest_content, Translator const& tr) { typedef typename rtree::element_indexable_type::type element_indexable_type; @@ -266,7 +266,7 @@ struct choose_split_axis_and_index Box, 0, typename index::traits::tag::type - >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_area, tr); + >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, tr); } }; @@ -321,7 +321,7 @@ struct redistribute_elements static const size_t dimension = index::traits::dimension::value; typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline void apply( @@ -340,13 +340,13 @@ struct redistribute_elements size_t split_corner = 0; size_t split_index = parameters_type::min_elements; margin_type smallest_sum_of_margins = std::numeric_limits::max(); - area_type smallest_overlap = std::numeric_limits::max(); - area_type smallest_area = std::numeric_limits::max(); + content_type smallest_overlap = std::numeric_limits::max(); + content_type smallest_content = std::numeric_limits::max(); rstar::choose_split_axis_and_index::value>:: apply(elements1, split_axis, split_corner, split_index, - smallest_sum_of_margins, smallest_overlap, smallest_area, + smallest_sum_of_margins, smallest_overlap, smallest_content, tr); // TODO: awulkiew - get rid of following static_casts? diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 5713563d2..5757943e3 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -11,8 +11,10 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP -#include -#include +#include +#include + +#include #include diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 64ba69056..c0ed3b03c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -10,8 +10,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP -#include - #include //#include diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 86554d282..093310edc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP -#include +#include #include @@ -25,7 +25,7 @@ template -struct choose_next_node +struct choose_next_node { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -33,7 +33,7 @@ struct choose_next_node typedef typename rtree::elements_type::type children_type; - typedef typename index::default_area_result::type area_type; + typedef typename index::default_content_result::type content_type; template static inline size_t apply(internal_node & n, Indexable const& indexable, size_t /*node_relative_level*/) @@ -44,10 +44,10 @@ struct choose_next_node size_t children_count = children.size(); - // choose index with smallest area change or smallest area + // choose index with smallest content change or smallest content size_t choosen_index = 0; - area_type smallest_area_diff = std::numeric_limits::max(); - area_type smallest_area = std::numeric_limits::max(); + content_type smallest_content_diff = std::numeric_limits::max(); + content_type smallest_content = std::numeric_limits::max(); // caculate areas and areas of all nodes' boxes for ( size_t i = 0 ; i < children_count ; ++i ) @@ -60,15 +60,15 @@ struct choose_next_node geometry::expand(box_exp, indexable); // areas difference - area_type area = index::area(box_exp); - area_type area_diff = area - index::area(ch_i.first); + content_type content = index::content(box_exp); + content_type content_diff = content - index::content(ch_i.first); // update the result - if ( area_diff < smallest_area_diff || - ( area_diff == smallest_area_diff && area < smallest_area ) ) + if ( content_diff < smallest_content_diff || + ( content_diff == smallest_content_diff && content < smallest_content ) ) { - smallest_area_diff = area_diff; - smallest_area = area; + smallest_content_diff = content_diff; + smallest_content = content; choosen_index = i; } } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index e159a200f..d4e2f2d48 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -58,7 +58,7 @@ public: size_t child_node_index = 0; for ( ; child_node_index < children.size() ; ++child_node_index ) { - if ( index::within(children[child_node_index].first, m_tr(m_value)) ) + if ( index::within(m_tr(m_value), children[child_node_index].first) ) { // next traversing step traverse_apply_visitor(n, child_node_index); diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 2cc387f0b..3d1234bca 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -26,7 +26,8 @@ int main() namespace bg = boost::geometry; namespace bgi = bg::index; - typedef bg::model::point P; + //typedef bg::model::d2::point_xy P; + typedef bg::model::point P; typedef bg::model::box

B; //typedef bgi::rtree, bgi::linear<32, 8> > RT; //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; @@ -121,25 +122,6 @@ int main() float y = coords[i].second; B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - //if ( 341700 <= i ) - // std::cout << i << "\n"; - - // Czy mozliwe, ze w czasie powtornego reinserta - // nagle drzewo sie powieksza o jeden poziom? - // Tak, drzewo sie rozrasta, powinno sie wstawiac w poziomie liczac od lisci - // TODO: relative_level zamiast level - - // TODO: asserty w operator(leaf) - // current_level == leaf_level - - // Swoja droga to dziwne ze przy drzewie 4,2 - // dzieje sie to samo dopiero dla obiektow o indeksie 300k a nie wczesniej - // Dlaczego? - // Przy 32 obiektach powtornie wstawianych jest 9 a przy 4 tylko 1 - - // TODO: Zrobic kolejnego visitora sprawdzajacego czy odpowiednie wezly zostaly wstawione w dobrym miejscu - // Np sprawdzajacego czy wszystkie liscie sa na tym samym poziomie - t.insert(std::make_pair(b, i)); } std::cout << "time: " << tim.elapsed() << "s\n"; From e7d84e1bfa134859176a93ccdbd1a4842b08601a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 13 Jul 2011 01:38:24 +0000 Subject: [PATCH 045/366] example changed, now size of a rtree isn't loaded from file. [SVN r73028] --- tests/additional_sizes_and_times.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 3d1234bca..20bbdfd27 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -39,19 +39,14 @@ int main() // load config file std::ifstream file_cfg("config.txt"); - size_t max_elems = 4; - size_t min_elems = 2; size_t values_count = 0; size_t remove_count = 0; size_t queries_count = 0; std::string file_name(""); - file_cfg >> max_elems; - file_cfg >> min_elems; file_cfg >> values_count; file_cfg >> remove_count; file_cfg >> queries_count; file_cfg >> file_name; - std::cout << "max: " << max_elems << ", min: " << min_elems << "\n"; std::cout << "v: " << values_count << ", r: " << remove_count << ", q: " << queries_count << "\n"; if ( values_count < remove_count ) From 5586fc85bfadca3712c9dfd87dc6ec0f2b5ab0ce Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 13 Jul 2011 01:57:30 +0000 Subject: [PATCH 046/366] visitors are now explicitly nonassignable. rtree is set as noncopyable since copying isn't implemented. [SVN r73029] --- .../extensions/index/nonassignable.hpp | 22 +++++++++++++++++++ .../extensions/index/rtree/rstar/insert.hpp | 1 + .../rtree/rstar/redistribute_elements.hpp | 5 ++--- .../geometry/extensions/index/rtree/rtree.hpp | 4 +++- .../index/rtree/visitors/are_boxes_ok.hpp | 4 +++- .../index/rtree/visitors/are_levels_ok.hpp | 4 +++- .../extensions/index/rtree/visitors/find.hpp | 4 +++- .../index/rtree/visitors/insert.hpp | 4 +++- .../index/rtree/visitors/remove.hpp | 4 +++- 9 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 include/boost/geometry/extensions/index/nonassignable.hpp diff --git a/include/boost/geometry/extensions/index/nonassignable.hpp b/include/boost/geometry/extensions/index/nonassignable.hpp new file mode 100644 index 000000000..a59a04ae6 --- /dev/null +++ b/include/boost/geometry/extensions/index/nonassignable.hpp @@ -0,0 +1,22 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - nonassignable +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP + +namespace boost { namespace geometry { namespace index { + +class nonassignable +{ + nonassignable & operator=(nonassignable const&); +}; + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 352edcdc0..c35fd7573 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -352,6 +352,7 @@ struct level_insert<0, Value, Value, Options, Translator, Box> template class insert : public rtree::visitor::type + , index::nonassignable { private: typedef typename rtree::node::type node; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 94a070ed7..60676b45c 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -10,14 +10,12 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP -#include +#include #include #include #include -#include - #include #include #include @@ -32,6 +30,7 @@ namespace rstar { template class element_axis_corner_less + : index::nonassignable { public: element_axis_corner_less(Translator const& tr) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 5757943e3..d20439afb 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -17,6 +17,7 @@ #include #include +#include #include @@ -36,7 +37,7 @@ namespace boost { namespace geometry { namespace index { -// TODO: awulkiew - min and max elems as template parameters? +// TODO copying template < typename Value, @@ -44,6 +45,7 @@ template < typename Translator = translator::def > class rtree + : public boost::noncopyable { public: typedef Value value_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index d20164bfc..ce9e43478 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -18,7 +18,9 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -class are_boxes_ok : public rtree::visitor::type +class are_boxes_ok + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index 3ec7f7820..d905853f0 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -17,7 +17,9 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { template -class are_levels_ok : public rtree::visitor::type +class are_levels_ok + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index c0ed3b03c..83026bc2d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -141,7 +141,9 @@ namespace detail { namespace rtree { namespace visitors { // rtree spatial query visitor template -struct find : public rtree::visitor::type +struct find + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 093310edc..706cb43e8 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -83,7 +83,9 @@ struct redistribute_elements; // Default insert visitor template -class insert : public rtree::visitor::type +class insert + : public rtree::visitor::type + , index::nonassignable { protected: typedef typename rtree::node::type node; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index d4e2f2d48..57b9a1527 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -22,7 +22,9 @@ namespace detail { namespace rtree { namespace visitors { // Default remove algorithm template -class remove : public rtree::visitor::type +class remove + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; From 32181b8734d39d32c821846ec8a68a84fe2f0db6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 16 Jul 2011 09:59:35 +0000 Subject: [PATCH 047/366] node tag names changed [SVN r73140] --- .../index/rtree/node/node_default_static.hpp | 18 ++++++------- .../index/rtree/node/node_default_variant.hpp | 26 ++++++++++--------- .../extensions/index/rtree/options.hpp | 12 ++++----- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp index c9d7d0bc9..b1b3ffe94 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp @@ -17,28 +17,28 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { template -struct internal_node_poly - : public node_poly +struct internal_node_poly + : public node_poly { typedef index::pushable_array< - std::pair *>, + std::pair *>, Parameters::max_elements + 1 > elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; template -struct leaf_poly - : public node_poly +struct leaf_poly + : public node_poly { typedef index::pushable_array elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index 89b76036e..747ee0adf 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -42,24 +42,24 @@ struct leaf_variant // nodes traits template -struct node +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; template -struct internal_node +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; template -struct leaf +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // nodes conversion @@ -76,10 +76,12 @@ inline V & get( } template -inline V * get(boost::variant< - leaf_variant, - internal_node_variant - > *v) +inline V * get( + boost::variant< + leaf_variant, + internal_node_variant + > *v +) { return boost::get(v); } @@ -87,7 +89,7 @@ inline V * get(boost::variant< // visitor traits template -struct visitor +struct visitor { typedef static_visitor<> type; }; diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 710a4d799..4be3d5ce2 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -26,9 +26,9 @@ struct quadratic_tag {}; struct rstar_tag {}; // NodeTag -struct default_tag {}; -struct default_variant_tag {}; -struct default_static_tag {}; +struct node_default_tag {}; +struct node_default_variant_tag {}; +struct node_default_static_tag {}; // TODO: awulkiew - implement those: //if ( m_min_elems_per_node < 1 ) @@ -115,7 +115,7 @@ struct options_type< linear > insert_tag, choose_by_content_diff_tag, linear_tag, - default_tag + node_default_tag > type; }; @@ -127,7 +127,7 @@ struct options_type< quadratic > insert_tag, choose_by_content_diff_tag, quadratic_tag, - default_tag + node_default_tag > type; }; @@ -139,7 +139,7 @@ struct options_type< rstar type; }; From a55d592702c167d9f30f18517f2c5bc34bfebe19 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 16 Jul 2011 20:56:56 +0000 Subject: [PATCH 048/366] insert tags renamed [SVN r73154] --- .../extensions/index/rtree/options.hpp | 39 ++++++++++--------- .../extensions/index/rtree/rstar/insert.hpp | 2 +- .../index/rtree/visitors/insert.hpp | 6 ++- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 4be3d5ce2..85cc4eb2d 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -13,8 +13,8 @@ namespace boost { namespace geometry { namespace index { // InsertTag -struct insert_tag {}; -struct reinsert_tag {}; +struct insert_default_tag {}; +struct insert_reinsert_tag {}; // ChooseNextNodeTag struct choose_by_content_diff_tag {}; @@ -95,27 +95,28 @@ struct options_type // TODO: awulkiew - use static assert }; -template -struct options_type< options::rtree > -{ - typedef options::rtree< - Parameters, - InsertTag, - ChooseNextNodeTag, - RedistributeTag, - NodeTag - > type; -}; +// default options +//template +//struct options_type< options::rtree > +//{ +// typedef options::rtree< +// Parameters, +// InsertTag, +// ChooseNextNodeTag, +// RedistributeTag, +// NodeTag +// > type; +//}; template struct options_type< linear > { typedef options::rtree< linear, - insert_tag, + insert_default_tag, choose_by_content_diff_tag, linear_tag, - node_default_tag + node_default_static_tag > type; }; @@ -124,10 +125,10 @@ struct options_type< quadratic > { typedef options::rtree< quadratic, - insert_tag, + insert_default_tag, choose_by_content_diff_tag, quadratic_tag, - node_default_tag + node_default_static_tag > type; }; @@ -136,10 +137,10 @@ struct options_type< rstar, - reinsert_tag, + insert_reinsert_tag, choose_by_overlap_diff_tag, rstar_tag, - node_default_tag + node_default_static_tag > type; }; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index c35fd7573..73632c124 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -350,7 +350,7 @@ struct level_insert<0, Value, Value, Options, Translator, Box> // R*-tree insert visitor template -class insert +class insert : public rtree::visitor::type , index::nonassignable { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 706cb43e8..cf2832809 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -169,6 +169,8 @@ protected: m_current_level = current_level_bckup; } + // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation + template inline void split(Node &n) const { @@ -235,7 +237,7 @@ struct insert; // Default insert visitor used for nodes elements template -struct insert +struct insert : public detail::insert { typedef detail::insert base; @@ -280,7 +282,7 @@ struct insert // Default insert visitor specialized for Values elements template -struct insert +struct insert : public detail::insert { typedef detail::insert base; From d70a1756f92b2e39ee54e6dcc2d507baafe972e9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 16 Jul 2011 22:00:42 +0000 Subject: [PATCH 049/366] node split algorithm separated from insert visitor, it's now tag-dispatchable. [SVN r73157] --- .../extensions/index/rtree/options.hpp | 22 ++-- .../index/rtree/visitors/insert.hpp | 118 +++++++++++------- 2 files changed, 84 insertions(+), 56 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 85cc4eb2d..45fddc2de 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -20,6 +20,9 @@ struct insert_reinsert_tag {}; struct choose_by_content_diff_tag {}; struct choose_by_overlap_diff_tag {}; +// SplitTag +struct split_default_tag {}; + // RedistributeTag struct linear_tag {}; struct quadratic_tag {}; @@ -75,12 +78,13 @@ struct rstar namespace options { -template +template struct rtree { typedef Parameters parameters_type; typedef InsertTag insert_tag; typedef ChooseNextNodeTag choose_next_node_tag; + typedef SplitTag split_tag; typedef RedistributeTag redistribute_tag; typedef NodeTag node_tag; }; @@ -95,19 +99,6 @@ struct options_type // TODO: awulkiew - use static assert }; -// default options -//template -//struct options_type< options::rtree > -//{ -// typedef options::rtree< -// Parameters, -// InsertTag, -// ChooseNextNodeTag, -// RedistributeTag, -// NodeTag -// > type; -//}; - template struct options_type< linear > { @@ -115,6 +106,7 @@ struct options_type< linear > linear, insert_default_tag, choose_by_content_diff_tag, + split_default_tag, linear_tag, node_default_static_tag > type; @@ -127,6 +119,7 @@ struct options_type< quadratic > quadratic, insert_default_tag, choose_by_content_diff_tag, + split_default_tag, quadratic_tag, node_default_static_tag > type; @@ -139,6 +132,7 @@ struct options_type< rstar, insert_reinsert_tag, choose_by_overlap_diff_tag, + split_default_tag, rstar_tag, node_default_static_tag > type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index cf2832809..0521ff1c6 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -77,10 +77,82 @@ struct choose_next_node } }; +// ----------------------------------------------------------------------- // + // Not implemented here template struct redistribute_elements; +// ----------------------------------------------------------------------- // + +// Split algorithm +template +class split; + +// Default split algorithm +template +class split +{ +protected: + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename Options::parameters_type parameters_type; + +public: + template + static inline void apply(node* & root_node, + size_t & leafs_level, + Node & n, + internal_node *parent_node, + size_t current_child_index, + Translator const& tr) + { + // create additional node + node * second_node = rtree::create_node(Node()); + Node & n2 = rtree::get(*second_node); + + // redistribute elements + Box box1, box2; + redistribute_elements:: + apply(n, n2, box1, box2, tr); + + // check numbers of elements + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n).size() && + rtree::elements(n).size() <= parameters_type::max_elements, + "unexpected number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n2).size() && + rtree::elements(n2).size() <= parameters_type::max_elements, + "unexpected number of elements"); + + // node is not the root - just add the new node + if ( parent_node != 0 ) + { + // update old node's box + rtree::elements(*parent_node)[current_child_index].first = box1; + // add new node to the parent's children + rtree::elements(*parent_node).push_back(std::make_pair(box2, second_node)); + } + // node is the root - add level + else + { + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(root_node), "node should be the root"); + + // create new root and add nodes + node * new_root = rtree::create_node(internal_node()); + + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, root_node)); + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); + + root_node = new_root; + ++leafs_level; + } + } +}; + +// ----------------------------------------------------------------------- // + // Default insert visitor template class insert @@ -169,52 +241,14 @@ protected: m_current_level = current_level_bckup; } - // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation - template - inline void split(Node &n) const + inline void split(Node & n) const { - // create additional node - node * second_node = rtree::create_node(Node()); - Node & n2 = rtree::get(*second_node); - - // redistribute elements - Box box1, box2; - redistribute_elements:: - apply(n, n2, box1, box2, m_tr); - - // check numbers of elements - BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n).size() && - rtree::elements(n).size() <= parameters_type::max_elements, - "unexpected number of elements"); - BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n2).size() && - rtree::elements(n2).size() <= parameters_type::max_elements, - "unexpected number of elements"); - - // node is not the root - just add the new node - if ( m_parent != 0 ) - { - // update old node's box - rtree::elements(*m_parent)[m_current_child_index].first = box1; - // add new node to the parent's children - rtree::elements(*m_parent).push_back(std::make_pair(box2, second_node)); - } - // node is the root - add level - else - { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); - - // create new root and add nodes - node * new_root = rtree::create_node(internal_node()); - - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, m_root_node)); - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); - - m_root_node = new_root; - ++m_leafs_level; - } + detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr); } + // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation + Element const& m_element; Translator const& m_tr; const size_t m_relative_level; From 40a9cd095fa1be1ddbdf6105711ecaedc7d34f90 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 16 Jul 2011 22:09:04 +0000 Subject: [PATCH 050/366] some options-related template parameters names changed [SVN r73158] --- include/boost/geometry/extensions/index/rtree/options.hpp | 2 +- include/boost/geometry/extensions/index/rtree/rtree.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 45fddc2de..6b15545b0 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -93,7 +93,7 @@ struct rtree namespace detail { namespace rtree { -template +template struct options_type { // TODO: awulkiew - use static assert diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d20439afb..73d00e6dd 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -41,7 +41,7 @@ namespace boost { namespace geometry { namespace index { template < typename Value, - typename Options, + typename Parameters, typename Translator = translator::def > class rtree @@ -53,7 +53,7 @@ public: typedef typename translator_type::indexable_type indexable_type; typedef typename index::default_box_type::type box_type; - typedef typename detail::rtree::options_type::type options_type; + typedef typename detail::rtree::options_type::type options_type; typedef typename options_type::node_tag node_tag; typedef typename detail::rtree::node::type node; From b65c697cadbc4c44d0a33da88d0a69e543caabaf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jul 2011 02:21:17 +0000 Subject: [PATCH 051/366] within and distance_sqr removed from index/algorithms. geometry::covered_by used in remove visitor. [SVN r73370] --- .../index/algorithms/distance_sqr.hpp | 78 ----------- .../extensions/index/algorithms/within.hpp | 131 ------------------ .../index/rtree/visitors/remove.hpp | 4 +- 3 files changed, 2 insertions(+), 211 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp delete mode 100644 include/boost/geometry/extensions/index/algorithms/within.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp b/include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp deleted file mode 100644 index 0a27cbf5e..000000000 --- a/include/boost/geometry/extensions/index/algorithms/distance_sqr.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - n-dimensional distance_sqr between points -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DISTANCE_SQR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DISTANCE_SQR_HPP - -namespace boost { namespace geometry { namespace index { - -template -class default_distance_sqr_result -{ - typedef typename select_most_precise< - typename traits::coordinate_type::type, - long double - >::type intermediate_type; - -public: - typedef typename select_most_precise< - typename traits::coordinate_type::type, - intermediate_type - >::type type; -}; - -namespace detail { - -template -struct distance_sqr_for_each_dimension -{ - BOOST_STATIC_ASSERT(0 < CurrentDimension); - BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); - - typedef typename default_distance_sqr_result::type result_type; - - static inline result_type apply(Point1 const& p1, Point2 const& p2) - { - result_type temp = geometry::get(p1) - geometry::get(p2); - return distance_sqr_for_each_dimension::apply(p1, p2) + - temp * temp; - } -}; - -template -struct distance_sqr_for_each_dimension -{ - BOOST_STATIC_ASSERT(1 <= traits::dimension::value); - - typedef typename default_distance_sqr_result::type result_type; - - static inline result_type apply(Point1 const& p1, Point2 const& p2) - { - result_type temp = geometry::get<0>(p1) - geometry::get<0>(p2); - return temp * temp; - } -}; - -} // namespace detail - -template -typename default_distance_sqr_result::type distance_sqr(Point1 const& p1, Point2 const& p2) -{ - BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); - - return detail::distance_sqr_for_each_dimension< - Point1, - Point2, - index::traits::dimension::value - >::apply(p1, p2); -} - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DISTANCE_SQR_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/within.hpp b/include/boost/geometry/extensions/index/algorithms/within.hpp deleted file mode 100644 index a65d8a6e3..000000000 --- a/include/boost/geometry/extensions/index/algorithms/within.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - n-dimensional within box -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_WITHIN_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_WITHIN_HPP - -namespace boost { namespace geometry { namespace index { - -namespace dispatch { - -template -struct within_compare -{ - // TODO: awulkiew - static assert? -}; - -template -struct within_compare -{ - template - static inline bool apply(Indexable const& b1, Box const& b2) - { - return index::get(b2) <= index::get(b1); - } -}; - -template -struct within_compare -{ - template - static inline bool apply(Indexable const& b1, Box const& b2) - { - return index::get(b1) <= index::get(b2); - } -}; - -template -struct within_compare -{ - template - static inline bool apply(Indexable const& p, Box const& b) - { - return index::get(b) <= geometry::get(p); - } -}; - -template -struct within_compare -{ - template - static inline bool apply(Indexable const& p, Box const& b) - { - return geometry::get(p) <= index::get(b); - } -}; - -} // namespace dispatch - -namespace detail { - -template -struct within_for_each_dimension -{ - BOOST_STATIC_ASSERT(0 < CurrentDimension); - BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); - BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); - - static inline bool apply(Indexable const& i, Box const& b) - { - return - within_for_each_dimension< - Box, - Indexable, - CurrentDimension - 1 - >::apply(i, b) && - dispatch::within_compare< - min_corner, - CurrentDimension - 1, - Indexable, - typename traits::tag::type - >::apply(i, b) && - dispatch::within_compare< - max_corner, - CurrentDimension - 1, - Indexable, - typename traits::tag::type - >::apply(i, b); - } -}; - -template -struct within_for_each_dimension -{ - BOOST_STATIC_ASSERT(1 <= traits::dimension::value); - BOOST_STATIC_ASSERT(traits::dimension::value == traits::dimension::value); - - static inline bool apply(Indexable const& i, Box const& b) - { - return - dispatch::within_compare< - min_corner, - 0, - Indexable, - typename traits::tag::type - >::apply(i, b) && - dispatch::within_compare< - max_corner, - 0, - Indexable, - typename traits::tag::type - >::apply(i, b); - } -}; - -} // namespace detail - -template -bool within(Indexable const& i, Box const& box) -{ - return detail::within_for_each_dimension::value>::apply(i, box); -} - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_WITHIN_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 57b9a1527..5db8b079b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -14,7 +14,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -60,7 +60,7 @@ public: size_t child_node_index = 0; for ( ; child_node_index < children.size() ; ++child_node_index ) { - if ( index::within(m_tr(m_value), children[child_node_index].first) ) + if ( geometry::covered_by(m_tr(m_value), children[child_node_index].first) ) { // next traversing step traverse_apply_visitor(n, child_node_index); From d5029f92d2a1b10d18fdb84cbaf06523fcd9638f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jul 2011 20:53:40 +0000 Subject: [PATCH 052/366] intersects replaced by overlaps in find visitor [SVN r73391] --- .../boost/geometry/extensions/index/rtree/visitors/find.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 83026bc2d..95fa5a3e5 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -199,7 +199,7 @@ struct find for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( geometry::intersects(it->first, geom) ) + if ( geometry::overlaps(it->first, geom) ) rtree::apply_visitor(*this, *it->second); } } @@ -212,7 +212,7 @@ struct find for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( geometry::intersects(tr(*it), geom) ) + if ( geometry::overlaps(tr(*it), geom) ) { out_iter = *it; ++out_iter; From f9aafbf5aad058cd08e18caf193c95834f809acf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jul 2011 20:58:13 +0000 Subject: [PATCH 053/366] previous change reverted - intersects used instead of overlaps [SVN r73392] --- .../boost/geometry/extensions/index/rtree/visitors/find.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 95fa5a3e5..83026bc2d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -199,7 +199,7 @@ struct find for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( geometry::overlaps(it->first, geom) ) + if ( geometry::intersects(it->first, geom) ) rtree::apply_visitor(*this, *it->second); } } @@ -212,7 +212,7 @@ struct find for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( geometry::overlaps(tr(*it), geom) ) + if ( geometry::intersects(tr(*it), geom) ) { out_iter = *it; ++out_iter; From ea822b7aea2f68d9d071372060ce4f06eddf61e5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 27 Aug 2011 00:05:54 +0000 Subject: [PATCH 054/366] predicates implemented, query() method added to the rtree + some cleanup. [SVN r74082] --- .../index/algorithms/intersection_content.hpp | 16 +- .../geometry/extensions/index/assert.hpp | 6 +- .../geometry/extensions/index/indexable.hpp | 14 +- .../extensions/index/nonassignable.hpp | 2 +- .../geometry/extensions/index/predicates.hpp | 217 ++++++++++++++++ .../extensions/index/pushable_array.hpp | 232 +++++++++--------- .../extensions/index/rtree/options.hpp | 92 +++---- .../extensions/index/rtree/predicates.hpp | 52 ++++ .../geometry/extensions/index/rtree/rtree.hpp | 24 +- .../index/rtree/visitors/are_boxes_ok.hpp | 40 +-- .../index/rtree/visitors/are_levels_ok.hpp | 32 +-- .../extensions/index/rtree/visitors/find.hpp | 4 +- .../index/rtree/visitors/gl_draw.hpp | 2 +- .../index/rtree/visitors/insert.hpp | 140 +++++------ .../extensions/index/rtree/visitors/print.hpp | 2 +- .../extensions/index/rtree/visitors/query.hpp | 70 ++++++ .../index/rtree/visitors/remove.hpp | 10 +- .../extensions/index/translator/getter.hpp | 4 +- .../extensions/index/translator/helpers.hpp | 16 +- tests/additional_sizes_and_times.cpp | 106 +++++--- tests/main.cpp | 2 +- 21 files changed, 733 insertions(+), 350 deletions(-) create mode 100644 include/boost/geometry/extensions/index/predicates.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/predicates.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/query.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp index bb42ec79f..ae8286f2c 100644 --- a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp +++ b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp @@ -21,14 +21,14 @@ namespace boost { namespace geometry { namespace index { template inline typename default_content_result::type intersection_content(Box const& box1, Box const& box2) { - typename default_content_result::type result = 0; - if ( geometry::intersects(box1, box2) ) - { - Box box_intersection; - geometry::intersection(box1, box2, box_intersection); - result = index::content(box_intersection); - } - return result; + typename default_content_result::type result = 0; + if ( geometry::intersects(box1, box2) ) + { + Box box_intersection; + geometry::intersection(box1, box2, box_intersection); + result = index::content(box_intersection); + } + return result; } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/assert.hpp b/include/boost/geometry/extensions/index/assert.hpp index c40a9cf49..d614165ea 100644 --- a/include/boost/geometry/extensions/index/assert.hpp +++ b/include/boost/geometry/extensions/index/assert.hpp @@ -7,8 +7,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_ASSERT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_ASSERT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP #ifdef NDEBUG @@ -24,4 +24,4 @@ #endif -#endif // BOOST_GEOMETRY_EXTENSIONS_ASSERT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP diff --git a/include/boost/geometry/extensions/index/indexable.hpp b/include/boost/geometry/extensions/index/indexable.hpp index 7553c46c2..5092b5086 100644 --- a/include/boost/geometry/extensions/index/indexable.hpp +++ b/include/boost/geometry/extensions/index/indexable.hpp @@ -162,13 +162,13 @@ typename traits::coordinate_type::type get(Indexable const& i) template struct default_box_type { - typedef geometry::model::box< - geometry::model::point< - typename traits::coordinate_type::type, - traits::dimension::value, - typename traits::coordinate_system::type - > - > type; + typedef geometry::model::box< + geometry::model::point< + typename traits::coordinate_type::type, + traits::dimension::value, + typename traits::coordinate_system::type + > + > type; }; }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/nonassignable.hpp b/include/boost/geometry/extensions/index/nonassignable.hpp index a59a04ae6..a272c9289 100644 --- a/include/boost/geometry/extensions/index/nonassignable.hpp +++ b/include/boost/geometry/extensions/index/nonassignable.hpp @@ -14,7 +14,7 @@ namespace boost { namespace geometry { namespace index { class nonassignable { - nonassignable & operator=(nonassignable const&); + nonassignable & operator=(nonassignable const&); }; }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp new file mode 100644 index 000000000..edca1fb35 --- /dev/null +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -0,0 +1,217 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - Spatial index query predicates +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP + +#include +#include +#include + +// TODO: awulkiew - temporary +#include + +namespace boost { namespace geometry { namespace index { + +// predicates + +namespace detail { + +template +struct covered_by +{ + covered_by(Geometry const& g) : geometry(g) {} + Geometry const& geometry; +}; + +template +struct intersects +{ + intersects(Geometry const& g) : geometry(g) {} + Geometry const& geometry; +}; + +template +struct overlaps +{ + overlaps(Geometry const& g) : geometry(g) {} + Geometry const& geometry; +}; + +template +struct within +{ + within(Geometry const& g) : geometry(g) {} + Geometry const& geometry; +}; + +} // namespace detail + +template +inline detail::covered_by covered_by(Geometry const& g) +{ + return detail::covered_by(g); +} + +template +inline detail::intersects intersects(Geometry const& g) +{ + return detail::intersects(g); +} + +template +inline detail::overlaps overlaps(Geometry const& g) +{ + return detail::overlaps(g); +} + +template +inline detail::within within(Geometry const& g) +{ + return detail::within(g); +} + +// predicates checks + +namespace detail +{ + +template +struct predicate_check +{ + template + static inline bool apply(Geometry const& g, Indexable const& i) + { + return geometry::intersects(i, g); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(covered_by const& p, Indexable const& i) + { + return geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(intersects const& p, Indexable const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(overlaps const& p, Indexable const& i) + { + return geometry::overlaps(i, p.geometry); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(within const& p, Indexable const& i) + { + return geometry::within(i, p.geometry); + } +}; + +template +struct predicates_check_tuple +{ + template + static inline bool apply(TuplePredicates const& p, Indexable const& i) + { + return predicates_check_tuple::apply(p, i) + && predicate_check< + typename boost::tuples::element::type, + Tag + >::apply(boost::get(p), i); + } +}; + +template +struct predicates_check_tuple +{ + template + static inline bool apply(TuplePredicates const& p, Indexable const& i) + { + return predicate_check< + typename boost::tuples::element<0, TuplePredicates>::type, + Tag + >::apply(boost::get<0>(p), i); + } +}; + +template +struct predicates_check +{ + template + static inline bool apply(Predicate const& p, Indexable const& i) + { + return predicate_check::apply(p, i); + } +}; + +template +struct predicates_check, Tag> +{ + template + static inline bool apply(std::pair const& p, Indexable const& i) + { + return predicate_check::apply(p.first, i) + && predicate_check::apply(p.second, i); + } +}; + +template < + typename T0, typename T1, typename T2, typename T3, typename T4, + typename T5, typename T6, typename T7, typename T8, typename T9, + typename Tag +> +struct predicates_check< + boost::tuple, + Tag +> +{ + typedef boost::tuple predicates_type; + + template + static inline bool apply(predicates_type const& p, Indexable const& i) + { + return predicates_check_tuple< + predicates_type, + Tag, + boost::tuples::length::value + >::apply(p, i); + } +}; + +} // namespace detail + +template +inline bool predicates_check(Predicates const& p, Indexable const& i) +{ + return detail::predicates_check + ::apply(p, i); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index 566f86873..b782bd2b5 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -19,146 +19,146 @@ namespace boost { namespace geometry { namespace index { template class pushable_array { - typedef typename boost::array array_type; + typedef typename boost::array array_type; public: - typedef typename array_type::value_type value_type; - typedef typename array_type::size_type size_type; - typedef typename array_type::iterator iterator; - typedef typename array_type::const_iterator const_iterator; - typedef typename array_type::reverse_iterator reverse_iterator; - typedef typename array_type::const_reverse_iterator const_reverse_iterator; + typedef typename array_type::value_type value_type; + typedef typename array_type::size_type size_type; + typedef typename array_type::iterator iterator; + typedef typename array_type::const_iterator const_iterator; + typedef typename array_type::reverse_iterator reverse_iterator; + typedef typename array_type::const_reverse_iterator const_reverse_iterator; - inline pushable_array() - : m_size(0) - {} + inline pushable_array() + : m_size(0) + {} - inline explicit pushable_array(size_type s) - : m_size(s) - { - BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); - } + inline explicit pushable_array(size_type s) + : m_size(s) + { + BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); + } - inline void resize(size_type s) - { - BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); - m_size = s; - } + inline void resize(size_type s) + { + BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); + m_size = s; + } - inline Element & operator[](size_type i) - { - BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); - return m_array[i]; - } + inline Element & operator[](size_type i) + { + BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); + return m_array[i]; + } - inline Element const& operator[](size_type i) const - { - BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); - return m_array[i]; - } + inline Element const& operator[](size_type i) const + { + BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); + return m_array[i]; + } - inline Element const& front() const - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return m_array.front(); - } + inline Element const& front() const + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return m_array.front(); + } - inline Element & front() - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return m_array.front(); - } + inline Element & front() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return m_array.front(); + } - inline Element const& back() const - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return *(begin() + (m_size - 1)); - } + inline Element const& back() const + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return *(begin() + (m_size - 1)); + } - inline Element & back() - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return *(begin() + (m_size - 1)); - } + inline Element & back() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return *(begin() + (m_size - 1)); + } - inline iterator begin() - { - return m_array.begin(); - } + inline iterator begin() + { + return m_array.begin(); + } - inline iterator end() - { - return m_array.begin() + m_size; - } + inline iterator end() + { + return m_array.begin() + m_size; + } - inline const_iterator begin() const - { - return m_array.begin(); - } + inline const_iterator begin() const + { + return m_array.begin(); + } - inline const_iterator end() const - { - return m_array.begin() + m_size; - } + inline const_iterator end() const + { + return m_array.begin() + m_size; + } - inline reverse_iterator rbegin() - { - return reverse_iterator(end()); - } + inline reverse_iterator rbegin() + { + return reverse_iterator(end()); + } - inline reverse_iterator rend() - { - return reverse_iterator(begin()); - } + inline reverse_iterator rend() + { + return reverse_iterator(begin()); + } - inline const_reverse_iterator rbegin() const - { - return const_reverse_iterator(end()); - } + inline const_reverse_iterator rbegin() const + { + return const_reverse_iterator(end()); + } - inline const_reverse_iterator rend() const - { - return const_reverse_iterator(begin()); - } + inline const_reverse_iterator rend() const + { + return const_reverse_iterator(begin()); + } - inline void clear() - { - m_size = 0; - } + inline void clear() + { + m_size = 0; + } - inline void erase(iterator it) - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - BOOST_GEOMETRY_INDEX_ASSERT(begin() <= it && it < end(), "iterator points on the element outside the container"); - //std::copy(it + 1, end(), it); - *it = back(); - --m_size; - } - - inline void push_back(Element const& v) - { - BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container"); - m_array[m_size++] = v; - } + inline void erase(iterator it) + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + BOOST_GEOMETRY_INDEX_ASSERT(begin() <= it && it < end(), "iterator points on the element outside the container"); + //std::copy(it + 1, end(), it); + *it = back(); + --m_size; + } + + inline void push_back(Element const& v) + { + BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container"); + m_array[m_size++] = v; + } - inline bool empty() const - { - return m_size == 0; - } - - inline size_t size() const - { - return m_size; - } + inline bool empty() const + { + return m_size == 0; + } + + inline size_t size() const + { + return m_size; + } - inline size_t capacity() const - { - return Capacity; - } - + inline size_t capacity() const + { + return Capacity; + } + private: - boost::array m_array; - size_type m_size; + boost::array m_array; + size_type m_size; }; }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 6b15545b0..842bae424 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -35,22 +35,22 @@ struct node_default_static_tag {}; // TODO: awulkiew - implement those: //if ( m_min_elems_per_node < 1 ) -// m_min_elems_per_node = 1; +// m_min_elems_per_node = 1; //if ( m_max_elems_per_node < 2 ) -// m_max_elems_per_node = 2; +// m_max_elems_per_node = 2; template struct linear { - static const size_t max_elements = MaxElements; - static const size_t min_elements = MinElements; + static const size_t max_elements = MaxElements; + static const size_t min_elements = MinElements; }; template struct quadratic { - static const size_t max_elements = MaxElements; - static const size_t min_elements = MinElements; + static const size_t max_elements = MaxElements; + static const size_t min_elements = MinElements; }; namespace options { namespace detail { @@ -58,22 +58,22 @@ namespace options { namespace detail { template struct default_rstar_reinserted_elements { - static const size_t value = (MaxElements * 3) / 10; + static const size_t value = (MaxElements * 3) / 10; }; }} // namespace options::detail template ::value - > + size_t MinElements, + size_t OverlapCostThreshold = 0, + size_t ReinsertedElements = options::detail::default_rstar_reinserted_elements::value + > struct rstar { - static const size_t max_elements = MaxElements; - static const size_t min_elements = MinElements; - static const size_t overlap_cost_threshold = OverlapCostThreshold; - static const size_t reinserted_elements = ReinsertedElements; + static const size_t max_elements = MaxElements; + static const size_t min_elements = MinElements; + static const size_t overlap_cost_threshold = OverlapCostThreshold; + static const size_t reinserted_elements = ReinsertedElements; }; namespace options { @@ -81,12 +81,12 @@ namespace options { template struct rtree { - typedef Parameters parameters_type; - typedef InsertTag insert_tag; - typedef ChooseNextNodeTag choose_next_node_tag; - typedef SplitTag split_tag; - typedef RedistributeTag redistribute_tag; - typedef NodeTag node_tag; + typedef Parameters parameters_type; + typedef InsertTag insert_tag; + typedef ChooseNextNodeTag choose_next_node_tag; + typedef SplitTag split_tag; + typedef RedistributeTag redistribute_tag; + typedef NodeTag node_tag; }; } // namespace options @@ -96,46 +96,46 @@ namespace detail { namespace rtree { template struct options_type { - // TODO: awulkiew - use static assert + // TODO: awulkiew - use static assert }; template struct options_type< linear > { - typedef options::rtree< - linear, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - linear_tag, - node_default_static_tag - > type; + typedef options::rtree< + linear, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + linear_tag, + node_default_static_tag + > type; }; template struct options_type< quadratic > { - typedef options::rtree< - quadratic, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - quadratic_tag, - node_default_static_tag - > type; + typedef options::rtree< + quadratic, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + quadratic_tag, + node_default_static_tag + > type; }; template struct options_type< rstar > { - typedef options::rtree< - rstar, - insert_reinsert_tag, - choose_by_overlap_diff_tag, - split_default_tag, - rstar_tag, - node_default_static_tag - > type; + typedef options::rtree< + rstar, + insert_reinsert_tag, + choose_by_overlap_diff_tag, + split_default_tag, + rstar_tag, + node_default_static_tag + > type; }; }} // namespace detail::rtree diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp new file mode 100644 index 000000000..05d74ae16 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -0,0 +1,52 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - Spatial index query predicates +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +namespace rtree { + +struct value_predicates_tag {}; +struct node_predicates_tag {}; + +} // namespace rtree + +template +struct predicate_check, rtree::node_predicates_tag> +{ + template + static bool apply(covered_by const& p, Indexable const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, rtree::node_predicates_tag> +{ + template + static bool apply(within const& p, Indexable const& i) + { + // TODO: awulkiew - possibly change to the version without border case + // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false + return geometry::intersects(i, p.geometry); + } +}; + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 73d00e6dd..a8275e9d4 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -22,11 +22,13 @@ #include #include -#include +#include +//#include #include #include +#include #include #include #include @@ -42,19 +44,19 @@ namespace boost { namespace geometry { namespace index { template < typename Value, typename Parameters, - typename Translator = translator::def + typename Translator = translator::def > class rtree - : public boost::noncopyable + : public boost::noncopyable { public: typedef Value value_type; typedef Translator translator_type; - typedef typename translator_type::indexable_type indexable_type; + typedef typename translator_type::indexable_type indexable_type; typedef typename index::default_box_type::type box_type; - typedef typename detail::rtree::options_type::type options_type; - typedef typename options_type::node_tag node_tag; + typedef typename detail::rtree::options_type::type options_type; + typedef typename options_type::node_tag node_tag; typedef typename detail::rtree::node::type node; typedef typename detail::rtree::internal_node::type internal_node; @@ -75,8 +77,16 @@ public: detail::rtree::apply_visitor(del_v, *m_root); } - // TODO: awulkiew - change name to query? + template + inline void query(Predicates const& pred, OutIter out_it) const + { + detail::rtree::visitors::query + find_v(m_translator, pred, out_it); + detail::rtree::apply_visitor(find_v, *m_root); + } + + // TODO: delete find method template inline void find(Geometry const& geom, OutIter out_it) const { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index ce9e43478..7a1acd23a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -19,8 +19,8 @@ namespace detail { namespace rtree { namespace visitors { template class are_boxes_ok - : public rtree::visitor::type - , index::nonassignable + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -76,27 +76,27 @@ public: typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - // non-root node + // non-root node if (!m_is_root) { - if ( elements.empty() ) - { - result = false; - return; - } + if ( elements.empty() ) + { + result = false; + return; + } - Box box_exp; - geometry::convert(m_tr(elements.front()), box_exp); - for(typename elements_type::const_iterator it = elements.begin() + 1; - it != elements.end() ; ++it) - { - geometry::expand(box_exp, m_tr(*it)); - } + Box box_exp; + geometry::convert(m_tr(elements.front()), box_exp); + for(typename elements_type::const_iterator it = elements.begin() + 1; + it != elements.end() ; ++it) + { + geometry::expand(box_exp, m_tr(*it)); + } - result = geometry::equals(box_exp, m_box); - } - else - result = true; + result = geometry::equals(box_exp, m_box); + } + else + result = true; } bool result; @@ -115,7 +115,7 @@ bool are_boxes_ok(rtree const& tree) typedef rtree rt; detail::rtree::visitors::are_boxes_ok< typename rt::value_type, - typename rt::options_type, + typename rt::options_type, typename rt::translator_type, typename rt::box_type> v(tree.get_translator()); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index d905853f0..c1d88b2a0 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -18,8 +18,8 @@ namespace detail { namespace rtree { namespace visitors { template class are_levels_ok - : public rtree::visitor::type - , index::nonassignable + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -40,10 +40,10 @@ public: return; } - size_t current_level_backup = m_current_level; - ++m_current_level; + size_t current_level_backup = m_current_level; + ++m_current_level; - for ( typename elements_type::const_iterator it = elements.begin(); + for ( typename elements_type::const_iterator it = elements.begin(); it != elements.end() ; ++it) { rtree::apply_visitor(*this, *it->second); @@ -52,7 +52,7 @@ public: return; } - m_current_level = current_level_backup; + m_current_level = current_level_backup; } inline void operator()(leaf const& n) @@ -60,7 +60,7 @@ public: typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - // empty leaf in non-root node + // empty leaf in non-root node if (0 < m_current_level && elements.empty()) { result = false; @@ -68,13 +68,13 @@ public: } if ( m_leafs_level == std::numeric_limits::max() ) - { - m_leafs_level = m_current_level; - } - else if ( m_leafs_level != m_current_level ) - { - result = false; - } + { + m_leafs_level = m_current_level; + } + else if ( m_leafs_level != m_current_level ) + { + result = false; + } } bool result; @@ -82,7 +82,7 @@ public: private: Translator const& m_tr; size_t m_leafs_level; - size_t m_current_level; + size_t m_current_level; }; }}} // namespace detail::rtree::visitors @@ -93,7 +93,7 @@ bool are_levels_ok(rtree const& tree) typedef rtree rt; detail::rtree::visitors::are_levels_ok< typename rt::value_type, - typename rt::options_type, + typename rt::options_type, typename rt::translator_type, typename rt::box_type> v(tree.get_translator()); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp index 83026bc2d..aa13ec189 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp @@ -142,8 +142,8 @@ namespace detail { namespace rtree { namespace visitors { template struct find - : public rtree::visitor::type - , index::nonassignable + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; 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 122cfedeb..bbe1c035c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -196,7 +196,7 @@ void gl_draw(rtree const& tree, ) { typedef typename rtree::value_type value_type; - typedef typename rtree::options_type options_type; + typedef typename rtree::options_type options_type; typedef typename rtree::translator_type translator_type; typedef typename rtree::box_type box_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 0521ff1c6..93bdc368c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -40,7 +40,7 @@ struct choose_next_node { children_type & children = rtree::elements(n); - BOOST_GEOMETRY_INDEX_ASSERT(!children.empty(), "can't choose the next node if children are empty"); + BOOST_GEOMETRY_INDEX_ASSERT(!children.empty(), "can't choose the next node if children are empty"); size_t children_count = children.size(); @@ -94,61 +94,61 @@ template class split { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; - typedef typename Options::parameters_type parameters_type; + typedef typename Options::parameters_type parameters_type; public: - template - static inline void apply(node* & root_node, - size_t & leafs_level, - Node & n, - internal_node *parent_node, - size_t current_child_index, - Translator const& tr) - { - // create additional node - node * second_node = rtree::create_node(Node()); - Node & n2 = rtree::get(*second_node); + template + static inline void apply(node* & root_node, + size_t & leafs_level, + Node & n, + internal_node *parent_node, + size_t current_child_index, + Translator const& tr) + { + // create additional node + node * second_node = rtree::create_node(Node()); + Node & n2 = rtree::get(*second_node); - // redistribute elements - Box box1, box2; - redistribute_elements:: - apply(n, n2, box1, box2, tr); + // redistribute elements + Box box1, box2; + redistribute_elements:: + apply(n, n2, box1, box2, tr); - // check numbers of elements - BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n).size() && - rtree::elements(n).size() <= parameters_type::max_elements, - "unexpected number of elements"); - BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n2).size() && - rtree::elements(n2).size() <= parameters_type::max_elements, - "unexpected number of elements"); + // check numbers of elements + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n).size() && + rtree::elements(n).size() <= parameters_type::max_elements, + "unexpected number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n2).size() && + rtree::elements(n2).size() <= parameters_type::max_elements, + "unexpected number of elements"); - // node is not the root - just add the new node - if ( parent_node != 0 ) - { - // update old node's box - rtree::elements(*parent_node)[current_child_index].first = box1; - // add new node to the parent's children - rtree::elements(*parent_node).push_back(std::make_pair(box2, second_node)); - } - // node is the root - add level - else - { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(root_node), "node should be the root"); + // node is not the root - just add the new node + if ( parent_node != 0 ) + { + // update old node's box + rtree::elements(*parent_node)[current_child_index].first = box1; + // add new node to the parent's children + rtree::elements(*parent_node).push_back(std::make_pair(box2, second_node)); + } + // node is the root - add level + else + { + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(root_node), "node should be the root"); - // create new root and add nodes - node * new_root = rtree::create_node(internal_node()); + // create new root and add nodes + node * new_root = rtree::create_node(internal_node()); - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, root_node)); - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, root_node)); + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); - root_node = new_root; - ++leafs_level; - } - } + root_node = new_root; + ++leafs_level; + } + } }; // ----------------------------------------------------------------------- // @@ -156,15 +156,15 @@ public: // Default insert visitor template class insert - : public rtree::visitor::type - , index::nonassignable + : public rtree::visitor::type + , index::nonassignable { protected: typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename Options::parameters_type parameters_type; + typedef typename Options::parameters_type parameters_type; inline insert(node* & root, size_t & leafs_level, @@ -174,7 +174,7 @@ protected: ) : m_element(element) , m_tr(t) - , m_relative_level(relative_level) + , m_relative_level(relative_level) , m_level(leafs_level - relative_level) , m_root_node(root) , m_leafs_level(leafs_level) @@ -182,8 +182,8 @@ protected: , m_current_child_index(0) , m_current_level(0) { - BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); - BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value"); + BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); + BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value"); // TODO // assert - check if Box is correct } @@ -209,13 +209,13 @@ protected: template inline void post_traverse(Node &n) { - BOOST_GEOMETRY_INDEX_ASSERT(0 == m_parent || &n == rtree::get(rtree::elements(*m_parent)[m_current_child_index].second), - "if node isn't the root current_child_index should be valid"); + BOOST_GEOMETRY_INDEX_ASSERT(0 == m_parent || &n == rtree::get(rtree::elements(*m_parent)[m_current_child_index].second), + "if node isn't the root current_child_index should be valid"); // handle overflow if ( parameters_type::max_elements < rtree::elements(n).size() ) { - split(n); + split(n); } } @@ -241,17 +241,17 @@ protected: m_current_level = current_level_bckup; } - template - inline void split(Node & n) const - { - detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr); - } + template + inline void split(Node & n) const + { + detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr); + } // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation Element const& m_element; Translator const& m_tr; - const size_t m_relative_level; + const size_t m_relative_level; const size_t m_level; node* & m_root_node; @@ -272,7 +272,7 @@ struct insert; // Default insert visitor used for nodes elements template struct insert - : public detail::insert + : public detail::insert { typedef detail::insert base; typedef typename base::node node; @@ -290,7 +290,7 @@ struct insert inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); if ( base::m_current_level < base::m_level ) { @@ -299,7 +299,7 @@ struct insert } else { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level"); // push new child node rtree::elements(n).push_back(base::m_element); @@ -317,7 +317,7 @@ struct insert // Default insert visitor specialized for Values elements template struct insert - : public detail::insert + : public detail::insert { typedef detail::insert base; typedef typename base::node node; @@ -335,8 +335,8 @@ struct insert inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level"); // next traversing step base::traverse(*this, n); @@ -346,8 +346,8 @@ struct insert inline void operator()(leaf & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits::max(), "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits::max(), "unexpected level"); rtree::elements(n).push_back(base::m_element); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 282f35553..26e16a3e5 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -182,7 +182,7 @@ template std::ostream & operator<<(std::ostream & os, rtree const& tree) { typedef typename rtree::value_type value_type; - typedef typename rtree::options_type options_type; + typedef typename rtree::options_type options_type; typedef typename rtree::translator_type translator_type; typedef typename rtree::box_type box_type; detail::rtree::visitors::print print_v(os, tree.get_translator()); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp new file mode 100644 index 000000000..75978c53b --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -0,0 +1,70 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree spatial query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +struct query + : public rtree::visitor::type + , index::nonassignable +{ + typedef typename rtree::node::type node; + 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) + : tr(t), pred(p), out_iter(out_it) + {} + + inline void operator()(internal_node const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + if ( index::predicates_check(pred, it->first) ) + rtree::apply_visitor(*this, *it->second); + } + } + + inline void operator()(leaf const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + if ( index::predicates_check(pred, tr(*it)) ) + { + out_iter = *it; + ++out_iter; + } + } + } + + Translator const& tr; + Predicates const& pred; + OutIter out_iter; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 5db8b079b..326a5a050 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -23,14 +23,14 @@ namespace detail { namespace rtree { namespace visitors { // Default remove algorithm template class remove - : public rtree::visitor::type - , index::nonassignable + : public rtree::visitor::type + , index::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename Options::parameters_type parameters_type; + typedef typename Options::parameters_type parameters_type; public: inline remove(node* & root, @@ -104,8 +104,8 @@ public: // n is root node else { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); - BOOST_GEOMETRY_INDEX_ASSERT(m_is_value_removed, "value not found"); + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); + BOOST_GEOMETRY_INDEX_ASSERT(m_is_value_removed, "value not found"); // reinsert elements from removed nodes // begin with levels closer to the root diff --git a/include/boost/geometry/extensions/index/translator/getter.hpp b/include/boost/geometry/extensions/index/translator/getter.hpp index be0c6ea55..702b2779c 100644 --- a/include/boost/geometry/extensions/index/translator/getter.hpp +++ b/include/boost/geometry/extensions/index/translator/getter.hpp @@ -17,7 +17,7 @@ struct getter { typedef Indexable indexable_type; - indexable_type const& operator()(Value const& v) const + indexable_type const& operator()(Value const& v) const { return (v.*Getter)(); } @@ -25,7 +25,7 @@ struct getter bool equals(Value const& v1, Value const& v2) const { //return geometry::equals(operator()(v1), operator()(v2)); - return v1 == v2; + return v1 == v2; } }; diff --git a/include/boost/geometry/extensions/index/translator/helpers.hpp b/include/boost/geometry/extensions/index/translator/helpers.hpp index 44b364650..1bc57ccd3 100644 --- a/include/boost/geometry/extensions/index/translator/helpers.hpp +++ b/include/boost/geometry/extensions/index/translator/helpers.hpp @@ -173,15 +173,15 @@ struct equals< std::pair > static bool apply(std::pair const& p1, std::pair const& p2) { return - dispatch::equals< - First, - typename traits::tag::type - >::apply(p1.first, p2.first) - && dispatch::equals< - Second, - typename traits::tag::type - >::apply(p1.second, p2.second); + First, + typename traits::tag::type + >::apply(p1.first, p2.first) + && + dispatch::equals< + Second, + typename traits::tag::type + >::apply(p1.second, p2.second); } }; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 20bbdfd27..d54002af6 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -26,16 +26,16 @@ int main() namespace bg = boost::geometry; namespace bgi = bg::index; - //typedef bg::model::d2::point_xy P; + //typedef bg::model::d2::point_xy P; typedef bg::model::point P; typedef bg::model::box

B; - //typedef bgi::rtree, bgi::linear<32, 8> > RT; + typedef bgi::rtree, bgi::linear<32, 8> > RT; //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; - typedef bgi::rtree, bgi::rstar<32, 8> > RT; - /*typedef bgi::rtree< - std::pair, - bgi::options::rtree, bgi::reinsert_tag, bgi::choose_by_area_diff_tag, bgi::rstar_tag, bgi::default_tag> - > RT;*/ + //typedef bgi::rtree, bgi::rstar<32, 8> > RT; + /*typedef bgi::rtree< + std::pair, + bgi::options::rtree, bgi::reinsert_tag, bgi::choose_by_area_diff_tag, bgi::rstar_tag, bgi::default_tag> + > RT;*/ // load config file std::ifstream file_cfg("config.txt"); @@ -89,13 +89,13 @@ int main() else { boost::mt19937 rng; - //rng.seed(static_cast(std::time(0))); + //rng.seed(static_cast(std::time(0))); - float max_val = static_cast(values_count / 2); + float max_val = static_cast(values_count / 2); boost::uniform_real range(-max_val, max_val); - boost::variate_generator > rnd(rng, range); - + boost::variate_generator > rnd(rng, range); + std::cout << "randomizing data\n"; for ( size_t i = 0 ; i < values_count ; ++i ) { @@ -127,14 +127,14 @@ int main() std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; - if ( bgi::are_levels_ok(t) ) - std::cout << "LEVELS OK\n"; - else - std::cout << "WRONG LEVELS\n"; + if ( bgi::are_levels_ok(t) ) + std::cout << "LEVELS OK\n"; + else + std::cout << "WRONG LEVELS\n"; // searching test { - std::cout << "searching time test...\n"; + std::cout << "find(B) searching time test...\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count ; ++i ) @@ -149,6 +149,40 @@ int main() std::cout << "found: " << temp << "\n"; } + // searching test + { + std::cout << "query(intersects(B)) searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + + // searching test + { + std::cout << "query(B) searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + // elements removing test { std::cout << "removing time test...\n"; @@ -164,15 +198,15 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } - // check - if ( bgi::are_boxes_ok(t) ) - std::cout << "BOXES OK\n"; - else - std::cout << "WRONG BOXES\n"; - if ( bgi::are_levels_ok(t) ) - std::cout << "LEVELS OK\n"; - else - std::cout << "WRONG LEVELS\n"; + // check + if ( bgi::are_boxes_ok(t) ) + std::cout << "BOXES OK\n"; + else + std::cout << "WRONG BOXES\n"; + if ( bgi::are_levels_ok(t) ) + std::cout << "LEVELS OK\n"; + else + std::cout << "WRONG LEVELS\n"; // searching test { @@ -184,7 +218,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -206,15 +240,15 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } - // check - if ( bgi::are_boxes_ok(t) ) - std::cout << "BOXES OK\n"; - else - std::cout << "WRONG BOXES\n"; - if ( bgi::are_levels_ok(t) ) - std::cout << "LEVELS OK\n"; - else - std::cout << "WRONG LEVELS\n"; + // check + if ( bgi::are_boxes_ok(t) ) + std::cout << "BOXES OK\n"; + else + std::cout << "WRONG BOXES\n"; + if ( bgi::are_levels_ok(t) ) + std::cout << "LEVELS OK\n"; + else + std::cout << "WRONG LEVELS\n"; // searching test { @@ -226,7 +260,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; diff --git a/tests/main.cpp b/tests/main.cpp index 1f97014a0..7d6d94067 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -18,7 +18,7 @@ int main() tests_translators_hpp(); tests_rtree_native_hpp >(); tests_rtree_native_hpp >(); - tests_rtree_native_hpp >(); + tests_rtree_native_hpp >(); tests_rtree_filters_hpp(); /* { From 8c7aec4b3e94c95a42d4826a785623e3d27b68e5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 16 Sep 2011 19:44:04 +0000 Subject: [PATCH 055/366] k nearest neighbors search implemented, empty predicate added, pop_back() added to pushable_array, glFlush() and glClear() calls removed from gl_draw(), number of found objects added to spatial query, find visitor and corresponding rtree's method removed. [SVN r74422] --- .../detail/smallest_for_indexable.hpp | 83 ++++++ .../algorithms/detail/sum_for_indexable.hpp | 79 ++++++ .../extensions/index/algorithms/mindist.hpp | 80 ++++++ .../index/algorithms/minmaxdist.hpp | 168 ++++++++++++ .../geometry/extensions/index/predicates.hpp | 27 +- .../extensions/index/pushable_array.hpp | 6 + .../extensions/index/rtree/predicates.hpp | 30 +++ .../geometry/extensions/index/rtree/rtree.hpp | 136 ++++++++-- .../extensions/index/rtree/visitors/find.hpp | 232 ----------------- .../index/rtree/visitors/gl_draw.hpp | 4 - .../index/rtree/visitors/nearest.hpp | 246 ++++++++++++++++++ .../extensions/index/rtree/visitors/query.hpp | 5 +- tests/additional_glut_vis.cpp | 71 ++++- tests/additional_sizes_and_times.cpp | 58 +++-- 14 files changed, 931 insertions(+), 294 deletions(-) create mode 100644 include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp create mode 100644 include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp create mode 100644 include/boost/geometry/extensions/index/algorithms/mindist.hpp create mode 100644 include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/visitors/find.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp b/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp new file mode 100644 index 000000000..aeae612fa --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp @@ -0,0 +1,83 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - Get smallest value calculated for indexable's dimensions, used in R-tree k nearest neighbors query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template < + typename Geometry, + typename Indexable, + typename IndexableTag, + typename AlgoTag, + size_t DimensionIndex> +struct smallest_for_indexable_dimension +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE, + (smallest_for_indexable_dimension)); +}; + +template < + typename Geometry, + typename Indexable, + typename IndexableTag, + typename AlgoTag, + size_t N> +struct smallest_for_indexable +{ + typedef typename smallest_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, N - 1 + >::result_type result_type; + + template + inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data) + { + result_type r1 = smallest_for_indexable< + Geometry, Indexable, IndexableTag, AlgoTag, N - 1 + >::apply(g, i, data); + + result_type r2 = smallest_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, N - 1 + >::apply(g, i, data); + + return r1 < r2 ? r1 : r2; + } +}; + +template < + typename Geometry, + typename Indexable, + typename IndexableTag, + typename AlgoTag> +struct smallest_for_indexable +{ + typedef typename smallest_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, 0 + >::result_type result_type; + + template + inline static result_type apply(Geometry const& g, Indexable const& i, Data const& data) + { + return + smallest_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, 0 + >::apply(g, i, data); + } +}; + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp b/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp new file mode 100644 index 000000000..4a6c11b0f --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp @@ -0,0 +1,79 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - Sum values calculated for indexable's dimensions, used e.g. in R-tree k nearest neighbors query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template < + typename Geometry, + typename Indexable, + typename IndexableTag, + typename AlgoTag, + size_t DimensionIndex> +struct sum_for_indexable_dimension +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE, + (sum_for_indexable_dimension)); +}; + +template < + typename Geometry, + typename Indexable, + typename IndexableTag, + typename AlgoTag, + size_t N> +struct sum_for_indexable +{ + typedef typename sum_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, N - 1 + >::result_type result_type; + + inline static result_type apply(Geometry const& g, Indexable const& i) + { + return + sum_for_indexable< + Geometry, Indexable, IndexableTag, AlgoTag, N - 1 + >::apply(g, i) + + sum_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, N - 1 + >::apply(g, i); + } +}; + +template < + typename Geometry, + typename Indexable, + typename IndexableTag, + typename AlgoTag> +struct sum_for_indexable +{ + typedef typename sum_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, 0 + >::result_type result_type; + + inline static result_type apply(Geometry const& g, Indexable const& i) + { + return + sum_for_indexable_dimension< + Geometry, Indexable, IndexableTag, AlgoTag, 0 + >::apply(g, i); + } +}; + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/mindist.hpp b/include/boost/geometry/extensions/index/algorithms/mindist.hpp new file mode 100644 index 000000000..15e86c278 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/mindist.hpp @@ -0,0 +1,80 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - mindist used in R-tree k nearest neighbors query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +struct mindist_tag {}; + +template < + typename Point, + typename PointIndexable, + size_t N> +struct sum_for_indexable +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, PointIndexable const& i) + { + return geometry::comparable_distance(pt, i); + } +}; + +template < + typename Point, + typename BoxIndexable, + size_t DimensionIndex> +struct sum_for_indexable_dimension +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, BoxIndexable const& i) + { + typedef typename index::traits::coordinate_type::type point_coord_t; + typedef typename index::traits::coordinate_type::type indexable_coord_t; + + point_coord_t pt_c = geometry::get(pt); + indexable_coord_t ind_c_min = geometry::get(i); + indexable_coord_t ind_c_max = geometry::get(i); + + result_type diff = 0; + + if ( pt_c < ind_c_min ) + diff = ind_c_min - pt_c; + else if ( ind_c_max < pt_c ) + diff = pt_c - ind_c_max; + + return diff * diff; + } +}; + +} // namespace detail + +template +typename geometry::default_distance_result::type +mindist(Point const& pt, Indexable const& i) +{ + return detail::sum_for_indexable< + Point, + Indexable, + typename index::traits::tag::type, + detail::mindist_tag, + index::traits::dimension::value + >::apply(pt, i); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp new file mode 100644 index 000000000..4ce994250 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp @@ -0,0 +1,168 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - minmaxdist used in R-tree k nearest neighbors query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +// awulkiew - use if unsigned values may be used as coordinates +template +inline T diff_abs(T const& v1, T const& v2) +{ + return v1 < v2 ? v2 - v1 : v1 - v2; +} + +// minmaxdist component + +struct minmaxdist_comp_tag {}; + +template < + typename Point, + typename BoxIndexable, + size_t DimensionIndex> +struct sum_for_indexable_dimension +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, BoxIndexable const& i) + { + typedef typename index::traits::coordinate_type::type point_coord_t; + typedef typename index::traits::coordinate_type::type indexable_coord_t; + + point_coord_t pt_c = geometry::get(pt); + indexable_coord_t ind_c_min = geometry::get(i); + indexable_coord_t ind_c_max = geometry::get(i); + + result_type further_diff = 0; + + if ( (ind_c_min + ind_c_max) / 2 <= pt_c ) + further_diff = pt_c - ind_c_min; + else + further_diff = diff_abs(pt_c, ind_c_max); // unsigned values protection + + return further_diff * further_diff; + } +}; + +template +typename geometry::default_distance_result::type +minmaxdist_comp(Point const& pt, Indexable const& i) +{ + return sum_for_indexable< + Point, + Indexable, + typename index::traits::tag::type, + minmaxdist_comp_tag, + index::traits::dimension::value + >::apply(pt, i); +} + +// minmaxdist + +struct minmaxdist_tag {}; + +template < + typename Point, + typename BoxIndexable, + size_t DimensionIndex> +struct smallest_for_indexable_dimension +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, BoxIndexable const& i, result_type const& comp) + { + typedef typename index::traits::coordinate_type::type point_coord_t; + typedef typename index::traits::coordinate_type::type indexable_coord_t; + + point_coord_t pt_c = geometry::get(pt); + indexable_coord_t ind_c_min = geometry::get(i); + indexable_coord_t ind_c_max = geometry::get(i); + + indexable_coord_t ind_c_avg = (ind_c_min + ind_c_max) / 2; + + // TODO: awulkiew - optimize! don't calculate 2x pt_c <= ind_c_avg + // take particular case pt_c == ind_c_avg into account + + result_type closer_comp = 0; + if ( pt_c <= ind_c_avg ) + closer_comp = diff_abs(pt_c, ind_c_min); // unsigned values protection + else + closer_comp = diff_abs(pt_c, ind_c_max); // unsigned values protection + + result_type further_comp = 0; + if ( ind_c_avg <= pt_c ) + further_comp = pt_c - ind_c_min; + else + further_comp = diff_abs(pt_c, ind_c_max); // unsigned values protection + + return (comp + closer_comp * closer_comp) - further_comp * further_comp; + } +}; + +template +struct minmaxdist_impl +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_INDEXABLE_TAG_TYPE, + (minmaxdist_impl)); +}; + +template +struct minmaxdist_impl +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, Indexable const& i) + { + return geometry::comparable_distance(pt, i); + } +}; + +template +struct minmaxdist_impl +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, Indexable const& i) + { + result_type comp = minmaxdist_comp(pt, i); + + return smallest_for_indexable< + Point, + Indexable, + box_tag, + minmaxdist_tag, + index::traits::dimension::value + >::apply(pt, i, comp); + } +}; + +} // namespace detail + +template +typename geometry::default_distance_result::type +minmaxdist(Point const& pt, Indexable const& i) +{ + return detail::minmaxdist_impl< + Point, + Indexable, + typename index::traits::tag::type + >::apply(pt, i); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index edca1fb35..04672ccfd 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -23,8 +23,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { +struct empty {}; + template struct covered_by + : nonassignable { covered_by(Geometry const& g) : geometry(g) {} Geometry const& geometry; @@ -32,6 +35,7 @@ struct covered_by template struct intersects + : nonassignable { intersects(Geometry const& g) : geometry(g) {} Geometry const& geometry; @@ -39,6 +43,7 @@ struct intersects template struct overlaps + : nonassignable { overlaps(Geometry const& g) : geometry(g) {} Geometry const& geometry; @@ -46,6 +51,7 @@ struct overlaps template struct within + : nonassignable { within(Geometry const& g) : geometry(g) {} Geometry const& geometry; @@ -53,6 +59,11 @@ struct within } // namespace detail +inline detail::empty empty() +{ + return detail::empty(); +} + template inline detail::covered_by covered_by(Geometry const& g) { @@ -77,11 +88,11 @@ inline detail::within within(Geometry const& g) return detail::within(g); } -// predicates checks - namespace detail { +// predicate check + template struct predicate_check { @@ -92,6 +103,16 @@ struct predicate_check } }; +template +struct predicate_check +{ + template + static inline bool apply(Geometry const&, Indexable const&) + { + return true; + } +}; + template struct predicate_check, Tag> { @@ -132,6 +153,8 @@ struct predicate_check, Tag> } }; +// predicates check + template struct predicates_check_tuple { diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index b782bd2b5..f0123b1c8 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -141,6 +141,12 @@ public: m_array[m_size++] = v; } + inline void pop_back() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + --m_size; + } + inline bool empty() const { return m_size == 0; diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index 05d74ae16..a88c96bf9 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -23,6 +23,16 @@ struct node_predicates_tag {}; } // namespace rtree +//template +//struct predicate_check +//{ +// template +// static inline bool apply(Geometry const& g, Indexable const& i) +// { +// return geometry::intersects(i, g); +// } +//}; + template struct predicate_check, rtree::node_predicates_tag> { @@ -33,6 +43,26 @@ struct predicate_check, rtree::node_predicates_tag> } }; +//template +//struct predicate_check, rtree::node_predicates_tag> +//{ +// template +// static inline bool apply(intersects const& p, Indexable const& i) +// { +// return geometry::intersects(i, p.geometry); +// } +//}; +// +//template +//struct predicate_check, rtree::node_predicates_tag> +//{ +// template +// static inline bool apply(overlaps const& p, Indexable const& i) +// { +// return geometry::overlaps(i, p.geometry); +// } +//}; + template struct predicate_check, rtree::node_predicates_tag> { diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index a8275e9d4..9f3605034 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -20,15 +20,15 @@ #include #include - #include + #include //#include #include -#include #include +#include #include #include #include @@ -78,25 +78,44 @@ public: } template - inline void query(Predicates const& pred, OutIter out_it) const + inline size_t query(Predicates const& pred, OutIter out_it) const { detail::rtree::visitors::query find_v(m_translator, pred, out_it); detail::rtree::apply_visitor(find_v, *m_root); + + return find_v.found_count; } - // TODO: delete find method - template - inline void find(Geometry const& geom, OutIter out_it) const + // TODO: awulkiew - change Point to Geometry? + // return number of elements instead of bool? + + template + inline size_t nearest(Point const& pt, value_type & v) const { - detail::rtree::visitors::find - find_v(m_translator, geom, out_it); - - detail::rtree::apply_visitor(find_v, *m_root); + return nearest_one(pt, detail::empty(), v); } - void insert(value_type const& value) + template + inline size_t nearest(Point const& pt, Predicates const& pred, value_type & v) const + { + return nearest_one(pt, pred, v); + } + + template + inline size_t nearest(Point const& pt, size_t k, OutIter out_it) const + { + return nearest_k(pt, k, detail::empty(), out_it); + } + + template + inline size_t nearest(Point const& pt, size_t k, Predicates const& pred, OutIter out_it) const + { + return nearest_k(pt, k, pred, out_it); + } + + inline void insert(value_type const& value) { // TODO: awulkiew - assert for correct value @@ -108,7 +127,7 @@ public: ++m_values_count; } - void remove(value_type const& value) + inline void remove(value_type const& value) { // TODO: awulkiew - assert for correct value @@ -122,40 +141,77 @@ public: --m_values_count; } - size_t size() const + inline size_t size() const { return m_values_count; } - bool empty() const + inline bool empty() const { - // TODO: awulkiew - take root into consideration return 0 == m_values_count; } - void clear() - { - // TODO: awulkiew - implement - BOOST_GEOMETRY_INDEX_ASSERT(false, "not implemented"); - } + // TODO: awulkiew + // clear() + // aabb/box/get_box/etc. + // iterators, begin/end/etc. + + //inline void clear() + //{ + // // TODO: awulkiew - implement + // BOOST_GEOMETRY_INDEX_ASSERT(false, "not implemented"); + //} template - void apply_visitor(Visitor & visitor) const + inline void apply_visitor(Visitor & visitor) const { detail::rtree::apply_visitor(visitor, *m_root); } - translator_type const& get_translator() const + inline translator_type const& get_translator() const { return m_translator; } - size_t values_count() const + inline size_t values_count() const { return m_values_count; } + inline size_t depth() const + { + return m_leafs_level; + } + private: + template + inline size_t nearest_one(Point const& pt, Predicates const& pred, value_type & v) const + { + typedef detail::rtree::visitors::nearest_one result_type; + result_type result; + + detail::rtree::visitors::nearest + nearest_v(m_translator, pt, pred, result); + + detail::rtree::apply_visitor(nearest_v, *m_root); + + return result.get(v); + } + + template + inline size_t nearest_k(Point const& pt, size_t k, Predicates const& pred, OutIter out_it) const + { + typedef detail::rtree::visitors::nearest_k result_type; + result_type result(k); + + detail::rtree::visitors::nearest + nearest_v(m_translator, pt, pred, result); + + detail::rtree::apply_visitor(nearest_v, *m_root); + + return result.get(out_it); + } + size_t m_values_count; node *m_root; size_t m_leafs_level; @@ -163,17 +219,47 @@ private: }; template -void insert(rtree & tree, Value const& v) +inline void insert(rtree & tree, Value const& v) { tree.insert(v); } template -void remove(rtree & tree, Value const& v) +inline void remove(rtree & tree, Value const& v) { tree.remove(v); } +template +inline size_t query(rtree const& tree, Predicates const& pred, OutIter out_it) +{ + return tree.query(pred, out_it); +} + +template +inline size_t nearest(rtree const& tree, Point const& pt, Value & v) +{ + return tree.nearest(pt, v); +} + +template +inline size_t nearest(rtree const& tree, Point const& pt, Predicates const& pred, Value & v) +{ + return tree.nearest(pt, pred, v); +} + +template +inline size_t nearest(rtree const& tree, Point const& pt, size_t k, OutIter out_it) +{ + return tree.nearest(pt, k, out_it); +} + +template +inline size_t nearest(rtree const& tree, Point const& pt, size_t k, Predicates const& pred, OutIter out_it) +{ + return tree.nearest(pt, k, pred, out_it); +} + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp b/include/boost/geometry/extensions/index/rtree/visitors/find.hpp deleted file mode 100644 index aa13ec189..000000000 --- a/include/boost/geometry/extensions/index/rtree/visitors/find.hpp +++ /dev/null @@ -1,232 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - R-tree find -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_FIND_HPP - -#include - -//#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace visitors { - -//template -//class array -//{ -//public: -// inline array() -// : arr_elements(0) -// {} -// -// inline void push(T const& v) -// { -// arr[arr_elements++] = v; -// } -// -// inline T pop() -// { -// assert(0 < arr_elements); -// return arr[--arr_elements]; -// } -// -// inline bool empty() const -// { -// return 0 == arr_elements; -// } -// -// inline size_t size() const -// { -// return arr_elements; -// } -// -//private: -// boost::array arr; -// size_t arr_elements; -//}; -// -//template -//class dynamic -//{ -//public: -// typedef typename Cont::value_type value_type; -// -// inline void push(value_type const& v) -// { -// cont.push_back(v); -// } -// -// inline value_type pop() -// { -// value_type v = cont.back(); -// cont.pop_back(); -// return v; -// } -// -// inline bool empty() const -// { -// return cont.empty(); -// } -// -// inline size_t size() const -// { -// return cont.size(); -// } -// -// inline void clear() -// { -// cont.clear(); -// } -// -//private: -// Cont cont; -//}; -// -//template -//class array_semi_dynamic -//{ -//public: -// typedef typename Cont::value_type value_type; -// -// inline array_semi_dynamic() -// : arr_elements(0) -// {} -// -// inline void push(value_type const& v) -// { -// if ( arr_elements < N ) -// arr[arr_elements++] = v; -// else -// cont.push_back(v); -// } -// -// inline value_type pop() -// { -// if ( !cont.empty() ) -// { -// value_type v = cont.back(); -// cont.pop_back(); -// return v; -// } -// else -// { -// assert(0 < arr_elements); -// return arr[--arr_elements]; -// } -// } -// -// inline bool empty() const -// { -// return cont.empty() && 0 == arr_elements; -// } -// -// inline size_t size() const -// { -// return arr_elements + cont.size(); -// } -// -//private: -// boost::array arr; -// size_t arr_elements; -// Cont cont; -//}; - -// rtree spatial query visitor - -template -struct find - : public rtree::visitor::type - , index::nonassignable -{ - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - inline find(Translator const& t, Geometry const& g, OutIter out_it) - : tr(t), geom(g), out_iter(out_it) - {} - - inline void operator()(internal_node const& n) - { - //typedef typename internal_node::children_type children_type; - - //array_semi_dynamic<1024, std::deque > nodes; - ////array<1024, node*> nodes; - ////dynamic< std::deque > nodes; - // - //for (typename children_type::const_iterator it = n.children.begin(); - // it != n.children.end(); ++it) - //{ - // if ( geometry::intersects(it->first, geom) ) - // { - // nodes.push(it->second); - // } - //} - - //while ( !nodes.empty() ) - //{ - // node *n = nodes.pop(); - - // if ( !boost::apply_visitor(visitors::is_leaf(), *n) ) - // { - // internal_node &in = boost::get(*n); - - // for (typename children_type::const_iterator it = in.children.begin(); - // it != in.children.end(); ++it) - // { - // if ( geometry::intersects(it->first, geom) ) - // { - // nodes.push(it->second); - // } - // } - // } - // else - // { - // operator()(boost::get(*n)); - // } - //} - - typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements(n); - - for (typename elements_type::const_iterator it = elements.begin(); - it != elements.end(); ++it) - { - if ( geometry::intersects(it->first, geom) ) - rtree::apply_visitor(*this, *it->second); - } - } - - inline void operator()(leaf const& n) - { - typedef typename rtree::elements_type::type elements_type; - elements_type const& elements = rtree::elements(n); - - for (typename elements_type::const_iterator it = elements.begin(); - it != elements.end(); ++it) - { - if ( geometry::intersects(tr(*it), geom) ) - { - out_iter = *it; - ++out_iter; - } - } - } - - Translator const& tr; - Geometry const& geom; - OutIter out_iter; -}; - -}}} // namespace detail::rtree::visitors - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_VISITORS_FIND_HPP 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 bbe1c035c..ea9e55c2b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -200,14 +200,10 @@ void gl_draw(rtree const& tree, typedef typename rtree::translator_type translator_type; typedef typename rtree::box_type box_type; - glClear(GL_COLOR_BUFFER_BIT); - detail::rtree::visitors::gl_draw gl_draw_v(tree.get_translator(), level_first, level_last, z_coord_level_multiplier); tree.apply_visitor(gl_draw_v); - - glFlush(); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp new file mode 100644 index 000000000..c9fb77d39 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -0,0 +1,246 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree k nearest neighbors query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP + +#include +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +struct nearest_one +{ +public: + typedef typename Translator::indexable_type indexable_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline nearest_one() + : comp_mindist(std::numeric_limits::max()) + {} + + inline void store(Value const& val, distance_type const& curr_mindist) + { + if ( curr_mindist < comp_mindist ) + { + comp_mindist = curr_mindist; + value = val; + } + } + + inline bool is_mindist_valid() const + { + return comp_mindist < std::numeric_limits::max(); + } + + inline distance_type mindist() const + { + return comp_mindist; + } + + inline size_t get(Value & v) + { + v = value; + return is_mindist_valid() ? 1 : 0; + } + +private: + Value value; + distance_type comp_mindist; +}; + +template +struct nearest_k +{ +public: + typedef typename Translator::indexable_type indexable_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline explicit nearest_k(size_t k) + : m_count(k) + { + // TEMP? + m_neighbors.reserve(m_count + 1); + } + + inline void store(Value const& val, distance_type const& curr_mindist) + { + m_neighbors.push_back(std::make_pair(curr_mindist, val)); + std::sort(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + + if ( m_count < m_neighbors.size() ) + m_neighbors.pop_back(); + + // TODO: awulkiew - test other methods: + // heap, manual inserting + // don't sort if size < k ? + } + + inline bool is_mindist_valid() const + { + return m_neighbors.size() == m_count; + } + + inline distance_type mindist() const + { + return m_neighbors.size() < m_count ? + std::numeric_limits::max() : + m_neighbors.back().first; + } + + template + inline size_t get(OutIter & out_it) + { + typedef typename std::vector< std::pair >::const_iterator neighbors_iterator; + for ( neighbors_iterator it = m_neighbors.begin() ; it != m_neighbors.end() ; ++it ) + *out_it = it->second; + + return m_neighbors.size(); + } + +private: + inline static bool neighbors_less( + std::pair const& p1, + std::pair const& p2) + { + return p1.first < p2.first; + } + + size_t m_count; + std::vector< std::pair > m_neighbors; +}; + +template < + typename Value, + typename Options, + typename Translator, + typename Box, + typename Point, + typename Predicates, + typename Result = typename geometry::default_distance_result< + Point, + typename Translator::indexable_type + >::type +> +class nearest + : public rtree::visitor::type + , index::nonassignable +{ +public: + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename geometry::default_distance_result::type node_distance_type; + + inline nearest(Translator const& t, Point const& pt, Predicates const& pr, Result & r) + : m_tr(t), m_point(pt), m_pred(pr) + , m_result(r) + {} + + inline void operator()(internal_node const& n) + { + // array of active nodes + index::pushable_array< + std::pair, + Options::parameters_type::max_elements + > active_branch_list; + + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + // fill array of nodes meeting predicates + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + if ( index::predicates_check(m_pred, it->first) ) + { + active_branch_list.push_back( + std::make_pair(index::mindist(m_point, it->first), it->second) + ); + } + } + + // if there aren't any nodes in ABL - return + if ( active_branch_list.empty() ) + return; + + // sort array + std::sort(active_branch_list.begin(), active_branch_list.end(), abl_mindist_less); + + // recursively visit nodes + for ( size_t i = 0 ;; ++i ) + { + // prune nodes + prune_nodes(active_branch_list); + + if ( active_branch_list.size() <= i ) + break; + + rtree::apply_visitor(*this, *active_branch_list[i].second); + } + } + + inline void operator()(leaf const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + // search leaf for closest value meeting predicates + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + if ( index::predicates_check(m_pred, m_tr(*it)) ) + { + // store value + m_result.store(*it, index::mindist(m_point, m_tr(*it))); + } + } + } + +private: + inline static bool abl_mindist_less( + std::pair const& p1, + std::pair const& p2) + { + return p1.first < p2.first; + } + + template + inline void prune_nodes(ActiveBranchList & abl) const + { + // if some value were found + if ( m_result.is_mindist_valid() ) + { + // prune if box's mindist is further than value's mindist + while ( !abl.empty() && + m_result.mindist() < abl.back().first ) + { + abl.pop_back(); + } + } + } + + Translator const& m_tr; + Point const& m_point; + Predicates const& m_pred; + + Result & m_result; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp index 75978c53b..3708e0772 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -26,7 +26,7 @@ struct query typedef typename rtree::leaf::type leaf; inline query(Translator const& t, Predicates const& p, OutIter out_it) - : tr(t), pred(p), out_iter(out_it) + : tr(t), pred(p), out_iter(out_it), found_count(0) {} inline void operator()(internal_node const& n) @@ -54,6 +54,8 @@ struct query { out_iter = *it; ++out_iter; + + ++found_count; } } } @@ -61,6 +63,7 @@ struct query Translator const& tr; Predicates const& pred; OutIter out_iter; + size_t found_count; }; }}} // namespace detail::rtree::visitors diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index c2576af9e..1a3c800a3 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -20,14 +20,36 @@ typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; //boost::geometry::index::rtree t(2, 1); + boost::geometry::index::rtree< B, boost::geometry::index::rstar<4, 2> > t; std::vector vect; +bool is_nearest = false; +P search_point; +std::vector nearest_boxes; + void render_scene(void) { + glClear(GL_COLOR_BUFFER_BIT); + boost::geometry::index::gl_draw(t); + + if ( is_nearest ) + { + glColor3f(1.0f, 0.5f, 0.0f); + glBegin(GL_TRIANGLES); + glVertex3f(boost::geometry::get<0>(search_point), boost::geometry::get<1>(search_point), t.depth()); + glVertex3f(boost::geometry::get<0>(search_point) + 1, boost::geometry::get<1>(search_point), t.depth()); + glVertex3f(boost::geometry::get<0>(search_point) + 1, boost::geometry::get<1>(search_point) + 1, t.depth()); + glEnd(); + + for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) + boost::geometry::index::detail::rtree::visitors::detail::gl_draw_indexable(nearest_boxes[i], t.depth()); + } + + glFlush(); } void resize(int w, int h) @@ -65,16 +87,14 @@ void mouse(int button, int state, int x, int y) boost::geometry::index::insert(t, b); vect.push_back(b); - std::cout << t << "\n\n"; - std::cout << "inserted: "; boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); - std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); - std::cout << "\n\n"; - glutPostRedisplay(); + std::cout << "\n" << t << "\n"; + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); + std::cout << "\n"; } else if ( button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN ) { @@ -87,16 +107,45 @@ void mouse(int button, int state, int x, int y) boost::geometry::index::remove(t, b); vect.erase(vect.begin() + i); - std::cout << '\n' << t << "\n\n"; std::cout << "removed: "; boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); - std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); - std::cout << "\n\n"; - glutPostRedisplay(); + std::cout << "\n" << t << "\n"; + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); + std::cout << "\n"; } + else if ( button == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN ) + { + float x = ( rand() % 1000 ) / 10.0f; + float y = ( rand() % 1000 ) / 10.0f; + + search_point = P(x, y); + nearest_boxes.clear(); + is_nearest = t.nearest(search_point, 3, std::back_inserter(nearest_boxes)); + + if ( is_nearest ) + { + std::cout << "search point: "; + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, search_point); + std::cout << "\nfound: "; + for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) + { + boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); + std::cout << '\n'; + } + } + else + std::cout << "nearest not found\n"; + + std::cout << "\n" << t << "\n"; + std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); + std::cout << "\n"; + } + + glutPostRedisplay(); } int main(int argc, char **argv) diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index d54002af6..2d5061155 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -90,16 +90,21 @@ int main() { boost::mt19937 rng; //rng.seed(static_cast(std::time(0))); - float max_val = static_cast(values_count / 2); boost::uniform_real range(-max_val, max_val); - boost::variate_generator > rnd(rng, range); + //::srand( ::time(NULL) ); + //float factor = values_count / float(RAND_MAX); + //float comp = values_count / 2; + std::cout << "randomizing data\n"; for ( size_t i = 0 ; i < values_count ; ++i ) { coords.push_back(std::make_pair(rnd(), rnd())); + //float x = rand() * factor + comp; + //float y = rand() * factor + comp; + //coords.push_back( std::make_pair( x, y )); } std::cout << "randomized\n"; } @@ -132,23 +137,6 @@ int main() else std::cout << "WRONG LEVELS\n"; - // searching test - { - std::cout << "find(B) searching time test...\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.find(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - // searching test { std::cout << "query(intersects(B)) searching time test...\n"; @@ -183,6 +171,38 @@ int main() std::cout << "found: " << temp << "\n"; } + // searching test + { + std::cout << "nearest searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + std::pair result; + temp += t.nearest(P(x, y), result); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + + // searching test + { + std::cout << "nearest searching time test...\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + std::vector< std::pair > result; + temp += t.nearest(P(x, y), 5, std::back_inserter(result)); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + // elements removing test { std::cout << "removing time test...\n"; From f84c5bff81d972c645c55e247f7e92f5446cc678 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 17 Sep 2011 10:45:08 +0000 Subject: [PATCH 056/366] nearest_filter implemented, spatial_filter changed to query_filter. [SVN r74435] --- .../index/filters/nearest_filter.hpp | 81 ++++++++++--------- .../extensions/index/filters/query_filter.hpp | 70 ++++++++++++++++ .../index/filters/spacial_filter.hpp | 67 --------------- .../extensions/index/rtree/filters.hpp | 63 +++++++++------ .../geometry/extensions/index/rtree/rtree.hpp | 2 +- 5 files changed, 150 insertions(+), 133 deletions(-) create mode 100644 include/boost/geometry/extensions/index/filters/query_filter.hpp delete mode 100644 include/boost/geometry/extensions/index/filters/spacial_filter.hpp diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp index adc871b7c..ea63c959e 100644 --- a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp @@ -12,69 +12,70 @@ namespace boost { namespace geometry { namespace index { -namespace filters { - -template +template class nearest_filter { -public: + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_INDEX, + (nearest_filter)); + typedef int* iterator; typedef const int* const_iterator; - template - nearest_filter( - SpacialIndex const&, + template + inline nearest_filter( + Index const&, Point const&, - typename traits::coordinate_type::type const& + size_t, + Predicates const& ) {} - iterator begin() { return 0; } - iterator end() { return 0; } - const_iterator begin() const { return 0; } - const_iterator end() const { return 0; } + inline iterator begin() { return 0; } + inline iterator end() { return 0; } + inline const_iterator begin() const { return 0; } + inline const_iterator end() const { return 0; } }; namespace detail { -template -class nearest_filtered +template +struct nearest_filtered { -public: - explicit nearest_filtered( - Point const& p, - typename traits::coordinate_type::type const& distance) - : m_point(p), m_distance(distance) {} + inline nearest_filtered( + Point const& pt, + size_t k, + Predicates const& pred + ) + : point(pt) + , count(k) + , predicates(pred) + {} - Point const& point() const { return m_point; } - - typename traits::coordinate_type::type const& - distance() const { return m_distance; } - -private: - Point m_point; - typename traits::coordinate_type::type m_distance; + Point const& point; + size_t count; + Predicates const& predicates; }; } // namespace detail -template -detail::nearest_filtered nearest_filtered( - Point const& p, - typename traits::coordinate_type::type const& distance) +template +detail::nearest_filtered nearest_filtered( + Point const& pt, + size_t k, + Predicates const& pred = detail::empty()) { - return detail::nearest_filtered(p, distance); + return detail::nearest_filtered(pt, k, pred); } -} // namespace filters - -template -boost::geometry::index::filters::nearest_filter - operator|( - SpacialIndex const& si, - boost::geometry::index::filters::detail::nearest_filtered const& f) +template +index::nearest_filter +operator|( + Index const& si, + detail::nearest_filtered const& f) { - return boost::geometry::index::filters::nearest_filter(si, f.point(), f.distance()); + return index::nearest_filter(si, f.point, f.count, f.predicates); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/filters/query_filter.hpp b/include/boost/geometry/extensions/index/filters/query_filter.hpp new file mode 100644 index 000000000..a0bec8192 --- /dev/null +++ b/include/boost/geometry/extensions/index/filters/query_filter.hpp @@ -0,0 +1,70 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - query filter implementation +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_QUERY_FILTER_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_QUERY_FILTER_HPP + +namespace boost { namespace geometry { namespace index { + +template +class query_filter +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_INDEX, + (query_filter)); + + typedef int* iterator; + typedef const int* const_iterator; + + template + inline query_filter( + Index const&, + Predicates const& + ) + {} + + inline iterator begin() { return 0; } + inline iterator end() { return 0; } + inline const_iterator begin() const { return 0; } + inline const_iterator end() const { return 0; } +}; + +namespace detail { + +template +struct query_filtered +{ + inline explicit query_filtered(Predicates const& pred) + : predicates(pred) + {} + + Predicates const& predicates; +}; + +} // namespace detail + +template +detail::query_filtered query_filtered(Predicates const& pred) +{ + return detail::query_filtered(pred); +} + +template +index::query_filter +operator|( + Index const& si, + index::detail::query_filtered const& f) +{ + return index::query_filter(si, f.predicates); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_QUERY_FILTER_HPP diff --git a/include/boost/geometry/extensions/index/filters/spacial_filter.hpp b/include/boost/geometry/extensions/index/filters/spacial_filter.hpp deleted file mode 100644 index 7790471e0..000000000 --- a/include/boost/geometry/extensions/index/filters/spacial_filter.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - box query filter implementation -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP - -namespace boost { namespace geometry { namespace index { - -namespace filters { - -template -class spatial_filter -{ -public: - typedef int* iterator; - typedef const int* const_iterator; - - template - spatial_filter(SpacialIndex const&, Geometry const&) {} - - iterator begin() { return 0; } - iterator end() { return 0; } - const_iterator begin() const { return 0; } - const_iterator end() const { return 0; } -}; - -namespace detail { - -template -class spatially_filtered -{ -public: - explicit spatially_filtered(Geometry const& geom) : m_geom(geom) {} - Geometry const& geometry() const { return m_geom; } - -private: - Geometry const& m_geom; -}; - -} // namespace detail - -template -detail::spatially_filtered spatially_filtered(Geometry const& geom) -{ - return detail::spatially_filtered(geom); -} - -} // namespace filters - -template -index::filters::spatial_filter -operator|( - SpacialIndex const& si, - index::filters::detail::spatially_filtered const& f) -{ - return index::filters::spatial_filter(si, f.geometry()); -} - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_SPACIAL_FILTER_HPP diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 4cee0bfa1..8a3eccb37 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -13,29 +13,29 @@ #include #include -#include - -// TODO: awulkiew - implement nearest filter -//#include +#include +#include namespace boost { namespace geometry { namespace index { template class rtree; -namespace filters { - template -class spatial_filter< index::rtree > +class query_filter< index::rtree > { public: - typedef typename std::deque::iterator iterator; - typedef typename std::deque::const_iterator const_iterator; + typedef std::vector result_type; + typedef typename result_type::iterator iterator; + typedef typename result_type::const_iterator const_iterator; - template - inline spatial_filter(index::rtree const& rtree, Geometry const& geom) + template + inline query_filter( + index::rtree const& rtree, + Predicates const& pred + ) { - rtree.find(geom, std::back_inserter(m_result)); + rtree.query(pred, std::back_inserter(m_result)); } inline iterator begin() { return m_result.begin(); } @@ -44,23 +44,36 @@ public: inline const_iterator end() const { return m_result.end(); } private: - std::deque m_result; + result_type m_result; }; -} // namespace filters +template +class nearest_filter< index::rtree > +{ +public: + typedef std::vector result_type; + typedef typename result_type::iterator iterator; + typedef typename result_type::const_iterator const_iterator; -// TODO: awulkiew - filter may be implemented in operator| + template + inline nearest_filter( + index::rtree const& rtree, + Point const& pt, + size_t k, + Predicates const& pred + ) + { + rtree.nearest(pt, k, pred, std::back_inserter(m_result)); + } -//template -//std::deque -//operator|( -// index::rtree const& si, -// index::filters::detail::spatially_filtered const& f) -//{ -// std::deque result; -// si.find(f.geometry(), std::back_inserter(result)); -// return result; -//} + inline iterator begin() { return m_result.begin(); } + inline iterator end() { return m_result.end(); } + inline const_iterator begin() const { return m_result.begin(); } + inline const_iterator end() const { return m_result.end(); } + +private: + result_type m_result; +}; }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 9f3605034..70c306bc6 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -23,7 +23,7 @@ #include #include -//#include +#include #include From f40db8b264db3347ce25827ad04286cef78102c2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 17 Sep 2011 18:41:36 +0000 Subject: [PATCH 057/366] maxdist algorithm added [SVN r74438] --- .../index/algorithms/detail/diff_abs.hpp | 27 +++++ .../extensions/index/algorithms/maxdist.hpp | 69 ++++++++++++ .../index/algorithms/minmaxdist.hpp | 71 ++---------- tests/additional_sizes_and_times.cpp | 106 ++++++++++++++++-- 4 files changed, 203 insertions(+), 70 deletions(-) create mode 100644 include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp create mode 100644 include/boost/geometry/extensions/index/algorithms/maxdist.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp b/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp new file mode 100644 index 000000000..4c89b31c1 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp @@ -0,0 +1,27 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - Abs of difference +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template +inline T diff_abs(T const& v1, T const& v2) +{ + return v1 < v2 ? v2 - v1 : v1 - v2; +} + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/maxdist.hpp b/include/boost/geometry/extensions/index/algorithms/maxdist.hpp new file mode 100644 index 000000000..1aa7a9b94 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/maxdist.hpp @@ -0,0 +1,69 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - maxdist used in R-tree k nearest neighbors query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +// minmaxdist component + +struct maxdist_tag {}; + +template < + typename Point, + typename BoxIndexable, + size_t DimensionIndex> +struct sum_for_indexable_dimension +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, BoxIndexable const& i) + { + typedef typename index::traits::coordinate_type::type point_coord_t; + typedef typename index::traits::coordinate_type::type indexable_coord_t; + + point_coord_t pt_c = geometry::get(pt); + indexable_coord_t ind_c_min = geometry::get(i); + indexable_coord_t ind_c_max = geometry::get(i); + + result_type further_diff = 0; + + if ( (ind_c_min + ind_c_max) / 2 <= pt_c ) + further_diff = pt_c - ind_c_min; + else + further_diff = detail::diff_abs(pt_c, ind_c_max); // unsigned values protection + + return further_diff * further_diff; + } +}; + +} // namespace detail + +template +typename geometry::default_distance_result::type +maxdist(Point const& pt, Indexable const& i) +{ + return sum_for_indexable< + Point, + Indexable, + typename index::traits::tag::type, + maxdist_tag, + index::traits::dimension::value + >::apply(pt, i); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp index 4ce994250..815ceefab 100644 --- a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp +++ b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp @@ -10,67 +10,16 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP +#include #include #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { -// awulkiew - use if unsigned values may be used as coordinates -template -inline T diff_abs(T const& v1, T const& v2) -{ - return v1 < v2 ? v2 - v1 : v1 - v2; -} - -// minmaxdist component - -struct minmaxdist_comp_tag {}; - -template < - typename Point, - typename BoxIndexable, - size_t DimensionIndex> -struct sum_for_indexable_dimension -{ - typedef typename geometry::default_distance_result::type result_type; - - inline static result_type apply(Point const& pt, BoxIndexable const& i) - { - typedef typename index::traits::coordinate_type::type point_coord_t; - typedef typename index::traits::coordinate_type::type indexable_coord_t; - - point_coord_t pt_c = geometry::get(pt); - indexable_coord_t ind_c_min = geometry::get(i); - indexable_coord_t ind_c_max = geometry::get(i); - - result_type further_diff = 0; - - if ( (ind_c_min + ind_c_max) / 2 <= pt_c ) - further_diff = pt_c - ind_c_min; - else - further_diff = diff_abs(pt_c, ind_c_max); // unsigned values protection - - return further_diff * further_diff; - } -}; - -template -typename geometry::default_distance_result::type -minmaxdist_comp(Point const& pt, Indexable const& i) -{ - return sum_for_indexable< - Point, - Indexable, - typename index::traits::tag::type, - minmaxdist_comp_tag, - index::traits::dimension::value - >::apply(pt, i); -} - -// minmaxdist - struct minmaxdist_tag {}; template < @@ -81,7 +30,7 @@ struct smallest_for_indexable_dimension::type result_type; - inline static result_type apply(Point const& pt, BoxIndexable const& i, result_type const& comp) + inline static result_type apply(Point const& pt, BoxIndexable const& i, result_type const& maxd) { typedef typename index::traits::coordinate_type::type point_coord_t; typedef typename index::traits::coordinate_type::type indexable_coord_t; @@ -97,17 +46,17 @@ struct smallest_for_indexable_dimension inline static result_type apply(Point const& pt, Indexable const& i) { - result_type comp = minmaxdist_comp(pt, i); + result_type maxd = maxdist(pt, i); return smallest_for_indexable< Point, @@ -146,7 +95,7 @@ struct minmaxdist_impl box_tag, minmaxdist_tag, index::traits::dimension::value - >::apply(pt, i, comp); + >::apply(pt, i, maxd); } }; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 2d5061155..82f1736cc 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -114,7 +114,8 @@ int main() // elements inserting test { - std::cout << "inserting time test...\n"; + std::cout << "rtree inserting time test... (" + << values_count << ")\n"; tim.restart(); for (size_t i = 0 ; i < values_count ; ++i ) { @@ -127,6 +128,24 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } + std::vector< std::pair > v; + + // elements inserting test + { + std::cout << "vector inserting time test... (" + << values_count << ")\n"; + tim.restart(); + for (size_t i = 0 ; i < values_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + v.push_back(std::make_pair(b, i)); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + } + // check if ( bgi::are_boxes_ok(t) ) std::cout << "BOXES OK\n"; @@ -139,7 +158,8 @@ int main() // searching test { - std::cout << "query(intersects(B)) searching time test...\n"; + std::cout << "query(intersects(B)) searching time test... (" + << queries_count << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count ; ++i ) @@ -156,7 +176,8 @@ int main() // searching test { - std::cout << "query(B) searching time test...\n"; + std::cout << "query(B) searching time test... (" + << queries_count << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count ; ++i ) @@ -173,7 +194,36 @@ int main() // searching test { - std::cout << "nearest searching time test...\n"; + std::cout << "vector searching time test... (" + << queries_count / 1000 << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 1000 ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + for ( std::vector< std::pair >::const_iterator it = v.begin(); + it != v.end() ; + ++it ) + { + if ( bg::intersects( + it->first, + B(P(x - 10, y - 10), P(x + 10, y + 10)) + ) + ) + result.push_back(*it); + } + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + + // searching test + { + std::cout << "nearest searching time test... (" + << queries_count / 10 << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count / 10 ; ++i ) @@ -189,7 +239,8 @@ int main() // searching test { - std::cout << "nearest searching time test...\n"; + std::cout << "nearest 5 searching time test... (" + << queries_count / 10 << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count / 10 ; ++i ) @@ -203,9 +254,43 @@ int main() std::cout << "found: " << temp << "\n"; } + // searching test + { + std::cout << "vector nearest searching time test... (" + << queries_count / 1000 << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 1000 ; ++i ) + { + typedef bg::default_distance_result::type distance_type; + + float x = coords[i].first + 100; + float y = coords[i].second + 100; + std::pair result; + distance_type dist = std::numeric_limits::max(); + + for ( std::vector< std::pair >::const_iterator it = v.begin(); + it != v.end(); + ++it ) + { + distance_type cd = bgi::mindist(P(x, y), it->first); + + if ( cd < dist ) + { + result = *it; + dist = cd; + } + } + temp += dist < std::numeric_limits::max() ? 1 : 0; + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + // elements removing test { - std::cout << "removing time test...\n"; + std::cout << "removing time test... (" + << remove_count << ")\n"; tim.restart(); for (size_t i = 0 ; i < remove_count ; ++i ) { @@ -230,7 +315,8 @@ int main() // searching test { - std::cout << "searching time test...\n"; + std::cout << "searching time test... (" + << queries_count << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count ; ++i ) @@ -247,7 +333,8 @@ int main() // inserting test { - std::cout << "inserting time test...\n"; + std::cout << "inserting time test... (" + << remove_count << ")\n"; tim.restart(); for (size_t i = 0 ; i < remove_count ; ++i ) { @@ -272,7 +359,8 @@ int main() // searching test { - std::cout << "searching time test...\n"; + std::cout << "searching time test... (" + << queries_count << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count ; ++i ) From 4ea2a9d915e21e4fe18e8fe338a737ca708f82e0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 17 Sep 2011 19:47:01 +0000 Subject: [PATCH 058/366] namespace names error fixed [SVN r74439] --- .../boost/geometry/extensions/index/algorithms/maxdist.hpp | 4 ++-- .../geometry/extensions/index/rtree/visitors/nearest.hpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/extensions/index/algorithms/maxdist.hpp b/include/boost/geometry/extensions/index/algorithms/maxdist.hpp index 1aa7a9b94..b207d271d 100644 --- a/include/boost/geometry/extensions/index/algorithms/maxdist.hpp +++ b/include/boost/geometry/extensions/index/algorithms/maxdist.hpp @@ -55,11 +55,11 @@ template typename geometry::default_distance_result::type maxdist(Point const& pt, Indexable const& i) { - return sum_for_indexable< + return detail::sum_for_indexable< Point, Indexable, typename index::traits::tag::type, - maxdist_tag, + detail::maxdist_tag, index::traits::dimension::value >::apply(pt, i); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index c9fb77d39..da950e7f4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -12,6 +12,7 @@ #include #include +#include #include @@ -19,6 +20,10 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { +// TODO: awulkiew - maby it's a good idea to check if curr_mindist < comp_mindist and then check predicates +// in store() or break store to 2 functions e.g. should_store() and store() +// - well not with this algorithm of storing k-th neighbor + template struct nearest_one { @@ -85,6 +90,7 @@ public: // TODO: awulkiew - test other methods: // heap, manual inserting // don't sort if size < k ? + // check the furthest distance at the first place, before push_back() } inline bool is_mindist_valid() const From c6cb77680a55e251a27a78d4c1406a79fa67f370 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 18 Sep 2011 00:48:28 +0000 Subject: [PATCH 059/366] query name fixed in tests + partially switched to Boost.Test. [SVN r74442] --- tests/additional_load_time_vis.cpp | 141 ----------------------------- tests/main.cpp | 46 +++------- tests/rtree_filters.hpp | 17 ++-- tests/translators.hpp | 109 ++++++++++++---------- 4 files changed, 79 insertions(+), 234 deletions(-) delete mode 100644 tests/additional_load_time_vis.cpp diff --git a/tests/additional_load_time_vis.cpp b/tests/additional_load_time_vis.cpp deleted file mode 100644 index 0db3b5ac6..000000000 --- a/tests/additional_load_time_vis.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include - -#include -#include - -#include -#include - -//TEST -#include -#include - -typedef boost::geometry::model::point P; -typedef boost::geometry::model::box

B; -boost::geometry::index::rtree< std::pair > t; - -void render_scene(void) -{ - boost::geometry::index::gl_draw(t, 0, 1, 20000.0f); -} - -void resize(int w, int h) -{ - if ( h == 0 ) - h = 1; - - float ratio = float(w) / h; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - glViewport(0, 0, w, h); - - gluPerspective(45.0, ratio, 1, 10000000.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - gluLookAt( - 2000000.0, 2000000.0, 2000000.0, - 0.0, 0.0, -1.0, - 0.0, 1.0, 0.0); -} - -int main(int argc, char **argv) -{ - boost::timer tim; - - // randomize boxes - const size_t n = 1000000; - //const size_t n = 300; - const size_t ns = 100000; - - std::ifstream file_cfg("config.txt"); - std::ifstream file("test_coords.txt"); - - std::cout << "loading data\n"; - std::vector< std::pair > coords(n); - for ( size_t i = 0 ; i < n ; ++i ) - { - file >> coords[i].first; - file >> coords[i].second; - } - std::cout << "loaded\n"; - - std::cin.get(); - - size_t max_elems, min_elems; - file_cfg >> max_elems; - file_cfg >> min_elems; - std::cout << "max: " << max_elems << ", min: " << min_elems << "\n"; - - t = boost::geometry::index::rtree< std::pair > (max_elems, min_elems); - - //std::cout << "inserting time test...\n"; - //tim.restart(); - //for (size_t i = 0 ; i < n ; ++i ) - //{ - // float x = coords[i].first; - // float y = coords[i].second; - // B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - - // // Zle wyswietla dane, obcina czesc ulamkowa - // // Zle buduje drzewo dla i == 228 - - // //TEST - // /*if ( i == 228 ) - // { - // std::cout << std::fixed << x << ", " << y << "\n"; - // boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); - // }*/ - - // t.insert(std::make_pair(b, i)); - - // //TEST - // /*if ( !boost::geometry::index::are_boxes_ok(t) ) - // { - // std::ofstream log("log1.txt", std::ofstream::trunc); - // log << std::fixed << i << " - " << x << ", " << y << " - inserted: "; - // boost::geometry::index::detail::rtree::visitors::detail::print_indexable(log, b); - // log << '\n'; - // log << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); - // log << '\n' << t; - // }*/ - //} - //std::cout << "time: " << tim.elapsed() << "s\n"; - - { - std::cout << "loading tree structure...\n"; - std::ifstream is("save.txt"); - t.load(is); - std::cout << "done.\n"; - } - - std::cout << "searching time test...\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < ns ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result = t.find(B(P(x - 10, y - 10), P(x + 10, y + 10))); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << temp << "\n"; - - std::cin.get(); - - //TEST - glutInit(&argc, argv); - glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); - glutInitWindowPosition(100,100); - glutInitWindowSize(800, 600); - glutCreateWindow("Mouse click to insert new value"); - - glutDisplayFunc(render_scene); - glutReshapeFunc(resize); - - glutMainLoop(); - - return 0; -} diff --git a/tests/main.cpp b/tests/main.cpp index 7d6d94067..854655206 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,55 +1,31 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - example +// Boost.Index - unit tests // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#define BOOST_TEST_MODULE test_module_boost_geometry_index +#include + #include #include #include -#include - -int main() +BOOST_AUTO_TEST_CASE( main ) { - tests_translators_hpp(); - tests_rtree_native_hpp >(); - tests_rtree_native_hpp >(); - tests_rtree_native_hpp >(); + std::cout << "test\n"; + + tests_rtree_native_hpp< boost::geometry::index::linear<32, 8> >(); + tests_rtree_native_hpp< boost::geometry::index::quadratic<32, 8> >(); + tests_rtree_native_hpp< boost::geometry::index::rstar<32, 8> >(); + tests_rtree_filters_hpp(); - /* - { - namespace bg = boost::geometry; - namespace bgi = boost::geometry::index; - typedef bg::model::point P; - typedef bg::model::box

B; - typedef std::pair V; - bgi::rtree t(4, 2); - const int m = 15; - for ( int i = 0 ; i < m ; ++i ) - { - bgi::insert(t, V(B(P(i*2.0f, i*2.0f), P(i*2.0f+1, i*2.0f+1)), i)); - } - std::cout << t << "\n------------------------------------\n"; - std::cin.get(); - - for ( int i = 0 ; i < m ; ++i ) - { - bgi::remove(t, V(B(P(i*2.0f, i*2.0f), P(i*2.0f+1, i*2.0f+1)), i)); - std::cout << t << '\n'; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK" : "WRONG BOXES!" ); - std::cout << "\n------------------------------------\n"; - std::cin.get(); - } - } - */ #ifdef _MSC_VER std::cin.get(); #endif - return 0; } diff --git a/tests/rtree_filters.hpp b/tests/rtree_filters.hpp index 221b3ddd4..28decfd08 100644 --- a/tests/rtree_filters.hpp +++ b/tests/rtree_filters.hpp @@ -37,17 +37,18 @@ void tests_rtree_filters_hpp() typedef boost::geometry::model::box

B; { - boost::geometry::index::rtree > t; - boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); - boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); - boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); - boost::geometry::index::insert(t, B(P(6, 6), P(7, 7))); - boost::geometry::index::insert(t, B(P(8, 8), P(9, 9))); + namespace bgi = boost::geometry::index; + + bgi::rtree > t; + bgi::insert(t, B(P(0, 0), P(1, 1))); + bgi::insert(t, B(P(2, 2), P(3, 3))); + bgi::insert(t, B(P(4, 4), P(5, 5))); + bgi::insert(t, B(P(6, 6), P(7, 7))); + bgi::insert(t, B(P(8, 8), P(9, 9))); std::cout << t; std::cout << "Query: (2.5, 2.5)x(4.5, 4.5)\n"; - namespace f = boost::geometry::index::filters; - tests_rtree_filters_hpp_print_range(t | f::spatially_filtered(B(P(2.5f, 2.5f), P(4.5f, 4.5f)))); + tests_rtree_filters_hpp_print_range(t | bgi::query_filtered(B(P(2.5f, 2.5f), P(4.5f, 4.5f)))); } } diff --git a/tests/translators.hpp b/tests/translators.hpp index 39d059eec..7d2cc7417 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -3,9 +3,8 @@ #include #include -#include -#include +#include #include #include @@ -16,6 +15,10 @@ template struct tests_translators_val { + tests_translators_val(Indexable const& ii) + : i(ii) + {} + Indexable const& get_box() const { return i; @@ -29,64 +32,70 @@ struct tests_translators_val Indexable i; }; -void tests_translators_hpp() +BOOST_AUTO_TEST_CASE(tests_translators) { - std::cout << "tests/translators.hpp\n"; + namespace bg = boost::geometry; + namespace bgm = bg::model; + namespace bgi = bg::index; + namespace bgit = bgi::translator; - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - //typedef boost::geometry::index::rtree I; + typedef bgm::point P; + typedef bgm::box

B; - using namespace boost::geometry; + bgit::def< P > p; + bgit::def< P* > pp; + bgit::def< std::pair* > ppip; + bgit::def< boost::shared_ptr

> sp; + bgit::def< std::vector

::iterator > ip; + bgit::def< std::map::iterator > mip; + bgit::def< std::pair > pip; + bgit::def< boost::shared_ptr< std::pair > > spip; + bgit::def< boost::shared_ptr< std::pair > > sppi; + bgit::def< boost::scoped_ptr< std::pair > > scppi; + bgit::def< boost::scoped_ptr< std::pair > > scpip; - index::translator::def

p; - index::translator::def pp; - index::translator::def*> pip; - index::translator::def< boost::shared_ptr

> sp; - index::translator::def< std::vector

::iterator > ip; - index::translator::def< std::map::iterator > mip; - index::translator::def< std::pair > ppi; - index::translator::def< boost::shared_ptr< std::pair > > spip; - index::translator::def< boost::shared_ptr< std::pair > > sppi; - index::translator::def< boost::scoped_ptr< std::pair > > scppi; - index::translator::def< boost::scoped_ptr< std::pair > > scpip; - - P tmp_p; - boost::shared_ptr

tmp_sp(new P()); - std::vector

tmp_v(1); + P tmp_p(2, 3); + boost::shared_ptr

tmp_sp(new P(2, 3)); + std::vector

tmp_v(1, P(2, 3)); std::map tmp_m; - tmp_m.insert(std::pair(0, P())); - std::pair tmp_pip; - boost::shared_ptr< std::pair > tmp_spip(new std::pair(0, P())); - boost::shared_ptr< std::pair > tmp_sppi(new std::pair(P(), 0)); - boost::scoped_ptr< std::pair > tmp_scpip(new std::pair(0, P())); - boost::scoped_ptr< std::pair > tmp_scppi(new std::pair(P(), 0)); + tmp_m.insert(std::pair(0, P(2, 3))); + std::pair tmp_pip(0, P(2, 3)); + boost::shared_ptr< std::pair > tmp_spip(new std::pair(0, P(2, 3))); + boost::shared_ptr< std::pair > tmp_sppi(new std::pair(P(2, 3), 0)); + boost::scoped_ptr< std::pair > tmp_scpip(new std::pair(0, P(2, 3))); + boost::scoped_ptr< std::pair > tmp_scppi(new std::pair(P(2, 3), 0)); - tmp_p = p(P()); - tmp_p = pp(&tmp_p); - tmp_p = pip(&tmp_pip); - tmp_p = sp(tmp_sp); - tmp_p = ip(tmp_v.begin()); - tmp_p = mip(tmp_m.begin()); - tmp_p = ppi(std::pair(P(), 0)); - tmp_p = spip(tmp_spip); - tmp_p = sppi(tmp_sppi); - tmp_p = scpip(tmp_scpip); - tmp_p = scppi(tmp_scppi); + BOOST_CHECK( bg::equals(tmp_p, p(tmp_p)) ); + BOOST_CHECK( bg::equals(tmp_p, pp(&tmp_p)) ); + BOOST_CHECK( bg::equals(tmp_p, ppip(&tmp_pip)) ); + BOOST_CHECK( bg::equals(tmp_p, sp(tmp_sp)) ); + BOOST_CHECK( bg::equals(tmp_p, ip(tmp_v.begin())) ); + BOOST_CHECK( bg::equals(tmp_p, mip(tmp_m.begin())) ); + BOOST_CHECK( bg::equals(tmp_p, pip(tmp_pip)) ); + BOOST_CHECK( bg::equals(tmp_p, spip(tmp_spip)) ); + BOOST_CHECK( bg::equals(tmp_p, sppi(tmp_sppi)) ); + BOOST_CHECK( bg::equals(tmp_p, scpip(tmp_scpip)) ); + BOOST_CHECK( bg::equals(tmp_p, scppi(tmp_scppi)) ); + + //bgit::def d; // error + //bgit::def< bgm::segment

> d; // error - //index::translator::def d; // error - //index::translator::def< model::segment

> d; // error + B tmp_b(P(2, 3), P(4, 5)); + std::pair, B> tmp_ppb = + std::make_pair(bgm::polygon

(), tmp_b); + std::pair> tmp_pbp = + std::make_pair(tmp_b, bgm::polygon

()); - index::translator::def< std::pair, B> > d; - index::translator::def< std::pair > > dd; + bgit::def< std::pair, B> > ppb; + bgit::def< std::pair > > pbp; - B tmp_b; - tmp_b = d( std::pair, B>() ); - tmp_b = dd( std::pair >() ); + BOOST_CHECK( bg::equals(tmp_b, ppb(tmp_ppb)) ); + BOOST_CHECK( bg::equals(tmp_b, pbp(tmp_pbp)) ); - tests_translators_val

val_p; - index::translator::getter, P, &tests_translators_val

::get_box> tr_get_p; - tmp_p = tr_get_p(val_p); + tests_translators_val

val_p(tmp_p); + bgit::getter, P, &tests_translators_val

::get_box> tr_get_p; + + BOOST_CHECK( bg::equals(tmp_p, tr_get_p(val_p)) ); } #endif // TESTS_TRANSLATORS_HPP From ec724b4038022dc16d6242a23a0ff8d8e01748d2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 18 Sep 2011 01:28:15 +0000 Subject: [PATCH 060/366] operator >> error in template definition fixed. [SVN r74443] --- tests/main.cpp | 2 +- tests/translators.hpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/main.cpp b/tests/main.cpp index 854655206..33b385374 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -14,7 +14,7 @@ #include #include -BOOST_AUTO_TEST_CASE( main ) +BOOST_AUTO_TEST_CASE( test_main ) { std::cout << "test\n"; diff --git a/tests/translators.hpp b/tests/translators.hpp index 7d2cc7417..490481846 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -34,6 +34,8 @@ struct tests_translators_val BOOST_AUTO_TEST_CASE(tests_translators) { + std::cout << "tests/translators.hpp\n"; + namespace bg = boost::geometry; namespace bgm = bg::model; namespace bgi = bg::index; @@ -83,7 +85,7 @@ BOOST_AUTO_TEST_CASE(tests_translators) B tmp_b(P(2, 3), P(4, 5)); std::pair, B> tmp_ppb = std::make_pair(bgm::polygon

(), tmp_b); - std::pair> tmp_pbp = + std::pair > tmp_pbp = std::make_pair(tmp_b, bgm::polygon

()); bgit::def< std::pair, B> > ppb; From 6c0cfd7d10a26c09e76060d8b1087b0d3bac667a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 18 Sep 2011 10:42:46 +0000 Subject: [PATCH 061/366] error fixed in rtree's overlaps predicate check specialization for node [SVN r74447] --- .../geometry/extensions/index/predicates.hpp | 2 + .../extensions/index/rtree/predicates.hpp | 22 +- .../index/rtree/visitors/nearest.hpp | 7 +- tests/main.cpp | 8 +- tests/rtree_function.hpp | 209 ++++++++++++++++++ tests/rtree_native.hpp | 169 -------------- tests/translators.hpp | 2 +- 7 files changed, 231 insertions(+), 188 deletions(-) create mode 100644 tests/rtree_function.hpp delete mode 100644 tests/rtree_native.hpp diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 04672ccfd..c968d0080 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -93,6 +93,8 @@ namespace detail // predicate check +// TODO: use empty definitions here + MPL_ASSERT + template struct predicate_check { diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index a88c96bf9..d54300528 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -52,16 +52,18 @@ struct predicate_check, rtree::node_predicates_tag> // return geometry::intersects(i, p.geometry); // } //}; -// -//template -//struct predicate_check, rtree::node_predicates_tag> -//{ -// template -// static inline bool apply(overlaps const& p, Indexable const& i) -// { -// return geometry::overlaps(i, p.geometry); -// } -//}; + +template +struct predicate_check, rtree::node_predicates_tag> +{ + template + static inline bool apply(overlaps const& p, Indexable const& i) + { + // TODO: awulkiew - possibly change to the version without border case + // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false + return geometry::intersects(i, p.geometry); + } +}; template struct predicate_check, rtree::node_predicates_tag> diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index da950e7f4..27f5b4c72 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -155,13 +155,16 @@ public: , m_result(r) {} + //TODO: awulkiew - check this approach: store one, global vector of active branches, add branches only if mindist is ok + inline void operator()(internal_node const& n) { // array of active nodes - index::pushable_array< + /*index::pushable_array< std::pair, Options::parameters_type::max_elements - > active_branch_list; + > active_branch_list;*/ + std::vector< std::pair > active_branch_list; typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); diff --git a/tests/main.cpp b/tests/main.cpp index 33b385374..06154803e 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -11,17 +11,13 @@ #include #include -#include +#include #include -BOOST_AUTO_TEST_CASE( test_main ) +BOOST_AUTO_TEST_CASE( aaaa ) { std::cout << "test\n"; - tests_rtree_native_hpp< boost::geometry::index::linear<32, 8> >(); - tests_rtree_native_hpp< boost::geometry::index::quadratic<32, 8> >(); - tests_rtree_native_hpp< boost::geometry::index::rstar<32, 8> >(); - tests_rtree_filters_hpp(); #ifdef _MSC_VER diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp new file mode 100644 index 000000000..2ca459fe9 --- /dev/null +++ b/tests/rtree_function.hpp @@ -0,0 +1,209 @@ +#ifndef TESTS_RTREE_FUNCTION_HPP +#define TESTS_RTREE_FUNCTION_HPP + +#include + +#include +#include + +#include + +#include +#include + +#include + +template +void tests_rtree_function_box3f_impl() +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + + typedef bg::model::point P; + typedef bg::model::box

B; + typedef B val_t; + + bgi::rtree t; + + bgi::insert(t, B(P(0, 0, 0), P(1, 1, 1))); + bgi::insert(t, B(P(2, 2, 2), P(3, 3, 3))); + bgi::insert(t, B(P(4, 4, 4), P(5, 5, 5))); + bgi::insert(t, B(P(6, 6, 6), P(7, 7, 7))); + bgi::insert(t, B(P(8, 8, 8), P(9, 9, 9))); + + B g(P(4.5f, 4.5f, 4.5f), P(5.5f, 5.5f, 5.5f)); + B gi(P(4, 4, 4), P(5, 5, 5)); + std::vector result; + + size_t f = bgi::query(t, g, std::back_inserter(result)); + BOOST_CHECK( 1 == f && 1 == result.size() && bg::equals(result[0], gi) ); + + result.clear(); + f = bgi::query(t, bgi::intersects(g), std::back_inserter(result)); + BOOST_CHECK( 1 == f && 1 == result.size() && bg::equals(result[0], gi) ); + + BOOST_CHECK( bg::overlaps(g, gi) ); + + result.clear(); + f = bgi::query(t, bgi::overlaps(g), std::back_inserter(result)); + BOOST_CHECK( 1 == f && 1 == result.size() && bg::equals(result[0], gi) ); + + result.clear(); + f = bgi::query(t, bgi::within(g), std::back_inserter(result)); + BOOST_CHECK( 0 == f && 0 == result.size() ); + + result.clear(); + f = bgi::query(t, bgi::covered_by(g), std::back_inserter(result)); + BOOST_CHECK( 0 == f && 0 == result.size() ); + + P p(3.9f, 3.5f, 3.5f); + val_t result_val; + + f = bgi::nearest(t, p, result_val); + BOOST_CHECK( 1 == f && bg::equals(result_val, gi) ); +} + +BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) +{ + std::cout << "tests/rtree_function_box3f\n"; + + namespace bg = boost::geometry; + namespace bgi = bg::index; + + tests_rtree_function_box3f_impl< bgi::linear<4, 2> >(); + tests_rtree_function_box3f_impl< bgi::quadratic<4, 2> >(); + tests_rtree_function_box3f_impl< bgi::rstar<4, 2> >(); +} + + + // std::cout << "Boxes2d\n"; + // { + // typedef bg::model::point P; + // typedef bg::model::box

B; + + // bgi::rtree t; + // bgi::insert(t, B(P(0, 0), P(1, 1))); + // bgi::insert(t, B(P(2, 2), P(3, 3))); + // bgi::insert(t, B(P(4, 4), P(5, 5))); + // bgi::insert(t, B(P(6, 6), P(7, 7))); + // bgi::insert(t, B(P(8, 8), P(9, 9))); + // std::cerr << t; + // } + + // std::cout << "-------------------------------------------------\n"; + // std::cout << "-------------------------------------------------\n"; + + // std::cout << "Points\n"; + // { + // typedef bg::model::point P; + // typedef bg::model::box

B; + + // bgi::rtree t; + // bgi::insert(t, P(0, 0)); + // bgi::insert(t, P(2, 2)); + // bgi::insert(t, P(4, 4)); + // bgi::insert(t, P(6, 6)); + // bgi::insert(t, P(8, 8)); + // std::cerr << t; + // } + + // std::cout << "-------------------------------------------------\n"; + // std::cout << "-------------------------------------------------\n"; + + // std::cout << "std::pair\n"; + // { + // typedef bg::model::point P; + // typedef bg::model::box

B; + // typedef std::pair V; + + // bgi::rtree t; + // bgi::insert(t, V(B(P(0, 0), P(1, 1)), 0)); + // bgi::insert(t, V(B(P(2, 2), P(3, 3)), 1)); + // bgi::insert(t, V(B(P(4, 4), P(5, 5)), 2)); + // bgi::insert(t, V(B(P(6, 6), P(7, 7)), 3)); + // bgi::insert(t, V(B(P(8, 8), P(9, 9)), 4)); + // std::cerr << t; + // } + + // std::cout << "-------------------------------------------------\n"; + // std::cout << "-------------------------------------------------\n"; + + // std::cout << "boost::shared_ptr< std::pair >\n"; + // { + // typedef bg::model::point P; + // typedef bg::model::box

B; + // + // typedef boost::shared_ptr< std::pair > V; + + // V v1( new std::pair(B(P(0, 0), P(1, 1)), 0) ); + // V v2( new std::pair(B(P(2, 2), P(3, 3)), 1) ); + // V v3( new std::pair(B(P(4, 4), P(5, 5)), 2) ); + // V v4( new std::pair(B(P(6, 6), P(7, 7)), 3) ); + // V v5( new std::pair(B(P(8, 8), P(9, 9)), 4) ); + + // bgi::rtree t; + // bgi::insert(t, v1); + // bgi::insert(t, v2); + // bgi::insert(t, v3); + // bgi::insert(t, v4); + // bgi::insert(t, v5); + // std::cerr << t; + // } + + // std::cout << "-------------------------------------------------\n"; + // std::cout << "-------------------------------------------------\n"; + + // std::cout << "std::map::iterator\n"; + // { + // typedef bg::model::point P; + // typedef bg::model::box

B; + // + // typedef std::map::iterator V; + + // std::map m; + // m.insert(std::pair(0, B(P(0, 0), P(1, 1)))); + // m.insert(std::pair(1, B(P(2, 2), P(3, 3)))); + // m.insert(std::pair(2, B(P(4, 4), P(5, 5)))); + // m.insert(std::pair(3, B(P(6, 6), P(7, 7)))); + // m.insert(std::pair(4, B(P(8, 8), P(9, 9)))); + + // bgi::rtree t; + // V vit = m.begin(); + // bgi::insert(t, vit++); + // bgi::insert(t, vit++); + // bgi::insert(t, vit++); + // bgi::insert(t, vit++); + // bgi::insert(t, vit); + // std::cerr << t; + // } + + // std::cout << "-------------------------------------------------\n"; + // std::cout << "-------------------------------------------------\n"; + + // std::cout << "size_t\n"; + // { + // typedef bg::model::point P; + // typedef bg::model::box

B; + + // typedef size_t V; + // typedef bgi::translator::index > Tr; + + // std::vector v; + // v.push_back(B(P(0, 0), P(1, 1))); + // v.push_back(B(P(2, 2), P(3, 3))); + // v.push_back(B(P(4, 4), P(5, 5))); + // v.push_back(B(P(6, 6), P(7, 7))); + // v.push_back(B(P(8, 8), P(9, 9))); + + //Tr tr(v); + // bgi::rtree t(tr); + + // bgi::insert(t, 0u); + // bgi::insert(t, 1u); + // bgi::insert(t, 2u); + // bgi::insert(t, 3u); + // bgi::insert(t, 4u); + // std::cerr << t; + // } + +#endif // TESTS_RTREE_FUNCTION_HPP diff --git a/tests/rtree_native.hpp b/tests/rtree_native.hpp deleted file mode 100644 index 6f2a6a268..000000000 --- a/tests/rtree_native.hpp +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef TESTS_RTREE_NATIVE_HPP -#define TESTS_RTREE_NATIVE_HPP - -#include - -#include -#include - -#include - -#include -#include - -#include - -template -void tests_rtree_native_hpp() -{ - std::cout << "tests/rtree_native.hpp\n"; - - std::cout << "Boxes3d\n"; - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - boost::geometry::index::rtree t; - boost::geometry::index::insert(t, B(P(0, 0, 0), P(1, 1, 1))); - boost::geometry::index::insert(t, B(P(2, 2, 2), P(3, 3, 3))); - boost::geometry::index::insert(t, B(P(4, 4, 4), P(5, 5, 5))); - boost::geometry::index::insert(t, B(P(6, 6, 6), P(7, 7, 7))); - boost::geometry::index::insert(t, B(P(8, 8, 8), P(9, 9, 9))); - std::cerr << t; - } - - std::cout << "-------------------------------------------------\n"; - std::cout << "-------------------------------------------------\n"; - - std::cout << "Boxes2d\n"; - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - boost::geometry::index::rtree t; - boost::geometry::index::insert(t, B(P(0, 0), P(1, 1))); - boost::geometry::index::insert(t, B(P(2, 2), P(3, 3))); - boost::geometry::index::insert(t, B(P(4, 4), P(5, 5))); - boost::geometry::index::insert(t, B(P(6, 6), P(7, 7))); - boost::geometry::index::insert(t, B(P(8, 8), P(9, 9))); - std::cerr << t; - } - - std::cout << "-------------------------------------------------\n"; - std::cout << "-------------------------------------------------\n"; - - std::cout << "Points\n"; - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - boost::geometry::index::rtree t; - boost::geometry::index::insert(t, P(0, 0)); - boost::geometry::index::insert(t, P(2, 2)); - boost::geometry::index::insert(t, P(4, 4)); - boost::geometry::index::insert(t, P(6, 6)); - boost::geometry::index::insert(t, P(8, 8)); - std::cerr << t; - } - - std::cout << "-------------------------------------------------\n"; - std::cout << "-------------------------------------------------\n"; - - std::cout << "std::pair\n"; - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - typedef std::pair V; - - boost::geometry::index::rtree t; - boost::geometry::index::insert(t, V(B(P(0, 0), P(1, 1)), 0)); - boost::geometry::index::insert(t, V(B(P(2, 2), P(3, 3)), 1)); - boost::geometry::index::insert(t, V(B(P(4, 4), P(5, 5)), 2)); - boost::geometry::index::insert(t, V(B(P(6, 6), P(7, 7)), 3)); - boost::geometry::index::insert(t, V(B(P(8, 8), P(9, 9)), 4)); - std::cerr << t; - } - - std::cout << "-------------------------------------------------\n"; - std::cout << "-------------------------------------------------\n"; - - std::cout << "boost::shared_ptr< std::pair >\n"; - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - typedef boost::shared_ptr< std::pair > V; - - V v1( new std::pair(B(P(0, 0), P(1, 1)), 0) ); - V v2( new std::pair(B(P(2, 2), P(3, 3)), 1) ); - V v3( new std::pair(B(P(4, 4), P(5, 5)), 2) ); - V v4( new std::pair(B(P(6, 6), P(7, 7)), 3) ); - V v5( new std::pair(B(P(8, 8), P(9, 9)), 4) ); - - boost::geometry::index::rtree t; - boost::geometry::index::insert(t, v1); - boost::geometry::index::insert(t, v2); - boost::geometry::index::insert(t, v3); - boost::geometry::index::insert(t, v4); - boost::geometry::index::insert(t, v5); - std::cerr << t; - } - - std::cout << "-------------------------------------------------\n"; - std::cout << "-------------------------------------------------\n"; - - std::cout << "std::map::iterator\n"; - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - typedef std::map::iterator V; - - std::map m; - m.insert(std::pair(0, B(P(0, 0), P(1, 1)))); - m.insert(std::pair(1, B(P(2, 2), P(3, 3)))); - m.insert(std::pair(2, B(P(4, 4), P(5, 5)))); - m.insert(std::pair(3, B(P(6, 6), P(7, 7)))); - m.insert(std::pair(4, B(P(8, 8), P(9, 9)))); - - boost::geometry::index::rtree t; - V vit = m.begin(); - boost::geometry::index::insert(t, vit++); - boost::geometry::index::insert(t, vit++); - boost::geometry::index::insert(t, vit++); - boost::geometry::index::insert(t, vit++); - boost::geometry::index::insert(t, vit); - std::cerr << t; - } - - std::cout << "-------------------------------------------------\n"; - std::cout << "-------------------------------------------------\n"; - - std::cout << "size_t\n"; - { - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

B; - - typedef size_t V; - typedef boost::geometry::index::translator::index > Tr; - - std::vector v; - v.push_back(B(P(0, 0), P(1, 1))); - v.push_back(B(P(2, 2), P(3, 3))); - v.push_back(B(P(4, 4), P(5, 5))); - v.push_back(B(P(6, 6), P(7, 7))); - v.push_back(B(P(8, 8), P(9, 9))); - - Tr tr(v); - boost::geometry::index::rtree t(tr); - - boost::geometry::index::insert(t, 0u); - boost::geometry::index::insert(t, 1u); - boost::geometry::index::insert(t, 2u); - boost::geometry::index::insert(t, 3u); - boost::geometry::index::insert(t, 4u); - std::cerr << t; - } -} - -#endif // TESTS_RTREE_NATIVE_HPP diff --git a/tests/translators.hpp b/tests/translators.hpp index 490481846..98396675a 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -34,7 +34,7 @@ struct tests_translators_val BOOST_AUTO_TEST_CASE(tests_translators) { - std::cout << "tests/translators.hpp\n"; + std::cout << "tests/translators\n"; namespace bg = boost::geometry; namespace bgm = bg::model; From d0604349d5c6337a23155565bc3f3fd861ff5141 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 18 Sep 2011 21:19:20 +0000 Subject: [PATCH 062/366] random rtree insert/query/nearest tests implemented [SVN r74460] --- .../geometry/extensions/index/predicates.hpp | 3 + tests/rtree_function.hpp | 341 ++++++++++++++---- 2 files changed, 272 insertions(+), 72 deletions(-) diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index c968d0080..fa82bfb29 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -25,6 +25,9 @@ namespace detail { struct empty {}; +//TODO: awulkiew - consider storing Geometry instead of Geometry const& +// it's faster and eliminates problems with storing of references to temporaries + template struct covered_by : nonassignable diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 2ca459fe9..04f56e17d 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -13,54 +13,250 @@ #include -template -void tests_rtree_function_box3f_impl() +namespace helpers +{ + template + struct value_randomizer_impl_set {}; + + template + struct value_randomizer_impl_set + { + inline static void apply( + Box & b, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type w) + { + namespace bg = boost::geometry; + typedef typename bg::index::traits::coordinate_type::type coord_t; + + coord_t c1 = rand() / coord_t(RAND_MAX / m); + coord_t c2 = rand() / coord_t(RAND_MAX / w); + + bg::set(b, c1 - c2); + bg::set(b, c1 + c2); + } + }; + + template + struct value_randomizer_impl_set + { + inline static void apply( + Point & p, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type) + { + namespace bg = boost::geometry; + typedef typename bg::index::traits::coordinate_type::type coord_t; + + coord_t c = rand() / coord_t(RAND_MAX / m); + + bg::set(p, c); + } + }; + + template + struct value_randomizer_impl + { + inline static void apply( + Indexable & i, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type w) + { + value_randomizer_impl::apply(i, m, w); + value_randomizer_impl_set< + Indexable, + D - 1, + typename boost::geometry::index::traits::tag::type + >::apply(i, m, w); + } + }; + + template + struct value_randomizer_impl + { + inline static void apply( + Indexable & i, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type w) + { + value_randomizer_impl_set< + Indexable, + 0, + typename boost::geometry::index::traits::tag::type + >::apply(i, m, w); + } + }; + + template + struct value_randomizer + { + typedef Indexable value_type; + + typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; + + inline value_randomizer(coord_t mm, coord_t ww) + : m(mm), w(ww) + {} + + inline Indexable operator()() const + { + namespace bg = boost::geometry; + namespace bgi = bg::index; + + Indexable i; + value_randomizer_impl::value>::apply(i, m, w); + return i; + } + + coord_t m, w; + }; + + template + void random_insert(Rtree & t, Cont & c, size_t n, Randomizer r) + { + namespace bg = boost::geometry; + namespace bgi = bg::index; + + for ( size_t i = 0 ; i < n ; ++i ) + { + typename Randomizer::value_type v = r(); + bgi::insert(t, v); + c.push_back(v); + } + } + + template + bool results_comp(Cont const& c1, Cont const& c2, Translator const& tr) + { + if ( c1.size() != c2.size() ) + return false; + + for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) + { + bool found = false; + for ( typename Cont::const_iterator it2 = c2.begin() ; it2 != c2.end() ; ++it2 ) + if ( tr.equals(*it, *it2) ) + { + found = true; + break; + } + + if ( !found ) + return false; + } + + return true; + } + + template + void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) + { + namespace bg = boost::geometry; + namespace bgi = bg::index; + + for ( size_t i = 0 ; i < n ; ++i ) + { + Predicate pred = Predicate(r()); + + std::vector res1, res2; + + bgi::query(t, pred, std::back_inserter(res1)); + + for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) + { + if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) + res2.push_back(*it); + } + + BOOST_CHECK( helpers::results_comp(res1, res2, t.get_translator()) ); + } + } + + template + struct val_mindist_cmp + { + val_mindist_cmp(Point const& p, Translator const& t) + : pt(p), tr(t) + {} + + template + bool operator()(Indexable const& i1, Indexable const& i2) + { + return boost::geometry::index::mindist(pt, i1) < boost::geometry::index::mindist(pt, i2); + } + + Point const& pt; + Translator const& tr; + }; + + template + void random_nearest_check( + Rtree const& t, + Cont const& c, + size_t n, + PointRandomizer const& pr, + size_t k, + PredicateRandomizer const& r) + { + namespace bg = boost::geometry; + namespace bgi = bg::index; + + for ( size_t i = 0 ; i < n ; ++i ) + { + typename PointRandomizer::value_type pt = pr(); + Predicate pred = Predicate(r()); + + std::vector res1, res2; + + bgi::nearest(t, pt, k, pred, std::back_inserter(res1)); + + for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) + { + if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) + res2.push_back(*it); + } + std::sort( + res2.begin(), + res2.end(), + val_mindist_cmp< + typename PointRandomizer::value_type, + typename Rtree::translator_type + >(pt, t.get_translator()) + ); + if ( k < res2.size() ) + res2.resize(k); + + BOOST_CHECK( helpers::results_comp(res1, res2, t.get_translator()) ); + } + } +} + +template +void tests_rtree_function() { namespace bg = boost::geometry; namespace bgi = bg::index; - typedef bg::model::point P; - typedef bg::model::box

B; - typedef B val_t; + bgi::rtree t; + std::vector v; - bgi::rtree t; + typedef typename bgi::rtree::box_type B; + typedef typename bgi::traits::point_type::type P ; - bgi::insert(t, B(P(0, 0, 0), P(1, 1, 1))); - bgi::insert(t, B(P(2, 2, 2), P(3, 3, 3))); - bgi::insert(t, B(P(4, 4, 4), P(5, 5, 5))); - bgi::insert(t, B(P(6, 6, 6), P(7, 7, 7))); - bgi::insert(t, B(P(8, 8, 8), P(9, 9, 9))); - - B g(P(4.5f, 4.5f, 4.5f), P(5.5f, 5.5f, 5.5f)); - B gi(P(4, 4, 4), P(5, 5, 5)); - std::vector result; + helpers::random_insert(t, v, 10, helpers::value_randomizer(10, 1)); - size_t f = bgi::query(t, g, std::back_inserter(result)); - BOOST_CHECK( 1 == f && 1 == result.size() && bg::equals(result[0], gi) ); + helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - result.clear(); - f = bgi::query(t, bgi::intersects(g), std::back_inserter(result)); - BOOST_CHECK( 1 == f && 1 == result.size() && bg::equals(result[0], gi) ); - - BOOST_CHECK( bg::overlaps(g, gi) ); - - result.clear(); - f = bgi::query(t, bgi::overlaps(g), std::back_inserter(result)); - BOOST_CHECK( 1 == f && 1 == result.size() && bg::equals(result[0], gi) ); - - result.clear(); - f = bgi::query(t, bgi::within(g), std::back_inserter(result)); - BOOST_CHECK( 0 == f && 0 == result.size() ); - - result.clear(); - f = bgi::query(t, bgi::covered_by(g), std::back_inserter(result)); - BOOST_CHECK( 0 == f && 0 == result.size() ); - - P p(3.9f, 3.5f, 3.5f); - val_t result_val; - - f = bgi::nearest(t, p, result_val); - BOOST_CHECK( 1 == f && bg::equals(result_val, gi) ); + helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) @@ -70,45 +266,46 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) namespace bg = boost::geometry; namespace bgi = bg::index; - tests_rtree_function_box3f_impl< bgi::linear<4, 2> >(); - tests_rtree_function_box3f_impl< bgi::quadratic<4, 2> >(); - tests_rtree_function_box3f_impl< bgi::rstar<4, 2> >(); + typedef bg::model::point P; + typedef bg::model::box

B; + typedef B val_t; + + tests_rtree_function< val_t, bgi::linear<4, 2> >(); + tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); + tests_rtree_function< val_t, bgi::rstar<4, 2> >(); } +BOOST_AUTO_TEST_CASE(tests_rtree_function_box2f) +{ + std::cout << "tests/rtree_function_box2f\n"; - // std::cout << "Boxes2d\n"; - // { - // typedef bg::model::point P; - // typedef bg::model::box

B; + namespace bg = boost::geometry; + namespace bgi = bg::index; - // bgi::rtree t; - // bgi::insert(t, B(P(0, 0), P(1, 1))); - // bgi::insert(t, B(P(2, 2), P(3, 3))); - // bgi::insert(t, B(P(4, 4), P(5, 5))); - // bgi::insert(t, B(P(6, 6), P(7, 7))); - // bgi::insert(t, B(P(8, 8), P(9, 9))); - // std::cerr << t; - // } + typedef bg::model::point P; + typedef bg::model::box

B; + typedef B val_t; - // std::cout << "-------------------------------------------------\n"; - // std::cout << "-------------------------------------------------\n"; + tests_rtree_function< val_t, bgi::linear<4, 2> >(); + tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); + tests_rtree_function< val_t, bgi::rstar<4, 2> >(); +} - // std::cout << "Points\n"; - // { - // typedef bg::model::point P; - // typedef bg::model::box

B; +//BOOST_AUTO_TEST_CASE(tests_rtree_function_point2f) +//{ +// std::cout << "tests/rtree_function_point2f\n"; +// +// namespace bg = boost::geometry; +// namespace bgi = bg::index; +// +// typedef bg::model::point P; +// typedef P val_t; +// +// tests_rtree_function< val_t, bgi::linear<4, 2> >(); +// tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); +// tests_rtree_function< val_t, bgi::rstar<4, 2> >(); +//} - // bgi::rtree t; - // bgi::insert(t, P(0, 0)); - // bgi::insert(t, P(2, 2)); - // bgi::insert(t, P(4, 4)); - // bgi::insert(t, P(6, 6)); - // bgi::insert(t, P(8, 8)); - // std::cerr << t; - // } - - // std::cout << "-------------------------------------------------\n"; - // std::cout << "-------------------------------------------------\n"; // std::cout << "std::pair\n"; // { From bc0352452bcf5951551630b37bccefd96564aa37 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 18 Sep 2011 22:53:22 +0000 Subject: [PATCH 063/366] more tests added + picking a seed before testing [SVN r74461] --- tests/main.cpp | 11 ++- tests/rtree_function.hpp | 150 +++++++++++++++++++++++++++------------ 2 files changed, 113 insertions(+), 48 deletions(-) diff --git a/tests/main.cpp b/tests/main.cpp index 06154803e..95dbe698f 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -10,14 +10,19 @@ #define BOOST_TEST_MODULE test_module_boost_geometry_index #include +#include + +BOOST_AUTO_TEST_CASE( first_test_case ) +{ + ::srand( (unsigned)::time(NULL) ); +} + #include #include #include -BOOST_AUTO_TEST_CASE( aaaa ) +BOOST_AUTO_TEST_CASE( last_test_case ) { - std::cout << "test\n"; - tests_rtree_filters_hpp(); #ifdef _MSC_VER diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 04f56e17d..0a05a9fca 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -29,8 +29,8 @@ namespace helpers namespace bg = boost::geometry; typedef typename bg::index::traits::coordinate_type::type coord_t; - coord_t c1 = rand() / coord_t(RAND_MAX / m); - coord_t c2 = rand() / coord_t(RAND_MAX / w); + coord_t c1 = ::rand() / coord_t(RAND_MAX / m); + coord_t c2 = ::rand() / coord_t(RAND_MAX / w); bg::set(b, c1 - c2); bg::set(b, c1 + c2); @@ -48,7 +48,7 @@ namespace helpers namespace bg = boost::geometry; typedef typename bg::index::traits::coordinate_type::type coord_t; - coord_t c = rand() / coord_t(RAND_MAX / m); + coord_t c = ::rand() / coord_t(RAND_MAX / m); bg::set(p, c); } @@ -179,10 +179,10 @@ namespace helpers : pt(p), tr(t) {} - template - bool operator()(Indexable const& i1, Indexable const& i2) + template + bool operator()(Value const& v1, Value const& v2) { - return boost::geometry::index::mindist(pt, i1) < boost::geometry::index::mindist(pt, i2); + return boost::geometry::index::mindist(pt, tr(v1)) < boost::geometry::index::mindist(pt, tr(v2)); } Point const& pt; @@ -231,6 +231,53 @@ namespace helpers } } +template +struct tests_rtree_function_queries {}; + +template +struct tests_rtree_function_queries +{ + template + inline static void apply(Rtree const& t, Cont const& v) + { + namespace bgi = boost::geometry::index; + + helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + + helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + } +}; + +template +struct tests_rtree_function_queries +{ + template + inline static void apply(Rtree const& t, Cont const& v) + { + namespace bgi = boost::geometry::index; + + helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + + helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + } +}; + template void tests_rtree_function() { @@ -240,23 +287,13 @@ void tests_rtree_function() bgi::rtree t; std::vector v; + typedef typename bgi::rtree::indexable_type I; typedef typename bgi::rtree::box_type B; typedef typename bgi::traits::point_type::type P ; helpers::random_insert(t, v, 10, helpers::value_randomizer(10, 1)); - helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - - helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); - helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + tests_rtree_function_queries::type>::apply(t, v); } BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) @@ -291,36 +328,59 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_box2f) tests_rtree_function< val_t, bgi::rstar<4, 2> >(); } -//BOOST_AUTO_TEST_CASE(tests_rtree_function_point2f) -//{ -// std::cout << "tests/rtree_function_point2f\n"; -// -// namespace bg = boost::geometry; -// namespace bgi = bg::index; -// -// typedef bg::model::point P; -// typedef P val_t; -// -// tests_rtree_function< val_t, bgi::linear<4, 2> >(); -// tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); -// tests_rtree_function< val_t, bgi::rstar<4, 2> >(); -//} +BOOST_AUTO_TEST_CASE(tests_rtree_function_point2f) +{ + std::cout << "tests/rtree_function_point2f\n"; + namespace bg = boost::geometry; + namespace bgi = bg::index; - // std::cout << "std::pair\n"; - // { - // typedef bg::model::point P; - // typedef bg::model::box

B; - // typedef std::pair V; + typedef bg::model::point P; + typedef P val_t; - // bgi::rtree t; - // bgi::insert(t, V(B(P(0, 0), P(1, 1)), 0)); - // bgi::insert(t, V(B(P(2, 2), P(3, 3)), 1)); - // bgi::insert(t, V(B(P(4, 4), P(5, 5)), 2)); - // bgi::insert(t, V(B(P(6, 6), P(7, 7)), 3)); - // bgi::insert(t, V(B(P(8, 8), P(9, 9)), 4)); - // std::cerr << t; - // } + tests_rtree_function< val_t, bgi::linear<4, 2> >(); + tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); + tests_rtree_function< val_t, bgi::rstar<4, 2> >(); +} + +namespace helpers { + +template +struct value_randomizer< std::pair > +{ + typedef std::pair value_type; + + typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; + + inline value_randomizer(coord_t mm, coord_t ww) + : r(mm, ww) + {} + + inline value_type operator()() const + { + return std::make_pair(r(), ::rand()); + } + + value_randomizer r; +}; + +} // namespace helpers + +BOOST_AUTO_TEST_CASE(tests_rtree_function_pair_box2f_int) +{ + std::cout << "tests/rtree_function_pair_box2f_int\n"; + + namespace bg = boost::geometry; + namespace bgi = bg::index; + + typedef bg::model::point P; + typedef bg::model::box

B; + typedef std::pair V; + + tests_rtree_function< V, bgi::linear<4, 2> >(); + tests_rtree_function< V, bgi::quadratic<4, 2> >(); + tests_rtree_function< V, bgi::rstar<4, 2> >(); +} // std::cout << "-------------------------------------------------\n"; // std::cout << "-------------------------------------------------\n"; From 573b6958e11df95ef69bba92b247da1cc6b4f2eb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 18 Sep 2011 23:17:07 +0000 Subject: [PATCH 064/366] more rtree_function tests added. [SVN r74462] --- tests/rtree_function.hpp | 138 ++++++++++++++------------------------- 1 file changed, 48 insertions(+), 90 deletions(-) diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 0a05a9fca..eec1d22d6 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -278,17 +278,17 @@ struct tests_rtree_function_queries } }; -template -void tests_rtree_function() +template +void tests_rtree_function(Translator const& tr = Translator()) { namespace bg = boost::geometry; namespace bgi = bg::index; - bgi::rtree t; + bgi::rtree t(tr); std::vector v; - typedef typename bgi::rtree::indexable_type I; - typedef typename bgi::rtree::box_type B; + typedef typename bgi::rtree::indexable_type I; + typedef typename bgi::rtree::box_type B; typedef typename bgi::traits::point_type::type P ; helpers::random_insert(t, v, 10, helpers::value_randomizer(10, 1)); @@ -305,11 +305,11 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) typedef bg::model::point P; typedef bg::model::box

B; - typedef B val_t; + typedef B V; - tests_rtree_function< val_t, bgi::linear<4, 2> >(); - tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); - tests_rtree_function< val_t, bgi::rstar<4, 2> >(); + tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); } BOOST_AUTO_TEST_CASE(tests_rtree_function_box2f) @@ -321,11 +321,11 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_box2f) typedef bg::model::point P; typedef bg::model::box

B; - typedef B val_t; + typedef B V; - tests_rtree_function< val_t, bgi::linear<4, 2> >(); - tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); - tests_rtree_function< val_t, bgi::rstar<4, 2> >(); + tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); } BOOST_AUTO_TEST_CASE(tests_rtree_function_point2f) @@ -336,11 +336,11 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_point2f) namespace bgi = bg::index; typedef bg::model::point P; - typedef P val_t; + typedef P V; - tests_rtree_function< val_t, bgi::linear<4, 2> >(); - tests_rtree_function< val_t, bgi::quadratic<4, 2> >(); - tests_rtree_function< val_t, bgi::rstar<4, 2> >(); + tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); } namespace helpers { @@ -377,90 +377,48 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_pair_box2f_int) typedef bg::model::box

B; typedef std::pair V; - tests_rtree_function< V, bgi::linear<4, 2> >(); - tests_rtree_function< V, bgi::quadratic<4, 2> >(); - tests_rtree_function< V, bgi::rstar<4, 2> >(); + tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); } - // std::cout << "-------------------------------------------------\n"; - // std::cout << "-------------------------------------------------\n"; +namespace helpers { - // std::cout << "boost::shared_ptr< std::pair >\n"; - // { - // typedef bg::model::point P; - // typedef bg::model::box

B; - // - // typedef boost::shared_ptr< std::pair > V; +template +struct value_randomizer< boost::shared_ptr< std::pair > > +{ + typedef boost::shared_ptr< std::pair > value_type; - // V v1( new std::pair(B(P(0, 0), P(1, 1)), 0) ); - // V v2( new std::pair(B(P(2, 2), P(3, 3)), 1) ); - // V v3( new std::pair(B(P(4, 4), P(5, 5)), 2) ); - // V v4( new std::pair(B(P(6, 6), P(7, 7)), 3) ); - // V v5( new std::pair(B(P(8, 8), P(9, 9)), 4) ); + typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; - // bgi::rtree t; - // bgi::insert(t, v1); - // bgi::insert(t, v2); - // bgi::insert(t, v3); - // bgi::insert(t, v4); - // bgi::insert(t, v5); - // std::cerr << t; - // } + inline value_randomizer(coord_t mm, coord_t ww) + : r(mm, ww) + {} - // std::cout << "-------------------------------------------------\n"; - // std::cout << "-------------------------------------------------\n"; + inline value_type operator()() const + { + return value_type(new std::pair(r(), ::rand())); + } - // std::cout << "std::map::iterator\n"; - // { - // typedef bg::model::point P; - // typedef bg::model::box

B; - // - // typedef std::map::iterator V; + value_randomizer r; +}; - // std::map m; - // m.insert(std::pair(0, B(P(0, 0), P(1, 1)))); - // m.insert(std::pair(1, B(P(2, 2), P(3, 3)))); - // m.insert(std::pair(2, B(P(4, 4), P(5, 5)))); - // m.insert(std::pair(3, B(P(6, 6), P(7, 7)))); - // m.insert(std::pair(4, B(P(8, 8), P(9, 9)))); +} // namespace helpers - // bgi::rtree t; - // V vit = m.begin(); - // bgi::insert(t, vit++); - // bgi::insert(t, vit++); - // bgi::insert(t, vit++); - // bgi::insert(t, vit++); - // bgi::insert(t, vit); - // std::cerr << t; - // } +BOOST_AUTO_TEST_CASE(tests_rtree_function_shared_ptr_pair_box2f_int) +{ + std::cout << "tests/rtree_function_shared_ptr_pair_box2f_int\n"; - // std::cout << "-------------------------------------------------\n"; - // std::cout << "-------------------------------------------------\n"; + namespace bg = boost::geometry; + namespace bgi = bg::index; - // std::cout << "size_t\n"; - // { - // typedef bg::model::point P; - // typedef bg::model::box

B; + typedef bg::model::point P; + typedef bg::model::box

B; + typedef boost::shared_ptr< std::pair > V; - // typedef size_t V; - // typedef bgi::translator::index > Tr; - - // std::vector v; - // v.push_back(B(P(0, 0), P(1, 1))); - // v.push_back(B(P(2, 2), P(3, 3))); - // v.push_back(B(P(4, 4), P(5, 5))); - // v.push_back(B(P(6, 6), P(7, 7))); - // v.push_back(B(P(8, 8), P(9, 9))); - - //Tr tr(v); - // bgi::rtree t(tr); - - // bgi::insert(t, 0u); - // bgi::insert(t, 1u); - // bgi::insert(t, 2u); - // bgi::insert(t, 3u); - // bgi::insert(t, 4u); - // std::cerr << t; - // } + tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); + tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); +} #endif // TESTS_RTREE_FUNCTION_HPP From dca40d8822f7e450ee5be0fd37a3a56aa516725b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 21 Sep 2011 18:50:15 +0000 Subject: [PATCH 065/366] distance calculators that will be used in knn implemented, some names changed to more general in knn results wrappers. [SVN r74497] --- .../extensions/index/distance_calc.hpp | 188 ++++++++++++++++++ .../geometry/extensions/index/predicates.hpp | 6 +- .../index/rtree/visitors/nearest.hpp | 39 ++-- 3 files changed, 212 insertions(+), 21 deletions(-) create mode 100644 include/boost/geometry/extensions/index/distance_calc.hpp diff --git a/include/boost/geometry/extensions/index/distance_calc.hpp b/include/boost/geometry/extensions/index/distance_calc.hpp new file mode 100644 index 000000000..22001e2e0 --- /dev/null +++ b/include/boost/geometry/extensions/index/distance_calc.hpp @@ -0,0 +1,188 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - Spatial index distances calculators used in nearest query +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_CALC_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_CALC_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +//TODO: awulkiew - consider storing values instead of const references +// it may be faster and it eliminates problems with storing of references to temporaries + +struct distance_near_tag {}; +struct distance_far_tag {}; +struct distance_centroid_tag {}; + +template +struct distance_xxx + : nonassignable +{ + typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline explicit distance_xxx( + Point const& p, + coordinate_type const& distance_near = coordinate_type(0), + coordinate_type const& distance_far = std::numeric_limits::max() + ) + : point(p) + , comparable_near(distance_near * distance_near) + , comparable_far(distance_far * distance_far) + {} + + Point const& point; + distance_type comparable_near; + distance_type comparable_far; +}; + +} // namespace detail + +template +inline detail::distance_xxx +distance( + Point const& p, + typename index::traits::coordinate_type::type const& near + = typename index::traits::coordinate_type::type(0), + typename index::traits::coordinate_type::type const& far + = std::numeric_limits::type>::max() +) +{ + return detail::detail::distance_xxx(p, near, far); +} + +template +inline detail::distance_xxx +distance_near( + Point const& p, + typename index::traits::coordinate_type::type const& near + = typename index::traits::coordinate_type::type(0), + typename index::traits::coordinate_type::type const& far + = std::numeric_limits::type>::max() +) +{ + return detail::detail::distance_xxx(p, near, far); +} + +template +inline detail::distance_xxx +distance_far( + Point const& p, + typename index::traits::coordinate_type::type const& near + = typename index::traits::coordinate_type::type(0), + typename index::traits::coordinate_type::type const& far + = std::numeric_limits::type>::max() + ) +{ + return detail::detail::distance_xxx(p, near, far); +} + +template +inline detail::distance_xxx +distance_centroid( + Point const& p, + typename index::traits::coordinate_type::type const& near + = typename index::traits::coordinate_type::type(0), + typename index::traits::coordinate_type::type const& far + = std::numeric_limits::type>::max() + ) +{ + return detail::detail::distance_xxx(p, near, far); +} + +namespace detail +{ + +template +struct distance_calc +{ + typedef typename geometry::default_distance_result::type distance_type; + + static inline distance_type apply(Point const& p, Indexable const& i) + { + return index::mindist(p, i); + } +}; + +template +struct distance_calc< + detail::distance_xxx, + Indexable> +{ + typedef typename geometry::default_distance_result::type distance_type; + + static inline distance_type apply( + detail::distance_xxx const& d, + Indexable const& i) + { + return index::mindist(d.point, i); + } +}; + +// TODO distance_centroid + +template +struct distance_calc< + detail::distance_xxx, + Indexable> +{ + typedef typename geometry::default_distance_result::type distance_type; + + static inline distance_type apply( + detail::distance_xxx const& d, + Indexable const& i) + { + return index::maxdist(d.point, i); + } +}; + +template +struct is_distance_ok +{ + template + static inline bool apply(Point const&, DistanceType const&) + { + return true; + } +}; + +template +struct is_distance_ok< detail::distance_xxx > +{ + template + static inline bool apply( + detail::distance_xxx const& dx, + DistanceType const& d) + { + return dx.comparable_near <= d && d <= dx.comparable_far; + } +}; + +} // namespace detail + +template +inline typename detail::distance_calc::distance_type +distance_calc(PointData const& p, Indexable const& i) +{ + return detail::distance_calc + ::apply(p, i); +} + +template +inline bool +is_distance_ok(PointData const& p, DistanceType const& d) +{ + return detail::is_distance_ok + ::apply(p, d); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_CALC_HPP diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index fa82bfb29..6ce3d3667 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -96,7 +96,11 @@ namespace detail // predicate check -// TODO: use empty definitions here + MPL_ASSERT +// TODO: use empty definitions here + MPL_ASSERT ? +// implement default values predicates applied to values in leafs, as a function/functor as simple as possible +// bool fun(Value const& v); +// distinguish between geometries and other types by use of geometry::tag +// in predicate_check_default<..., GeomTag> -> predicate_check_default<..., void> template struct predicate_check diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 27f5b4c72..2f540c439 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -14,6 +14,8 @@ #include #include +#include + #include namespace boost { namespace geometry { namespace index { @@ -32,37 +34,37 @@ public: typedef typename geometry::default_distance_result::type distance_type; inline nearest_one() - : comp_mindist(std::numeric_limits::max()) + : comp_dist(std::numeric_limits::max()) {} - inline void store(Value const& val, distance_type const& curr_mindist) + inline void store(Value const& val, distance_type const& curr_comp_dist) { - if ( curr_mindist < comp_mindist ) + if ( curr_comp_dist < comp_dist ) { - comp_mindist = curr_mindist; + comp_dist = curr_mindist; value = val; } } - inline bool is_mindist_valid() const + inline bool is_comparable_distance_valid() const { - return comp_mindist < std::numeric_limits::max(); + return comp_dist < std::numeric_limits::max(); } - inline distance_type mindist() const + inline distance_type comparable_distance() const { - return comp_mindist; + return comp_dist; } inline size_t get(Value & v) { v = value; - return is_mindist_valid() ? 1 : 0; + return is_comparable_distance_valid() ? 1 : 0; } private: Value value; - distance_type comp_mindist; + distance_type comp_dist; }; template @@ -79,9 +81,9 @@ public: m_neighbors.reserve(m_count + 1); } - inline void store(Value const& val, distance_type const& curr_mindist) + inline void store(Value const& val, distance_type const& curr_comp_dist) { - m_neighbors.push_back(std::make_pair(curr_mindist, val)); + m_neighbors.push_back(std::make_pair(curr_comp_dist, val)); std::sort(m_neighbors.begin(), m_neighbors.end(), neighbors_less); if ( m_count < m_neighbors.size() ) @@ -93,12 +95,12 @@ public: // check the furthest distance at the first place, before push_back() } - inline bool is_mindist_valid() const + inline bool is_comparable_distance_valid() const { return m_neighbors.size() == m_count; } - inline distance_type mindist() const + inline distance_type comparable_distance() const { return m_neighbors.size() < m_count ? std::numeric_limits::max() : @@ -134,10 +136,7 @@ template < typename Box, typename Point, typename Predicates, - typename Result = typename geometry::default_distance_result< - Point, - typename Translator::indexable_type - >::type + typename Result > class nearest : public rtree::visitor::type @@ -230,11 +229,11 @@ private: inline void prune_nodes(ActiveBranchList & abl) const { // if some value were found - if ( m_result.is_mindist_valid() ) + if ( m_result.is_comparable_distance_valid() ) { // prune if box's mindist is further than value's mindist while ( !abl.empty() && - m_result.mindist() < abl.back().first ) + m_result.comparable_distance() < abl.back().first ) { abl.pop_back(); } From 99b3f7b60ad64635302157a828a1bb4c787e0fc6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Sep 2011 11:34:02 +0000 Subject: [PATCH 066/366] some todo comments added, names changed [SVN r74510] --- .../extensions/index/distance_calc.hpp | 43 +++++++++++++++---- .../index/rtree/visitors/nearest.hpp | 8 ++-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/include/boost/geometry/extensions/index/distance_calc.hpp b/include/boost/geometry/extensions/index/distance_calc.hpp index 22001e2e0..babf8b3e3 100644 --- a/include/boost/geometry/extensions/index/distance_calc.hpp +++ b/include/boost/geometry/extensions/index/distance_calc.hpp @@ -119,10 +119,10 @@ struct distance_calc< typedef typename geometry::default_distance_result::type distance_type; static inline distance_type apply( - detail::distance_xxx const& d, + detail::distance_xxx const& dx, Indexable const& i) { - return index::mindist(d.point, i); + return index::mindist(dx.point, i); } }; @@ -136,15 +136,15 @@ struct distance_calc< typedef typename geometry::default_distance_result::type distance_type; static inline distance_type apply( - detail::distance_xxx const& d, + detail::distance_xxx const& dx, Indexable const& i) { - return index::maxdist(d.point, i); + return index::maxdist(dx.point, i); } }; template -struct is_distance_ok +struct distance_comp { template static inline bool apply(Point const&, DistanceType const&) @@ -154,7 +154,7 @@ struct is_distance_ok }; template -struct is_distance_ok< detail::distance_xxx > +struct distance_comp< detail::distance_xxx > { template static inline bool apply( @@ -165,6 +165,33 @@ struct is_distance_ok< detail::distance_xxx > } }; +// TODO: awulkiew - pruning for nodes! +// if 0 < comp_near node is pruned if maxdist(point, node_box) < comp_near +// if comp_far < INF node is pruned if comp_far < min_dist(point, node_box) +// still nodes must be sorted by min_dist(point, node_box) + +// for values, proper distance values are calculated min, max or centroid +// and tested with comp_near and/or comp_far + +// implement versions with only one comp or without comp distances? +// less tests == speed increase +// near_between, near_lesser, near_greater +// far_xxx +// centroid_xxx, center_xxx + +// distance_range, distance_bound, distance_upper_bound + +// distance_between - now distance_xxx +// distance_xxxxxx +// distance_point_only + +// distance_calc for each +// distance_comp for each class and xxxxxx + +// + something in case of nodes +// additional calculation of maxdist in case of distance_between and +// distance_xxxxx + } // namespace detail template @@ -177,9 +204,9 @@ distance_calc(PointData const& p, Indexable const& i) template inline bool -is_distance_ok(PointData const& p, DistanceType const& d) +distance_comp(PointData const& p, DistanceType const& d) { - return detail::is_distance_ok + return detail::distance_comp ::apply(p, d); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 2f540c439..2cb080866 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -134,7 +134,7 @@ template < typename Options, typename Translator, typename Box, - typename Point, + typename PointData, typename Predicates, typename Result > @@ -149,8 +149,8 @@ public: typedef typename geometry::default_distance_result::type node_distance_type; - inline nearest(Translator const& t, Point const& pt, Predicates const& pr, Result & r) - : m_tr(t), m_point(pt), m_pred(pr) + inline nearest(Translator const& t, PointData const& point_data, Predicates const& pr, Result & r) + : m_tr(t), m_point_data(point_data), m_pred(pr) , m_result(r) {} @@ -241,7 +241,7 @@ private: } Translator const& m_tr; - Point const& m_point; + Point const& m_point_data; Predicates const& m_pred; Result & m_result; From 9de013a3a1b2627a346fa682a6389adc7557baea Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Sep 2011 18:21:22 +0000 Subject: [PATCH 067/366] knn distance calculators added + naming errors fixed [SVN r74519] --- .../extensions/index/distance_calc.hpp | 305 +++++++++++------- .../index/rtree/visitors/nearest.hpp | 10 +- tests/main.cpp | 6 +- tests/rtree_filters.hpp | 2 + tests/rtree_function.hpp | 10 + tests/translators.hpp | 2 + 6 files changed, 220 insertions(+), 115 deletions(-) diff --git a/include/boost/geometry/extensions/index/distance_calc.hpp b/include/boost/geometry/extensions/index/distance_calc.hpp index babf8b3e3..1e9440e43 100644 --- a/include/boost/geometry/extensions/index/distance_calc.hpp +++ b/include/boost/geometry/extensions/index/distance_calc.hpp @@ -17,155 +17,259 @@ namespace detail { //TODO: awulkiew - consider storing values instead of const references // it may be faster and it eliminates problems with storing of references to temporaries +// data + struct distance_near_tag {}; struct distance_far_tag {}; struct distance_centroid_tag {}; +struct distance_min_tag {}; +struct distance_max_tag {}; + template -struct distance_xxx +struct distance_unbounded + : nonassignable +{ + typedef typename index::traits::coordinate_type::type coordinate_type; + + inline explicit distance_unbounded(Point const& p) + : point(p) + {} + + Point const& point; +}; + +template +struct distance_half_bounded : nonassignable { typedef typename index::traits::coordinate_type::type coordinate_type; typedef typename geometry::default_distance_result::type distance_type; - inline explicit distance_xxx( - Point const& p, - coordinate_type const& distance_near = coordinate_type(0), - coordinate_type const& distance_far = std::numeric_limits::max() - ) + inline explicit distance_half_bounded(Point const& p, coordinate_type const& distance_limit) : point(p) - , comparable_near(distance_near * distance_near) - , comparable_far(distance_far * distance_far) + , comparable_limit(distance_limit * distance_limit) {} Point const& point; - distance_type comparable_near; - distance_type comparable_far; + distance_type comparable_limit; +}; + +template +struct distance_bounded + : nonassignable +{ + typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline explicit distance_bounded(Point const& p, coordinate_type const& distance_min, coordinate_type const& distance_max) + : point(p) + , comparable_min(distance_min * distance_min) + , comparable_max(distance_max * distance_max) + {} + + Point const& point; + distance_type comparable_min; + distance_type comparable_max; }; } // namespace detail +// generators + template -inline detail::distance_xxx -distance( - Point const& p, - typename index::traits::coordinate_type::type const& near - = typename index::traits::coordinate_type::type(0), - typename index::traits::coordinate_type::type const& far - = std::numeric_limits::type>::max() -) +inline detail::distance_unbounded +distance_near(Point const& p) { - return detail::detail::distance_xxx(p, near, far); + return detail::detail::distance_unbounded(p); } template -inline detail::distance_xxx +inline detail::distance_unbounded +distance_far(Point const& p) +{ + return detail::detail::distance_unbounded(p); +} + +template +inline detail::distance_unbounded +distance_centroid(Point const& p) +{ + return detail::detail::distance_unbounded(p); +} + +template +inline detail::distance_half_bounded distance_near( Point const& p, - typename index::traits::coordinate_type::type const& near - = typename index::traits::coordinate_type::type(0), - typename index::traits::coordinate_type::type const& far - = std::numeric_limits::type>::max() -) + typename index::traits::coordinate_type::type const& distance_min) { - return detail::detail::distance_xxx(p, near, far); + return detail::detail::distance_half_bounded(p, distance_min); } template -inline detail::distance_xxx +inline detail::distance_half_bounded distance_far( Point const& p, - typename index::traits::coordinate_type::type const& near - = typename index::traits::coordinate_type::type(0), - typename index::traits::coordinate_type::type const& far - = std::numeric_limits::type>::max() - ) + typename index::traits::coordinate_type::type const& distance_min) { - return detail::detail::distance_xxx(p, near, far); + return detail::detail::distance_half_bounded(p, distance_min); } template -inline detail::distance_xxx +inline detail::distance_half_bounded distance_centroid( Point const& p, - typename index::traits::coordinate_type::type const& near - = typename index::traits::coordinate_type::type(0), - typename index::traits::coordinate_type::type const& far - = std::numeric_limits::type>::max() - ) + typename index::traits::coordinate_type::type const& distance_min) { - return detail::detail::distance_xxx(p, near, far); + return detail::detail::distance_half_bounded(p, distance_min); } +template +inline detail::distance_bounded +distance_near( + Point const& p, + typename index::traits::coordinate_type::type const& distance_min, + typename index::traits::coordinate_type::type const& distance_max) +{ + return detail::detail::distance_bounded(p, distance_min, distance_max); +} + +template +inline detail::distance_bounded +distance_far( + Point const& p, + typename index::traits::coordinate_type::type const& distance_min, + typename index::traits::coordinate_type::type const& distance_max) +{ + return detail::detail::distance_bounded(p, distance_min, distance_max); +} + +template +inline detail::distance_bounded +distance_centroid( + Point const& p, + typename index::traits::coordinate_type::type const& distance_min, + typename index::traits::coordinate_type::type const& distance_max) +{ + return detail::detail::distance_bounded(p, distance_min, distance_max); +} + +// algorithms + namespace detail { -template -struct distance_calc -{ - typedef typename geometry::default_distance_result::type distance_type; +// TODO: +// to use it properly in case of rtree nodes there must be additional template parameter added: Tag +// and typedef ... result_type - in case of bounded distance or half-bounded min maxdist must be calculated as well - static inline distance_type apply(Point const& p, Indexable const& i) +// distance_calc_result::type or distance_calc::result_type +// sorting is needed only in rtree nodes so it shouldn't be here, use detail::rtree instead +// should comp be here or only in detail::rtree? + +// in addition, maby don't use Tag, just implement different structure in detail::rtree specialized for rtree? +// in addition, maby don't use Tag in predicates? + +// rename distance_calc -> comparable_distance_calc ? or calculate_comparable_distance or distance_data_calc? + +template +struct distance_calc_impl +{ + // TODO MPL_ASSERT +}; + +template +struct distance_calc_impl +{ + typedef typename geometry::default_distance_result::type result_type; + + static inline result_type apply(Point const& p, Indexable const& i) { return index::mindist(p, i); } }; template -struct distance_calc< - detail::distance_xxx, - Indexable> +struct distance_calc_impl { - typedef typename geometry::default_distance_result::type distance_type; + typedef typename geometry::default_distance_result::type result_type; - static inline distance_type apply( - detail::distance_xxx const& dx, + static inline result_type apply(Point const& p, Indexable const& i) + { + return index::maxdist(p, i); + } +}; + +// TODO distance_calc_impl +// rename: +// mindist -> comparable_distance_near +// maxdist -> comparable_distance_far +// add comparable_distance_centroid + +template +struct distance_calc +{ + typedef typename geometry::default_distance_result::type result_type; + + static inline result_type apply(Point const& p, Indexable const& i) + { + return index::mindist(p, i); + } +}; + +template +struct distance_calc< + detail::distance_unbounded, + Indexable, + Tag> +{ + typedef typename distance_calc_impl::result_type result_type; + + static inline result_type apply( + detail::distance_unbounded const& dx, Indexable const& i) { - return index::mindist(dx.point, i); + return distance_calc_impl::apply(dx.point, i); } }; -// TODO distance_centroid - -template +template struct distance_calc< - detail::distance_xxx, - Indexable> + detail::distance_half_bounded, + Indexable, + Tag> { - typedef typename geometry::default_distance_result::type distance_type; + typedef typename distance_calc_impl::result_type result_type; - static inline distance_type apply( - detail::distance_xxx const& dx, + static inline result_type apply( + detail::distance_half_bounded const& dx, Indexable const& i) { - return index::maxdist(dx.point, i); + return distance_calc_impl::apply(dx.point, i); } }; -template -struct distance_comp +template +struct distance_calc< + detail::distance_bounded, + Indexable, + Tag> { - template - static inline bool apply(Point const&, DistanceType const&) + typedef typename distance_calc_impl::result_type result_type; + + static inline result_type apply( + detail::distance_bounded const& dx, + Indexable const& i) { - return true; + return distance_calc_impl::apply(dx.point, i); } }; -template -struct distance_comp< detail::distance_xxx > -{ - template - static inline bool apply( - detail::distance_xxx const& dx, - DistanceType const& d) - { - return dx.comparable_near <= d && d <= dx.comparable_far; - } -}; +// TODO distance_comp +// move distance_calc and distance_comp into geometry::index ? -// TODO: awulkiew - pruning for nodes! +// TODO: awulkiew - pruning for nodes! <- inside detail::rtree so NOT HERE // if 0 < comp_near node is pruned if maxdist(point, node_box) < comp_near // if comp_far < INF node is pruned if comp_far < min_dist(point, node_box) // still nodes must be sorted by min_dist(point, node_box) @@ -173,42 +277,27 @@ struct distance_comp< detail::distance_xxx > // for values, proper distance values are calculated min, max or centroid // and tested with comp_near and/or comp_far -// implement versions with only one comp or without comp distances? -// less tests == speed increase -// near_between, near_lesser, near_greater -// far_xxx -// centroid_xxx, center_xxx - -// distance_range, distance_bound, distance_upper_bound - -// distance_between - now distance_xxx -// distance_xxxxxx -// distance_point_only - -// distance_calc for each -// distance_comp for each class and xxxxxx - // + something in case of nodes // additional calculation of maxdist in case of distance_between and // distance_xxxxx } // namespace detail -template -inline typename detail::distance_calc::distance_type -distance_calc(PointData const& p, Indexable const& i) -{ - return detail::distance_calc - ::apply(p, i); -} - -template -inline bool -distance_comp(PointData const& p, DistanceType const& d) -{ - return detail::distance_comp - ::apply(p, d); -} +//template +//inline typename detail::distance_calc::distance_type +//distance_calc(PointData const& p, Indexable const& i) +//{ +// return detail::distance_calc +// ::apply(p, i); +//} +// +//template +//inline bool +//distance_comp(PointData const& p, DistanceType const& d) +//{ +// return detail::distance_comp +// ::apply(p, d); +//} }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 2cb080866..81db2ac69 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include @@ -147,7 +147,7 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename geometry::default_distance_result::type node_distance_type; + typedef typename geometry::default_distance_result::type node_distance_type; inline nearest(Translator const& t, PointData const& point_data, Predicates const& pr, Result & r) : m_tr(t), m_point_data(point_data), m_pred(pr) @@ -175,7 +175,7 @@ public: if ( index::predicates_check(m_pred, it->first) ) { active_branch_list.push_back( - std::make_pair(index::mindist(m_point, it->first), it->second) + std::make_pair(index::mindist(m_point_data, it->first), it->second) ); } } @@ -212,7 +212,7 @@ public: if ( index::predicates_check(m_pred, m_tr(*it)) ) { // store value - m_result.store(*it, index::mindist(m_point, m_tr(*it))); + m_result.store(*it, index::mindist(m_point_data, m_tr(*it))); } } } @@ -241,7 +241,7 @@ private: } Translator const& m_tr; - Point const& m_point_data; + PointData const& m_point_data; Predicates const& m_pred; Result & m_result; diff --git a/tests/main.cpp b/tests/main.cpp index 95dbe698f..5147bf322 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -17,13 +17,15 @@ BOOST_AUTO_TEST_CASE( first_test_case ) ::srand( (unsigned)::time(NULL) ); } +//#define TEST_PRINT_INFO + #include #include -#include +//#include BOOST_AUTO_TEST_CASE( last_test_case ) { - tests_rtree_filters_hpp(); + //tests_rtree_filters_hpp(); #ifdef _MSC_VER std::cin.get(); diff --git a/tests/rtree_filters.hpp b/tests/rtree_filters.hpp index 28decfd08..98461a1d3 100644 --- a/tests/rtree_filters.hpp +++ b/tests/rtree_filters.hpp @@ -31,7 +31,9 @@ void tests_rtree_filters_hpp_print_range(R const& r) void tests_rtree_filters_hpp() { +#ifdef TEST_PRINT_INFO std::cout << "tests/rtree_filters.hpp\n"; +#endif typedef boost::geometry::model::point P; typedef boost::geometry::model::box

B; diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index eec1d22d6..e41168f92 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -298,7 +298,9 @@ void tests_rtree_function(Translator const& tr = Translator()) BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) { +#ifdef TEST_PRINT_INFO std::cout << "tests/rtree_function_box3f\n"; +#endif namespace bg = boost::geometry; namespace bgi = bg::index; @@ -314,7 +316,9 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) BOOST_AUTO_TEST_CASE(tests_rtree_function_box2f) { +#ifdef TEST_PRINT_INFO std::cout << "tests/rtree_function_box2f\n"; +#endif namespace bg = boost::geometry; namespace bgi = bg::index; @@ -330,7 +334,9 @@ BOOST_AUTO_TEST_CASE(tests_rtree_function_box2f) BOOST_AUTO_TEST_CASE(tests_rtree_function_point2f) { +#ifdef TEST_PRINT_INFO std::cout << "tests/rtree_function_point2f\n"; +#endif namespace bg = boost::geometry; namespace bgi = bg::index; @@ -368,7 +374,9 @@ struct value_randomizer< std::pair > BOOST_AUTO_TEST_CASE(tests_rtree_function_pair_box2f_int) { +#ifdef TEST_PRINT_INFO std::cout << "tests/rtree_function_pair_box2f_int\n"; +#endif namespace bg = boost::geometry; namespace bgi = bg::index; @@ -407,7 +415,9 @@ struct value_randomizer< boost::shared_ptr< std::pair > > BOOST_AUTO_TEST_CASE(tests_rtree_function_shared_ptr_pair_box2f_int) { +#ifdef TEST_PRINT_INFO std::cout << "tests/rtree_function_shared_ptr_pair_box2f_int\n"; +#endif namespace bg = boost::geometry; namespace bgi = bg::index; diff --git a/tests/translators.hpp b/tests/translators.hpp index 98396675a..827b59aff 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -34,7 +34,9 @@ struct tests_translators_val BOOST_AUTO_TEST_CASE(tests_translators) { +#ifdef TEST_PRINT_INFO std::cout << "tests/translators\n"; +#endif namespace bg = boost::geometry; namespace bgm = bg::model; From 528d112c9c52183769804a75c402a4a5721d63eb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Sep 2011 18:30:17 +0000 Subject: [PATCH 068/366] fixed: memory leak in rtree destructor [SVN r74520] --- include/boost/geometry/extensions/index/rtree/rtree.hpp | 3 +++ tests/main.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 70c306bc6..2088782fd 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -75,6 +75,9 @@ public: { detail::rtree::visitors::destroy del_v; detail::rtree::apply_visitor(del_v, *m_root); + + // TODO: awulkiew - move this into the destroy visitor? + detail::rtree::delete_node(m_root); } template diff --git a/tests/main.cpp b/tests/main.cpp index 5147bf322..c7e76984e 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -17,15 +17,15 @@ BOOST_AUTO_TEST_CASE( first_test_case ) ::srand( (unsigned)::time(NULL) ); } -//#define TEST_PRINT_INFO +#define TEST_PRINT_INFO #include #include -//#include +#include BOOST_AUTO_TEST_CASE( last_test_case ) { - //tests_rtree_filters_hpp(); + tests_rtree_filters_hpp(); #ifdef _MSC_VER std::cin.get(); From d2ec53ab4e8f85333f7115264eadc89b7261e727 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Sep 2011 21:51:21 +0000 Subject: [PATCH 069/366] some names changed, namespace error fixed [SVN r74524] --- .../extensions/index/distance_calc.hpp | 18 +++++++++--------- .../index/rtree/visitors/nearest.hpp | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/boost/geometry/extensions/index/distance_calc.hpp b/include/boost/geometry/extensions/index/distance_calc.hpp index 1e9440e43..ecc48176e 100644 --- a/include/boost/geometry/extensions/index/distance_calc.hpp +++ b/include/boost/geometry/extensions/index/distance_calc.hpp @@ -81,21 +81,21 @@ template inline detail::distance_unbounded distance_near(Point const& p) { - return detail::detail::distance_unbounded(p); + return detail::distance_unbounded(p); } template inline detail::distance_unbounded distance_far(Point const& p) { - return detail::detail::distance_unbounded(p); + return detail::distance_unbounded(p); } template inline detail::distance_unbounded distance_centroid(Point const& p) { - return detail::detail::distance_unbounded(p); + return detail::distance_unbounded(p); } template @@ -104,7 +104,7 @@ distance_near( Point const& p, typename index::traits::coordinate_type::type const& distance_min) { - return detail::detail::distance_half_bounded(p, distance_min); + return detail::distance_half_bounded(p, distance_min); } template @@ -113,7 +113,7 @@ distance_far( Point const& p, typename index::traits::coordinate_type::type const& distance_min) { - return detail::detail::distance_half_bounded(p, distance_min); + return detail::distance_half_bounded(p, distance_min); } template @@ -122,7 +122,7 @@ distance_centroid( Point const& p, typename index::traits::coordinate_type::type const& distance_min) { - return detail::detail::distance_half_bounded(p, distance_min); + return detail::distance_half_bounded(p, distance_min); } template @@ -132,7 +132,7 @@ distance_near( typename index::traits::coordinate_type::type const& distance_min, typename index::traits::coordinate_type::type const& distance_max) { - return detail::detail::distance_bounded(p, distance_min, distance_max); + return detail::distance_bounded(p, distance_min, distance_max); } template @@ -142,7 +142,7 @@ distance_far( typename index::traits::coordinate_type::type const& distance_min, typename index::traits::coordinate_type::type const& distance_max) { - return detail::detail::distance_bounded(p, distance_min, distance_max); + return detail::distance_bounded(p, distance_min, distance_max); } template @@ -152,7 +152,7 @@ distance_centroid( typename index::traits::coordinate_type::type const& distance_min, typename index::traits::coordinate_type::type const& distance_max) { - return detail::detail::distance_bounded(p, distance_min, distance_max); + return detail::distance_bounded(p, distance_min, distance_max); } // algorithms diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 81db2ac69..dc1041d8f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -34,37 +34,37 @@ public: typedef typename geometry::default_distance_result::type distance_type; inline nearest_one() - : comp_dist(std::numeric_limits::max()) + : m_comp_dist(std::numeric_limits::max()) {} inline void store(Value const& val, distance_type const& curr_comp_dist) { - if ( curr_comp_dist < comp_dist ) + if ( curr_comp_dist < m_comp_dist ) { - comp_dist = curr_mindist; - value = val; + m_comp_dist = curr_comp_dist; + m_value = val; } } inline bool is_comparable_distance_valid() const { - return comp_dist < std::numeric_limits::max(); + return m_comp_dist < std::numeric_limits::max(); } inline distance_type comparable_distance() const { - return comp_dist; + return m_comp_dist; } inline size_t get(Value & v) { - v = value; + v = m_value; return is_comparable_distance_valid() ? 1 : 0; } private: - Value value; - distance_type comp_dist; + Value m_value; + distance_type m_comp_dist; }; template From 5989892e82f1faff13d3c44a016e6b7b4a6a8903 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Sep 2011 23:16:20 +0000 Subject: [PATCH 070/366] comparable distance calculating algorithms names changed [SVN r74528] --- .../comparable_distance_centroid.hpp | 80 +++++++++++++++++++ ...axdist.hpp => comparable_distance_far.hpp} | 16 ++-- ...ndist.hpp => comparable_distance_near.hpp} | 18 ++--- .../index/algorithms/minmaxdist.hpp | 3 +- .../extensions/index/distance_calc.hpp | 78 ++++++++++-------- .../index/rtree/visitors/nearest.hpp | 16 ++-- tests/additional_sizes_and_times.cpp | 2 +- tests/rtree_function.hpp | 3 +- 8 files changed, 156 insertions(+), 60 deletions(-) create mode 100644 include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp rename include/boost/geometry/extensions/index/algorithms/{maxdist.hpp => comparable_distance_far.hpp} (79%) rename include/boost/geometry/extensions/index/algorithms/{mindist.hpp => comparable_distance_near.hpp} (77%) diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp new file mode 100644 index 000000000..156edece2 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp @@ -0,0 +1,80 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - squared distance between point and centroid of the box or point +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +struct comparable_distance_centroid_tag {}; + +template < + typename Point, + typename PointIndexable, + size_t N> +struct sum_for_indexable +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, PointIndexable const& i) + { + return geometry::comparable_distance(pt, i); + } +}; + +template < + typename Point, + typename BoxIndexable, + size_t DimensionIndex> +struct sum_for_indexable_dimension +{ + typedef typename geometry::default_distance_result::type result_type; + + inline static result_type apply(Point const& pt, BoxIndexable const& i) + { + typedef typename index::traits::coordinate_type::type point_coord_t; + typedef typename index::traits::coordinate_type::type indexable_coord_t; + + point_coord_t pt_c = geometry::get(pt); + indexable_coord_t ind_c_min = geometry::get(i); + indexable_coord_t ind_c_max = geometry::get(i); + + indexable_coord_t ind_c_avg = ind_c_min + (ind_c_max - ind_c_min) / 2; + // TODO: awulkiew - is (ind_c_min + ind_c_max) / 2 safe? + + result_type diff = detail::diff_abs(ind_c_avg, pt_c); + + return diff * diff; + } +}; + +} // namespace detail + +template +typename geometry::default_distance_result::type +comparable_distance_centroid(Point const& pt, Indexable const& i) +{ + return detail::sum_for_indexable< + Point, + Indexable, + typename index::traits::tag::type, + detail::comparable_distance_centroid_tag, + index::traits::dimension::value + >::apply(pt, i); +} + +}}} // namespace boost::geometry::index + +#endif // #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP + diff --git a/include/boost/geometry/extensions/index/algorithms/maxdist.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp similarity index 79% rename from include/boost/geometry/extensions/index/algorithms/maxdist.hpp rename to include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp index b207d271d..a80e98e3b 100644 --- a/include/boost/geometry/extensions/index/algorithms/maxdist.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp @@ -1,14 +1,14 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - maxdist used in R-tree k nearest neighbors query +// Boost.Index - squared distance between point and furthest point of the box or point // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP #include #include @@ -19,13 +19,13 @@ namespace detail { // minmaxdist component -struct maxdist_tag {}; +struct comparable_distance_far_tag {}; template < typename Point, typename BoxIndexable, size_t DimensionIndex> -struct sum_for_indexable_dimension +struct sum_for_indexable_dimension { typedef typename geometry::default_distance_result::type result_type; @@ -53,17 +53,17 @@ struct sum_for_indexable_dimension typename geometry::default_distance_result::type -maxdist(Point const& pt, Indexable const& i) +comparable_distance_far(Point const& pt, Indexable const& i) { return detail::sum_for_indexable< Point, Indexable, typename index::traits::tag::type, - detail::maxdist_tag, + detail::comparable_distance_far_tag, index::traits::dimension::value >::apply(pt, i); } }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/mindist.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp similarity index 77% rename from include/boost/geometry/extensions/index/algorithms/mindist.hpp rename to include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp index 15e86c278..a6021c82e 100644 --- a/include/boost/geometry/extensions/index/algorithms/mindist.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp @@ -1,14 +1,14 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - mindist used in R-tree k nearest neighbors query +// Boost.Index - squared distance between point and nearest point of the box or point // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP #include @@ -16,13 +16,13 @@ namespace boost { namespace geometry { namespace index { namespace detail { -struct mindist_tag {}; +struct comparable_distance_near_tag {}; template < typename Point, typename PointIndexable, size_t N> -struct sum_for_indexable +struct sum_for_indexable { typedef typename geometry::default_distance_result::type result_type; @@ -36,7 +36,7 @@ template < typename Point, typename BoxIndexable, size_t DimensionIndex> -struct sum_for_indexable_dimension +struct sum_for_indexable_dimension { typedef typename geometry::default_distance_result::type result_type; @@ -64,17 +64,17 @@ struct sum_for_indexable_dimension typename geometry::default_distance_result::type -mindist(Point const& pt, Indexable const& i) +comparable_distance_near(Point const& pt, Indexable const& i) { return detail::sum_for_indexable< Point, Indexable, typename index::traits::tag::type, - detail::mindist_tag, + detail::comparable_distance_near_tag, index::traits::dimension::value >::apply(pt, i); } }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp index 815ceefab..d7ed6d0f0 100644 --- a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp +++ b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp @@ -39,7 +39,8 @@ struct smallest_for_indexable_dimension(i); indexable_coord_t ind_c_max = geometry::get(i); - indexable_coord_t ind_c_avg = (ind_c_min + ind_c_max) / 2; + indexable_coord_t ind_c_avg = ind_c_min + (ind_c_max - ind_c_min) / 2; + // TODO: awulkiew - is (ind_c_min + ind_c_max) / 2 safe? // TODO: awulkiew - optimize! don't calculate 2x pt_c <= ind_c_avg // take particular case pt_c == ind_c_avg into account diff --git a/include/boost/geometry/extensions/index/distance_calc.hpp b/include/boost/geometry/extensions/index/distance_calc.hpp index ecc48176e..d2a1b286d 100644 --- a/include/boost/geometry/extensions/index/distance_calc.hpp +++ b/include/boost/geometry/extensions/index/distance_calc.hpp @@ -160,6 +160,48 @@ distance_centroid( namespace detail { +template +struct distance_calc_impl +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (distance_calc_impl)); +}; + +template +struct distance_calc_impl +{ + typedef typename geometry::default_distance_result::type result_type; + + static inline result_type apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_near(p, i); + } +}; + +template +struct distance_calc_impl +{ + typedef typename geometry::default_distance_result::type result_type; + + static inline result_type apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_far(p, i); + } +}; + +template +struct distance_calc_impl +{ + typedef typename geometry::default_distance_result::type result_type; + + static inline result_type apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_centroid(p, i); + } +}; + // TODO: // to use it properly in case of rtree nodes there must be additional template parameter added: Tag // and typedef ... result_type - in case of bounded distance or half-bounded min maxdist must be calculated as well @@ -173,40 +215,6 @@ namespace detail // rename distance_calc -> comparable_distance_calc ? or calculate_comparable_distance or distance_data_calc? -template -struct distance_calc_impl -{ - // TODO MPL_ASSERT -}; - -template -struct distance_calc_impl -{ - typedef typename geometry::default_distance_result::type result_type; - - static inline result_type apply(Point const& p, Indexable const& i) - { - return index::mindist(p, i); - } -}; - -template -struct distance_calc_impl -{ - typedef typename geometry::default_distance_result::type result_type; - - static inline result_type apply(Point const& p, Indexable const& i) - { - return index::maxdist(p, i); - } -}; - -// TODO distance_calc_impl -// rename: -// mindist -> comparable_distance_near -// maxdist -> comparable_distance_far -// add comparable_distance_centroid - template struct distance_calc { @@ -214,7 +222,7 @@ struct distance_calc static inline result_type apply(Point const& p, Indexable const& i) { - return index::mindist(p, i); + return index::comparable_distance_near(p, i); } }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index dc1041d8f..00772d33e 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -10,9 +10,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP -#include -#include -#include +#include +#include +#include #include @@ -175,7 +175,10 @@ public: if ( index::predicates_check(m_pred, it->first) ) { active_branch_list.push_back( - std::make_pair(index::mindist(m_point_data, it->first), it->second) + std::make_pair( + index::comparable_distance_near(m_point_data, it->first), + it->second + ) ); } } @@ -212,7 +215,10 @@ public: if ( index::predicates_check(m_pred, m_tr(*it)) ) { // store value - m_result.store(*it, index::mindist(m_point_data, m_tr(*it))); + m_result.store( + *it, + index::comparable_distance_near(m_point_data, m_tr(*it)) + ); } } } diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 82f1736cc..384dc1ab8 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -273,7 +273,7 @@ int main() it != v.end(); ++it ) { - distance_type cd = bgi::mindist(P(x, y), it->first); + distance_type cd = bgi::comparable_distance_near(P(x, y), it->first); if ( cd < dist ) { diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index e41168f92..0f229d8d1 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -182,7 +182,8 @@ namespace helpers template bool operator()(Value const& v1, Value const& v2) { - return boost::geometry::index::mindist(pt, tr(v1)) < boost::geometry::index::mindist(pt, tr(v2)); + return boost::geometry::index::comparable_distance_near(pt, tr(v1)) + < boost::geometry::index::comparable_distance_near(pt, tr(v2)); } Point const& pt; From 3d7ac58ba5b56e60c821110f11f55c123fa58cbd Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 23 Sep 2011 16:02:13 +0000 Subject: [PATCH 071/366] some names changed, distance predicates implemented, specialization for nodes implemented partially - not finished [SVN r74536] --- ...tance_calc.hpp => distance_predicates.hpp} | 98 +++++++-- .../index/rtree/distance_predicates.hpp | 191 ++++++++++++++++++ .../index/rtree/visitors/nearest.hpp | 2 +- 3 files changed, 273 insertions(+), 18 deletions(-) rename include/boost/geometry/extensions/index/{distance_calc.hpp => distance_predicates.hpp} (79%) create mode 100644 include/boost/geometry/extensions/index/rtree/distance_predicates.hpp diff --git a/include/boost/geometry/extensions/index/distance_calc.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp similarity index 79% rename from include/boost/geometry/extensions/index/distance_calc.hpp rename to include/boost/geometry/extensions/index/distance_predicates.hpp index d2a1b286d..7b771d610 100644 --- a/include/boost/geometry/extensions/index/distance_calc.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -1,14 +1,14 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.SpatialIndex - Spatial index distances calculators used in nearest query +// Boost.SpatialIndex - Spatial index distance predicates, calculators and checkers used in nearest query // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_CALC_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_CALC_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP namespace boost { namespace geometry { namespace index { @@ -16,6 +16,12 @@ namespace detail { //TODO: awulkiew - consider storing values instead of const references // it may be faster and it eliminates problems with storing of references to temporaries +// moreover user may use boost::cref + +// TODO: awulkiew - what with coordinate systems other than cartesian? +// do comparable_distance returns distance in coordinate system of objects used? +// what if objects are in different systems? +// should index algorithms work exactly like comparable_distance or not? // data @@ -160,6 +166,8 @@ distance_centroid( namespace detail { +// distance_calc_impl + template struct distance_calc_impl { @@ -202,18 +210,7 @@ struct distance_calc_impl } }; -// TODO: -// to use it properly in case of rtree nodes there must be additional template parameter added: Tag -// and typedef ... result_type - in case of bounded distance or half-bounded min maxdist must be calculated as well - -// distance_calc_result::type or distance_calc::result_type -// sorting is needed only in rtree nodes so it shouldn't be here, use detail::rtree instead -// should comp be here or only in detail::rtree? - -// in addition, maby don't use Tag, just implement different structure in detail::rtree specialized for rtree? -// in addition, maby don't use Tag in predicates? - -// rename distance_calc -> comparable_distance_calc ? or calculate_comparable_distance or distance_data_calc? +// distance_calc template struct distance_calc @@ -274,7 +271,74 @@ struct distance_calc< } }; -// TODO distance_comp +// distance_check + +template +struct distance_check +{ + template + static inline bool apply(Point const&, DistanceType const&) + { + return true; + } +}; + +template +struct distance_check< + detail::distance_unbounded, + Tag> +{ + template + static inline bool apply( + detail::distance_unbounded const&, + DistanceType const&) + { + return true; + } +}; + +template +struct distance_check< + detail::distance_half_bounded, + Tag> +{ + template + static inline bool apply( + detail::distance_half_bounded const& dx, + DistanceType const& comparable_d) + { + return dx.comparable_limit <= comparable_d; + } +}; + +template +struct distance_check< + detail::distance_half_bounded, + Tag> +{ + template + static inline bool apply( + detail::distance_half_bounded const& dx, + DistanceType const& comparable_d) + { + return comparable_d <= dx.comparable_limit; + } +}; + +template +struct distance_check< + detail::distance_bounded, + Tag> +{ + template + static inline bool apply( + detail::distance_bounded const& dx, + DistanceType const& comparable_d) + { + return dx.comparable_min <= comparable_d && comparable_d <= dx.comparable_max; + } +}; + // move distance_calc and distance_comp into geometry::index ? // TODO: awulkiew - pruning for nodes! <- inside detail::rtree so NOT HERE @@ -309,4 +373,4 @@ struct distance_calc< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_CALC_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp new file mode 100644 index 000000000..50d3fe6f5 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp @@ -0,0 +1,191 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - Spatial index distance predicates, calculators and checkers +// used in nearest query - rtree's specializations +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +namespace rtree +{ + +struct value_distance_predicate_tag {}; +struct node_distance_predicate_tag {}; + +} // namespace rtree + +// distance_calc + +template +struct distance_calc +{ + typedef typename geometry::default_distance_result::type result_type; + + static inline result_type apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_near(p, i); + } +}; + +// TODO - finish specializations for nodes + +template +struct distance_calc< + detail::distance_unbounded, + Indexable, + Tag> +{ + typedef typename distance_calc_impl::result_type result_type; + + static inline result_type apply( + detail::distance_unbounded const& dx, + Indexable const& i) + { + return distance_calc_impl::apply(dx.point, i); + } +}; + +template +struct distance_calc< + detail::distance_half_bounded, + Indexable, + Tag> +{ + typedef typename distance_calc_impl::result_type result_type; + + static inline result_type apply( + detail::distance_half_bounded const& dx, + Indexable const& i) + { + return distance_calc_impl::apply(dx.point, i); + } +}; + +template +struct distance_calc< + detail::distance_bounded, + Indexable, + Tag> +{ + typedef typename distance_calc_impl::result_type result_type; + + static inline result_type apply( + detail::distance_bounded const& dx, + Indexable const& i) + { + return distance_calc_impl::apply(dx.point, i); + } +}; + +// distance_check + +template +struct distance_check +{ + template + static inline bool apply(Point const&, DistanceType const&) + { + return true; + } +}; + +template +struct distance_check< + detail::distance_unbounded, + Tag> +{ + template + static inline bool apply( + detail::distance_unbounded const&, + DistanceType const&) + { + return true; + } +}; + +template +struct distance_check< + detail::distance_half_bounded, + Tag> +{ + template + static inline bool apply( + detail::distance_half_bounded const& dx, + DistanceType const& comparable_d) + { + return dx.comparable_limit <= comparable_d; + } +}; + +template +struct distance_check< + detail::distance_half_bounded, + Tag> +{ + template + static inline bool apply( + detail::distance_half_bounded const& dx, + DistanceType const& comparable_d) + { + return comparable_d <= dx.comparable_limit; + } +}; + +template +struct distance_check< + detail::distance_bounded, + Tag> +{ + template + static inline bool apply( + detail::distance_bounded const& dx, + DistanceType const& comparable_d) + { + return dx.comparable_min <= comparable_d && comparable_d <= dx.comparable_max; + } +}; + +// move distance_calc and distance_comp into geometry::index ? + +// TODO: awulkiew - pruning for nodes! <- inside detail::rtree so NOT HERE +// if 0 < comp_near node is pruned if maxdist(point, node_box) < comp_near +// if comp_far < INF node is pruned if comp_far < min_dist(point, node_box) +// still nodes must be sorted by min_dist(point, node_box) + +// for values, proper distance values are calculated min, max or centroid +// and tested with comp_near and/or comp_far + +// + something in case of nodes +// additional calculation of maxdist in case of distance_between and +// distance_xxxxx + +} // namespace detail + +//template +//inline typename detail::distance_calc::distance_type +//distance_calc(PointData const& p, Indexable const& i) +//{ +// return detail::distance_calc +// ::apply(p, i); +//} +// +//template +//inline bool +//distance_comp(PointData const& p, DistanceType const& d) +//{ +// return detail::distance_comp +// ::apply(p, d); +//} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 00772d33e..c25c6e68d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include From 2ee9adef725cc1d95b18e3969198dc1ae7b1bc67 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 25 Sep 2011 09:54:42 +0000 Subject: [PATCH 072/366] knn query distance predicates (first version) implemented [SVN r74558] --- .../extensions/index/distance_predicates.hpp | 78 +++---- .../index/rtree/distance_predicates.hpp | 190 ++++++++++++++---- .../geometry/extensions/index/rtree/rtree.hpp | 81 ++++++-- .../index/rtree/visitors/nearest.hpp | 71 ++++--- tests/additional_glut_vis.cpp | 70 +++++-- 5 files changed, 342 insertions(+), 148 deletions(-) diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 7b771d610..65d1be779 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -10,6 +10,10 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP +#include +#include +#include + namespace boost { namespace geometry { namespace index { namespace detail { @@ -271,10 +275,10 @@ struct distance_calc< } }; -// distance_check +// distance_predicate_check -template -struct distance_check +template +struct distance_predicate_check { template static inline bool apply(Point const&, DistanceType const&) @@ -283,9 +287,10 @@ struct distance_check } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_unbounded, + Indexable, Tag> { template @@ -297,9 +302,10 @@ struct distance_check< } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_half_bounded, + Indexable, Tag> { template @@ -311,9 +317,10 @@ struct distance_check< } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_half_bounded, + Indexable, Tag> { template @@ -325,9 +332,10 @@ struct distance_check< } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_bounded, + Indexable, Tag> { template @@ -339,38 +347,34 @@ struct distance_check< } }; -// move distance_calc and distance_comp into geometry::index ? +// distance_point -// TODO: awulkiew - pruning for nodes! <- inside detail::rtree so NOT HERE -// if 0 < comp_near node is pruned if maxdist(point, node_box) < comp_near -// if comp_far < INF node is pruned if comp_far < min_dist(point, node_box) -// still nodes must be sorted by min_dist(point, node_box) +template +struct distance_point +{ + typedef Point type; +}; -// for values, proper distance values are calculated min, max or centroid -// and tested with comp_near and/or comp_far +template +struct distance_point< detail::distance_unbounded > +{ + typedef Point type; +}; -// + something in case of nodes -// additional calculation of maxdist in case of distance_between and -// distance_xxxxx +template +struct distance_point< detail::distance_half_bounded > +{ + typedef Point type; +}; + +template +struct distance_point< detail::distance_bounded > +{ + typedef Point type; +}; } // namespace detail -//template -//inline typename detail::distance_calc::distance_type -//distance_calc(PointData const& p, Indexable const& i) -//{ -// return detail::distance_calc -// ::apply(p, i); -//} -// -//template -//inline bool -//distance_comp(PointData const& p, DistanceType const& d) -//{ -// return detail::distance_comp -// ::apply(p, d); -//} - }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp index 50d3fe6f5..3bb39c19c 100644 --- a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP +#include + namespace boost { namespace geometry { namespace index { namespace detail { @@ -26,7 +28,10 @@ struct node_distance_predicate_tag {}; // distance_calc template -struct distance_calc +struct distance_calc< + Point, + Indexable, + rtree::node_distance_predicate_tag> { typedef typename geometry::default_distance_result::type result_type; @@ -36,60 +41,85 @@ struct distance_calc } }; -// TODO - finish specializations for nodes - -template +template struct distance_calc< detail::distance_unbounded, Indexable, - Tag> + rtree::node_distance_predicate_tag> { - typedef typename distance_calc_impl::result_type result_type; + typedef typename geometry::default_distance_result::type result_type; static inline result_type apply( detail::distance_unbounded const& dx, Indexable const& i) { - return distance_calc_impl::apply(dx.point, i); + return index::comparable_distance_near(dx.point, i); } }; -template +template struct distance_calc< - detail::distance_half_bounded, + detail::distance_half_bounded, Indexable, - Tag> + rtree::node_distance_predicate_tag> { - typedef typename distance_calc_impl::result_type result_type; + typedef typename geometry::default_distance_result::type distance_type; + typedef std::pair result_type; static inline result_type apply( - detail::distance_half_bounded const& dx, + detail::distance_half_bounded const& dx, Indexable const& i) { - return distance_calc_impl::apply(dx.point, i); + return std::make_pair( + index::comparable_distance_near(dx.point, i), + index::comparable_distance_far(dx.point, i) + ); } }; -template +template +struct distance_calc< + detail::distance_half_bounded, + Indexable, + rtree::node_distance_predicate_tag> +{ + typedef typename geometry::default_distance_result::type result_type; + + static inline result_type apply( + detail::distance_half_bounded const& dx, + Indexable const& i) + { + return index::comparable_distance_near(dx.point, i); + } +}; + +template struct distance_calc< detail::distance_bounded, Indexable, - Tag> + rtree::node_distance_predicate_tag> { - typedef typename distance_calc_impl::result_type result_type; + typedef typename geometry::default_distance_result::type distance_type; + typedef std::pair result_type; static inline result_type apply( detail::distance_bounded const& dx, Indexable const& i) { - return distance_calc_impl::apply(dx.point, i); + return std::make_pair( + index::comparable_distance_near(dx.point, i), + index::comparable_distance_far(dx.point, i) + ); } }; -// distance_check +// distance_predicate_check -template -struct distance_check +template +struct distance_predicate_check< + Point, + Indexable, + rtree::node_distance_predicate_tag> { template static inline bool apply(Point const&, DistanceType const&) @@ -98,10 +128,11 @@ struct distance_check } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_unbounded, - Tag> + Indexable, + rtree::node_distance_predicate_tag> { template static inline bool apply( @@ -112,24 +143,26 @@ struct distance_check< } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_half_bounded, - Tag> + Indexable, + rtree::node_distance_predicate_tag> { template static inline bool apply( detail::distance_half_bounded const& dx, - DistanceType const& comparable_d) + DistanceType const& d) { - return dx.comparable_limit <= comparable_d; + return dx.comparable_limit <= d.second; } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_half_bounded, - Tag> + Indexable, + rtree::node_distance_predicate_tag> { template static inline bool apply( @@ -140,20 +173,105 @@ struct distance_check< } }; -template -struct distance_check< +template +struct distance_predicate_check< detail::distance_bounded, - Tag> + Indexable, + rtree::node_distance_predicate_tag> { template static inline bool apply( detail::distance_bounded const& dx, - DistanceType const& comparable_d) + DistanceType const& d) { - return dx.comparable_min <= comparable_d && comparable_d <= dx.comparable_max; + return dx.comparable_min <= d.second && d.first <= dx.comparable_max; } }; +// TODO implement alternative version for Indexable being a Point - don't need to calculate the distance 2x +// TODO explicitly define DistanceType ? + +namespace rtree +{ + +// distance less comparator + +template +struct distance_less +{ + template + inline bool operator()(DistanceType const& d1, DistanceType const& d2) + { + return d1 < d2; + } +}; + +template +struct distance_less< + detail::distance_half_bounded, + Indexable +> +{ + template + inline bool operator()(DistanceType const& d1, DistanceType const& d2) + { + return d1.first < d2.first; + } +}; + +template +struct distance_less< + detail::distance_bounded, + Indexable +> +{ + template + inline bool operator()(DistanceType const& d1, DistanceType const& d2) + { + return d1.first < d2.first; + } +}; + +// TODO distance_node_pruning_check + +template +struct distance_node_pruning_check +{ + template + static inline bool apply(SmallestDistanceType const& sd, NodeDistanceType const& nd) + { + return sd < nd; + } +}; + +template +struct distance_node_pruning_check< + detail::distance_half_bounded, + Indexable +> +{ + template + static inline bool apply(SmallestDistanceType const& sd, NodeDistanceType const& nd) + { + return sd < nd.first; + } +}; + +template +struct distance_node_pruning_check< + detail::distance_bounded, + Indexable +> +{ + template + static inline bool apply(SmallestDistanceType const& sd, NodeDistanceType const& nd) + { + return sd < nd.first; + } +}; + +} // namespace rtree + // move distance_calc and distance_comp into geometry::index ? // TODO: awulkiew - pruning for nodes! <- inside detail::rtree so NOT HERE diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 2088782fd..eae2a9a08 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -40,6 +40,7 @@ namespace boost { namespace geometry { namespace index { // TODO copying +// TODO move extensional/debug visitors to the other folder template < typename Value, @@ -94,28 +95,28 @@ public: // TODO: awulkiew - change Point to Geometry? // return number of elements instead of bool? - template - inline size_t nearest(Point const& pt, value_type & v) const + template + inline size_t nearest(DistancePredicate const& p, value_type & v) const { - return nearest_one(pt, detail::empty(), v); + return nearest_one(p, detail::empty(), v); } - template - inline size_t nearest(Point const& pt, Predicates const& pred, value_type & v) const + template + inline size_t nearest(DistancePredicate const& p, Predicates const& pred, value_type & v) const { - return nearest_one(pt, pred, v); + return nearest_one(p, pred, v); } - template - inline size_t nearest(Point const& pt, size_t k, OutIter out_it) const + template + inline size_t nearest(DistancePredicate const& p, size_t k, OutIter out_it) const { - return nearest_k(pt, k, detail::empty(), out_it); + return nearest_k(p, k, detail::empty(), out_it); } - template - inline size_t nearest(Point const& pt, size_t k, Predicates const& pred, OutIter out_it) const + template + inline size_t nearest(DistancePredicate const& p, size_t k, Predicates const& pred, OutIter out_it) const { - return nearest_k(pt, k, pred, out_it); + return nearest_k(p, k, pred, out_it); } inline void insert(value_type const& value) @@ -187,28 +188,52 @@ public: } private: - template - inline size_t nearest_one(Point const& pt, Predicates const& pred, value_type & v) const + template + inline size_t nearest_one(DistancePredicate const& p, Predicates const& pred, value_type & v) const { - typedef detail::rtree::visitors::nearest_one result_type; + typedef detail::rtree::visitors::nearest_one< + value_type, + translator_type, + typename detail::distance_point::type + > result_type; + result_type result; - detail::rtree::visitors::nearest - nearest_v(m_translator, pt, pred, result); + detail::rtree::visitors::nearest< + value_type, + options_type, + translator_type, + box_type, + DistancePredicate, + Predicates, + result_type + > nearest_v(m_translator, p, pred, result); detail::rtree::apply_visitor(nearest_v, *m_root); return result.get(v); } - template - inline size_t nearest_k(Point const& pt, size_t k, Predicates const& pred, OutIter out_it) const + template + inline size_t nearest_k(DistancePredicate const& p, size_t k, Predicates const& pred, OutIter out_it) const { - typedef detail::rtree::visitors::nearest_k result_type; + typedef detail::rtree::visitors::nearest_k< + value_type, + translator_type, + typename detail::distance_point::type + > result_type; + result_type result(k); - detail::rtree::visitors::nearest - nearest_v(m_translator, pt, pred, result); + detail::rtree::visitors::nearest< + value_type, + options_type, + translator_type, + box_type, + DistancePredicate, + Predicates, + result_type + > nearest_v(m_translator, p, pred, result); detail::rtree::apply_visitor(nearest_v, *m_root); @@ -263,6 +288,18 @@ inline size_t nearest(rtree const& tree, Point const return tree.nearest(pt, k, pred, out_it); } +template +inline size_t size(rtree const& tree) +{ + return tree.size(); +} + +template +inline bool empty(rtree const& tree) +{ + return tree.empty(); +} + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index c25c6e68d..c69a41717 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -10,11 +10,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP -#include -#include -#include - -#include +#include #include @@ -134,7 +130,7 @@ template < typename Options, typename Translator, typename Box, - typename PointData, + typename DistancePredicate, typename Predicates, typename Result > @@ -147,10 +143,17 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename geometry::default_distance_result::type node_distance_type; + typedef index::detail::distance_calc node_distance_calc; + typedef typename node_distance_calc::result_type node_distance_type; + typedef index::detail::distance_predicate_check node_distance_predicate_check; + typedef rtree::distance_less node_distance_less; - inline nearest(Translator const& t, PointData const& point_data, Predicates const& pr, Result & r) - : m_tr(t), m_point_data(point_data), m_pred(pr) + typedef index::detail::distance_calc value_distance_calc; + typedef typename value_distance_calc::result_type value_distance_type; + typedef index::detail::distance_predicate_check value_distance_predicate_check; + + inline nearest(Translator const& t, DistancePredicate const& dist_pred, Predicates const& pred, Result & r) + : m_tr(t), m_dist_pred(dist_pred), m_pred(pred) , m_result(r) {} @@ -159,11 +162,10 @@ public: inline void operator()(internal_node const& n) { // array of active nodes - /*index::pushable_array< + index::pushable_array< std::pair, Options::parameters_type::max_elements - > active_branch_list;*/ - std::vector< std::pair > active_branch_list; + > active_branch_list; typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); @@ -172,14 +174,18 @@ public: for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { + // if current node meets predicates if ( index::predicates_check(m_pred, it->first) ) { - active_branch_list.push_back( - std::make_pair( - index::comparable_distance_near(m_point_data, it->first), - it->second - ) - ); + // calculate node's distance(s) for distance predicate + node_distance_type node_dist_data = node_distance_calc::apply(m_dist_pred, it->first); + + // if current node distance(s) meets distance predicate + if ( node_distance_predicate_check::apply(m_dist_pred, node_dist_data) ) + { + // add current node's data into the list + active_branch_list.push_back( std::make_pair(node_dist_data, it->second) ); + } } } @@ -188,7 +194,7 @@ public: return; // sort array - std::sort(active_branch_list.begin(), active_branch_list.end(), abl_mindist_less); + std::sort(active_branch_list.begin(), active_branch_list.end(), node_distance_less()); // recursively visit nodes for ( size_t i = 0 ;; ++i ) @@ -212,25 +218,23 @@ public: for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { + // if value meets predicates if ( index::predicates_check(m_pred, m_tr(*it)) ) { - // store value - m_result.store( - *it, - index::comparable_distance_near(m_point_data, m_tr(*it)) - ); + // calculate values distance for distance predicate + value_distance_type dist = value_distance_calc::apply(m_dist_pred, m_tr(*it)); + + // if distance meets distance predicate + if ( value_distance_predicate_check::apply(m_dist_pred, dist) ) + { + // store value + m_result.store(*it, dist); + } } } } private: - inline static bool abl_mindist_less( - std::pair const& p1, - std::pair const& p2) - { - return p1.first < p2.first; - } - template inline void prune_nodes(ActiveBranchList & abl) const { @@ -239,7 +243,8 @@ private: { // prune if box's mindist is further than value's mindist while ( !abl.empty() && - m_result.comparable_distance() < abl.back().first ) + distance_node_pruning_check + ::apply(m_result.comparable_distance(), abl.back().first) ) { abl.pop_back(); } @@ -247,7 +252,7 @@ private: } Translator const& m_tr; - PointData const& m_point_data; + DistancePredicate const& m_dist_pred; Predicates const& m_pred; Result & m_result; diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 1a3c800a3..ddae78142 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -26,24 +26,51 @@ boost::geometry::index::rtree< boost::geometry::index::rstar<4, 2> > t; std::vector vect; -bool is_nearest = false; +size_t found_count = 0; P search_point; +float min_distance = 20; +float max_distance = 30; +size_t count = 10; std::vector nearest_boxes; +void draw_search_area() +{ + float x = boost::geometry::get<0>(search_point); + float y = boost::geometry::get<1>(search_point); + float z = t.depth(); + + // search point + glBegin(GL_TRIANGLES); + glVertex3f(x, y, z); + glVertex3f(x + 1, y, z); + glVertex3f(x + 1, y + 1, z); + glEnd(); + + // search min circle + + glBegin(GL_LINE_LOOP); + for(float a = 0 ; a < 3.14158f * 2 ; a += 3.14158f / 180) + glVertex3f(x + min_distance * ::cos(a), y + min_distance * ::sin(a), z); + glEnd(); + + // search max circle + + glBegin(GL_LINE_LOOP); + for(float a = 0 ; a < 3.14158f * 2 ; a += 3.14158f / 180) + glVertex3f(x + max_distance * ::cos(a), y + max_distance * ::sin(a), z); + glEnd(); +} + void render_scene(void) { glClear(GL_COLOR_BUFFER_BIT); boost::geometry::index::gl_draw(t); - if ( is_nearest ) + if ( found_count > 0 ) { glColor3f(1.0f, 0.5f, 0.0f); - glBegin(GL_TRIANGLES); - glVertex3f(boost::geometry::get<0>(search_point), boost::geometry::get<1>(search_point), t.depth()); - glVertex3f(boost::geometry::get<0>(search_point) + 1, boost::geometry::get<1>(search_point), t.depth()); - glVertex3f(boost::geometry::get<0>(search_point) + 1, boost::geometry::get<1>(search_point) + 1, t.depth()); - glEnd(); + draw_search_area(); for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) boost::geometry::index::detail::rtree::visitors::detail::gl_draw_indexable(nearest_boxes[i], t.depth()); @@ -75,6 +102,9 @@ void resize(int w, int h) void mouse(int button, int state, int x, int y) { + namespace bg = boost::geometry; + namespace bgi = bg::index; + if ( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) { float x = ( rand() % 100 ); @@ -88,12 +118,12 @@ void mouse(int button, int state, int x, int y) vect.push_back(b); std::cout << "inserted: "; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; std::cout << "\n" << t << "\n"; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); - std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\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"; } else if ( button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN ) @@ -104,16 +134,16 @@ void mouse(int button, int state, int x, int y) size_t i = rand() % vect.size(); B b = vect[i]; - boost::geometry::index::remove(t, b); + bgi::remove(t, b); vect.erase(vect.begin() + i); std::cout << "removed: "; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, b); + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; std::cout << "\n" << t << "\n"; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); - std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\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"; } else if ( button == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN ) @@ -123,16 +153,16 @@ void mouse(int button, int state, int x, int y) search_point = P(x, y); nearest_boxes.clear(); - is_nearest = t.nearest(search_point, 3, std::back_inserter(nearest_boxes)); + found_count = t.nearest(bgi::distance_centroid(search_point, min_distance, max_distance), count, std::back_inserter(nearest_boxes)); - if ( is_nearest ) + if ( found_count > 0 ) { std::cout << "search point: "; - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, search_point); + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, search_point); std::cout << "\nfound: "; for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) { - boost::geometry::index::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); std::cout << '\n'; } } @@ -140,8 +170,8 @@ void mouse(int button, int state, int x, int y) std::cout << "nearest not found\n"; std::cout << "\n" << t << "\n"; - std::cout << ( boost::geometry::index::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); - std::cout << ( boost::geometry::index::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\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"; } From e42f8b61c54124e8eb0291162297c21e978d345c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 27 Sep 2011 19:31:01 +0000 Subject: [PATCH 073/366] Distances predicates version 2 implemented. Now the user may use different predicates for knn point, min and max distances. [SVN r74593] --- .../extensions/index/distance_predicates.hpp | 817 ++++++++++++------ .../geometry/extensions/index/predicates.hpp | 11 +- .../index/rtree/distance_predicates.hpp | 350 +++----- .../extensions/index/rtree/predicates.hpp | 34 +- .../geometry/extensions/index/rtree/rtree.hpp | 22 +- .../geometry/extensions/index/rtree/tags.hpp | 24 + .../index/rtree/visitors/nearest.hpp | 65 +- .../extensions/index/rtree/visitors/query.hpp | 4 +- .../geometry/extensions/index/tuples.hpp | 185 ++++ tests/additional_glut_vis.cpp | 9 +- tests/main.cpp | 2 + tests/rtree_function.hpp | 4 +- 12 files changed, 997 insertions(+), 530 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/tags.hpp create mode 100644 include/boost/geometry/extensions/index/tuples.hpp diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 65d1be779..e7cc5d903 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -14,9 +14,9 @@ #include #include -namespace boost { namespace geometry { namespace index { +#include -namespace detail { +namespace boost { namespace geometry { namespace index { //TODO: awulkiew - consider storing values instead of const references // it may be faster and it eliminates problems with storing of references to temporaries @@ -27,351 +27,672 @@ namespace detail { // what if objects are in different systems? // should index algorithms work exactly like comparable_distance or not? -// data +namespace detail { -struct distance_near_tag {}; -struct distance_far_tag {}; -struct distance_centroid_tag {}; +// relations -struct distance_min_tag {}; -struct distance_max_tag {}; - -template -struct distance_unbounded - : nonassignable +template +struct near { - typedef typename index::traits::coordinate_type::type coordinate_type; - - inline explicit distance_unbounded(Point const& p) - : point(p) - {} - - Point const& point; + near(T const& v) : value(v) {} + T value; }; -template -struct distance_half_bounded - : nonassignable +template +struct centroid { - typedef typename index::traits::coordinate_type::type coordinate_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline explicit distance_half_bounded(Point const& p, coordinate_type const& distance_limit) - : point(p) - , comparable_limit(distance_limit * distance_limit) - {} - - Point const& point; - distance_type comparable_limit; + centroid(T const& v) : value(v) {} + T value; }; -template -struct distance_bounded +template +struct far +{ + far(T const& v) : value(v) {} + T value; +}; + +// tags + +struct near_tag {}; +struct centroid_tag {}; +struct far_tag {}; + +// relation + +template +struct relation +{ + typedef T value_type; + typedef near_tag tag; + static inline T const& value(T const& v) { return v; } + static inline T & value(T & v) { return v; } +}; + +template +struct relation< near > +{ + typedef T value_type; + typedef near_tag tag; + static inline T const& value(near const& r) { return r.value; } + static inline T & value(near & r) { return r.value; } +}; + +template +struct relation< centroid > +{ + typedef T value_type; + typedef centroid_tag tag; + static inline T const& value(centroid const& r) { return r.value; } + static inline T & value(centroid & r) { return r.value; } +}; + +template +struct relation< far > +{ + typedef T value_type; + typedef far_tag tag; + static inline T const& value(far const& r) { return r.value; } + static inline T & value(far & r) { return r.value; } +}; + +} // namespace detail + +// relations generators + +template +detail::near near(T const& v) +{ + return detail::near(v); +} + +template +detail::centroid centroid(T const& v) +{ + return detail::centroid(v); +} + +template +detail::far far(T const& v) +{ + return detail::far(v); +} + +// distance predicates + +namespace detail { + +template +struct unbounded : nonassignable { - typedef typename index::traits::coordinate_type::type coordinate_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline explicit distance_bounded(Point const& p, coordinate_type const& distance_min, coordinate_type const& distance_max) - : point(p) - , comparable_min(distance_min * distance_min) - , comparable_max(distance_max * distance_max) + inline explicit unbounded(PointRelation const& pr) + : point_relation(pr) {} - Point const& point; + PointRelation point_relation; +}; + +template +struct min_bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline min_bounded(PointRelation const& pr, MinRelation const& min_rel) + : point_relation(pr) + , comparable_min( + relation::value(min_rel) * + relation::value(min_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_min; +}; + +template +struct max_bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel) + : point_relation(pr) + , comparable_max( + relation::value(max_rel) * + relation::value(max_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_max; +}; + +template +struct bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel) + : point_relation(pr) + , comparable_min( + relation::value(min_rel) * + relation::value(min_rel) ) + , comparable_max( + relation::value(max_rel) * + relation::value(max_rel) ) + {} + + PointRelation point_relation; distance_type comparable_min; distance_type comparable_max; }; } // namespace detail -// generators +// distance predicates generators -template -inline detail::distance_unbounded -distance_near(Point const& p) +template +inline detail::unbounded +unbounded(PointRelation const& pr) { - return detail::distance_unbounded(p); + return detail::unbounded(pr); } -template -inline detail::distance_unbounded -distance_far(Point const& p) +template +inline detail::min_bounded +min_bounded(PointRelation const& pr, MinRelation const& minr) { - return detail::distance_unbounded(p); + return detail::min_bounded(pr, minr); } -template -inline detail::distance_unbounded -distance_centroid(Point const& p) +template +inline detail::max_bounded +max_bounded(PointRelation const& pr, MaxRelation const& maxr) { - return detail::distance_unbounded(p); + return detail::max_bounded(pr, maxr); } -template -inline detail::distance_half_bounded -distance_near( - Point const& p, - typename index::traits::coordinate_type::type const& distance_min) +template +inline detail::bounded +bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& maxr) { - return detail::distance_half_bounded(p, distance_min); -} - -template -inline detail::distance_half_bounded -distance_far( - Point const& p, - typename index::traits::coordinate_type::type const& distance_min) -{ - return detail::distance_half_bounded(p, distance_min); -} - -template -inline detail::distance_half_bounded -distance_centroid( - Point const& p, - typename index::traits::coordinate_type::type const& distance_min) -{ - return detail::distance_half_bounded(p, distance_min); -} - -template -inline detail::distance_bounded -distance_near( - Point const& p, - typename index::traits::coordinate_type::type const& distance_min, - typename index::traits::coordinate_type::type const& distance_max) -{ - return detail::distance_bounded(p, distance_min, distance_max); -} - -template -inline detail::distance_bounded -distance_far( - Point const& p, - typename index::traits::coordinate_type::type const& distance_min, - typename index::traits::coordinate_type::type const& distance_max) -{ - return detail::distance_bounded(p, distance_min, distance_max); -} - -template -inline detail::distance_bounded -distance_centroid( - Point const& p, - typename index::traits::coordinate_type::type const& distance_min, - typename index::traits::coordinate_type::type const& distance_max) -{ - return detail::distance_bounded(p, distance_min, distance_max); + return detail::bounded(pr, minr, maxr); } // algorithms +namespace detail{ + +// point_relation + +template +struct point_relation +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::unbounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::min_bounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::max_bounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::bounded > +{ + typedef PointRelation type; +}; + + +} // namespace detail + namespace detail { -// distance_calc_impl +// cdist -template -struct distance_calc_impl +template +struct cdist { - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, - (distance_calc_impl)); + T value; }; -template -struct distance_calc_impl -{ - typedef typename geometry::default_distance_result::type result_type; +// cdist_merge - static inline result_type apply(Point const& p, Indexable const& i) +template +struct cdist_merge +{ + typedef typename index::tuples::add_unique< + CDistTuple, + CDist + >::type type; +}; + +template +struct cdist_merge< + cdist, + cdist > +{ + typedef boost::tuple< + cdist, + cdist + > type; +}; + +template +struct cdist_merge< + cdist, + cdist > +{ + typedef cdist type; +}; + +// cdist_value_type + +template +struct cdist_value +{ + typedef typename cdist_value< + typename boost::tuples::element<0, CDistTuple>::type + >::type type; + + template + static inline type & get(CDistTuple & cdtup) + { + return boost::get< + index::tuples::find_index< + CDistTuple, + cdist + >::value + >(cdtup).value; + } + + template + static inline type const& get(CDistTuple const& cdtup) + { + return boost::get< + index::tuples::find_index< + CDistTuple, + cdist + >::value + >(cdtup).value; + } +}; + +template +struct cdist_value< + cdist +> +{ + typedef T type; + + template + static inline type & get(cdist & cd) + { + // TODO MPL_ASSERT tuples::equal>::value + return cd.value; + } + + template + static inline type const& get(cdist const& cd) + { + // TODO MPL_ASSERT tuples::equal>::value + return cd.value; + } +}; + +} // namespace detail + +namespace detail { + +// distances_calc_impl_rel + +template +struct distances_calc_impl_rel +{ + // TODO MPL_ASSERT not implemented for this RelDist +}; + +template +struct distances_calc_impl_rel< + cdist +> +{ + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) { return index::comparable_distance_near(p, i); } }; -template -struct distance_calc_impl +template +struct distances_calc_impl_rel< + cdist +> { - typedef typename geometry::default_distance_result::type result_type; - - static inline result_type apply(Point const& p, Indexable const& i) - { - return index::comparable_distance_far(p, i); - } -}; - -template -struct distance_calc_impl -{ - typedef typename geometry::default_distance_result::type result_type; - - static inline result_type apply(Point const& p, Indexable const& i) + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) { return index::comparable_distance_centroid(p, i); } }; -// distance_calc - -template -struct distance_calc +template +struct distances_calc_impl_rel< + cdist +> { - typedef typename geometry::default_distance_result::type result_type; - - static inline result_type apply(Point const& p, Indexable const& i) + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) { - return index::comparable_distance_near(p, i); + return index::comparable_distance_far(p, i); } }; -template -struct distance_calc< - detail::distance_unbounded, - Indexable, - Tag> +// distances_calc_impl_tuple + +template +struct distances_calc_impl_tuple { - typedef typename distance_calc_impl::result_type result_type; + // TODO MPL ASSERT 0 < N + static inline void apply(Distances & d, Point const& p, Indexable const&i) + { + boost::get(d).value = + distances_calc_impl_rel< + typename boost::tuples::element::type + >::apply(p, i); + + distances_calc_impl_tuple< + Distances, + Point, + Indexable, + N - 1 + >::apply(d, p, i); + } +}; + +template +struct distances_calc_impl_tuple +{ + static inline void apply(Distances & d, Point const& p, Indexable const&i) + { + boost::get<0>(d).value = + distances_calc_impl_rel< + typename boost::tuples::element<0, Distances>::type + >::apply(p, i); + } +}; + +// distances_calc_impl + +template +struct distances_calc_impl +{ + static inline void apply(Distances & d, Point const& p, Indexable const&i) + { + distances_calc_impl_tuple< + Distances, + Point, + Indexable, + boost::tuples::length::value + >::apply(d, p, i); + } +}; + +template +struct distances_calc_impl< + cdist, + Point, + Indexable +> +{ + static inline void apply(cdist & d, Point const& p, Indexable const&i) + { + d.value = distances_calc_impl_rel< + cdist + >::apply(p, i); + } +}; + +// distances_calc + +template +struct distances_calc +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(PointRelation const& p, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(p), i); + return res; + } +}; + +template +struct distances_calc< + detail::unbounded, + Indexable, + Tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(detail::unbounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::min_bounded, + Indexable, + Tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag min_relation_tag; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::min_bounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::max_bounded, + Indexable, + Tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag max_relation_tag; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::max_bounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::bounded, + Indexable, + Tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag min_relation_tag; + typedef typename detail::relation::tag max_relation_tag; + + typedef typename detail::cdist_merge< + typename detail::cdist_merge< + cdist, + cdist + >::type, + cdist + >::type result_type; static inline result_type apply( - detail::distance_unbounded const& dx, + detail::bounded const& pp, Indexable const& i) { - return distance_calc_impl::apply(dx.point, i); + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; } }; -template -struct distance_calc< - detail::distance_half_bounded, - Indexable, - Tag> +// distances_predicates_check + +// TODO explicitly define DistanceType ? +// Indexable/Box is used in distances_predicates_check only for purpose of +// this explicit DistanceType definition + +// move distance_calc and distance_comp into geometry::index ? + +template +struct distances_predicates_check { - typedef typename distance_calc_impl::result_type result_type; - - static inline result_type apply( - detail::distance_half_bounded const& dx, - Indexable const& i) - { - return distance_calc_impl::apply(dx.point, i); - } -}; - -template -struct distance_calc< - detail::distance_bounded, - Indexable, - Tag> -{ - typedef typename distance_calc_impl::result_type result_type; - - static inline result_type apply( - detail::distance_bounded const& dx, - Indexable const& i) - { - return distance_calc_impl::apply(dx.point, i); - } -}; - -// distance_predicate_check - -template -struct distance_predicate_check -{ - template - static inline bool apply(Point const&, DistanceType const&) + template + static inline bool apply(PointRelation const&, Distances const&) { return true; } }; -template -struct distance_predicate_check< - detail::distance_unbounded, +template +struct distances_predicates_check< + detail::unbounded, Indexable, - Tag> + Tag +> { - template - static inline bool apply( - detail::distance_unbounded const&, - DistanceType const&) + template + static inline bool apply(detail::unbounded const&, Distances const&) { return true; } }; -template -struct distance_predicate_check< - detail::distance_half_bounded, +template +struct distances_predicates_check< + detail::min_bounded, Indexable, - Tag> + Tag +> { - template + typedef typename detail::relation::tag min_relation_tag; + + template static inline bool apply( - detail::distance_half_bounded const& dx, - DistanceType const& comparable_d) + detail::min_bounded const& pred, + Distances const& d) { - return dx.comparable_limit <= comparable_d; + return pred.comparable_min <= + detail::cdist_value::template get(d); } }; -template -struct distance_predicate_check< - detail::distance_half_bounded, +template +struct distances_predicates_check< + detail::max_bounded, Indexable, - Tag> + Tag +> { - template + typedef typename detail::relation::tag max_relation_tag; + + template static inline bool apply( - detail::distance_half_bounded const& dx, - DistanceType const& comparable_d) + detail::max_bounded const& pred, + Distances const& d) { - return comparable_d <= dx.comparable_limit; + return pred.comparable_max <= + detail::cdist_value::template get(d); } }; -template -struct distance_predicate_check< - detail::distance_bounded, +template +struct distances_predicates_check< + detail::bounded, Indexable, - Tag> + Tag +> { - template + typedef typename detail::relation::tag min_relation_tag; + typedef typename detail::relation::tag max_relation_tag; + + template static inline bool apply( - detail::distance_bounded const& dx, - DistanceType const& comparable_d) + detail::bounded const& pred, + Distances const& d) { - return dx.comparable_min <= comparable_d && comparable_d <= dx.comparable_max; + return pred.comparable_min + <= detail::cdist_value::template get(d) + && detail::cdist_value::template get(d) + <= pred.comparable_max; } }; -// distance_point - -template -struct distance_point -{ - typedef Point type; -}; - -template -struct distance_point< detail::distance_unbounded > -{ - typedef Point type; -}; - -template -struct distance_point< detail::distance_half_bounded > -{ - typedef Point type; -}; - -template -struct distance_point< detail::distance_bounded > -{ - typedef Point type; -}; +// TODO calculate all of this for Boxes only! +// for Points calculate only 1 distance allways } // namespace detail diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 6ce3d3667..a48d222f4 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -25,15 +25,12 @@ namespace detail { struct empty {}; -//TODO: awulkiew - consider storing Geometry instead of Geometry const& -// it's faster and eliminates problems with storing of references to temporaries - template struct covered_by : nonassignable { covered_by(Geometry const& g) : geometry(g) {} - Geometry const& geometry; + Geometry geometry; }; template @@ -41,7 +38,7 @@ struct intersects : nonassignable { intersects(Geometry const& g) : geometry(g) {} - Geometry const& geometry; + Geometry geometry; }; template @@ -49,7 +46,7 @@ struct overlaps : nonassignable { overlaps(Geometry const& g) : geometry(g) {} - Geometry const& geometry; + Geometry geometry; }; template @@ -57,7 +54,7 @@ struct within : nonassignable { within(Geometry const& g) : geometry(g) {} - Geometry const& geometry; + Geometry geometry; }; } // namespace detail diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp index 3bb39c19c..3b19559f5 100644 --- a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // // Boost.SpatialIndex - Spatial index distance predicates, calculators and checkers -// used in nearest query - rtree's specializations +// used in nearest query - rtree's nodes specializations // // Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, @@ -12,298 +12,206 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP #include +#include namespace boost { namespace geometry { namespace index { namespace detail { -namespace rtree -{ - -struct value_distance_predicate_tag {}; -struct node_distance_predicate_tag {}; - -} // namespace rtree - // distance_calc -template -struct distance_calc< - Point, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_calc< + PointRelation, + Box, + rtree::node_tag> { - typedef typename geometry::default_distance_result::type result_type; + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; - static inline result_type apply(Point const& p, Indexable const& i) + typedef detail::cdist result_type; + + static inline result_type apply(PointRelation const& p, Box const& i) { - return index::comparable_distance_near(p, i); + result_type res; + distances_calc_impl + ::apply(res, relation::value(p), i); + return res; } }; -template -struct distance_calc< - detail::distance_unbounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_calc< + detail::unbounded, + Box, + rtree::node_tag +> { - typedef typename geometry::default_distance_result::type result_type; + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; - static inline result_type apply( - detail::distance_unbounded const& dx, - Indexable const& i) + typedef detail::cdist result_type; + + static inline result_type apply(detail::unbounded const& pp, Box const& i) { - return index::comparable_distance_near(dx.point, i); + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; } }; -template -struct distance_calc< - detail::distance_half_bounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_calc< + detail::min_bounded, + Box, + rtree::node_tag +> { - typedef typename geometry::default_distance_result::type distance_type; - typedef std::pair result_type; + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; - static inline result_type apply( - detail::distance_half_bounded const& dx, - Indexable const& i) + static inline result_type apply(detail::min_bounded const& pp, Box const& i) { - return std::make_pair( - index::comparable_distance_near(dx.point, i), - index::comparable_distance_far(dx.point, i) - ); + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; } }; -template -struct distance_calc< - detail::distance_half_bounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_calc< + detail::max_bounded, + Box, + rtree::node_tag +> { - typedef typename geometry::default_distance_result::type result_type; + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; - static inline result_type apply( - detail::distance_half_bounded const& dx, - Indexable const& i) + typedef cdist result_type; + + static inline result_type apply(detail::max_bounded const& pp, Box const& i) { - return index::comparable_distance_near(dx.point, i); + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; } }; -template -struct distance_calc< - detail::distance_bounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_calc< + detail::bounded, + Box, + rtree::node_tag +> { - typedef typename geometry::default_distance_result::type distance_type; - typedef std::pair result_type; + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; - static inline result_type apply( - detail::distance_bounded const& dx, - Indexable const& i) + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::bounded const& pp, Box const& i) { - return std::make_pair( - index::comparable_distance_near(dx.point, i), - index::comparable_distance_far(dx.point, i) - ); + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; } }; // distance_predicate_check -template -struct distance_predicate_check< - Point, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_predicates_check< + PointRelation, + Box, + rtree::node_tag> { - template - static inline bool apply(Point const&, DistanceType const&) + template + static inline bool apply(PointRelation const&, Distances const&) { return true; } }; -template -struct distance_predicate_check< - detail::distance_unbounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_predicates_check< + detail::unbounded, + Box, + rtree::node_tag> { - template + template static inline bool apply( - detail::distance_unbounded const&, - DistanceType const&) + detail::unbounded const&, + Distances const&) { return true; } }; -template -struct distance_predicate_check< - detail::distance_half_bounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_predicates_check< + detail::min_bounded, + Box, + rtree::node_tag> { - template + template static inline bool apply( - detail::distance_half_bounded const& dx, - DistanceType const& d) + detail::min_bounded const& pred, + Distances const& d) { - return dx.comparable_limit <= d.second; + return pred.comparable_min + <= cdist_value::template get(d); } }; -template -struct distance_predicate_check< - detail::distance_half_bounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_predicates_check< + detail::max_bounded, + Box, + rtree::node_tag> { - template + template static inline bool apply( - detail::distance_half_bounded const& dx, - DistanceType const& comparable_d) + detail::max_bounded const& pred, + Distances const& d) { - return comparable_d <= dx.comparable_limit; + return cdist_value::template get(d) + <= pred.comparable_max; } }; -template -struct distance_predicate_check< - detail::distance_bounded, - Indexable, - rtree::node_distance_predicate_tag> +template +struct distances_predicates_check< + detail::bounded, + Box, + rtree::node_tag> { - template + template static inline bool apply( - detail::distance_bounded const& dx, - DistanceType const& d) + detail::bounded const& pred, + Distances const& d) { - return dx.comparable_min <= d.second && d.first <= dx.comparable_max; + return pred.comparable_min + <= cdist_value::template get(d) + && cdist_value::template get(d) + <= pred.comparable_max; } }; -// TODO implement alternative version for Indexable being a Point - don't need to calculate the distance 2x -// TODO explicitly define DistanceType ? - -namespace rtree -{ - -// distance less comparator - -template -struct distance_less -{ - template - inline bool operator()(DistanceType const& d1, DistanceType const& d2) - { - return d1 < d2; - } -}; - -template -struct distance_less< - detail::distance_half_bounded, - Indexable -> -{ - template - inline bool operator()(DistanceType const& d1, DistanceType const& d2) - { - return d1.first < d2.first; - } -}; - -template -struct distance_less< - detail::distance_bounded, - Indexable -> -{ - template - inline bool operator()(DistanceType const& d1, DistanceType const& d2) - { - return d1.first < d2.first; - } -}; - -// TODO distance_node_pruning_check - -template -struct distance_node_pruning_check -{ - template - static inline bool apply(SmallestDistanceType const& sd, NodeDistanceType const& nd) - { - return sd < nd; - } -}; - -template -struct distance_node_pruning_check< - detail::distance_half_bounded, - Indexable -> -{ - template - static inline bool apply(SmallestDistanceType const& sd, NodeDistanceType const& nd) - { - return sd < nd.first; - } -}; - -template -struct distance_node_pruning_check< - detail::distance_bounded, - Indexable -> -{ - template - static inline bool apply(SmallestDistanceType const& sd, NodeDistanceType const& nd) - { - return sd < nd.first; - } -}; - -} // namespace rtree - -// move distance_calc and distance_comp into geometry::index ? - -// TODO: awulkiew - pruning for nodes! <- inside detail::rtree so NOT HERE -// if 0 < comp_near node is pruned if maxdist(point, node_box) < comp_near -// if comp_far < INF node is pruned if comp_far < min_dist(point, node_box) -// still nodes must be sorted by min_dist(point, node_box) - -// for values, proper distance values are calculated min, max or centroid -// and tested with comp_near and/or comp_far - -// + something in case of nodes -// additional calculation of maxdist in case of distance_between and -// distance_xxxxx - } // namespace detail -//template -//inline typename detail::distance_calc::distance_type -//distance_calc(PointData const& p, Indexable const& i) -//{ -// return detail::distance_calc -// ::apply(p, i); -//} -// -//template -//inline bool -//distance_comp(PointData const& p, DistanceType const& d) -//{ -// return detail::distance_comp -// ::apply(p, d); -//} - }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index d54300528..35efc773f 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -11,33 +11,27 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP #include +#include namespace boost { namespace geometry { namespace index { namespace detail { - -namespace rtree { - -struct value_predicates_tag {}; -struct node_predicates_tag {}; - -} // namespace rtree //template //struct predicate_check //{ -// template -// static inline bool apply(Geometry const& g, Indexable const& i) +// template +// static inline bool apply(Geometry const& g, Box const& i) // { // return geometry::intersects(i, g); // } //}; template -struct predicate_check, rtree::node_predicates_tag> +struct predicate_check, rtree::node_tag> { - template - static bool apply(covered_by const& p, Indexable const& i) + template + static bool apply(covered_by const& p, Box const& i) { return geometry::intersects(i, p.geometry); } @@ -46,18 +40,18 @@ struct predicate_check, rtree::node_predicates_tag> //template //struct predicate_check, rtree::node_predicates_tag> //{ -// template -// static inline bool apply(intersects const& p, Indexable const& i) +// template +// static inline bool apply(intersects const& p, Box const& i) // { // return geometry::intersects(i, p.geometry); // } //}; template -struct predicate_check, rtree::node_predicates_tag> +struct predicate_check, rtree::node_tag> { - template - static inline bool apply(overlaps const& p, Indexable const& i) + template + static inline bool apply(overlaps const& p, Box const& i) { // TODO: awulkiew - possibly change to the version without border case // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false @@ -66,10 +60,10 @@ struct predicate_check, rtree::node_predicates_tag> }; template -struct predicate_check, rtree::node_predicates_tag> +struct predicate_check, rtree::node_tag> { - template - static bool apply(within const& p, Indexable const& i) + template + static bool apply(within const& p, Box const& i) { // TODO: awulkiew - possibly change to the version without border case // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index eae2a9a08..863322faa 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -188,13 +188,16 @@ public: } private: - template - inline size_t nearest_one(DistancePredicate const& p, Predicates const& pred, value_type & v) const + template + inline size_t nearest_one(DistancesPredicates const& p, Predicates const& pred, value_type & v) const { + typedef typename detail::point_relation::type point_relation; + typedef typename detail::relation::value_type point_type; + typedef detail::rtree::visitors::nearest_one< value_type, translator_type, - typename detail::distance_point::type + point_type > result_type; result_type result; @@ -204,7 +207,7 @@ private: options_type, translator_type, box_type, - DistancePredicate, + DistancesPredicates, Predicates, result_type > nearest_v(m_translator, p, pred, result); @@ -214,13 +217,16 @@ private: return result.get(v); } - template - inline size_t nearest_k(DistancePredicate const& p, size_t k, Predicates const& pred, OutIter out_it) const + template + inline size_t nearest_k(DistancesPredicates const& p, size_t k, Predicates const& pred, OutIter out_it) const { + typedef typename detail::point_relation::type point_relation; + typedef typename detail::relation::value_type point_type; + typedef detail::rtree::visitors::nearest_k< value_type, translator_type, - typename detail::distance_point::type + point_type > result_type; result_type result(k); @@ -230,7 +236,7 @@ private: options_type, translator_type, box_type, - DistancePredicate, + DistancesPredicates, Predicates, result_type > nearest_v(m_translator, p, pred, result); diff --git a/include/boost/geometry/extensions/index/rtree/tags.hpp b/include/boost/geometry/extensions/index/rtree/tags.hpp new file mode 100644 index 000000000..682368f72 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/tags.hpp @@ -0,0 +1,24 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - tags related to rtree used in various files +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +struct value_tag {}; +struct node_tag {}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index c69a41717..e896a90f1 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -130,7 +130,7 @@ template < typename Options, typename Translator, typename Box, - typename DistancePredicate, + typename DistancesPredicates, typename Predicates, typename Result > @@ -143,16 +143,15 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef index::detail::distance_calc node_distance_calc; - typedef typename node_distance_calc::result_type node_distance_type; - typedef index::detail::distance_predicate_check node_distance_predicate_check; - typedef rtree::distance_less node_distance_less; + typedef index::detail::distances_calc node_distances_calc; + typedef typename node_distances_calc::result_type node_distances_type; + typedef index::detail::distances_predicates_check node_distances_predicates_check; - typedef index::detail::distance_calc value_distance_calc; - typedef typename value_distance_calc::result_type value_distance_type; - typedef index::detail::distance_predicate_check value_distance_predicate_check; + typedef index::detail::distances_calc value_distances_calc; + typedef typename value_distances_calc::result_type value_distances_type; + typedef index::detail::distances_predicates_check value_distances_predicates_check; - inline nearest(Translator const& t, DistancePredicate const& dist_pred, Predicates const& pred, Result & r) + inline nearest(Translator const& t, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r) : m_tr(t), m_dist_pred(dist_pred), m_pred(pred) , m_result(r) {} @@ -163,7 +162,7 @@ public: { // array of active nodes index::pushable_array< - std::pair, + std::pair, Options::parameters_type::max_elements > active_branch_list; @@ -175,13 +174,13 @@ public: it != elements.end(); ++it) { // if current node meets predicates - if ( index::predicates_check(m_pred, it->first) ) + if ( index::predicates_check(m_pred, it->first) ) { // calculate node's distance(s) for distance predicate - node_distance_type node_dist_data = node_distance_calc::apply(m_dist_pred, it->first); + node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); // if current node distance(s) meets distance predicate - if ( node_distance_predicate_check::apply(m_dist_pred, node_dist_data) ) + if ( node_distances_predicates_check::apply(m_dist_pred, node_dist_data) ) { // add current node's data into the list active_branch_list.push_back( std::make_pair(node_dist_data, it->second) ); @@ -194,7 +193,7 @@ public: return; // sort array - std::sort(active_branch_list.begin(), active_branch_list.end(), node_distance_less()); + std::sort(active_branch_list.begin(), active_branch_list.end(), abl_less); // recursively visit nodes for ( size_t i = 0 ;; ++i ) @@ -219,16 +218,23 @@ public: it != elements.end(); ++it) { // if value meets predicates - if ( index::predicates_check(m_pred, m_tr(*it)) ) + if ( index::predicates_check(m_pred, m_tr(*it)) ) { // calculate values distance for distance predicate - value_distance_type dist = value_distance_calc::apply(m_dist_pred, m_tr(*it)); + value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_tr(*it)); // if distance meets distance predicate - if ( value_distance_predicate_check::apply(m_dist_pred, dist) ) + if ( value_distances_predicates_check::apply(m_dist_pred, distances) ) { + typedef typename index::detail::point_relation::type point_relation_type; + typedef typename index::detail::relation::tag point_relation_tag; + // store value - m_result.store(*it, dist); + m_result.store( + *it, + index::detail::cdist_value + ::template get(distances) + ); } } } @@ -243,16 +249,33 @@ private: { // prune if box's mindist is further than value's mindist while ( !abl.empty() && - distance_node_pruning_check - ::apply(m_result.comparable_distance(), abl.back().first) ) + prune_node(m_result.comparable_distance(), abl.back().first) ) { abl.pop_back(); } } } + static inline bool abl_less( + std::pair const& p1, + std::pair const& p2) + { + return index::detail::cdist_value + ::template get(p1.first) + < index::detail::cdist_value + ::template get(p2.first); + } + + template + static inline bool prune_node(Distance const& smallest_dist, node_distances_type const& d) + { + return smallest_dist + < index::detail::cdist_value + ::template get(d); + } + Translator const& m_tr; - DistancePredicate const& m_dist_pred; + DistancesPredicates const& m_dist_pred; Predicates const& m_pred; Result & m_result; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp index 3708e0772..13581945d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -37,7 +37,7 @@ struct query for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( index::predicates_check(pred, it->first) ) + if ( index::predicates_check(pred, it->first) ) rtree::apply_visitor(*this, *it->second); } } @@ -50,7 +50,7 @@ struct query for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( index::predicates_check(pred, tr(*it)) ) + if ( index::predicates_check(pred, tr(*it)) ) { out_iter = *it; ++out_iter; diff --git a/include/boost/geometry/extensions/index/tuples.hpp b/include/boost/geometry/extensions/index/tuples.hpp new file mode 100644 index 000000000..5d0f4c0a0 --- /dev/null +++ b/include/boost/geometry/extensions/index/tuples.hpp @@ -0,0 +1,185 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - tags related to rtree used in various files +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TUPLES_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TUPLES_HPP + +#include + +// TODO move this to index/tuples and separate algorithms + +namespace boost { namespace geometry { namespace index { + +namespace tuples { + +// find_index + +namespace detail { + +template +struct find_index; + +template +struct find_index_impl +{ + static const size_t value = find_index::value; +}; + +template +struct find_index_impl +{ + static const size_t value = N - 1; +}; + +template +struct find_index_impl +{ + BOOST_MPL_ASSERT_MSG( + (false), + ELEMENT_NOT_FOUND, + (find_index_impl)); +}; + +template +struct find_index_impl +{ + static const size_t value = 0; +}; + +template +struct find_index +{ + static const size_t value = + find_index_impl< + Tuple, + El, + N, + typename boost::tuples::element::type + >::value; +}; + +} // namespace detail + +template +struct find_index +{ + static const size_t value = + detail::find_index< + Tuple, + El, + boost::tuples::length::value + >::value; +}; + +// types_equal + +template +struct equal +{ + static const bool value = false; +}; + +template +struct equal +{ + static const bool value = true; +}; + +// has + +namespace detail { + +template +struct has +{ + static const bool value + = equal< + typename boost::tuples::element::type, + El + >::value + || has::value; +}; + +template +struct has +{ + static const bool value + = equal< + typename boost::tuples::element<0, Tuple>::type, + El + >::value; +}; + +} // namespace detail + +template +struct has +{ + static const bool value + = detail::has< + Tuple, + El, + boost::tuples::length::value + >::value; +}; + +// add + +template +struct add +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TUPLE_TYPE, + (add)); +}; + +template +struct add, T> +{ + typedef boost::tuple type; +}; + +template +struct add, T> +{ + typedef boost::tuple type; +}; + +// add_if + +template +struct add_if +{ + typedef Tuple type; +}; + +template +struct add_if +{ + typedef typename add::type type; +}; + +// add_unique + +template +struct add_unique +{ + typedef typename add_if< + Tuple, + El, + !has::value + >::type type; +}; + +} // namespace tuples + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index ddae78142..40090b369 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -153,7 +153,14 @@ void mouse(int button, int state, int x, int y) search_point = P(x, y); nearest_boxes.clear(); - found_count = t.nearest(bgi::distance_centroid(search_point, min_distance, max_distance), count, std::back_inserter(nearest_boxes)); + found_count = t.nearest( + bgi::bounded( + search_point, + bgi::far(min_distance), + bgi::near(max_distance)), + count, + std::back_inserter(nearest_boxes) + ); if ( found_count > 0 ) { diff --git a/tests/main.cpp b/tests/main.cpp index c7e76984e..f26e2927d 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -23,6 +23,8 @@ BOOST_AUTO_TEST_CASE( first_test_case ) #include #include +#include + BOOST_AUTO_TEST_CASE( last_test_case ) { tests_rtree_filters_hpp(); diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 0f229d8d1..20b83a446 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -164,7 +164,7 @@ namespace helpers for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) + if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) res2.push_back(*it); } @@ -213,7 +213,7 @@ namespace helpers for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) + if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) res2.push_back(*it); } std::sort( From cfc5335ccca58f5804b270f1fd01e4b62d38bcaf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 27 Sep 2011 19:43:13 +0000 Subject: [PATCH 074/366] templates and functions parameters changed in filters and rtree's functions to suit new distances predicates. [SVN r74594] --- .../index/filters/nearest_filter.hpp | 26 +++++----- .../extensions/index/rtree/filters.hpp | 6 +-- .../geometry/extensions/index/rtree/rtree.hpp | 48 +++++++++---------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp index ea63c959e..cb6f15f4b 100644 --- a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp @@ -23,10 +23,10 @@ class nearest_filter typedef int* iterator; typedef const int* const_iterator; - template + template inline nearest_filter( Index const&, - Point const&, + DistancesPredicates const&, size_t, Predicates const& ) @@ -40,42 +40,42 @@ class nearest_filter namespace detail { -template +template struct nearest_filtered { inline nearest_filtered( - Point const& pt, + DistancesPredicates const& dpred, size_t k, Predicates const& pred ) - : point(pt) + : distances_predicates(dpred) , count(k) , predicates(pred) {} - Point const& point; + DistancesPredicates const& distances_predicates; size_t count; Predicates const& predicates; }; } // namespace detail -template -detail::nearest_filtered nearest_filtered( - Point const& pt, +template +detail::nearest_filtered nearest_filtered( + DistancesPredicates const& dpred, size_t k, Predicates const& pred = detail::empty()) { - return detail::nearest_filtered(pt, k, pred); + return detail::nearest_filtered(dpred, k, pred); } -template +template index::nearest_filter operator|( Index const& si, - detail::nearest_filtered const& f) + detail::nearest_filtered const& f) { - return index::nearest_filter(si, f.point, f.count, f.predicates); + return index::nearest_filter(si, f.distances_predicates, f.count, f.predicates); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 8a3eccb37..dcdfbf59c 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -55,15 +55,15 @@ public: typedef typename result_type::iterator iterator; typedef typename result_type::const_iterator const_iterator; - template + template inline nearest_filter( index::rtree const& rtree, - Point const& pt, + DistancesPredicates const& dpred, size_t k, Predicates const& pred ) { - rtree.nearest(pt, k, pred, std::back_inserter(m_result)); + rtree.nearest(dpred, k, pred, std::back_inserter(m_result)); } inline iterator begin() { return m_result.begin(); } diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 863322faa..e2e0d70b3 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -96,27 +96,27 @@ public: // return number of elements instead of bool? template - inline size_t nearest(DistancePredicate const& p, value_type & v) const + inline size_t nearest(DistancePredicate const& dpred, value_type & v) const { - return nearest_one(p, detail::empty(), v); + return nearest_one(dpred, detail::empty(), v); } template - inline size_t nearest(DistancePredicate const& p, Predicates const& pred, value_type & v) const + inline size_t nearest(DistancePredicate const& dpred, Predicates const& pred, value_type & v) const { - return nearest_one(p, pred, v); + return nearest_one(dpred, pred, v); } template - inline size_t nearest(DistancePredicate const& p, size_t k, OutIter out_it) const + inline size_t nearest(DistancePredicate const& dpred, size_t k, OutIter out_it) const { - return nearest_k(p, k, detail::empty(), out_it); + return nearest_k(dpred, k, detail::empty(), out_it); } template - inline size_t nearest(DistancePredicate const& p, size_t k, Predicates const& pred, OutIter out_it) const + inline size_t nearest(DistancePredicate const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { - return nearest_k(p, k, pred, out_it); + return nearest_k(dpred, k, pred, out_it); } inline void insert(value_type const& value) @@ -189,7 +189,7 @@ public: private: template - inline size_t nearest_one(DistancesPredicates const& p, Predicates const& pred, value_type & v) const + inline size_t nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; @@ -210,7 +210,7 @@ private: DistancesPredicates, Predicates, result_type - > nearest_v(m_translator, p, pred, result); + > nearest_v(m_translator, dpred, pred, result); detail::rtree::apply_visitor(nearest_v, *m_root); @@ -218,7 +218,7 @@ private: } template - inline size_t nearest_k(DistancesPredicates const& p, size_t k, Predicates const& pred, OutIter out_it) const + inline size_t nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; @@ -239,7 +239,7 @@ private: DistancesPredicates, Predicates, result_type - > nearest_v(m_translator, p, pred, result); + > nearest_v(m_translator, dpred, pred, result); detail::rtree::apply_visitor(nearest_v, *m_root); @@ -270,28 +270,28 @@ inline size_t query(rtree const& tree, Predicates co return tree.query(pred, out_it); } -template -inline size_t nearest(rtree const& tree, Point const& pt, Value & v) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Value & v) { - return tree.nearest(pt, v); + return tree.nearest(dpred, v); } -template -inline size_t nearest(rtree const& tree, Point const& pt, Predicates const& pred, Value & v) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v) { - return tree.nearest(pt, pred, v); + return tree.nearest(dpred, pred, v); } -template -inline size_t nearest(rtree const& tree, Point const& pt, size_t k, OutIter out_it) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, OutIter out_it) { - return tree.nearest(pt, k, out_it); + return tree.nearest(dpred, k, out_it); } -template -inline size_t nearest(rtree const& tree, Point const& pt, size_t k, Predicates const& pred, OutIter out_it) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) { - return tree.nearest(pt, k, pred, out_it); + return tree.nearest(dpred, k, pred, out_it); } template From 68fc281a60aec78947d64abb4c2de326a3e1c825 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 28 Sep 2011 11:04:17 +0000 Subject: [PATCH 075/366] Value predicates added. Error in boost::tuple predicates check fixed. [SVN r74596] --- .../extensions/index/distance_predicates.hpp | 2 + .../geometry/extensions/index/predicates.hpp | 96 ++++++++++++------- .../extensions/index/rtree/predicates.hpp | 43 ++++----- .../index/rtree/visitors/nearest.hpp | 5 +- .../extensions/index/rtree/visitors/query.hpp | 9 +- tests/additional_sizes_and_times.cpp | 33 ++++++- 6 files changed, 121 insertions(+), 67 deletions(-) diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index e7cc5d903..4134d0941 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -122,6 +122,8 @@ detail::far far(T const& v) namespace detail { +// TODO: awulkiew - consider storing points instead of PointRelations in predicates below + template struct unbounded : nonassignable diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index a48d222f4..26b4967ec 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -27,7 +27,6 @@ struct empty {}; template struct covered_by - : nonassignable { covered_by(Geometry const& g) : geometry(g) {} Geometry geometry; @@ -35,7 +34,6 @@ struct covered_by template struct intersects - : nonassignable { intersects(Geometry const& g) : geometry(g) {} Geometry geometry; @@ -43,7 +41,6 @@ struct intersects template struct overlaps - : nonassignable { overlaps(Geometry const& g) : geometry(g) {} Geometry geometry; @@ -51,12 +48,18 @@ struct overlaps template struct within - : nonassignable { within(Geometry const& g) : geometry(g) {} Geometry geometry; }; +template +struct value +{ + value(ValuePredicate const& vpred) : value_predicate(vpred) {} + ValuePredicate value_predicate; +}; + } // namespace detail inline detail::empty empty() @@ -88,6 +91,12 @@ inline detail::within within(Geometry const& g) return detail::within(g); } +template +inline detail::value value(ValuePredicate const& vpred) +{ + return detail::value(vpred); +} + namespace detail { @@ -99,11 +108,14 @@ namespace detail // distinguish between geometries and other types by use of geometry::tag // in predicate_check_default<..., GeomTag> -> predicate_check_default<..., void> +// TODO: awulkiew - consider passing Value/Node and Translator instead of +// Value and Indexable + template struct predicate_check { - template - static inline bool apply(Geometry const& g, Indexable const& i) + template + static inline bool apply(Geometry const& g, Value const&, Indexable const& i) { return geometry::intersects(i, g); } @@ -112,8 +124,8 @@ struct predicate_check template struct predicate_check { - template - static inline bool apply(Geometry const&, Indexable const&) + template + static inline bool apply(Geometry const&, Value const&, Indexable const&) { return true; } @@ -122,8 +134,8 @@ struct predicate_check template struct predicate_check, Tag> { - template - static inline bool apply(covered_by const& p, Indexable const& i) + template + static inline bool apply(covered_by const& p, Value const&, Indexable const& i) { return geometry::covered_by(i, p.geometry); } @@ -132,8 +144,8 @@ struct predicate_check, Tag> template struct predicate_check, Tag> { - template - static inline bool apply(intersects const& p, Indexable const& i) + template + static inline bool apply(intersects const& p, Value const&, Indexable const& i) { return geometry::intersects(i, p.geometry); } @@ -142,8 +154,8 @@ struct predicate_check, Tag> template struct predicate_check, Tag> { - template - static inline bool apply(overlaps const& p, Indexable const& i) + template + static inline bool apply(overlaps const& p, Value const&, Indexable const& i) { return geometry::overlaps(i, p.geometry); } @@ -152,60 +164,70 @@ struct predicate_check, Tag> template struct predicate_check, Tag> { - template - static inline bool apply(within const& p, Indexable const& i) + template + static inline bool apply(within const& p, Value const&, Indexable const& i) { return geometry::within(i, p.geometry); } }; +template +struct predicate_check, Tag> +{ + template + static inline bool apply(value const& p, Value const& v, Indexable const&) + { + return p.value_predicate(v); + } +}; + // predicates check template struct predicates_check_tuple { - template - static inline bool apply(TuplePredicates const& p, Indexable const& i) + template + static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) { - return predicates_check_tuple::apply(p, i) + return predicates_check_tuple::apply(p, v, i) && predicate_check< typename boost::tuples::element::type, Tag - >::apply(boost::get(p), i); + >::apply(boost::get(p), v, i); } }; template -struct predicates_check_tuple +struct predicates_check_tuple { - template - static inline bool apply(TuplePredicates const& p, Indexable const& i) + template + static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) { return predicate_check< typename boost::tuples::element<0, TuplePredicates>::type, Tag - >::apply(boost::get<0>(p), i); + >::apply(boost::get<0>(p), v, i); } }; template struct predicates_check { - template - static inline bool apply(Predicate const& p, Indexable const& i) + template + static inline bool apply(Predicate const& p, Value const& v, Indexable const& i) { - return predicate_check::apply(p, i); + return predicate_check::apply(p, v, i); } }; template struct predicates_check, Tag> { - template - static inline bool apply(std::pair const& p, Indexable const& i) + template + static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) { - return predicate_check::apply(p.first, i) - && predicate_check::apply(p.second, i); + return predicate_check::apply(p.first, v, i) + && predicate_check::apply(p.second, v, i); } }; @@ -221,24 +243,24 @@ struct predicates_check< { typedef boost::tuple predicates_type; - template - static inline bool apply(predicates_type const& p, Indexable const& i) + template + static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) { return predicates_check_tuple< predicates_type, Tag, boost::tuples::length::value - >::apply(p, i); + >::apply(p, v, i); } }; } // namespace detail -template -inline bool predicates_check(Predicates const& p, Indexable const& i) +template +inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i) { return detail::predicates_check - ::apply(p, i); + ::apply(p, v, i); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index 35efc773f..75306e22f 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -17,41 +17,24 @@ namespace boost { namespace geometry { namespace index { namespace detail { -//template -//struct predicate_check -//{ -// template -// static inline bool apply(Geometry const& g, Box const& i) -// { -// return geometry::intersects(i, g); -// } -//}; +// TODO: awulkiew - consider removing Value from parameters +// then predicates_check must be implemented for nodes as well template struct predicate_check, rtree::node_tag> { - template - static bool apply(covered_by const& p, Box const& i) + template + static bool apply(covered_by const& p, Value const&, Box const& i) { return geometry::intersects(i, p.geometry); } }; -//template -//struct predicate_check, rtree::node_predicates_tag> -//{ -// template -// static inline bool apply(intersects const& p, Box const& i) -// { -// return geometry::intersects(i, p.geometry); -// } -//}; - template struct predicate_check, rtree::node_tag> { - template - static inline bool apply(overlaps const& p, Box const& i) + template + static inline bool apply(overlaps const& p, Value const&, Box const& i) { // TODO: awulkiew - possibly change to the version without border case // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false @@ -62,8 +45,8 @@ struct predicate_check, rtree::node_tag> template struct predicate_check, rtree::node_tag> { - template - static bool apply(within const& p, Box const& i) + template + static bool apply(within const& p, Value const&, Box const& i) { // TODO: awulkiew - possibly change to the version without border case // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false @@ -71,6 +54,16 @@ struct predicate_check, rtree::node_tag> } }; +template +struct predicate_check, rtree::node_tag> +{ + template + static bool apply(value const&, Value const&, Box const&) + { + return true; + } +}; + } // namespace detail }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index e896a90f1..0999903f9 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -174,7 +174,8 @@ public: it != elements.end(); ++it) { // if current node meets predicates - if ( index::predicates_check(m_pred, it->first) ) + // 0 - dummy value + if ( index::predicates_check(m_pred, 0, it->first) ) { // calculate node's distance(s) for distance predicate node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); @@ -218,7 +219,7 @@ public: it != elements.end(); ++it) { // if value meets predicates - if ( index::predicates_check(m_pred, m_tr(*it)) ) + if ( index::predicates_check(m_pred, *it, m_tr(*it)) ) { // calculate values distance for distance predicate value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_tr(*it)); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp index 13581945d..39a12a345 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -34,10 +34,13 @@ struct query typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); + // traverse nodes meeting predicates for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( index::predicates_check(pred, it->first) ) + // if node meets predicates + // 0 - dummy value + if ( index::predicates_check(pred, 0, it->first) ) rtree::apply_visitor(*this, *it->second); } } @@ -47,10 +50,12 @@ struct query typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); + // get all values meeting predicates for (typename elements_type::const_iterator it = elements.begin(); it != elements.end(); ++it) { - if ( index::predicates_check(pred, tr(*it)) ) + // if value meets predicates + if ( index::predicates_check(pred, *it, tr(*it)) ) { out_iter = *it; ++out_iter; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 384dc1ab8..09aa04f4a 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -19,6 +19,15 @@ #include #include +template +struct test_pred +{ + bool operator()(V const& v) const + { + return v.second % 2 != 0; + } +}; + int main() { boost::timer tim; @@ -192,6 +201,28 @@ int main() std::cout << "found: " << temp << "\n"; } + // searching test + { + std::cout << "query(B) and value(odd index) searching time test... (" + << queries_count << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.query( + std::make_pair( + B(P(x - 10, y - 10), P(x + 10, y + 10)), + bgi::value(test_pred< std::pair >()) + ), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + // searching test { std::cout << "vector searching time test... (" @@ -231,7 +262,7 @@ int main() float x = coords[i].first + 100; float y = coords[i].second + 100; std::pair result; - temp += t.nearest(P(x, y), result); + temp += t.nearest(bgi::unbounded(P(x, y)), result); } std::cout << "time: " << tim.elapsed() << "s\n"; std::cout << "found: " << temp << "\n"; From f47c5d2ae7b81101993824eafd543f76af445d19 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 28 Sep 2011 11:50:24 +0000 Subject: [PATCH 076/366] tests adapted to use predicates check interface handling value predicates. [SVN r74597] --- tests/rtree_function.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 20b83a446..310f90874 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -164,7 +164,7 @@ namespace helpers for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) + if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) res2.push_back(*it); } @@ -213,7 +213,7 @@ namespace helpers for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - if ( bgi::predicates_check(pred, t.get_translator()(*it)) ) + if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) res2.push_back(*it); } std::sort( From c6c1fee74be809f45ed9699e83d8f887ae9e3a1f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 28 Sep 2011 23:29:50 +0000 Subject: [PATCH 077/366] additional predicates implemented. [SVN r74604] --- .../index/filters/nearest_filter.hpp | 2 + .../extensions/index/filters/query_filter.hpp | 2 + .../geometry/extensions/index/predicates.hpp | 160 ++++++++++++++++-- .../extensions/index/rtree/predicates.hpp | 102 ++++++++++- .../index/rtree/visitors/nearest.hpp | 2 + tests/rtree_function.hpp | 29 +++- 6 files changed, 278 insertions(+), 19 deletions(-) diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp index cb6f15f4b..f16774937 100644 --- a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp @@ -40,6 +40,8 @@ class nearest_filter namespace detail { +// TODO: awulkiew - consider removing references from predicates + template struct nearest_filtered { diff --git a/include/boost/geometry/extensions/index/filters/query_filter.hpp b/include/boost/geometry/extensions/index/filters/query_filter.hpp index a0bec8192..185278cd0 100644 --- a/include/boost/geometry/extensions/index/filters/query_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/query_filter.hpp @@ -38,6 +38,8 @@ class query_filter namespace detail { +// TODO: awulkiew - consider removing reference from predicates + template struct query_filtered { diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 26b4967ec..cffe33306 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -25,6 +25,13 @@ namespace detail { struct empty {}; +template +struct value +{ + value(ValuePredicate const& vpred) : value_predicate(vpred) {} + ValuePredicate value_predicate; +}; + template struct covered_by { @@ -32,6 +39,13 @@ struct covered_by Geometry geometry; }; +template +struct disjoint +{ + disjoint(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + template struct intersects { @@ -53,11 +67,39 @@ struct within Geometry geometry; }; -template -struct value +template +struct not_covered_by { - value(ValuePredicate const& vpred) : value_predicate(vpred) {} - ValuePredicate value_predicate; + not_covered_by(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_disjoint +{ + not_disjoint(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_intersects +{ + not_intersects(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_overlaps +{ + not_overlaps(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_within +{ + not_within(Geometry const& g) : geometry(g) {} + Geometry geometry; }; } // namespace detail @@ -67,12 +109,24 @@ inline detail::empty empty() return detail::empty(); } +template +inline detail::value value(ValuePredicate const& vpred) +{ + return detail::value(vpred); +} + template inline detail::covered_by covered_by(Geometry const& g) { return detail::covered_by(g); } +template +inline detail::disjoint disjoint(Geometry const& g) +{ + return detail::disjoint(g); +} + template inline detail::intersects intersects(Geometry const& g) { @@ -91,10 +145,34 @@ inline detail::within within(Geometry const& g) return detail::within(g); } -template -inline detail::value value(ValuePredicate const& vpred) +template +inline detail::not_covered_by not_covered_by(Geometry const& g) { - return detail::value(vpred); + return detail::not_covered_by(g); +} + +template +inline detail::not_disjoint not_disjoint(Geometry const& g) +{ + return detail::not_disjoint(g); +} + +template +inline detail::not_intersects not_intersects(Geometry const& g) +{ + return detail::not_intersects(g); +} + +template +inline detail::not_overlaps not_overlaps(Geometry const& g) +{ + return detail::not_overlaps(g); +} + +template +inline detail::not_within not_within(Geometry const& g) +{ + return detail::not_within(g); } namespace detail @@ -131,6 +209,16 @@ struct predicate_check } }; +template +struct predicate_check, Tag> +{ + template + static inline bool apply(value const& p, Value const& v, Indexable const&) + { + return p.value_predicate(v); + } +}; + template struct predicate_check, Tag> { @@ -141,6 +229,16 @@ struct predicate_check, Tag> } }; +template +struct predicate_check, Tag> +{ + template + static inline bool apply(disjoint const& p, Value const&, Indexable const& i) + { + return geometry::disjoint(i, p.geometry); + } +}; + template struct predicate_check, Tag> { @@ -171,13 +269,53 @@ struct predicate_check, Tag> } }; -template -struct predicate_check, Tag> +template +struct predicate_check, Tag> { template - static inline bool apply(value const& p, Value const& v, Indexable const&) + static inline bool apply(not_covered_by const& p, Value const&, Indexable const& i) { - return p.value_predicate(v); + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(not_disjoint const& p, Value const&, Indexable const& i) + { + return !geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(not_intersects const& p, Value const&, Indexable const& i) + { + return !geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(not_overlaps const& p, Value const&, Indexable const& i) + { + return !geometry::overlaps(i, p.geometry); + } +}; + +template +struct predicate_check, Tag> +{ + template + static inline bool apply(not_within const& p, Value const&, Indexable const& i) + { + return !geometry::within(i, p.geometry); } }; diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index 75306e22f..145e926aa 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -20,6 +20,36 @@ namespace detail { // TODO: awulkiew - consider removing Value from parameters // then predicates_check must be implemented for nodes as well +template +struct predicate_check +{ + template + static inline bool apply(Geometry const& g, Value const&, Indexable const& i) + { + return geometry::intersects(i, g); + } +}; + +template <> +struct predicate_check +{ + template + static inline bool apply(Geometry const&, Value const&, Indexable const&) + { + return true; + } +}; + +template +struct predicate_check, rtree::node_tag> +{ + template + static bool apply(value const&, Value const&, Box const&) + { + return true; + } +}; + template struct predicate_check, rtree::node_tag> { @@ -30,6 +60,26 @@ struct predicate_check, rtree::node_tag> } }; +template +struct predicate_check, rtree::node_tag> +{ + template + static bool apply(disjoint const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, rtree::node_tag> +{ + template + static inline bool apply(intersects const& p, Value const&, Indexable const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + template struct predicate_check, rtree::node_tag> { @@ -54,16 +104,62 @@ struct predicate_check, rtree::node_tag> } }; -template -struct predicate_check, rtree::node_tag> +template +struct predicate_check, rtree::node_tag> { template - static bool apply(value const&, Value const&, Box const&) + static bool apply(not_covered_by const& p, Value const&, Box const& i) { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, rtree::node_tag> +{ + template + static bool apply(not_disjoint const& p, Value const&, Box const& i) + { + return !geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, rtree::node_tag> +{ + template + static bool apply(not_intersects const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, rtree::node_tag> +{ + template + static bool apply(not_overlaps const& p, Value const&, Box const& i) + { + bool inters = geometry::intersects(i, p.geometry); + + //return !inters || ( inters && !geometry::overlaps(i, p.geometry) ); + + // TODO: awulkiew - write working condition + return true; } }; +template +struct predicate_check, rtree::node_tag> +{ + template + static bool apply(not_within const& p, Value const&, Box const& i) + { + return !geometry::within(i, p.geometry); + } +}; + } // namespace detail }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 0999903f9..d696780e0 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -125,6 +125,8 @@ private: std::vector< std::pair > m_neighbors; }; +// TODO: awulkiew - add additional pruning before adding nodes to the ABL + template < typename Value, typename Options, diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 310f90874..86db25daa 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -126,7 +126,7 @@ namespace helpers } template - bool results_comp(Cont const& c1, Cont const& c2, Translator const& tr) + bool results_compare(Cont const& c1, Cont const& c2, Translator const& tr) { if ( c1.size() != c2.size() ) return false; @@ -168,7 +168,10 @@ namespace helpers res2.push_back(*it); } - BOOST_CHECK( helpers::results_comp(res1, res2, t.get_translator()) ); + std::stringstream ss; + ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; + + BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.get_translator()), ss.str()); } } @@ -227,7 +230,10 @@ namespace helpers if ( k < res2.size() ) res2.resize(k); - BOOST_CHECK( helpers::results_comp(res1, res2, t.get_translator()) ); + std::stringstream ss; + ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; + + BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.get_translator()), ss.str()); } } } @@ -244,15 +250,21 @@ struct tests_rtree_function_queries namespace bgi = boost::geometry::index; helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; @@ -265,10 +277,16 @@ struct tests_rtree_function_queries namespace bgi = boost::geometry::index; helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); @@ -276,6 +294,7 @@ struct tests_rtree_function_queries helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; From e6633533d65055165f3d35beaeabb23d6a40e982 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 29 Sep 2011 00:03:45 +0000 Subject: [PATCH 078/366] operator!() predicates generators implemented. [SVN r74606] --- .../geometry/extensions/index/predicates.hpp | 78 ++++++++++++++++++- .../extensions/index/rtree/predicates.hpp | 6 -- tests/additional_sizes_and_times.cpp | 18 +++++ 3 files changed, 94 insertions(+), 8 deletions(-) diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index cffe33306..2f3921410 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -19,10 +19,10 @@ namespace boost { namespace geometry { namespace index { -// predicates - namespace detail { +// predicates + struct empty {}; template @@ -104,6 +104,8 @@ struct not_within } // namespace detail +// generators + inline detail::empty empty() { return detail::empty(); @@ -403,4 +405,76 @@ inline bool predicates_check(Predicates const& p, Value const& v, Indexable cons }}} // namespace boost::geometry::index +// operator! generators + +template +boost::geometry::index::detail::not_covered_by +operator!(boost::geometry::index::detail::covered_by const& p) +{ + return boost::geometry::index::detail::not_covered_by(p.geometry); +} + +template +boost::geometry::index::detail::covered_by +operator!(boost::geometry::index::detail::not_covered_by const& p) +{ + return boost::geometry::index::detail::covered_by(p.geometry); +} + +template +boost::geometry::index::detail::not_disjoint +operator!(boost::geometry::index::detail::disjoint const& p) +{ + return boost::geometry::index::detail::not_disjoint(p.geometry); +} + +template +boost::geometry::index::detail::disjoint +operator!(boost::geometry::index::detail::not_disjoint const& p) +{ + return boost::geometry::index::detail::disjoint(p.geometry); +} + +template +boost::geometry::index::detail::not_intersects +operator!(boost::geometry::index::detail::intersects const& p) +{ + return boost::geometry::index::detail::not_intersects(p.geometry); +} + +template +boost::geometry::index::detail::intersects +operator!(boost::geometry::index::detail::not_intersects const& p) +{ + return boost::geometry::index::detail::intersects(p.geometry); +} + +template +boost::geometry::index::detail::not_overlaps +operator!(boost::geometry::index::detail::overlaps const& p) +{ + return boost::geometry::index::detail::not_overlaps(p.geometry); +} + +template +boost::geometry::index::detail::overlaps +operator!(boost::geometry::index::detail::not_overlaps const& p) +{ + return boost::geometry::index::detail::overlaps(p.geometry); +} + +template +boost::geometry::index::detail::not_within +operator!(boost::geometry::index::detail::within const& p) +{ + return boost::geometry::index::detail::not_within(p.geometry); +} + +template +boost::geometry::index::detail::within +operator!(boost::geometry::index::detail::not_within const& p) +{ + return boost::geometry::index::detail::within(p.geometry); +} + #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index 145e926aa..5718e520d 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -140,12 +140,6 @@ struct predicate_check, rtree::node_tag> template static bool apply(not_overlaps const& p, Value const&, Box const& i) { - bool inters = geometry::intersects(i, p.geometry); - - //return !inters || ( inters && !geometry::overlaps(i, p.geometry) ); - - // TODO: awulkiew - write working condition - return true; } }; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 09aa04f4a..9272e8838 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -183,6 +183,24 @@ int main() std::cout << "found: " << temp << "\n"; } + // searching test + { + std::cout << "query(!disjoint(B)) searching time test... (" + << queries_count << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.query(!bgi::disjoint(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + // searching test { std::cout << "query(B) searching time test... (" From 48176c64e6fc9ec533eb39f550a9887568439ec2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 29 Sep 2011 11:48:13 +0000 Subject: [PATCH 079/366] k-nearest query optimized by use of heap instead of sorting. [SVN r74608] --- .../index/rtree/visitors/nearest.hpp | 37 +++++++++++------- tests/rtree_function.hpp | 39 ++++++++++++++++++- 2 files changed, 61 insertions(+), 15 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index d696780e0..dd17994f6 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -73,22 +73,30 @@ public: inline explicit nearest_k(size_t k) : m_count(k) { - // TEMP? - m_neighbors.reserve(m_count + 1); + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_count, "Number of neighbors should be greater than 0"); + + m_neighbors.reserve(m_count); } inline void store(Value const& val, distance_type const& curr_comp_dist) { - m_neighbors.push_back(std::make_pair(curr_comp_dist, val)); - std::sort(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + if ( m_neighbors.size() < m_count ) + { + m_neighbors.push_back(std::make_pair(curr_comp_dist, val)); - if ( m_count < m_neighbors.size() ) - m_neighbors.pop_back(); - - // TODO: awulkiew - test other methods: - // heap, manual inserting - // don't sort if size < k ? - // check the furthest distance at the first place, before push_back() + if ( m_neighbors.size() == m_count ) + std::make_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + } + else + { + if ( curr_comp_dist < m_neighbors.front().first ) + { + std::pop_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + m_neighbors.back().first = curr_comp_dist; + m_neighbors.back().second = val; + std::push_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less); + } + } } inline bool is_comparable_distance_valid() const @@ -98,9 +106,9 @@ public: inline distance_type comparable_distance() const { - return m_neighbors.size() < m_count ? - std::numeric_limits::max() : - m_neighbors.back().first; + return m_neighbors.size() < 0 + ? std::numeric_limits::max() + : m_neighbors.front().first; } template @@ -123,6 +131,7 @@ private: size_t m_count; std::vector< std::pair > m_neighbors; + distance_type m_biggest_comp_dist; }; // TODO: awulkiew - add additional pruning before adding nodes to the ABL diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 86db25daa..2243f8399 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -148,6 +148,43 @@ namespace helpers return true; } + template + bool nearest_results_compare(Point const& p, Cont const& c1, Cont const& c2, Translator const& tr) + { + namespace bg = boost::geometry; + namespace bgi = boost::geometry::index; + + typedef typename Translator::indexable_type indexable_type; + typedef bg::default_distance_result::type distance_type; + + if ( c1.size() != c2.size() ) + return false; + + if ( c1.size() == 0 && c2.size() == 0 ) + return true; + + distance_type biggest_distance1 = 0; + + for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) + { + distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); + + if ( biggest_distance1 < curr_distance ) + biggest_distance1 = curr_distance; + } + + distance_type biggest_distance2 = 0; + for ( typename Cont::const_iterator it = c2.begin() ; it != c2.end() ; ++it ) + { + distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); + + if ( biggest_distance2 < curr_distance ) + biggest_distance2 = curr_distance; + } + + return biggest_distance1 == biggest_distance2; + } + template void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) { @@ -233,7 +270,7 @@ namespace helpers std::stringstream ss; ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; - BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.get_translator()), ss.str()); + BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res2, t.get_translator()), ss.str()); } } } From 66c2cf2605cb341e000f09ef9786cb9ebbe09e5a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 29 Sep 2011 13:38:03 +0000 Subject: [PATCH 080/366] nearest query optimized by rejecting distant nodes before adding them to the active branches list. [SVN r74610] --- .../index/rtree/visitors/nearest.hpp | 21 +++++++++++++--- tests/additional_sizes_and_times.cpp | 24 ++++++++++++++++++- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index dd17994f6..a13f6b0d0 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -167,7 +167,7 @@ public: , m_result(r) {} - //TODO: awulkiew - check this approach: store one, global vector of active branches, add branches only if mindist is ok + //TODO: awulkiew - consider this approach: store one, global vector of active branches, add branches only if mindist is ok inline void operator()(internal_node const& n) { @@ -191,6 +191,17 @@ public: // calculate node's distance(s) for distance predicate node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); + // TODO: awulkiew - consider at first calculating just near distance, + // comparing it with m_result.comparable_distance if it's valid, + // after that calculate the rest of distances and check predicates + + // if current node is further than found neighbors - don't analyze it + if ( m_result.is_comparable_distance_valid() && + is_node_prunable(m_result.comparable_distance(), node_dist_data) ) + { + continue; + } + // if current node distance(s) meets distance predicate if ( node_distances_predicates_check::apply(m_dist_pred, node_dist_data) ) { @@ -235,6 +246,10 @@ public: // calculate values distance for distance predicate value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_tr(*it)); + // TODO: awulkiew - consider at first calculating just point relation distance, + // comparing it with m_result.comparable_distance if it's valid, + // after that calculate the rest of distances and check predicates + // if distance meets distance predicate if ( value_distances_predicates_check::apply(m_dist_pred, distances) ) { @@ -261,7 +276,7 @@ private: { // prune if box's mindist is further than value's mindist while ( !abl.empty() && - prune_node(m_result.comparable_distance(), abl.back().first) ) + is_node_prunable(m_result.comparable_distance(), abl.back().first) ) { abl.pop_back(); } @@ -279,7 +294,7 @@ private: } template - static inline bool prune_node(Distance const& smallest_dist, node_distances_type const& d) + static inline bool is_node_prunable(Distance const& smallest_dist, node_distances_type const& d) { return smallest_dist < index::detail::cdist_value diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 9272e8838..1145cff69 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -221,7 +221,7 @@ int main() // searching test { - std::cout << "query(B) and value(odd index) searching time test... (" + std::cout << "pair: query(B) and value(odd index) searching time test... (" << queries_count << ")\n"; tim.restart(); size_t temp = 0; @@ -241,6 +241,28 @@ int main() std::cout << "found: " << temp << "\n"; } + // searching test + { + std::cout << "tuple: query(B) and value(odd index) searching time test... (" + << queries_count << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t.query( + boost::make_tuple( + B(P(x - 10, y - 10), P(x + 10, y + 10)), + bgi::value(test_pred< std::pair >()) + ), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + // searching test { std::cout << "vector searching time test... (" From e1895aab7609a16011df95833bf93dc2e320a5d8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 29 Sep 2011 22:54:22 +0000 Subject: [PATCH 081/366] added simple commands (various queries) to GLUT example. [SVN r74615] --- tests/additional_glut_vis.cpp | 231 ++++++++++++++++++++++++++-------- 1 file changed, 182 insertions(+), 49 deletions(-) diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 40090b369..b420f1f97 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -17,13 +17,16 @@ #include #include -typedef boost::geometry::model::point P; -typedef boost::geometry::model::box

B; -//boost::geometry::index::rtree t(2, 1); +namespace bg = boost::geometry; +namespace bgi = bg::index; -boost::geometry::index::rtree< +typedef bg::model::point P; +typedef bg::model::box

B; +//bgi::rtree t(2, 1); + +bgi::rtree< B, - boost::geometry::index::rstar<4, 2> > t; + bgi::rstar<4, 2> > t; std::vector vect; size_t found_count = 0; @@ -32,8 +35,101 @@ float min_distance = 20; float max_distance = 30; size_t count = 10; std::vector nearest_boxes; +B search_box; -void draw_search_area() +enum query_mode_type { + qm_knn, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw +} query_mode = qm_knn; + +bool search_valid = false; + +void knn() +{ + float x = ( rand() % 1000 ) / 10.0f; + float y = ( rand() % 1000 ) / 10.0f; + + search_point = P(x, y); + nearest_boxes.clear(); + found_count = t.nearest( + bgi::bounded( + search_point, + bgi::far(min_distance), + bgi::near(max_distance)), + count, + std::back_inserter(nearest_boxes) + ); + + if ( found_count > 0 ) + { + std::cout << "search point: "; + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, search_point); + std::cout << "\nfound: "; + for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); + std::cout << '\n'; + } + } + else + std::cout << "nearest not found\n"; +} + +template +void query() +{ + float x = ( rand() % 1000 ) / 10.0f; + float y = ( rand() % 1000 ) / 10.0f; + float w = 10 + ( rand() % 1000 ) / 100.0f; + float h = 10 + ( rand() % 1000 ) / 100.0f; + + search_box = B(P(x - w, y - h), P(x + w, y + h)); + nearest_boxes.clear(); + found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) ); + + if ( found_count > 0 ) + { + std::cout << "search box: "; + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, search_box); + std::cout << "\nfound: "; + for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); + std::cout << '\n'; + } + } + else + std::cout << "nearest not found\n"; +} + +void search() +{ + if ( query_mode == qm_knn ) + knn(); + else if ( query_mode == qm_c ) + query< bgi::detail::covered_by >(); + else if ( query_mode == qm_d ) + query< bgi::detail::disjoint >(); + else if ( query_mode == qm_i ) + query< bgi::detail::intersects >(); + else if ( query_mode == qm_o ) + query< bgi::detail::overlaps >(); + else if ( query_mode == qm_w ) + query< bgi::detail::within >(); + else if ( query_mode == qm_nc ) + query< bgi::detail::not_covered_by >(); + else if ( query_mode == qm_nd ) + query< bgi::detail::not_disjoint >(); + else if ( query_mode == qm_ni ) + query< bgi::detail::not_intersects >(); + else if ( query_mode == qm_no ) + query< bgi::detail::not_overlaps >(); + else if ( query_mode == qm_nw ) + query< bgi::detail::not_within >(); + + search_valid = true; +} + +void draw_knn_area() { float x = boost::geometry::get<0>(search_point); float y = boost::geometry::get<1>(search_point); @@ -61,16 +157,37 @@ void draw_search_area() glEnd(); } +void draw_query_area() +{ + float x1 = boost::geometry::get(search_box); + float y1 = boost::geometry::get(search_box); + float x2 = boost::geometry::get(search_box); + float y2 = boost::geometry::get(search_box); + float z = t.depth(); + + // search box + glBegin(GL_LINE_LOOP); + glVertex3f(x1, y1, z); + glVertex3f(x2, y1, z); + glVertex3f(x2, y2, z); + glVertex3f(x1, y2, z); + glEnd(); +} + void render_scene(void) { glClear(GL_COLOR_BUFFER_BIT); boost::geometry::index::gl_draw(t); - if ( found_count > 0 ) + if ( search_valid ) { glColor3f(1.0f, 0.5f, 0.0f); - draw_search_area(); + + if ( query_mode == qm_knn ) + draw_knn_area(); + else + draw_query_area(); for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) boost::geometry::index::detail::rtree::visitors::detail::gl_draw_indexable(nearest_boxes[i], t.depth()); @@ -95,16 +212,13 @@ void resize(int w, int h) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( - 150.0f, 150.0f, 150.0f, + 120.0f, 120.0f, 120.0f, 50.0f, 50.0f, -1.0f, 0.0f, 1.0f, 0.0f); } void mouse(int button, int state, int x, int y) { - namespace bg = boost::geometry; - namespace bgi = bg::index; - if ( button == GLUT_LEFT_BUTTON && state == GLUT_DOWN ) { float x = ( rand() % 100 ); @@ -121,10 +235,11 @@ void mouse(int button, int state, int x, int y) bgi::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; - std::cout << "\n" << t << "\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; } else if ( button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN ) { @@ -141,63 +256,81 @@ void mouse(int button, int state, int x, int y) bgi::detail::rtree::visitors::detail::print_indexable(std::cout, b); std::cout << '\n'; - std::cout << "\n" << t << "\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; } else if ( button == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN ) { - float x = ( rand() % 1000 ) / 10.0f; - float y = ( rand() % 1000 ) / 10.0f; - - search_point = P(x, y); - nearest_boxes.clear(); - found_count = t.nearest( - bgi::bounded( - search_point, - bgi::far(min_distance), - bgi::near(max_distance)), - count, - std::back_inserter(nearest_boxes) - ); - - if ( found_count > 0 ) - { - std::cout << "search point: "; - bgi::detail::rtree::visitors::detail::print_indexable(std::cout, search_point); - std::cout << "\nfound: "; - for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) - { - bgi::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); - std::cout << '\n'; - } - } - else - std::cout << "nearest not found\n"; - - std::cout << "\n" << t << "\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(); } glutPostRedisplay(); } +std::string current_line; + +void keyboard(unsigned char key, int x, int y) +{ + if ( key == '\r' || key == '\n' ) + { + if ( current_line == "t" ) + { + std::cout << "\n" << t << "\n"; + } + else + { + if ( current_line == "knn" ) + query_mode = qm_knn; + else if ( current_line == "c" ) + query_mode = qm_c; + else if ( current_line == "d" ) + query_mode = qm_d; + else if ( current_line == "i" ) + query_mode = qm_i; + else if ( current_line == "o" ) + query_mode = qm_o; + else if ( current_line == "w" ) + query_mode = qm_w; + else if ( current_line == "nc" ) + query_mode = qm_nc; + else if ( current_line == "nd" ) + query_mode = qm_nd; + else if ( current_line == "ni" ) + query_mode = qm_ni; + else if ( current_line == "no" ) + query_mode = qm_no; + else if ( current_line == "nw" ) + query_mode = qm_nw; + + search(); + glutPostRedisplay(); + } + + current_line.clear(); + std::cout << '\n'; + } + else + { + current_line += key; + std::cout << key; + } +} + int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(800, 600); - glutCreateWindow("Mouse click to insert new value"); + glutCreateWindow("boost::geometry::index::rtree GLUT test"); glutDisplayFunc(render_scene); glutReshapeFunc(resize); glutMouseFunc(mouse); - - std::cout << "Mouse click to insert new value"; + glutKeyboardFunc(keyboard); glutMainLoop(); From f163bd877aa3a661fb793f7b8ea3ae04930860c8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 30 Sep 2011 10:03:46 +0000 Subject: [PATCH 082/366] rtree's clear(), box() + tests added. [SVN r74616] --- .../geometry/extensions/index/rtree/rtree.hpp | 81 ++- .../index/rtree/visitors/children_box.hpp | 68 +++ tests/rtree_function.hpp | 520 +++++++++--------- 3 files changed, 406 insertions(+), 263 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index e2e0d70b3..94c6e768b 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,17 @@ namespace boost { namespace geometry { namespace index { // TODO copying // TODO move extensional/debug visitors to the other folder +// TODO: awulkiew +// iterators, begin/end/etc. + +// TODO: copy, assignment + +// TODO: should funcions like empty() clear() box() be free functions? +// change name of empty() - empty predicate generator? + +// TODO which types should be public and which one should be private? +// nodes, options etc. probably shouldn't + template < typename Value, typename Parameters, @@ -69,16 +81,12 @@ public: , m_leafs_level(0) , m_translator(translator) { - m_root = detail::rtree::create_node(leaf()); + create(); } ~rtree() { - detail::rtree::visitors::destroy del_v; - detail::rtree::apply_visitor(del_v, *m_root); - - // TODO: awulkiew - move this into the destroy visitor? - detail::rtree::delete_node(m_root); + destroy(); } template @@ -92,9 +100,6 @@ public: return find_v.found_count; } - // TODO: awulkiew - change Point to Geometry? - // return number of elements instead of bool? - template inline size_t nearest(DistancePredicate const& dpred, value_type & v) const { @@ -155,16 +160,21 @@ public: return 0 == m_values_count; } - // TODO: awulkiew - // clear() - // aabb/box/get_box/etc. - // iterators, begin/end/etc. + inline void clear() + { + destroy(); + create(); + } - //inline void clear() - //{ - // // TODO: awulkiew - implement - // BOOST_GEOMETRY_INDEX_ASSERT(false, "not implemented"); - //} + inline box_type box() const + { + detail::rtree::visitors::children_box + children_box_v(m_translator); + + detail::rtree::apply_visitor(children_box_v, *m_root); + + return children_box_v.result; + } template inline void apply_visitor(Visitor & visitor) const @@ -188,6 +198,28 @@ public: } private: + inline void create() + { + m_root = detail::rtree::create_node(leaf()); + m_values_count = 0; + m_leafs_level = 0; + } + + inline void destroy() + { + detail::rtree::visitors::destroy del_v; + detail::rtree::apply_visitor(del_v, *m_root); + + // TODO: awulkiew - consider moving this into the destroy visitor + // but have in mind that visitors works on references + // and address from reference would be passed here + detail::rtree::delete_node(m_root); + + m_root = 0; + m_values_count = 0; + m_leafs_level = 0; + } + template inline size_t nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { @@ -294,6 +326,12 @@ inline size_t nearest(rtree const& tree, DistancesPr return tree.nearest(dpred, k, pred, out_it); } +template +inline void clear(rtree & tree) +{ + return tree.clear(); +} + template inline size_t size(rtree const& tree) { @@ -306,6 +344,13 @@ inline bool empty(rtree const& tree) return tree.empty(); } +template +inline typename rtree::box_type +box(rtree const& tree) +{ + return tree.box(); +} + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp new file mode 100644 index 000000000..761634233 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp @@ -0,0 +1,68 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree node children box calculating visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_CHILDREN_BOX_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_CHILDREN_BOX_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +class children_box + : public rtree::visitor::type + , index::nonassignable +{ + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + +public: + inline children_box(Translator const& tr) + : m_tr(tr) + { + geometry::assign_inverse(result); + } + + inline void operator()(internal_node const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + for( typename elements_type::const_iterator it = elements.begin(); + it != elements.end() ; ++it) + { + geometry::expand(result, it->first); + } + } + + inline void operator()(leaf const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + for(typename elements_type::const_iterator it = elements.begin(); + it != elements.end() ; ++it) + { + geometry::expand(result, m_tr(*it)); + } + } + + Box result; + +private: + Translator const& m_tr; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_CHILDREN_BOX_HPP diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 2243f8399..4aac2fc91 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -15,263 +15,282 @@ namespace helpers { - template - struct value_randomizer_impl_set {}; - template - struct value_randomizer_impl_set +template +struct value_randomizer_impl_set {}; + +template +struct value_randomizer_impl_set +{ + inline static void apply( + Box & b, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type w) { - inline static void apply( - Box & b, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type w) - { - namespace bg = boost::geometry; - typedef typename bg::index::traits::coordinate_type::type coord_t; + namespace bg = boost::geometry; + typedef typename bg::index::traits::coordinate_type::type coord_t; - coord_t c1 = ::rand() / coord_t(RAND_MAX / m); - coord_t c2 = ::rand() / coord_t(RAND_MAX / w); + coord_t c1 = ::rand() / coord_t(RAND_MAX / m); + coord_t c2 = ::rand() / coord_t(RAND_MAX / w); - bg::set(b, c1 - c2); - bg::set(b, c1 + c2); - } - }; + bg::set(b, c1 - c2); + bg::set(b, c1 + c2); + } +}; - template - struct value_randomizer_impl_set +template +struct value_randomizer_impl_set +{ + inline static void apply( + Point & p, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type) { - inline static void apply( - Point & p, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type) - { - namespace bg = boost::geometry; - typedef typename bg::index::traits::coordinate_type::type coord_t; + namespace bg = boost::geometry; + typedef typename bg::index::traits::coordinate_type::type coord_t; - coord_t c = ::rand() / coord_t(RAND_MAX / m); + coord_t c = ::rand() / coord_t(RAND_MAX / m); - bg::set(p, c); - } - }; + bg::set(p, c); + } +}; - template - struct value_randomizer_impl +template +struct value_randomizer_impl +{ + inline static void apply( + Indexable & i, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type w) { - inline static void apply( - Indexable & i, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type w) - { - value_randomizer_impl::apply(i, m, w); - value_randomizer_impl_set< - Indexable, - D - 1, - typename boost::geometry::index::traits::tag::type - >::apply(i, m, w); - } - }; + value_randomizer_impl::apply(i, m, w); + value_randomizer_impl_set< + Indexable, + D - 1, + typename boost::geometry::index::traits::tag::type + >::apply(i, m, w); + } +}; - template - struct value_randomizer_impl +template +struct value_randomizer_impl +{ + inline static void apply( + Indexable & i, + typename boost::geometry::index::traits::coordinate_type::type m, + typename boost::geometry::index::traits::coordinate_type::type w) { - inline static void apply( - Indexable & i, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type w) - { - value_randomizer_impl_set< - Indexable, - 0, - typename boost::geometry::index::traits::tag::type - >::apply(i, m, w); - } - }; + value_randomizer_impl_set< + Indexable, + 0, + typename boost::geometry::index::traits::tag::type + >::apply(i, m, w); + } +}; - template - struct value_randomizer - { - typedef Indexable value_type; +template +struct value_randomizer +{ + typedef Indexable value_type; - typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; + typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; - inline value_randomizer(coord_t mm, coord_t ww) - : m(mm), w(ww) - {} + inline value_randomizer(coord_t mm, coord_t ww) + : m(mm), w(ww) + {} - inline Indexable operator()() const - { - namespace bg = boost::geometry; - namespace bgi = bg::index; - - Indexable i; - value_randomizer_impl::value>::apply(i, m, w); - return i; - } - - coord_t m, w; - }; - - template - void random_insert(Rtree & t, Cont & c, size_t n, Randomizer r) + inline Indexable operator()() const { namespace bg = boost::geometry; namespace bgi = bg::index; - for ( size_t i = 0 ; i < n ; ++i ) - { - typename Randomizer::value_type v = r(); - bgi::insert(t, v); - c.push_back(v); - } + Indexable i; + value_randomizer_impl::value>::apply(i, m, w); + return i; } - template - bool results_compare(Cont const& c1, Cont const& c2, Translator const& tr) + coord_t m, w; +}; + +template +void random_insert(Rtree & t, Cont & c, size_t n, Randomizer r) +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + + for ( size_t i = 0 ; i < n ; ++i ) { - if ( c1.size() != c2.size() ) - return false; + typename Randomizer::value_type v = r(); + bgi::insert(t, v); + c.push_back(v); + } +} - for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) - { - bool found = false; - for ( typename Cont::const_iterator it2 = c2.begin() ; it2 != c2.end() ; ++it2 ) - if ( tr.equals(*it, *it2) ) - { - found = true; - break; - } +template +bool results_compare(Cont const& c1, Cont const& c2, Translator const& tr) +{ + if ( c1.size() != c2.size() ) + return false; - if ( !found ) - return false; - } + for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) + { + bool found = false; + for ( typename Cont::const_iterator it2 = c2.begin() ; it2 != c2.end() ; ++it2 ) + if ( tr.equals(*it, *it2) ) + { + found = true; + break; + } + if ( !found ) + return false; + } + + return true; +} + +template +bool nearest_results_compare(Point const& p, Cont const& c1, Cont const& c2, Translator const& tr) +{ + namespace bg = boost::geometry; + namespace bgi = boost::geometry::index; + + typedef typename Translator::indexable_type indexable_type; + typedef bg::default_distance_result::type distance_type; + + if ( c1.size() != c2.size() ) + return false; + + if ( c1.size() == 0 && c2.size() == 0 ) return true; + + distance_type biggest_distance1 = 0; + + for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) + { + distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); + + if ( biggest_distance1 < curr_distance ) + biggest_distance1 = curr_distance; } - template - bool nearest_results_compare(Point const& p, Cont const& c1, Cont const& c2, Translator const& tr) + distance_type biggest_distance2 = 0; + for ( typename Cont::const_iterator it = c2.begin() ; it != c2.end() ; ++it ) { - namespace bg = boost::geometry; - namespace bgi = boost::geometry::index; + distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); - typedef typename Translator::indexable_type indexable_type; - typedef bg::default_distance_result::type distance_type; - - if ( c1.size() != c2.size() ) - return false; - - if ( c1.size() == 0 && c2.size() == 0 ) - return true; - - distance_type biggest_distance1 = 0; - - for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) - { - distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); - - if ( biggest_distance1 < curr_distance ) - biggest_distance1 = curr_distance; - } - - distance_type biggest_distance2 = 0; - for ( typename Cont::const_iterator it = c2.begin() ; it != c2.end() ; ++it ) - { - distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); - - if ( biggest_distance2 < curr_distance ) - biggest_distance2 = curr_distance; - } - - return biggest_distance1 == biggest_distance2; + if ( biggest_distance2 < curr_distance ) + biggest_distance2 = curr_distance; } - template - void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) + return biggest_distance1 == biggest_distance2; +} + +template +struct val_mindist_cmp +{ + val_mindist_cmp(Point const& p, Translator const& t) + : pt(p), tr(t) + {} + + template + bool operator()(Value const& v1, Value const& v2) { - namespace bg = boost::geometry; - namespace bgi = bg::index; - - for ( size_t i = 0 ; i < n ; ++i ) - { - Predicate pred = Predicate(r()); - - std::vector res1, res2; - - bgi::query(t, pred, std::back_inserter(res1)); - - for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) - { - if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) - res2.push_back(*it); - } - - std::stringstream ss; - ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; - - BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.get_translator()), ss.str()); - } + return boost::geometry::index::comparable_distance_near(pt, tr(v1)) + < boost::geometry::index::comparable_distance_near(pt, tr(v2)); } - template - struct val_mindist_cmp - { - val_mindist_cmp(Point const& p, Translator const& t) - : pt(p), tr(t) - {} + Point const& pt; + Translator const& tr; +}; - template - bool operator()(Value const& v1, Value const& v2) +template +Box values_box(Iter first, Iter last, Translator const& tr) +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + + Box b; + bg::assign_inverse(b); + + for ( ; first != last ; ++first ) + { + bg::expand(b, tr(*first)); + } + + return b; +} + +} // namespace helpers + +template +void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + + for ( size_t i = 0 ; i < n ; ++i ) + { + Predicate pred = Predicate(r()); + + std::vector res1, res2; + + bgi::query(t, pred, std::back_inserter(res1)); + + for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - return boost::geometry::index::comparable_distance_near(pt, tr(v1)) - < boost::geometry::index::comparable_distance_near(pt, tr(v2)); + if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) + res2.push_back(*it); } - Point const& pt; - Translator const& tr; - }; + std::stringstream ss; + ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; - template - void random_nearest_check( - Rtree const& t, - Cont const& c, - size_t n, - PointRandomizer const& pr, - size_t k, - PredicateRandomizer const& r) + BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.get_translator()), ss.str()); + } +} + +template +void random_nearest_check( + Rtree const& t, + Cont const& c, + size_t n, + PointRandomizer const& pr, + size_t k, + PredicateRandomizer const& r) +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + + for ( size_t i = 0 ; i < n ; ++i ) { - namespace bg = boost::geometry; - namespace bgi = bg::index; + typename PointRandomizer::value_type pt = pr(); + Predicate pred = Predicate(r()); - for ( size_t i = 0 ; i < n ; ++i ) + std::vector res1, res2; + + bgi::nearest(t, pt, k, pred, std::back_inserter(res1)); + + for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - typename PointRandomizer::value_type pt = pr(); - Predicate pred = Predicate(r()); - - std::vector res1, res2; - - bgi::nearest(t, pt, k, pred, std::back_inserter(res1)); - - for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) - { - if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) - res2.push_back(*it); - } - std::sort( - res2.begin(), - res2.end(), - val_mindist_cmp< - typename PointRandomizer::value_type, - typename Rtree::translator_type - >(pt, t.get_translator()) - ); - if ( k < res2.size() ) - res2.resize(k); - - std::stringstream ss; - ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; - - BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res2, t.get_translator()), ss.str()); + if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) + res2.push_back(*it); } + std::sort( + res2.begin(), + res2.end(), + helpers::val_mindist_cmp< + typename PointRandomizer::value_type, + typename Rtree::translator_type + >(pt, t.get_translator()) + ); + if ( k < res2.size() ) + res2.resize(k); + + std::stringstream ss; + ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; + + BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res2, t.get_translator()), ss.str()); } } @@ -286,22 +305,22 @@ struct tests_rtree_function_queries { namespace bgi = boost::geometry::index; - helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); - helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; @@ -313,25 +332,25 @@ struct tests_rtree_function_queries { namespace bgi = boost::geometry::index; - helpers::random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); - helpers::random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - helpers::random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; @@ -350,7 +369,18 @@ void tests_rtree_function(Translator const& tr = Translator()) helpers::random_insert(t, v, 10, helpers::value_randomizer(10, 1)); + B bt = bgi::box(t); + B bv = helpers::values_box(v.begin(), v.end(), tr); + BOOST_CHECK(bg::equals(bt, bv)); + tests_rtree_function_queries::type>::apply(t, v); + + bgi::clear(t); + BOOST_CHECK(bgi::empty(t)); + bt = bgi::box(t); + B be; + bg::assign_inverse(be); + BOOST_CHECK(bg::equals(be, bt)); } BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) From 4bc1bc3eb798c119ba2896a03d20105060977dd6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 30 Sep 2011 13:12:44 +0000 Subject: [PATCH 083/366] copy constructor implemented + tests updated, rtree::get_translator() changed to rtree::translator() + other files updated to respect this [SVN r74618] --- .../index/rtree/node/node_default.hpp | 14 +- .../geometry/extensions/index/rtree/rtree.hpp | 51 ++++++-- .../index/rtree/visitors/are_boxes_ok.hpp | 2 +- .../index/rtree/visitors/are_levels_ok.hpp | 2 +- .../index/rtree/visitors/children_box.hpp | 16 +-- .../extensions/index/rtree/visitors/copy.hpp | 76 +++++++++++ .../index/rtree/visitors/gl_draw.hpp | 2 +- .../index/rtree/visitors/nearest.hpp | 4 +- .../extensions/index/rtree/visitors/print.hpp | 2 +- tests/additional_sizes_and_times.cpp | 28 ++++ tests/main.cpp | 3 +- tests/rtree_filters.hpp | 44 ++++--- tests/rtree_function.hpp | 122 ++++++++++-------- 13 files changed, 251 insertions(+), 115 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/copy.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index b189a07b9..c32e1f983 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -153,7 +153,7 @@ struct element_indexable_type< template inline typename Translator::indexable_type const& - element_indexable(Value const& el, Translator const& tr) +element_indexable(Value const& el, Translator const& tr) { return tr(el); } @@ -207,14 +207,14 @@ struct elements_type template inline typename elements_type::type & - elements(Node & n) +elements(Node & n) { return n.elements; } template inline typename elements_type::type const& - elements(Node const& n) +elements(Node const& n) { return n.elements; } @@ -224,13 +224,9 @@ inline typename elements_type::type const& template inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) { - Box result; + BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box"); - if (first == last) - { - geometry::assign_zero(result); - return result; - } + Box result; geometry::convert(element_indexable(*first, tr), result); ++first; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 94c6e768b..ce41f936c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -27,11 +27,12 @@ #include -#include -#include -#include #include #include +#include +#include +#include +#include #include #include @@ -47,6 +48,7 @@ namespace boost { namespace geometry { namespace index { // iterators, begin/end/etc. // TODO: copy, assignment +// allow copying of a tree with different template parameters? e.g. Parameters, Translator? // TODO: should funcions like empty() clear() box() be free functions? // change name of empty() - empty predicate generator? @@ -84,9 +86,14 @@ public: create(); } - ~rtree() + inline rtree(rtree const& src) { - destroy(); + copy(src, *this); + } + + inline ~rtree() + { + destroy(*this); } template @@ -162,12 +169,19 @@ public: inline void clear() { - destroy(); + destroy(*this); create(); } inline box_type box() const { + if ( empty() ) + { + box_type result; + geometry::assign_inverse(result); + return result; + } + detail::rtree::visitors::children_box children_box_v(m_translator); @@ -182,7 +196,7 @@ public: detail::rtree::apply_visitor(visitor, *m_root); } - inline translator_type const& get_translator() const + inline translator_type const& translator() const { return m_translator; } @@ -205,19 +219,30 @@ private: m_leafs_level = 0; } - inline void destroy() + inline void destroy(rtree & t) { detail::rtree::visitors::destroy del_v; - detail::rtree::apply_visitor(del_v, *m_root); + detail::rtree::apply_visitor(del_v, *t.m_root); // TODO: awulkiew - consider moving this into the destroy visitor // but have in mind that visitors works on references // and address from reference would be passed here - detail::rtree::delete_node(m_root); + detail::rtree::delete_node(t.m_root); - m_root = 0; - m_values_count = 0; - m_leafs_level = 0; + t.m_root = 0; + t.m_values_count = 0; + t.m_leafs_level = 0; + } + + inline void copy(rtree const& src, rtree & dst) const + { + detail::rtree::visitors::copy copy_v; + detail::rtree::apply_visitor(copy_v, *src.m_root); + + dst.m_root = copy_v.result; + dst.m_values_count = src.m_values_count; + dst.m_leafs_level = src.m_leafs_level; + dst.m_translator = src.m_translator; } template diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 7a1acd23a..94408eaf7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -117,7 +117,7 @@ bool are_boxes_ok(rtree const& tree) typename rt::value_type, typename rt::options_type, typename rt::translator_type, - typename rt::box_type> v(tree.get_translator()); + typename rt::box_type> v(tree.translator()); tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index c1d88b2a0..b9394dd24 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -95,7 +95,7 @@ bool are_levels_ok(rtree const& tree) typename rt::value_type, typename rt::options_type, typename rt::translator_type, - typename rt::box_type> v(tree.get_translator()); + typename rt::box_type> v(tree.translator()); tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp index 761634233..34f493323 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp @@ -27,20 +27,14 @@ class children_box public: inline children_box(Translator const& tr) : m_tr(tr) - { - geometry::assign_inverse(result); - } + {} inline void operator()(internal_node const& n) { typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - for( typename elements_type::const_iterator it = elements.begin(); - it != elements.end() ; ++it) - { - geometry::expand(result, it->first); - } + result = rtree::elements_box(elements.begin(), elements.end(), m_tr); } inline void operator()(leaf const& n) @@ -48,11 +42,7 @@ public: typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - for(typename elements_type::const_iterator it = elements.begin(); - it != elements.end() ; ++it) - { - geometry::expand(result, m_tr(*it)); - } + result = rtree::elements_box(elements.begin(), elements.end(), m_tr); } Box result; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp new file mode 100644 index 000000000..26bdd8737 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -0,0 +1,76 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree copying visitor +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +struct copy + : public rtree::visitor::type +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + explicit inline copy() + : result(0) + {} + + inline void operator()(internal_node & n) + { + node * new_node = rtree::create_node(internal_node()); + + typedef typename rtree::elements_type::type elements_type; + elements_type & elements = rtree::elements(n); + + elements_type & elements_dst = rtree::elements(rtree::get(*new_node)); + + for (typename elements_type::iterator it = elements.begin(); + it != elements.end(); ++it) + { + rtree::apply_visitor(*this, *it->second); + + elements_dst.push_back( std::make_pair(it->first, result) ); + } + + result = new_node; + } + + inline void operator()(leaf & l) + { + node * new_node = rtree::create_node(leaf()); + + typedef typename rtree::elements_type::type elements_type; + elements_type & elements = rtree::elements(l); + + elements_type & elements_dst = rtree::elements(rtree::get(*new_node)); + + for (typename elements_type::iterator it = elements.begin(); + it != elements.end(); ++it) + { + elements_dst.push_back(*it); + } + + result = new_node; + } + + node * result; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP 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 ea9e55c2b..1d4e9feb7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -201,7 +201,7 @@ void gl_draw(rtree const& tree, typedef typename rtree::box_type box_type; detail::rtree::visitors::gl_draw - gl_draw_v(tree.get_translator(), level_first, level_last, z_coord_level_multiplier); + gl_draw_v(tree.translator(), level_first, level_last, z_coord_level_multiplier); tree.apply_visitor(gl_draw_v); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index a13f6b0d0..2796bd480 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -191,7 +191,7 @@ public: // calculate node's distance(s) for distance predicate node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); - // TODO: awulkiew - consider at first calculating just near distance, + // TODO: awulkiew - consider at first calculating near distance only, // comparing it with m_result.comparable_distance if it's valid, // after that calculate the rest of distances and check predicates @@ -246,7 +246,7 @@ public: // calculate values distance for distance predicate value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_tr(*it)); - // TODO: awulkiew - consider at first calculating just point relation distance, + // TODO: awulkiew - consider at first calculating point relation distance only, // comparing it with m_result.comparable_distance if it's valid, // after that calculate the rest of distances and check predicates diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 26e16a3e5..45928e1e0 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -185,7 +185,7 @@ std::ostream & operator<<(std::ostream & os, rtree c typedef typename rtree::options_type options_type; typedef typename rtree::translator_type translator_type; typedef typename rtree::box_type box_type; - detail::rtree::visitors::print print_v(os, tree.get_translator()); + detail::rtree::visitors::print print_v(os, tree.translator()); tree.apply_visitor(print_v); return os; } diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 1145cff69..2ac1ca206 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -183,6 +183,34 @@ int main() std::cout << "found: " << temp << "\n"; } + // copying test + { + std::cout << "rtree copying time test... (" + << values_count << ")\n"; + tim.restart(); + RT t_copy(t); + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "new size: " << t_copy.size() << '\n'; + + // t_copy searching test + { + std::cout << "tree copy query(intersects(B)) searching time test... (" + << queries_count << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + std::deque< std::pair > result; + t_copy.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + } + // searching test { std::cout << "query(!disjoint(B)) searching time test... (" diff --git a/tests/main.cpp b/tests/main.cpp index f26e2927d..0ed7fda2d 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -27,8 +27,7 @@ BOOST_AUTO_TEST_CASE( first_test_case ) BOOST_AUTO_TEST_CASE( last_test_case ) { - tests_rtree_filters_hpp(); - + #ifdef _MSC_VER std::cin.get(); #endif diff --git a/tests/rtree_filters.hpp b/tests/rtree_filters.hpp index 98461a1d3..86a9454af 100644 --- a/tests/rtree_filters.hpp +++ b/tests/rtree_filters.hpp @@ -12,24 +12,24 @@ #include #include -template -void tests_rtree_filters_hpp_print_range(R const& r) -{ - BOOST_FOREACH(typename boost::iterator_value::type const& b, r) - { - float min_x = b.min_corner().template get<0>(); - float min_y = b.min_corner().template get<1>(); - float max_x = b.max_corner().template get<0>(); - float max_y = b.max_corner().template get<1>(); - std::cout << "(" << min_x << ", " << min_y << ")"; - std::cout << 'x'; - std::cout << "(" << max_x << ", " << max_y << ")"; - std::cout << '\n'; - } - std::cout << std::endl; -} +//template +//void tests_rtree_filters_hpp_print_range(R const& r) +//{ +// BOOST_FOREACH(typename boost::iterator_value::type const& b, r) +// { +// float min_x = b.min_corner().template get<0>(); +// float min_y = b.min_corner().template get<1>(); +// float max_x = b.max_corner().template get<0>(); +// float max_y = b.max_corner().template get<1>(); +// std::cout << "(" << min_x << ", " << min_y << ")"; +// std::cout << 'x'; +// std::cout << "(" << max_x << ", " << max_y << ")"; +// std::cout << '\n'; +// } +// std::cout << std::endl; +//} -void tests_rtree_filters_hpp() +BOOST_AUTO_TEST_CASE(tests_rtree_query_filter) { #ifdef TEST_PRINT_INFO std::cout << "tests/rtree_filters.hpp\n"; @@ -47,10 +47,14 @@ void tests_rtree_filters_hpp() bgi::insert(t, B(P(4, 4), P(5, 5))); bgi::insert(t, B(P(6, 6), P(7, 7))); bgi::insert(t, B(P(8, 8), P(9, 9))); - std::cout << t; - std::cout << "Query: (2.5, 2.5)x(4.5, 4.5)\n"; - tests_rtree_filters_hpp_print_range(t | bgi::query_filtered(B(P(2.5f, 2.5f), P(4.5f, 4.5f)))); + size_t n = 0; + BOOST_FOREACH(B const& b, t | bgi::query_filtered(B(P(1.5f, 1.5f), P(4.5f, 4.5f)))) + { + ++n; + } + + BOOST_CHECK(n == 2); } } diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 4aac2fc91..60048dd69 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -224,7 +224,7 @@ Box values_box(Iter first, Iter last, Translator const& tr) } // namespace helpers template -void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) +void random_query_check(Rtree const& t, Rtree const& t_copy, Cont const& c, size_t n, Randomizer r) { namespace bg = boost::geometry; namespace bgi = bg::index; @@ -233,26 +233,32 @@ void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) { Predicate pred = Predicate(r()); - std::vector res1, res2; + std::vector res1, res2, res3; bgi::query(t, pred, std::back_inserter(res1)); + bgi::query(t_copy, pred, std::back_inserter(res2)); for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) - res2.push_back(*it); + if ( bgi::predicates_check(pred, *it, t.translator()(*it)) ) + res3.push_back(*it); } std::stringstream ss; - ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; + ss << "\nPredicate: " << typeid(Predicate).name() << "\n" + << "res1: " << res1.size() + << ", res2: " << res2.size() + << ", res3: " << res3.size() << '\n'; - BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.get_translator()), ss.str()); + BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.translator()), ss.str()); + BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res3, t.translator()), ss.str()); } } template void random_nearest_check( Rtree const& t, + Rtree const& t_copy, Cont const& c, size_t n, PointRandomizer const& pr, @@ -267,30 +273,36 @@ void random_nearest_check( typename PointRandomizer::value_type pt = pr(); Predicate pred = Predicate(r()); - std::vector res1, res2; + std::vector res1, res2, res3; bgi::nearest(t, pt, k, pred, std::back_inserter(res1)); + bgi::nearest(t_copy, pt, k, pred, std::back_inserter(res2)); + for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { - if ( bgi::predicates_check(pred, *it, t.get_translator()(*it)) ) - res2.push_back(*it); + if ( bgi::predicates_check(pred, *it, t.translator()(*it)) ) + res3.push_back(*it); } std::sort( - res2.begin(), - res2.end(), + res3.begin(), + res3.end(), helpers::val_mindist_cmp< typename PointRandomizer::value_type, typename Rtree::translator_type - >(pt, t.get_translator()) + >(pt, t.translator()) ); - if ( k < res2.size() ) - res2.resize(k); + if ( k < res3.size() ) + res3.resize(k); std::stringstream ss; - ss << "\nPredicate: " << typeid(Predicate).name() << "\nres1: " << res1.size() << ", res2: " << res2.size() << '\n'; + ss << "\nPredicate: " << typeid(Predicate).name() << "\n" + << "res1: " << res1.size() + << ", res2: " << res2.size() + << ", res3: " << res3.size() << '\n'; - BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res2, t.get_translator()), ss.str()); + BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res2, t.translator()), ss.str()); + BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res3, t.translator()), ss.str()); } } @@ -301,26 +313,26 @@ template struct tests_rtree_function_queries { template - inline static void apply(Rtree const& t, Cont const& v) + inline static void apply(Rtree const& t, Rtree const& t_copy, Cont const& v) { namespace bgi = boost::geometry::index; - random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); - random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; @@ -328,29 +340,29 @@ template struct tests_rtree_function_queries { template - inline static void apply(Rtree const& t, Cont const& v) + inline static void apply(Rtree const& t, Rtree const& t_copy, Cont const& v) { namespace bgi = boost::geometry::index; - random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); - random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; @@ -369,11 +381,17 @@ void tests_rtree_function(Translator const& tr = Translator()) helpers::random_insert(t, v, 10, helpers::value_randomizer(10, 1)); + bgi::rtree t_copy(t); + + BOOST_CHECK(bgi::size(t) == 10); + BOOST_CHECK(bgi::size(t) == bgi::size(t_copy)); + BOOST_CHECK(bg::equals(bgi::box(t), bgi::box(t_copy))); + B bt = bgi::box(t); B bv = helpers::values_box(v.begin(), v.end(), tr); BOOST_CHECK(bg::equals(bt, bv)); - tests_rtree_function_queries::type>::apply(t, v); + tests_rtree_function_queries::type>::apply(t, t_copy, v); bgi::clear(t); BOOST_CHECK(bgi::empty(t)); From 84b1230d6d4b475102412b182c8a38f05bde4823 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 30 Sep 2011 21:39:13 +0000 Subject: [PATCH 084/366] added rtree's constructor, insert, remove methods and free functions working for ranges specified by a pair of iterators. [SVN r74619] --- .../geometry/extensions/index/rtree/rtree.hpp | 124 +++++++++++++----- 1 file changed, 88 insertions(+), 36 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index ce41f936c..1d6115f5e 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -41,20 +41,24 @@ namespace boost { namespace geometry { namespace index { -// TODO copying // TODO move extensional/debug visitors to the other folder +// move gldraw indexable (+ value with translator) to geometry::index namespace -// TODO: awulkiew -// iterators, begin/end/etc. +// TODO: awulkiew - implement iterators ? -// TODO: copy, assignment -// allow copying of a tree with different template parameters? e.g. Parameters, Translator? +// TODO: allow copying of a tree with different template parameters? e.g. Parameters, Translator? -// TODO: should funcions like empty() clear() box() be free functions? -// change name of empty() - empty predicate generator? +// TODO: should funcions like empty(tree) clear(tree) box(tree) be free functions? +// change name of empty predicate generator - empty()? // TODO which types should be public and which one should be private? -// nodes, options etc. probably shouldn't +// nodes, options etc. probably shouldn't be public + +// TODO change remove() to erase() or just add erase() ? +// erase works on iterators of this container so this may be confusing with remove(ValIt, ValIt) + +// TODO add third parameter to insert(It, It) - unary_op, like in std::transform +// transforming It::value_type to rtree::value_type ? template < typename Value, @@ -86,9 +90,15 @@ public: create(); } - inline rtree(rtree const& src) + template + inline explicit rtree(Iterator first, Iterator last, translator_type const& translator = translator_type()) + : m_values_count(0) + , m_root(0) + , m_leafs_level(0) + , m_translator(translator) { - copy(src, *this); + create(); + insert(first, last); } inline ~rtree() @@ -96,6 +106,62 @@ public: destroy(*this); } + inline rtree(rtree const& src) + { + copy(src, *this); + } + + inline rtree & operator=(rtree const& src) + { + if ( &src == this ) + return *this; + + destroy(*this); + copy(src, *this); + + return *this; + } + + inline void insert(value_type const& value) + { + // TODO: awulkiew - assert for correct value + + detail::rtree::visitors::insert + insert_v(m_root, m_leafs_level, value, m_translator); + + detail::rtree::apply_visitor(insert_v, *m_root); + + ++m_values_count; + } + + template + inline void insert(Iterator first, Iterator last) + { + for ( ; first != last ; ++first ) + insert(*first); + } + + inline void remove(value_type const& value) + { + // TODO: awulkiew - assert for correct value + + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there is no elements in the rtree"); + + detail::rtree::visitors::remove + remove_v(m_root, m_leafs_level, value, m_translator); + + detail::rtree::apply_visitor(remove_v, *m_root); + + --m_values_count; + } + + template + inline void remove(Iterator first, Iterator last) + { + for ( ; first != last ; ++first ) + remove(*first); + } + template inline size_t query(Predicates const& pred, OutIter out_it) const { @@ -131,32 +197,6 @@ public: return nearest_k(dpred, k, pred, out_it); } - inline void insert(value_type const& value) - { - // TODO: awulkiew - assert for correct value - - detail::rtree::visitors::insert - insert_v(m_root, m_leafs_level, value, m_translator); - - detail::rtree::apply_visitor(insert_v, *m_root); - - ++m_values_count; - } - - inline void remove(value_type const& value) - { - // TODO: awulkiew - assert for correct value - - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there is no elements in the rtree"); - - detail::rtree::visitors::remove - remove_v(m_root, m_leafs_level, value, m_translator); - - detail::rtree::apply_visitor(remove_v, *m_root); - - --m_values_count; - } - inline size_t size() const { return m_values_count; @@ -315,12 +355,24 @@ inline void insert(rtree & tree, Value const& v) tree.insert(v); } +template +inline void insert(rtree & tree, Iterator first, Iterator last) +{ + tree.insert(first, last); +} + template inline void remove(rtree & tree, Value const& v) { tree.remove(v); } +template +inline void remove(rtree & tree, Iterator first, Iterator last) +{ + tree.remove(first, last); +} + template inline size_t query(rtree const& tree, Predicates const& pred, OutIter out_it) { From 164f39cf18421aa0b8ffe299ec684d86bfba2616 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 30 Sep 2011 22:48:01 +0000 Subject: [PATCH 085/366] added bgi::insert_iterator<> and bgi::inserter() + tests. [SVN r74620] --- .../geometry/extensions/index/inserter.hpp | 65 +++++++++++++++++++ .../geometry/extensions/index/rtree/rtree.hpp | 7 +- tests/additional_sizes_and_times.cpp | 20 ++++++ tests/rtree_function.hpp | 6 +- 4 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 include/boost/geometry/extensions/index/inserter.hpp diff --git a/include/boost/geometry/extensions/index/inserter.hpp b/include/boost/geometry/extensions/index/inserter.hpp new file mode 100644 index 000000000..73fe21fc7 --- /dev/null +++ b/include/boost/geometry/extensions/index/inserter.hpp @@ -0,0 +1,65 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - inserter +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_INSERTER_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_INSERTER_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +template +class insert_iterator : + public std::iterator +{ +public: + typedef Container container_type; + + inline explicit insert_iterator() +// : container(0) + {} + + inline explicit insert_iterator(Container & c) + : container(&c) + {} + + insert_iterator & operator=(typename Container::value_type const& value) + { + index::insert(*container, value); + return *this; + } + + insert_iterator & operator* () + { + return *this; + } + + insert_iterator & operator++ () + { + return *this; + } + + insert_iterator operator++(int) + { + return *this; + } + +private: + Container * container; +}; + +template +insert_iterator inserter(Container & c) +{ + return insert_iterator(c); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INSERTER_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 1d6115f5e..974e10d3c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -57,9 +57,6 @@ namespace boost { namespace geometry { namespace index { // TODO change remove() to erase() or just add erase() ? // erase works on iterators of this container so this may be confusing with remove(ValIt, ValIt) -// TODO add third parameter to insert(It, It) - unary_op, like in std::transform -// transforming It::value_type to rtree::value_type ? - template < typename Value, typename Parameters, @@ -355,7 +352,7 @@ inline void insert(rtree & tree, Value const& v) tree.insert(v); } -template +template inline void insert(rtree & tree, Iterator first, Iterator last) { tree.insert(first, last); @@ -367,7 +364,7 @@ inline void remove(rtree & tree, Value const& v) tree.remove(v); } -template +template inline void remove(rtree & tree, Iterator first, Iterator last) { tree.remove(first, last); diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 2ac1ca206..2d8352e12 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -137,6 +138,25 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; } + // elements inserting test using insert_iterator + { + RT t; + + std::cout << "rtree inserting time test using insert_iterator<>... (" + << values_count << ")\n"; + bgi::insert_iterator ii = bgi::inserter(t); + tim.restart(); + for (size_t i = 0 ; i < values_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + *ii++ = std::make_pair(b, i); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + } + std::vector< std::pair > v; // elements inserting test diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 60048dd69..3eb92a484 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -5,6 +5,7 @@ #include #include +#include #include @@ -118,10 +119,13 @@ void random_insert(Rtree & t, Cont & c, size_t n, Randomizer r) namespace bg = boost::geometry; namespace bgi = bg::index; + bgi::insert_iterator ii = bgi::inserter(t); + for ( size_t i = 0 ; i < n ; ++i ) { typename Randomizer::value_type v = r(); - bgi::insert(t, v); + //bgi::insert(t, v); + *ii++ = v; c.push_back(v); } } From f16cfaf4a3c2c20e017c41952c0a10c9d5b135eb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 1 Oct 2011 10:03:38 +0000 Subject: [PATCH 086/366] some comments added [SVN r74621] --- include/boost/geometry/extensions/index/rtree/rtree.hpp | 4 ++++ tests/additional_glut_vis.cpp | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 974e10d3c..51d4ba3f5 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -57,6 +57,8 @@ namespace boost { namespace geometry { namespace index { // TODO change remove() to erase() or just add erase() ? // erase works on iterators of this container so this may be confusing with remove(ValIt, ValIt) +// TODO delete unneeded nodes types (using vectors) and change the name of currently used one to node_default + template < typename Value, typename Parameters, @@ -251,6 +253,8 @@ public: private: inline void create() { + // TODO: awulkiew - consider moving create_node into the insert visitor + // and here setting m_root to 0 m_root = detail::rtree::create_node(leaf()); m_values_count = 0; m_leafs_level = 0; diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index b420f1f97..c1a21b5e9 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -9,7 +9,6 @@ #include -//#define BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES #include #include From a495ec75fdd3e1067f3c6ed2043e73763520f81a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 2 Oct 2011 10:49:54 +0000 Subject: [PATCH 087/366] destroy visitor moddified, some asserts added. [SVN r74646] --- .../extensions/index/algorithms/is_valid.hpp | 82 +++++++++++++++++++ .../extensions/index/distance_predicates.hpp | 24 ++++-- .../geometry/extensions/index/predicates.hpp | 6 -- .../geometry/extensions/index/rtree/rtree.hpp | 31 ++++--- .../index/rtree/visitors/destroy.hpp | 7 +- .../index/rtree/visitors/insert.hpp | 1 + 6 files changed, 121 insertions(+), 30 deletions(-) create mode 100644 include/boost/geometry/extensions/index/algorithms/is_valid.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/is_valid.hpp b/include/boost/geometry/extensions/index/algorithms/is_valid.hpp new file mode 100644 index 000000000..77f6ede62 --- /dev/null +++ b/include/boost/geometry/extensions/index/algorithms/is_valid.hpp @@ -0,0 +1,82 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.SpatialIndex - n-dimensional box's / point validity check +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template +struct is_valid_box +{ + BOOST_MPL_ASSERT_MSG( + (0 < Dimension && Dimension <= index::traits::dimension::value), + INVALID_DIMENSION_PARAMETER, + (is_valid_box)); + + static inline bool apply(Box const& b) + { + return is_valid_box::apply(b) && + ( index::get(b) <= index::get(b) ); + } +}; + +template +struct is_valid_box +{ + static inline bool apply(Box const& b) + { + return index::get(b) <= index::get(b); + } +}; + +} // namespace detail + +namespace dispatch { + +template +struct is_valid +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_INDEXABLE, + (is_valid)); +}; + +template +struct is_valid +{ + static inline bool apply(Indexable const&) + { + return true; + } +}; + +template +struct is_valid +{ + static inline bool apply(Indexable const& b) + { + return detail::is_valid_box::value>::apply(b); + } +}; + +} // namespace dispatch + +template +inline bool is_valid(Indexable const& b) +{ + return dispatch::is_valid::type>::apply(b); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 4134d0941..ddd58c9b5 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -347,14 +347,22 @@ struct cdist_value< template static inline type & get(cdist & cd) { - // TODO MPL_ASSERT tuples::equal>::value + BOOST_MPL_ASSERT_MSG( + (tuples::equal< cdist, cdist >::value), + TAGS_DO_NOT_MATCH, + (cdist_value)); + return cd.value; } template static inline type const& get(cdist const& cd) { - // TODO MPL_ASSERT tuples::equal>::value + BOOST_MPL_ASSERT_MSG( + (tuples::equal< cdist, cdist >::value), + TAGS_DO_NOT_MATCH, + (cdist_value)); + return cd.value; } }; @@ -368,7 +376,10 @@ namespace detail { template struct distances_calc_impl_rel { - // TODO MPL_ASSERT not implemented for this RelDist + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_RELATION, + (distances_calc_impl_rel)); }; template @@ -603,11 +614,8 @@ struct distances_calc< // distances_predicates_check -// TODO explicitly define DistanceType ? -// Indexable/Box is used in distances_predicates_check only for purpose of -// this explicit DistanceType definition - -// move distance_calc and distance_comp into geometry::index ? +// TODO explicitly define Distances type ? +// TODO move distance_calc and distance_comp into geometry::index ? template struct distances_predicates_check diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 2f3921410..1c40fa604 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -182,12 +182,6 @@ namespace detail // predicate check -// TODO: use empty definitions here + MPL_ASSERT ? -// implement default values predicates applied to values in leafs, as a function/functor as simple as possible -// bool fun(Value const& v); -// distinguish between geometries and other types by use of geometry::tag -// in predicate_check_default<..., GeomTag> -> predicate_check_default<..., void> - // TODO: awulkiew - consider passing Value/Node and Translator instead of // Value and Indexable diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 51d4ba3f5..d4cfbc8b6 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -27,6 +27,8 @@ #include +#include + #include #include #include @@ -123,10 +125,16 @@ public: inline void insert(value_type const& value) { - // TODO: awulkiew - assert for correct value + BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); - detail::rtree::visitors::insert - insert_v(m_root, m_leafs_level, value, m_translator); + detail::rtree::visitors::insert< + value_type, + value_type, + options_type, + translator_type, + box_type, + typename options_type::insert_tag + > insert_v(m_root, m_leafs_level, value, m_translator); detail::rtree::apply_visitor(insert_v, *m_root); @@ -142,12 +150,16 @@ public: inline void remove(value_type const& value) { - // TODO: awulkiew - assert for correct value + // TODO: awulkiew - assert for correct value (indexable) ? BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there is no elements in the rtree"); - detail::rtree::visitors::remove - remove_v(m_root, m_leafs_level, value, m_translator); + detail::rtree::visitors::remove< + value_type, + options_type, + translator_type, + box_type + > remove_v(m_root, m_leafs_level, value, m_translator); detail::rtree::apply_visitor(remove_v, *m_root); @@ -253,8 +265,6 @@ public: private: inline void create() { - // TODO: awulkiew - consider moving create_node into the insert visitor - // and here setting m_root to 0 m_root = detail::rtree::create_node(leaf()); m_values_count = 0; m_leafs_level = 0; @@ -265,11 +275,6 @@ private: detail::rtree::visitors::destroy del_v; detail::rtree::apply_visitor(del_v, *t.m_root); - // TODO: awulkiew - consider moving this into the destroy visitor - // but have in mind that visitors works on references - // and address from reference would be passed here - detail::rtree::delete_node(t.m_root); - t.m_root = 0; t.m_values_count = 0; t.m_leafs_level = 0; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 719f17171..0342fe4dd 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -31,13 +31,14 @@ struct destroy : public rtree::visitorsecond); - - rtree::delete_node(it->second); } + + rtree::delete_node(&n); } - inline void operator()(leaf &) + inline void operator()(leaf &n) { + rtree::delete_node(&n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 93bdc368c..e42ff494d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -184,6 +184,7 @@ protected: { BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value"); + BOOST_GEOMETRY_INDEX_ASSERT(0 != m_root_node, "there is no root node"); // TODO // assert - check if Box is correct } From a292370c6794e7b8f02990a05085afac5ee1691a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 2 Oct 2011 12:42:59 +0000 Subject: [PATCH 088/366] boost::variant based nodes with static-size elements containers added [SVN r74647] --- .../extensions/index/rtree/node/node.hpp | 1 + .../index/rtree/node/node_default_static.hpp | 5 +- .../node/node_default_static_variant.hpp | 78 +++++++++++++++++++ .../extensions/index/rtree/options.hpp | 1 + .../geometry/extensions/index/rtree/rtree.hpp | 1 + .../index/rtree/visitors/destroy.hpp | 4 +- 6 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 1c9bc5da6..7e3a05b5b 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -14,5 +14,6 @@ #include #include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp index b1b3ffe94..458817996 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp @@ -21,7 +21,10 @@ struct internal_node_poly : public node_poly { typedef index::pushable_array< - std::pair *>, + std::pair< + Box, + node_poly * + >, Parameters::max_elements + 1 > elements_type; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp new file mode 100644 index 000000000..4d6ef4242 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp @@ -0,0 +1,78 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree variant nodes with static-size containers +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +// nodes default types + +template +struct internal_node_variant +{ + typedef index::pushable_array< + std::pair< + Box, + typename node::type * + >, + Parameters::max_elements + 1 + > elements_type; + + elements_type elements; +}; + +template +struct leaf_variant +{ + typedef index::pushable_array elements_type; + elements_type elements; +}; + +// nodes traits + +template +struct node +{ + typedef boost::variant< + leaf_variant, + internal_node_variant + > type; +}; + +template +struct internal_node +{ + typedef internal_node_variant type; +}; + +template +struct leaf +{ + typedef leaf_variant type; +}; + +// visitor traits + +template +struct visitor +{ + typedef static_visitor<> type; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 842bae424..667e0161c 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -32,6 +32,7 @@ struct rstar_tag {}; struct node_default_tag {}; struct node_default_variant_tag {}; struct node_default_static_tag {}; +struct node_default_static_variant_tag {}; // TODO: awulkiew - implement those: //if ( m_min_elems_per_node < 1 ) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d4cfbc8b6..06c77cf67 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -274,6 +274,7 @@ private: { detail::rtree::visitors::destroy del_v; detail::rtree::apply_visitor(del_v, *t.m_root); + detail::rtree::delete_node(t.m_root); t.m_root = 0; t.m_values_count = 0; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 0342fe4dd..d5a16f4ba 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -31,14 +31,12 @@ struct destroy : public rtree::visitorsecond); + rtree::delete_node(it->second); } - - rtree::delete_node(&n); } inline void operator()(leaf &n) { - rtree::delete_node(&n); } }; From a1e7923de2ec63ce76e042812c2fc1a15af6f062 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 2 Oct 2011 23:32:22 +0000 Subject: [PATCH 089/366] prepared to use allocators, memory leak in remove visitor fixed, tests added [SVN r74661] --- .../extensions/index/rtree/filters.hpp | 14 +- .../index/rtree/node/node_default.hpp | 130 ++++++++++++++---- .../index/rtree/node/node_default_variant.hpp | 71 ++++++---- .../extensions/index/rtree/rstar/insert.hpp | 61 ++++---- .../geometry/extensions/index/rtree/rtree.hpp | 111 ++++++++------- .../extensions/index/rtree/visitors/copy.hpp | 16 ++- .../index/rtree/visitors/destroy.hpp | 32 ++++- .../index/rtree/visitors/insert.hpp | 41 +++--- .../index/rtree/visitors/remove.hpp | 29 +++- tests/rtree_function.hpp | 108 +++++++-------- 10 files changed, 390 insertions(+), 223 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index dcdfbf59c..1c63b0fa4 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -18,11 +18,11 @@ namespace boost { namespace geometry { namespace index { -template +template class rtree; -template -class query_filter< index::rtree > +template +class query_filter< index::rtree > { public: typedef std::vector result_type; @@ -31,7 +31,7 @@ public: template inline query_filter( - index::rtree const& rtree, + index::rtree const& rtree, Predicates const& pred ) { @@ -47,8 +47,8 @@ private: result_type m_result; }; -template -class nearest_filter< index::rtree > +template +class nearest_filter< index::rtree > { public: typedef std::vector result_type; @@ -57,7 +57,7 @@ public: template inline nearest_filter( - index::rtree const& rtree, + index::rtree const& rtree, DistancesPredicates const& dpred, size_t k, Predicates const& pred diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index c32e1f983..48131a1e3 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -167,36 +167,6 @@ element_indexable( return el.first; } -// create leaf node - -template -inline typename node::type * -create_node(leaf_poly const& l) -{ - typedef typename node::type node; - node * n = new leaf_poly(l); - return n; -} - -// create internal node - -template -inline typename node::type * -create_node(internal_node_poly const& in) -{ - typedef typename node::type node; - node * n = new internal_node_poly(in); - return n; -} - -// default node - -template -inline void delete_node(node_poly * n) -{ - delete n; -} - // nodes elements template @@ -237,6 +207,106 @@ inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) return result; } +// allocators + +template +struct allocators +{ + typedef Allocator allocator_type; + typedef typename allocator_type::size_type size_type; + + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other internal_node_allocator_type; + + typedef typename allocator_type::template rebind< + typename leaf::type + >::other leaf_allocator_type; + + inline explicit allocators(Allocator alloc) + : allocator(alloc) + , internal_node_allocator(allocator) + , leaf_allocator(allocator) + {} + + allocator_type allocator; + internal_node_allocator_type internal_node_allocator; + leaf_allocator_type leaf_allocator; +}; + +// create_node + +template +struct create_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, + (create_node)); +}; + +template +struct create_node< + Allocators, + internal_node_poly +> +{ + static inline typename node::type * apply(Allocators & allocators) + { + return new internal_node_poly(); + } +}; + +template +struct create_node< + Allocators, + leaf_poly +> +{ + static inline typename node::type * apply(Allocators & allocators) + { + return new leaf_poly(); + } +}; + +// destroy_node + +template +struct destroy_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, + (destroy_node)); +}; + +template +struct destroy_node< + Allocators, + internal_node_poly +> +{ + static inline void apply(Allocators & allocators, typename node::type * n) + { + delete n; + } +}; + +template +struct destroy_node< + Allocators, + leaf_poly +> +{ + static inline void apply(Allocators & allocators, typename node::type * n) + { + delete n; + } +}; + +// To delete variant node one must pass node * +// To delete poly node one must pass internal_node or leaf + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index 747ee0adf..f98a91a37 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -147,38 +147,59 @@ element_indexable(std::pair< return el.first; } -// create leaf node +// create_node -template -inline typename node::type * -create_node(leaf_variant const& l) +template +struct create_node< + Allocators, + internal_node_variant +> { - typedef typename node::type node; - node * n = new node(l); - return n; -} + static inline typename node::type * apply(Allocators & allocators) + { + return new typename node::type( + internal_node_variant() ); + } +}; -// create internal node - -template -inline typename node::type * -create_node(internal_node_variant const& in) +template +struct create_node< + Allocators, + leaf_variant +> { - typedef typename node::type node; - node * n = new node(in); - return n; -} + static inline typename node::type * apply(Allocators & allocators) + { + return new typename node::type( + leaf_variant() ); + } +}; -// default node +// destroy_node -template -inline void delete_node(boost::variant< - leaf_variant, - internal_node_variant - > * n) +template +struct destroy_node< + Allocators, + internal_node_variant +> { - delete n; -} + static inline void apply(Allocators & allocators, typename node::type * n) + { + delete n; + } +}; + +template +struct destroy_node< + Allocators, + leaf_variant +> +{ + static inline void apply(Allocators & allocators, typename node::type * n) + { + delete n; + } +}; }} // namespace detail::rtree diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 73632c124..2130c9bfc 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -119,11 +119,11 @@ struct level_insert_elements_type<0, Value, Value, Options, Box> >::type type; }; -template +template struct level_insert_base - : public detail::insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -135,8 +135,9 @@ struct level_insert_base size_t & leafs_level, Element const& element, Translator const& tr, + Allocators & allocators, size_t relative_level) - : base(root, leafs_level, element, tr, relative_level) + : base(root, leafs_level, element, tr, allocators, relative_level) , result_relative_level(0) {} @@ -192,11 +193,11 @@ struct level_insert_base elements_type result_elements; }; -template +template struct level_insert - : public level_insert_base + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -205,8 +206,9 @@ struct level_insert size_t & leafs_level, Element const& element, Translator const& tr, + Allocators & allocators, size_t relative_level) - : base(root, leafs_level, element, tr, relative_level) + : base(root, leafs_level, element, tr, allocators, relative_level) {} inline void operator()(internal_node & n) @@ -257,11 +259,11 @@ struct level_insert } }; -template -struct level_insert - : public level_insert_base +template +struct level_insert + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -270,8 +272,9 @@ struct level_insert size_t & leafs_level, Value const& v, Translator const& t, + Allocators & allocators, size_t relative_level) - : base(root, leafs_level, v, t, relative_level) + : base(root, leafs_level, v, t, allocators, relative_level) {} inline void operator()(internal_node & n) @@ -303,11 +306,11 @@ struct level_insert } }; -template -struct level_insert<0, Value, Value, Options, Translator, Box> - : public level_insert_base<0, Value, Value, Options, Translator, Box> +template +struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> + : public level_insert_base<0, Value, Value, Options, Translator, Box, Allocators> { - typedef level_insert_base<0, Value, Value, Options, Translator, Box> base; + typedef level_insert_base<0, Value, Value, Options, Translator, Box, Allocators> base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -316,8 +319,9 @@ struct level_insert<0, Value, Value, Options, Translator, Box> size_t & leafs_level, Value const& v, Translator const& t, + Allocators & allocators, size_t relative_level) - : base(root, leafs_level, v, t, relative_level) + : base(root, leafs_level, v, t, allocators, relative_level) {} inline void operator()(internal_node & n) @@ -349,8 +353,8 @@ struct level_insert<0, Value, Value, Options, Translator, Box> } // namespace detail // R*-tree insert visitor -template -class insert +template +class insert : public rtree::visitor::type , index::nonassignable { @@ -364,17 +368,18 @@ public: size_t & leafs_level, Element const& element, Translator const& tr, + Allocators & allocators, size_t relative_level = 0) : m_root(root), m_leafs_level(leafs_level), m_element(element) - , m_tr(tr), m_relative_level(relative_level) + , m_tr(tr), m_relative_level(relative_level), m_allocators(allocators) {} inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, m_element, m_tr, m_relative_level); + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( + m_root, m_leafs_level, m_element, m_tr, m_allocators, m_relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -388,8 +393,8 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, m_element, m_tr, m_relative_level); + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( + m_root, m_leafs_level, m_element, m_tr, m_allocators, m_relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -407,8 +412,8 @@ private: for ( typename Elements::const_reverse_iterator it = elements.rbegin(); it != elements.rend(); ++it) { - detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box> lins_v( - m_root, m_leafs_level, *it, m_tr, relative_level); + detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( + m_root, m_leafs_level, *it, m_tr, m_allocators, relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -427,6 +432,8 @@ private: Element const& m_element; Translator const& m_tr; size_t m_relative_level; + + Allocators m_allocators; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 06c77cf67..5cbd99d26 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -64,7 +64,8 @@ namespace boost { namespace geometry { namespace index { template < typename Value, typename Parameters, - typename Translator = translator::def + typename Translator = translator::def, + typename Allocator = std::allocator > class rtree : public boost::noncopyable @@ -82,17 +83,22 @@ public: typedef typename detail::rtree::internal_node::type internal_node; typedef typename detail::rtree::leaf::type leaf; - inline explicit rtree(translator_type const& translator = translator_type()) + typedef Allocator allocator_type; + typedef detail::rtree::allocators allocators_type; + typedef typename allocators_type::size_type size_type; + + inline explicit rtree(translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) : m_values_count(0) , m_root(0) , m_leafs_level(0) , m_translator(translator) + , m_allocators(allocator) { create(); } template - inline explicit rtree(Iterator first, Iterator last, translator_type const& translator = translator_type()) + inline explicit rtree(Iterator first, Iterator last, translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) : m_values_count(0) , m_root(0) , m_leafs_level(0) @@ -108,6 +114,7 @@ public: } inline rtree(rtree const& src) + : m_allocators(src.m_allocators) { copy(src, *this); } @@ -118,6 +125,8 @@ public: return *this; destroy(*this); + + m_allocators = src.m_allocators; copy(src, *this); return *this; @@ -133,8 +142,9 @@ public: options_type, translator_type, box_type, + allocators_type, typename options_type::insert_tag - > insert_v(m_root, m_leafs_level, value, m_translator); + > insert_v(m_root, m_leafs_level, value, m_translator, m_allocators); detail::rtree::apply_visitor(insert_v, *m_root); @@ -158,8 +168,9 @@ public: value_type, options_type, translator_type, - box_type - > remove_v(m_root, m_leafs_level, value, m_translator); + box_type, + allocators_type + > remove_v(m_root, m_leafs_level, value, m_translator, m_allocators); detail::rtree::apply_visitor(remove_v, *m_root); @@ -174,7 +185,7 @@ public: } template - inline size_t query(Predicates const& pred, OutIter out_it) const + inline size_type query(Predicates const& pred, OutIter out_it) const { detail::rtree::visitors::query find_v(m_translator, pred, out_it); @@ -185,30 +196,30 @@ public: } template - inline size_t nearest(DistancePredicate const& dpred, value_type & v) const + inline size_type nearest(DistancePredicate const& dpred, value_type & v) const { return nearest_one(dpred, detail::empty(), v); } template - inline size_t nearest(DistancePredicate const& dpred, Predicates const& pred, value_type & v) const + inline size_type nearest(DistancePredicate const& dpred, Predicates const& pred, value_type & v) const { return nearest_one(dpred, pred, v); } template - inline size_t nearest(DistancePredicate const& dpred, size_t k, OutIter out_it) const + inline size_type nearest(DistancePredicate const& dpred, size_t k, OutIter out_it) const { return nearest_k(dpred, k, detail::empty(), out_it); } template - inline size_t nearest(DistancePredicate const& dpred, size_t k, Predicates const& pred, OutIter out_it) const + inline size_type nearest(DistancePredicate const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { return nearest_k(dpred, k, pred, out_it); } - inline size_t size() const + inline size_type size() const { return m_values_count; } @@ -252,12 +263,12 @@ public: return m_translator; } - inline size_t values_count() const + inline size_type values_count() const { return m_values_count; } - inline size_t depth() const + inline size_type depth() const { return m_leafs_level; } @@ -265,16 +276,15 @@ public: private: inline void create() { - m_root = detail::rtree::create_node(leaf()); + m_root = detail::rtree::create_node::apply(m_allocators); m_values_count = 0; m_leafs_level = 0; } inline void destroy(rtree & t) { - detail::rtree::visitors::destroy del_v; + detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); detail::rtree::apply_visitor(del_v, *t.m_root); - detail::rtree::delete_node(t.m_root); t.m_root = 0; t.m_values_count = 0; @@ -283,7 +293,9 @@ private: inline void copy(rtree const& src, rtree & dst) const { - detail::rtree::visitors::copy copy_v; + //dst.m_allocators = src.m_allocators; + + detail::rtree::visitors::copy copy_v(dst.m_allocators); detail::rtree::apply_visitor(copy_v, *src.m_root); dst.m_root = copy_v.result; @@ -293,7 +305,7 @@ private: } template - inline size_t nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const + inline size_type nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; @@ -322,7 +334,7 @@ private: } template - inline size_t nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const + inline size_type nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; @@ -350,87 +362,88 @@ private: return result.get(out_it); } - size_t m_values_count; + size_type m_values_count; node *m_root; - size_t m_leafs_level; + size_type m_leafs_level; translator_type m_translator; + allocators_type m_allocators; }; -template -inline void insert(rtree & tree, Value const& v) +template +inline void insert(rtree & tree, Value const& v) { tree.insert(v); } -template -inline void insert(rtree & tree, Iterator first, Iterator last) +template +inline void insert(rtree & tree, Iterator first, Iterator last) { tree.insert(first, last); } -template -inline void remove(rtree & tree, Value const& v) +template +inline void remove(rtree & tree, Value const& v) { tree.remove(v); } -template -inline void remove(rtree & tree, Iterator first, Iterator last) +template +inline void remove(rtree & tree, Iterator first, Iterator last) { tree.remove(first, last); } -template -inline size_t query(rtree const& tree, Predicates const& pred, OutIter out_it) +template +inline size_t query(rtree const& tree, Predicates const& pred, OutIter out_it) { return tree.query(pred, out_it); } -template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Value & v) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Value & v) { return tree.nearest(dpred, v); } -template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v) { return tree.nearest(dpred, pred, v); } -template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, OutIter out_it) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, OutIter out_it) { return tree.nearest(dpred, k, out_it); } -template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) +template +inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) { return tree.nearest(dpred, k, pred, out_it); } -template -inline void clear(rtree & tree) +template +inline void clear(rtree & tree) { return tree.clear(); } -template -inline size_t size(rtree const& tree) +template +inline size_t size(rtree const& tree) { return tree.size(); } -template -inline bool empty(rtree const& tree) +template +inline bool empty(rtree const& tree) { return tree.empty(); } -template -inline typename rtree::box_type -box(rtree const& tree) +template +inline typename rtree::box_type +box(rtree const& tree) { return tree.box(); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp index 26bdd8737..31ea2b783 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -16,21 +16,24 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct copy +template +class copy : public rtree::visitor::type + , boost::noncopyable { +public: typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - explicit inline copy() + explicit inline copy(Allocators & allocators) : result(0) + , m_allocators(allocators) {} inline void operator()(internal_node & n) { - node * new_node = rtree::create_node(internal_node()); + node * new_node = rtree::create_node::apply(m_allocators); typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); @@ -50,7 +53,7 @@ struct copy inline void operator()(leaf & l) { - node * new_node = rtree::create_node(leaf()); + node * new_node = rtree::create_node::apply(m_allocators); typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(l); @@ -67,6 +70,9 @@ struct copy } node * result; + +private: + Allocators & m_allocators; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index d5a16f4ba..15fe5b126 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -16,28 +16,50 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct destroy : public rtree::visitor::type +template +class destroy + : public rtree::visitor::type + , boost::noncopyable { +public: + typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; + inline destroy(node * root_node, Allocators & allocators) + : m_current_node(root_node) + , m_allocators(allocators) + {} + inline void operator()(internal_node & n) { + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_current_node), "invalid pointers"); + + node * node_to_destroy = m_current_node; + typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); for (typename elements_type::iterator it = elements.begin(); it != elements.end(); ++it) { - rtree::apply_visitor(*this, *it->second); - rtree::delete_node(it->second); + m_current_node = it->second; + rtree::apply_visitor(*this, *m_current_node); } + + rtree::destroy_node::apply(m_allocators, node_to_destroy); } - inline void operator()(leaf &n) + inline void operator()(leaf & l) { + BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get(m_current_node), "invalid pointers"); + + rtree::destroy_node::apply(m_allocators, m_current_node); } + +private: + node * m_current_node; + Allocators & m_allocators; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index e42ff494d..c164186c3 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -101,16 +101,17 @@ protected: typedef typename Options::parameters_type parameters_type; public: - template + template static inline void apply(node* & root_node, size_t & leafs_level, Node & n, internal_node *parent_node, size_t current_child_index, - Translator const& tr) + Translator const& tr, + Allocators & allocators) { // create additional node - node * second_node = rtree::create_node(Node()); + node * second_node = rtree::create_node::apply(allocators); Node & n2 = rtree::get(*second_node); // redistribute elements @@ -140,7 +141,7 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(root_node), "node should be the root"); // create new root and add nodes - node * new_root = rtree::create_node(internal_node()); + node * new_root = rtree::create_node::apply(allocators); rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, root_node)); rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); @@ -154,7 +155,7 @@ public: // ----------------------------------------------------------------------- // // Default insert visitor -template +template class insert : public rtree::visitor::type , index::nonassignable @@ -170,6 +171,7 @@ protected: size_t & leafs_level, Element const& element, Translator const& t, + Allocators & allocators, size_t relative_level = 0 ) : m_element(element) @@ -181,6 +183,7 @@ protected: , m_parent(0) , m_current_child_index(0) , m_current_level(0) + , m_allocators(allocators) { BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value"); @@ -245,7 +248,7 @@ protected: template inline void split(Node & n) const { - detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr); + detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr, m_allocators); } // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation @@ -262,20 +265,22 @@ protected: internal_node *m_parent; size_t m_current_child_index; size_t m_current_level; + + Allocators & m_allocators; }; } // namespace detail // Insert visitor forward declaration -template +template struct insert; // Default insert visitor used for nodes elements -template -struct insert - : public detail::insert +template +struct insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -284,9 +289,10 @@ struct insert size_t & leafs_level, Element const& element, Translator const& tr, + Allocators & allocators, size_t relative_level = 0 ) - : base(root, leafs_level, element, tr, relative_level) + : base(root, leafs_level, element, tr, allocators, relative_level) {} inline void operator()(internal_node & n) @@ -316,11 +322,11 @@ struct insert }; // Default insert visitor specialized for Values elements -template -struct insert - : public detail::insert +template +struct insert + : public detail::insert { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -329,9 +335,10 @@ struct insert size_t & leafs_level, Value const& v, Translator const& t, + Allocators & allocators, size_t relative_level = 0 ) - : base(root, leafs_level, v, t, relative_level) + : base(root, leafs_level, v, t, allocators, relative_level) {} inline void operator()(internal_node & n) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 326a5a050..3a743585e 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -21,7 +21,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { // Default remove algorithm -template +template class remove : public rtree::visitor::type , index::nonassignable @@ -36,9 +36,11 @@ public: inline remove(node* & root, size_t & leafs_level, Value const& v, - Translator const& t) + Translator const& t, + Allocators & allocators) : m_value(v) , m_tr(t) + , m_allocators(allocators) , m_root_node(root) , m_leafs_level(leafs_level) , m_is_value_removed(false) @@ -115,16 +117,27 @@ public: is_leaf ilv; rtree::apply_visitor(ilv, *it->second); if ( ilv.result ) + { reinsert_elements(rtree::get(*it->second), it->first); + + rtree::destroy_node::apply(m_allocators, it->second); + } else + { reinsert_elements(rtree::get(*it->second), it->first); + + rtree::destroy_node::apply(m_allocators, it->second); + } } // shorten the tree if ( rtree::elements(n).size() == 1 ) { + node * root_to_destroy = m_root_node; m_root_node = rtree::elements(n)[0].second; --m_leafs_level; + + rtree::destroy_node::apply(m_allocators, root_to_destroy); } } } @@ -190,11 +203,20 @@ private: for ( typename elements_type::iterator it = elements.begin(); it != elements.end() ; ++it ) { - visitors::insert insert_v( + visitors::insert< + typename elements_type::value_type, + Value, + Options, + Translator, + Box, + Allocators, + typename Options::insert_tag + > insert_v( m_root_node, m_leafs_level, *it, m_tr, + m_allocators, node_relative_level - 1); rtree::apply_visitor(insert_v, *m_root_node); @@ -203,6 +225,7 @@ private: Value const& m_value; Translator const& m_tr; + Allocators & m_allocators; node* & m_root_node; size_t & m_leafs_level; diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 3eb92a484..0d73289e4 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -228,7 +228,7 @@ Box values_box(Iter first, Iter last, Translator const& tr) } // namespace helpers template -void random_query_check(Rtree const& t, Rtree const& t_copy, Cont const& c, size_t n, Randomizer r) +void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) { namespace bg = boost::geometry; namespace bgi = bg::index; @@ -237,32 +237,28 @@ void random_query_check(Rtree const& t, Rtree const& t_copy, Cont const& c, size { Predicate pred = Predicate(r()); - std::vector res1, res2, res3; + std::vector res1, res2; bgi::query(t, pred, std::back_inserter(res1)); - bgi::query(t_copy, pred, std::back_inserter(res2)); for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { if ( bgi::predicates_check(pred, *it, t.translator()(*it)) ) - res3.push_back(*it); + res2.push_back(*it); } std::stringstream ss; ss << "\nPredicate: " << typeid(Predicate).name() << "\n" << "res1: " << res1.size() - << ", res2: " << res2.size() - << ", res3: " << res3.size() << '\n'; + << ", res2: " << res2.size()<< '\n'; BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.translator()), ss.str()); - BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res3, t.translator()), ss.str()); } } template void random_nearest_check( Rtree const& t, - Rtree const& t_copy, Cont const& c, size_t n, PointRandomizer const& pr, @@ -277,36 +273,32 @@ void random_nearest_check( typename PointRandomizer::value_type pt = pr(); Predicate pred = Predicate(r()); - std::vector res1, res2, res3; + std::vector res1, res2; bgi::nearest(t, pt, k, pred, std::back_inserter(res1)); - bgi::nearest(t_copy, pt, k, pred, std::back_inserter(res2)); - for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) { if ( bgi::predicates_check(pred, *it, t.translator()(*it)) ) - res3.push_back(*it); + res2.push_back(*it); } std::sort( - res3.begin(), - res3.end(), + res2.begin(), + res2.end(), helpers::val_mindist_cmp< typename PointRandomizer::value_type, typename Rtree::translator_type >(pt, t.translator()) ); - if ( k < res3.size() ) - res3.resize(k); + if ( k < res2.size() ) + res2.resize(k); std::stringstream ss; ss << "\nPredicate: " << typeid(Predicate).name() << "\n" << "res1: " << res1.size() - << ", res2: " << res2.size() - << ", res3: " << res3.size() << '\n'; + << ", res2: " << res2.size() << '\n'; BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res2, t.translator()), ss.str()); - BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res3, t.translator()), ss.str()); } } @@ -317,26 +309,26 @@ template struct tests_rtree_function_queries { template - inline static void apply(Rtree const& t, Rtree const& t_copy, Cont const& v) + inline static void apply(Rtree const& t, Cont const& v) { namespace bgi = boost::geometry::index; - random_query_check(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); - random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; @@ -344,29 +336,29 @@ template struct tests_rtree_function_queries { template - inline static void apply(Rtree const& t, Rtree const& t_copy, Cont const& v) + inline static void apply(Rtree const& t, Cont const& v) { namespace bgi = boost::geometry::index; - random_query_check(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, t_copy, v, 5, helpers::value_randomizer(10, 5)); + random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); + random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); - random_nearest_check(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, t_copy, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, bgi::empty); + random_nearest_check(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); + random_nearest_check >(t, v, 5, helpers::value_randomizer

(10, 0), 3, helpers::value_randomizer(10, 5)); } }; @@ -395,7 +387,7 @@ void tests_rtree_function(Translator const& tr = Translator()) B bv = helpers::values_box(v.begin(), v.end(), tr); BOOST_CHECK(bg::equals(bt, bv)); - tests_rtree_function_queries::type>::apply(t, t_copy, v); + tests_rtree_function_queries::type>::apply(t, v); bgi::clear(t); BOOST_CHECK(bgi::empty(t)); @@ -403,6 +395,12 @@ void tests_rtree_function(Translator const& tr = Translator()) B be; bg::assign_inverse(be); BOOST_CHECK(bg::equals(be, bt)); + + for ( size_t i = 3 ; i < 10 ; ++i ) + bgi::remove(t_copy, v[i]); + v.erase(v.begin() + 3, v.end()); + + tests_rtree_function_queries::type>::apply(t_copy, v); } BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) From 3f3f991f108a0698b67f4516640ee925fc442ba9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 3 Oct 2011 00:07:32 +0000 Subject: [PATCH 090/366] basic use of allocators implemented. [SVN r74662] --- .../index/rtree/node/node_default.hpp | 38 +++++++++--- .../node/node_default_static_variant.hpp | 21 +++++++ .../index/rtree/node/node_default_variant.hpp | 60 ++++++++++++++++--- 3 files changed, 105 insertions(+), 14 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index 48131a1e3..7057df708 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -253,7 +253,15 @@ struct create_node< { static inline typename node::type * apply(Allocators & allocators) { - return new internal_node_poly(); + //return new internal_node_poly(); + internal_node_poly * p + = allocators.internal_node_allocator.allocate(1); + + allocators.internal_node_allocator.construct( + p, + internal_node_poly()); + + return p; } }; @@ -265,7 +273,16 @@ struct create_node< { static inline typename node::type * apply(Allocators & allocators) { - return new leaf_poly(); + //return new leaf_poly(); + + leaf_poly * p + = allocators.leaf_allocator.allocate(1); + + allocators.leaf_allocator.construct( + p, + leaf_poly()); + + return p; } }; @@ -288,7 +305,12 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - delete n; + //delete n; + + internal_node_poly * p + = rtree::get< internal_node_poly >(n); + allocators.internal_node_allocator.destroy(p); + allocators.internal_node_allocator.deallocate(p, 1); } }; @@ -300,13 +322,15 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - delete n; + //delete n; + + leaf_poly * p + = rtree::get< leaf_poly >(n); + allocators.leaf_allocator.destroy(p); + allocators.leaf_allocator.deallocate(p, 1); } }; -// To delete variant node one must pass node * -// To delete poly node one must pass internal_node or leaf - }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp index 4d6ef4242..46974f21f 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp @@ -71,6 +71,27 @@ struct visitor type; }; +// allocators + +template +struct allocators +{ + typedef Allocator allocator_type; + typedef typename allocator_type::size_type size_type; + + typedef typename allocator_type::template rebind< + typename node::type + >::other node_allocator_type; + + inline explicit allocators(Allocator alloc) + : allocator(alloc) + , node_allocator(allocator) + {} + + allocator_type allocator; + node_allocator_type node_allocator; +}; + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index f98a91a37..e69a1ca7a 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -147,6 +147,27 @@ element_indexable(std::pair< return el.first; } +// allocators + +template +struct allocators +{ + typedef Allocator allocator_type; + typedef typename allocator_type::size_type size_type; + + typedef typename allocator_type::template rebind< + typename node::type + >::other node_allocator_type; + + inline explicit allocators(Allocator alloc) + : allocator(alloc) + , node_allocator(allocator) + {} + + allocator_type allocator; + node_allocator_type node_allocator; +}; + // create_node template @@ -155,10 +176,20 @@ struct create_node< internal_node_variant > { - static inline typename node::type * apply(Allocators & allocators) + static inline typename node::type * + apply(Allocators & allocators) { - return new typename node::type( - internal_node_variant() ); + /*return new typename node::type( + internal_node_variant() );*/ + + typename node::type * p + = allocators.node_allocator.allocate(1); + + allocators.node_allocator.construct( + p, + internal_node_variant()); + + return p; } }; @@ -170,8 +201,17 @@ struct create_node< { static inline typename node::type * apply(Allocators & allocators) { - return new typename node::type( - leaf_variant() ); + /*return new typename node::type( + leaf_variant() );*/ + + typename node::type * p + = allocators.node_allocator.allocate(1); + + allocators.node_allocator.construct( + p, + leaf_variant()); + + return p; } }; @@ -185,7 +225,10 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - delete n; + //delete n; + + allocators.node_allocator.destroy(n); + allocators.node_allocator.deallocate(n, 1); } }; @@ -197,7 +240,10 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - delete n; + //delete n; + + allocators.node_allocator.destroy(n); + allocators.node_allocator.deallocate(n, 1); } }; From 9d61bed3e28c0024e1293aa3a72dda94d62b5d98 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 3 Oct 2011 09:24:17 +0000 Subject: [PATCH 091/366] exceptions handled [SVN r74664] --- .../index/rtree/node/node_default.hpp | 104 ++++++++++++------ .../node/node_default_static_variant.hpp | 15 +-- .../index/rtree/node/node_default_variant.hpp | 104 ++++++++++++------ .../geometry/extensions/index/rtree/rtree.hpp | 81 ++++++++++---- tests/main.cpp | 2 +- 5 files changed, 201 insertions(+), 105 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index 7057df708..0b7e036ad 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -210,7 +210,7 @@ inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) // allocators template -struct allocators +struct allocators_poly { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; @@ -223,7 +223,7 @@ struct allocators typename leaf::type >::other leaf_allocator_type; - inline explicit allocators(Allocator alloc) + inline explicit allocators_poly(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) @@ -234,6 +234,55 @@ struct allocators leaf_allocator_type leaf_allocator; }; +// allocators + +template +struct allocators +{ + typedef allocators_poly type; +}; + +// create_node_poly + +template +struct create_node_poly +{ + template + static inline RetNode * apply(Allocator & allocator) + { + Node * p = allocator.allocate(1); + + if ( 0 == p ) + throw std::bad_alloc(); + + try + { + allocator.construct(p, Node()); + } + catch(...) + { + allocator.deallocate(p, 1); + throw; + } + + return p; + } +}; + +// destroy_node_poly + +template +struct destroy_node_poly +{ + template + static inline void apply(Allocator & allocator, BaseNode * n) + { + Node * p = rtree::get(n); + allocator.destroy(p); + allocator.deallocate(p, 1); + } +}; + // create_node template @@ -253,15 +302,12 @@ struct create_node< { static inline typename node::type * apply(Allocators & allocators) { - //return new internal_node_poly(); - internal_node_poly * p - = allocators.internal_node_allocator.allocate(1); - - allocators.internal_node_allocator.construct( - p, - internal_node_poly()); - - return p; + return create_node_poly< + typename Allocators::internal_node_allocator_type, + internal_node_poly + >::template apply< + typename node::type + >(allocators.internal_node_allocator); } }; @@ -273,16 +319,12 @@ struct create_node< { static inline typename node::type * apply(Allocators & allocators) { - //return new leaf_poly(); - - leaf_poly * p - = allocators.leaf_allocator.allocate(1); - - allocators.leaf_allocator.construct( - p, - leaf_poly()); - - return p; + return create_node_poly< + typename Allocators::leaf_allocator_type, + leaf_poly + >::template apply< + typename node::type + >(allocators.leaf_allocator); } }; @@ -305,12 +347,10 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - //delete n; - - internal_node_poly * p - = rtree::get< internal_node_poly >(n); - allocators.internal_node_allocator.destroy(p); - allocators.internal_node_allocator.deallocate(p, 1); + destroy_node_poly< + typename Allocators::internal_node_allocator_type, + internal_node_poly + >::apply(allocators.internal_node_allocator, n); } }; @@ -322,12 +362,10 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - //delete n; - - leaf_poly * p - = rtree::get< leaf_poly >(n); - allocators.leaf_allocator.destroy(p); - allocators.leaf_allocator.deallocate(p, 1); + destroy_node_poly< + typename Allocators::leaf_allocator_type, + leaf_poly + >::apply(allocators.leaf_allocator, n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp index 46974f21f..5af462646 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp @@ -76,20 +76,7 @@ struct visitor struct allocators { - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; - - typedef typename allocator_type::template rebind< - typename node::type - >::other node_allocator_type; - - inline explicit allocators(Allocator alloc) - : allocator(alloc) - , node_allocator(allocator) - {} - - allocator_type allocator; - node_allocator_type node_allocator; + typedef allocators_variant type; }; }} // namespace detail::rtree diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index e69a1ca7a..3d081eb7e 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -149,8 +149,8 @@ element_indexable(std::pair< // allocators -template -struct allocators +template +struct allocators_variant { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; @@ -159,7 +159,7 @@ struct allocators typename node::type >::other node_allocator_type; - inline explicit allocators(Allocator alloc) + inline explicit allocators_variant(Allocator alloc) : allocator(alloc) , node_allocator(allocator) {} @@ -168,6 +168,54 @@ struct allocators node_allocator_type node_allocator; }; +// allocators + +template +struct allocators +{ + typedef allocators_variant type; +}; + +// create_node_variant + +template +struct create_node_variant +{ + template + static inline RetNode * apply(Allocator & allocator) + { + RetNode * p = allocator.allocate(1); + + if ( 0 == p ) + throw std::bad_alloc(); + + try + { + allocator.construct(p, Node()); + } + catch(...) + { + allocator.deallocate(p, 1); + throw; + } + + return p; + } +}; + +// destroy_node_variant + +template +struct destroy_node_variant +{ + template + static inline void apply(Allocator & allocator, BaseNode * n) + { + allocator.destroy(n); + allocator.deallocate(n, 1); + } +}; + // create_node template @@ -179,17 +227,12 @@ struct create_node< static inline typename node::type * apply(Allocators & allocators) { - /*return new typename node::type( - internal_node_variant() );*/ - - typename node::type * p - = allocators.node_allocator.allocate(1); - - allocators.node_allocator.construct( - p, - internal_node_variant()); - - return p; + return create_node_variant< + typename Allocators::node_allocator_type, + internal_node_variant + >::template apply< + typename node::type + >(allocators.node_allocator); } }; @@ -201,17 +244,12 @@ struct create_node< { static inline typename node::type * apply(Allocators & allocators) { - /*return new typename node::type( - leaf_variant() );*/ - - typename node::type * p - = allocators.node_allocator.allocate(1); - - allocators.node_allocator.construct( - p, - leaf_variant()); - - return p; + return create_node_variant< + typename Allocators::node_allocator_type, + leaf_variant + >::template apply< + typename node::type + >(allocators.node_allocator); } }; @@ -225,10 +263,10 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - //delete n; - - allocators.node_allocator.destroy(n); - allocators.node_allocator.deallocate(n, 1); + destroy_node_variant< + typename Allocators::node_allocator_type, + internal_node_variant + >::apply(allocators.node_allocator, n); } }; @@ -240,10 +278,10 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - //delete n; - - allocators.node_allocator.destroy(n); - allocators.node_allocator.deallocate(n, 1); + destroy_node_variant< + typename Allocators::node_allocator_type, + leaf_variant + >::apply(allocators.node_allocator, n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 5cbd99d26..d07a6487a 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -84,7 +84,7 @@ public: typedef typename detail::rtree::leaf::type leaf; typedef Allocator allocator_type; - typedef detail::rtree::allocators allocators_type; + typedef typename detail::rtree::allocators::type allocators_type; typedef typename allocators_type::size_type size_type; inline explicit rtree(translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) @@ -116,7 +116,15 @@ public: inline rtree(rtree const& src) : m_allocators(src.m_allocators) { - copy(src, *this); + try + { + copy(src, *this); + } + catch(...) + { + destroy(*this); + throw; + } } inline rtree & operator=(rtree const& src) @@ -127,7 +135,16 @@ public: destroy(*this); m_allocators = src.m_allocators; - copy(src, *this); + + try + { + copy(src, *this); + } + catch(...) + { + destroy(*this); + throw; + } return *this; } @@ -136,19 +153,27 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); - detail::rtree::visitors::insert< - value_type, - value_type, - options_type, - translator_type, - box_type, - allocators_type, - typename options_type::insert_tag - > insert_v(m_root, m_leafs_level, value, m_translator, m_allocators); + try + { + detail::rtree::visitors::insert< + value_type, + value_type, + options_type, + translator_type, + box_type, + allocators_type, + typename options_type::insert_tag + > insert_v(m_root, m_leafs_level, value, m_translator, m_allocators); - detail::rtree::apply_visitor(insert_v, *m_root); + detail::rtree::apply_visitor(insert_v, *m_root); - ++m_values_count; + ++m_values_count; + } + catch(...) + { + destroy(*this); + throw; + } } template @@ -162,19 +187,27 @@ public: { // TODO: awulkiew - assert for correct value (indexable) ? - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there is no elements in the rtree"); + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there are no elements in the rtree"); - detail::rtree::visitors::remove< - value_type, - options_type, - translator_type, - box_type, - allocators_type - > remove_v(m_root, m_leafs_level, value, m_translator, m_allocators); + try + { + detail::rtree::visitors::remove< + value_type, + options_type, + translator_type, + box_type, + allocators_type + > remove_v(m_root, m_leafs_level, value, m_translator, m_allocators); - detail::rtree::apply_visitor(remove_v, *m_root); + detail::rtree::apply_visitor(remove_v, *m_root); - --m_values_count; + --m_values_count; + } + catch(...) + { + destroy(*this); + throw; + } } template diff --git a/tests/main.cpp b/tests/main.cpp index 0ed7fda2d..50a1d4632 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE( first_test_case ) BOOST_AUTO_TEST_CASE( last_test_case ) { - + #ifdef _MSC_VER std::cin.get(); #endif From 456b9fd283255d153235186dcb2eef7df26b22a1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 3 Oct 2011 20:30:53 +0000 Subject: [PATCH 092/366] Allocators used in nodes children containers creation. [SVN r74675] --- .../rtree/linear/redistribute_elements.hpp | 10 +- .../extensions/index/rtree/node/node.hpp | 28 +++ .../index/rtree/node/node_default.hpp | 194 +++++++++--------- .../index/rtree/node/node_default_static.hpp | 91 +++++++- .../node/node_default_static_variant.hpp | 112 ++++++++-- .../index/rtree/node/node_default_variant.hpp | 164 ++++++++------- .../rtree/quadratic/redistribute_elements.hpp | 10 +- .../index/rtree/rstar/choose_next_node.hpp | 10 +- .../extensions/index/rtree/rstar/insert.hpp | 30 +-- .../rtree/rstar/redistribute_elements.hpp | 10 +- .../geometry/extensions/index/rtree/rtree.hpp | 20 +- .../index/rtree/visitors/are_boxes_ok.hpp | 18 +- .../index/rtree/visitors/are_levels_ok.hpp | 18 +- .../index/rtree/visitors/children_box.hpp | 8 +- .../extensions/index/rtree/visitors/copy.hpp | 8 +- .../index/rtree/visitors/destroy.hpp | 8 +- .../index/rtree/visitors/gl_draw.hpp | 27 +-- .../index/rtree/visitors/insert.hpp | 42 ++-- .../index/rtree/visitors/is_leaf.hpp | 8 +- .../index/rtree/visitors/nearest.hpp | 9 +- .../extensions/index/rtree/visitors/print.hpp | 24 ++- .../extensions/index/rtree/visitors/query.hpp | 10 +- .../index/rtree/visitors/remove.hpp | 10 +- 23 files changed, 536 insertions(+), 333 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 2e0e1d93f..a8d1ba090 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -168,12 +168,12 @@ struct pick_seeds // from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 7e3a05b5b..2f5c9a943 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -16,4 +16,32 @@ #include #include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +// elements box + +template +inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) +{ + BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box"); + + Box result; + + geometry::convert(element_indexable(*first, tr), result); + ++first; + + for ( ; first != last ; ++first ) + geometry::expand(result, element_indexable(*first, tr)); + + return result; +} + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index 0b7e036ad..a7f01533e 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -12,81 +12,91 @@ #include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { // visitor forward declaration -template +template struct visitor_poly; // nodes types -template +template struct node_poly { virtual ~node_poly() {} - virtual void apply_visitor(visitor_poly &) = 0; - virtual void apply_visitor(visitor_poly &) const = 0; + virtual void apply_visitor(visitor_poly &) = 0; + virtual void apply_visitor(visitor_poly &) const = 0; }; -template -struct internal_node_poly : public node_poly +template +struct internal_node_poly : public node_poly { typedef std::vector< - std::pair *> + std::pair *>, + typename Allocators::internal_node_elements_allocator_type > elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + inline internal_node_poly(typename Allocators::internal_node_elements_allocator_type & al) + : elements(al) + {} + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; -template -struct leaf_poly : public node_poly +template +struct leaf_poly : public node_poly { - typedef std::vector elements_type; + typedef std::vector< + Value, + typename Allocators::leaf_elements_allocator_type + > elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + inline leaf_poly(typename Allocators::leaf_elements_allocator_type & al) + : elements(al) + {} + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; // nodes traits -template +template struct node { - typedef node_poly type; + typedef node_poly type; }; -template +template struct internal_node { - typedef internal_node_poly type; + typedef internal_node_poly type; }; -template +template struct leaf { - typedef leaf_poly type; + typedef leaf_poly type; }; // nodes conversion -template -inline Derived & get(node_poly & n) +template +inline Derived & get(node_poly & n) { assert(dynamic_cast(&n)); return static_cast(n); } -template -inline Derived * get(node_poly * n) +template +inline Derived * get(node_poly * n) { assert(dynamic_cast(n)); return static_cast(n); @@ -94,11 +104,11 @@ inline Derived * get(node_poly * n) // visitor -template -struct visitor_poly +template +struct visitor_poly { - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; + typedef typename internal_node::type internal_node; + typedef typename leaf::type leaf; virtual ~visitor_poly() {} @@ -106,11 +116,11 @@ struct visitor_poly virtual void operator()(leaf const&) = 0; }; -template -struct visitor_poly +template +struct visitor_poly { - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; + typedef typename internal_node::type internal_node; + typedef typename leaf::type leaf; virtual ~visitor_poly() {} @@ -120,10 +130,10 @@ struct visitor_poly // visitor traits -template +template struct visitor { - typedef visitor_poly type; + typedef visitor_poly type; }; template @@ -140,9 +150,9 @@ struct element_indexable_type typedef typename Translator::indexable_type type; }; -template +template struct element_indexable_type< - std::pair *>, + std::pair *>, Translator > { @@ -158,10 +168,10 @@ element_indexable(Value const& el, Translator const& tr) return tr(el); } -template +template inline Box const& element_indexable( - std::pair< Box, node_poly *> const& el, + std::pair< Box, node_poly *> const& el, Translator const&) { return el.first; @@ -189,79 +199,73 @@ elements(Node const& n) return n.elements; } -// elements box - -template -inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) -{ - BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box"); - - Box result; - - geometry::convert(element_indexable(*first, tr), result); - ++first; - - for ( ; first != last ; ++first ) - geometry::expand(result, element_indexable(*first, tr)); - - return result; -} - // allocators -template +template struct allocators_poly { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename internal_node::type + typename internal_node::type >::other internal_node_allocator_type; typedef typename allocator_type::template rebind< - typename leaf::type + typename leaf::type >::other leaf_allocator_type; + typedef typename allocator_type::template rebind< + std::pair *> + >::other internal_node_elements_allocator_type; + + typedef typename allocator_type::template rebind< + Value + >::other leaf_elements_allocator_type; + inline explicit allocators_poly(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) + , internal_node_elements_allocator(allocator) + , leaf_elements_allocator(allocator) {} allocator_type allocator; internal_node_allocator_type internal_node_allocator; leaf_allocator_type leaf_allocator; + internal_node_elements_allocator_type internal_node_elements_allocator; + leaf_elements_allocator_type leaf_elements_allocator; }; // allocators -template +template struct allocators { - typedef allocators_poly type; + typedef allocators_poly type; }; -// create_node_poly +// create_node_impl -template +template struct create_node_poly { - template - static inline RetNode * apply(Allocator & allocator) + template + static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems) { - Node * p = allocator.allocate(1); + Node * p = alloc_node.allocate(1); if ( 0 == p ) throw std::bad_alloc(); try { - allocator.construct(p, Node()); + alloc_node.construct(p, Node(alloc_elems)); } catch(...) { - allocator.deallocate(p, 1); + alloc_node.deallocate(p, 1); throw; } @@ -269,17 +273,17 @@ struct create_node_poly } }; -// destroy_node_poly +// destroy_node_impl -template +template struct destroy_node_poly { - template - static inline void apply(Allocator & allocator, BaseNode * n) + template + static inline void apply(AllocNode & alloc_node, BaseNode * n) { Node * p = rtree::get(n); - allocator.destroy(p); - allocator.deallocate(p, 1); + alloc_node.destroy(p); + alloc_node.deallocate(p, 1); } }; @@ -297,34 +301,34 @@ struct create_node template struct create_node< Allocators, - internal_node_poly + internal_node_poly > { - static inline typename node::type * apply(Allocators & allocators) + static inline typename node::type * + apply(Allocators & allocators) { return create_node_poly< - typename Allocators::internal_node_allocator_type, - internal_node_poly + internal_node_poly >::template apply< - typename node::type - >(allocators.internal_node_allocator); + typename node::type + >(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); } }; template struct create_node< Allocators, - leaf_poly + leaf_poly > { - static inline typename node::type * apply(Allocators & allocators) + static inline typename node::type * + apply(Allocators & allocators) { return create_node_poly< - typename Allocators::leaf_allocator_type, - leaf_poly + leaf_poly >::template apply< - typename node::type - >(allocators.leaf_allocator); + typename node::type + >(allocators.leaf_allocator, allocators.leaf_elements_allocator); } }; @@ -342,14 +346,13 @@ struct destroy_node template struct destroy_node< Allocators, - internal_node_poly + internal_node_poly > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_poly< - typename Allocators::internal_node_allocator_type, - internal_node_poly + internal_node_poly >::apply(allocators.internal_node_allocator, n); } }; @@ -357,14 +360,13 @@ struct destroy_node< template struct destroy_node< Allocators, - leaf_poly + leaf_poly > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_poly< - typename Allocators::leaf_allocator_type, - leaf_poly + leaf_poly >::apply(allocators.leaf_allocator, n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp index 458817996..854680811 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp @@ -16,36 +16,105 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { -template -struct internal_node_poly - : public node_poly +template +struct internal_node_poly + : public node_poly { typedef index::pushable_array< std::pair< Box, - node_poly * + node_poly * >, Parameters::max_elements + 1 > elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + template + inline internal_node_poly(Dummy) {} + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; -template -struct leaf_poly - : public node_poly +template +struct leaf_poly + : public node_poly { typedef index::pushable_array elements_type; - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + template + inline leaf_poly(Dummy) {} + + void apply_visitor(visitor_poly & v) { v(*this); } + void apply_visitor(visitor_poly & v) const { v(*this); } elements_type elements; }; +// allocators_poly + +template +struct allocators_poly +{ + typedef Allocator allocator_type; + typedef typename allocator_type::size_type size_type; + + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other internal_node_allocator_type; + + typedef typename allocator_type::template rebind< + typename leaf::type + >::other leaf_allocator_type; + + inline explicit allocators_poly(Allocator alloc) + : allocator(alloc) + , internal_node_allocator(allocator) + , leaf_allocator(allocator) + {} + + allocator_type allocator; + internal_node_allocator_type internal_node_allocator; + leaf_allocator_type leaf_allocator; +}; + +// create_node + +template +struct create_node< + Allocators, + internal_node_poly +> +{ + static inline typename node::type * + apply(Allocators & allocators) + { + return create_node_poly< + internal_node_poly + >::template apply< + typename node::type + >(allocators.internal_node_allocator, allocators.internal_node_allocator); + } +}; + +template +struct create_node< + Allocators, + leaf_poly +> +{ + static inline typename node::type * + apply(Allocators & allocators) + { + return create_node_poly< + leaf_poly + >::template apply< + typename node::type + >(allocators.leaf_allocator, allocators.leaf_allocator); + } +}; + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp index 5af462646..ba7a6dba0 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp @@ -19,64 +19,136 @@ namespace detail { namespace rtree { // nodes default types -template -struct internal_node_variant +template +struct internal_node_variant { typedef index::pushable_array< std::pair< Box, - typename node::type * + typename node::type * >, Parameters::max_elements + 1 > elements_type; + template + inline internal_node_variant(Dummy) {} + elements_type elements; }; -template -struct leaf_variant +template +struct leaf_variant { typedef index::pushable_array elements_type; + + template + inline leaf_variant(Dummy) {} + elements_type elements; }; // nodes traits -template -struct node +template +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; -template -struct internal_node +template +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; -template -struct leaf +template +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // visitor traits -template -struct visitor +template +struct visitor { typedef static_visitor<> type; }; +// allocators_variant + +template +struct allocators_variant +{ + typedef Allocator allocator_type; + typedef typename allocator_type::size_type size_type; + + typedef typename allocator_type::template rebind< + typename node::type + >::other node_allocator_type; + + typedef typename allocator_type::template rebind< + std::pair *> + >::other internal_node_elements_allocator_type; + + typedef typename allocator_type::template rebind< + Value + >::other leaf_elements_allocator_type; + + inline explicit allocators_variant(Allocator alloc) + : allocator(alloc) + , node_allocator(allocator) + {} + + allocator_type allocator; + node_allocator_type node_allocator; +}; + // allocators -template -struct allocators +template +struct allocators { - typedef allocators_variant type; + typedef allocators_variant type; +}; + +// create_node + +template +struct create_node< + Allocators, + internal_node_variant +> +{ + static inline typename node::type * + apply(Allocators & allocators) + { + return create_node_variant< + internal_node_variant + >::template apply< + typename node::type + >(allocators.node_allocator, allocators.node_allocator); + } +}; + +template +struct create_node< + Allocators, + leaf_variant +> +{ + static inline typename node::type * + apply(Allocators & allocators) + { + return create_node_variant< + leaf_variant + >::template apply< + typename node::type + >(allocators.node_allocator, allocators.node_allocator); + } }; }} // namespace detail::rtree diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index 3d081eb7e..b5fff6942 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -19,67 +19,80 @@ namespace detail { namespace rtree { // nodes default types -template +template struct internal_node_variant { typedef std::vector< std::pair< Box, - typename node::type * - > + typename node::type * + >, + typename Allocators::internal_node_elements_allocator_type > elements_type; + inline internal_node_variant(typename Allocators::internal_node_elements_allocator_type & al) + : elements(al) + {} + elements_type elements; }; -template +template struct leaf_variant { - typedef std::vector elements_type; + typedef std::vector< + Value, + typename Allocators::leaf_elements_allocator_type + > elements_type; + + inline leaf_variant(typename Allocators::leaf_elements_allocator_type & al) + : elements(al) + {} + elements_type elements; }; // nodes traits -template -struct node +template +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; -template -struct internal_node +template +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; -template -struct leaf +template +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // nodes conversion -template +template inline V & get( boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > &v ) { return boost::get(v); } -template +template inline V * get( boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > *v ) { @@ -88,27 +101,27 @@ inline V * get( // visitor traits -template -struct visitor +template +struct visitor { typedef static_visitor<> type; }; -template +template inline void apply_visitor(Visitor & v, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > & n) { boost::apply_visitor(v, n); } -template +template inline void apply_visitor(Visitor & v, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > const& n) { boost::apply_visitor(v, n); @@ -116,13 +129,13 @@ inline void apply_visitor(Visitor & v, // element's indexable type -template +template struct element_indexable_type< std::pair< Box, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > * >, Translator @@ -133,13 +146,13 @@ struct element_indexable_type< // element's indexable getter -template +template inline Box const& element_indexable(std::pair< Box, boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > * > const& el, Translator const&) @@ -149,53 +162,65 @@ element_indexable(std::pair< // allocators -template +template struct allocators_variant { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename node::type + typename node::type >::other node_allocator_type; + typedef typename allocator_type::template rebind< + std::pair *> + >::other internal_node_elements_allocator_type; + + typedef typename allocator_type::template rebind< + Value + >::other leaf_elements_allocator_type; + inline explicit allocators_variant(Allocator alloc) : allocator(alloc) , node_allocator(allocator) + , internal_node_elements_allocator(allocator) + , leaf_elements_allocator(allocator) {} allocator_type allocator; node_allocator_type node_allocator; + internal_node_elements_allocator_type internal_node_elements_allocator; + leaf_elements_allocator_type leaf_elements_allocator; }; // allocators -template -struct allocators +template +struct allocators { - typedef allocators_variant type; + typedef allocators_variant type; }; // create_node_variant -template +template struct create_node_variant { - template - static inline RetNode * apply(Allocator & allocator) + template + static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems) { - RetNode * p = allocator.allocate(1); + RetNode * p = alloc_node.allocate(1); if ( 0 == p ) throw std::bad_alloc(); try { - allocator.construct(p, Node()); + alloc_node.construct(p, Node(alloc_elems)); } catch(...) { - allocator.deallocate(p, 1); + alloc_node.deallocate(p, 1); throw; } @@ -205,14 +230,14 @@ struct create_node_variant // destroy_node_variant -template +template struct destroy_node_variant { - template - static inline void apply(Allocator & allocator, BaseNode * n) + template + static inline void apply(AllocNode & alloc_node, BaseNode * n) { - allocator.destroy(n); - allocator.deallocate(n, 1); + alloc_node.destroy(n); + alloc_node.deallocate(n, 1); } }; @@ -221,35 +246,34 @@ struct destroy_node_variant template struct create_node< Allocators, - internal_node_variant + internal_node_variant > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - typename Allocators::node_allocator_type, - internal_node_variant + internal_node_variant >::template apply< - typename node::type - >(allocators.node_allocator); + typename node::type + >(allocators.node_allocator, allocators.internal_node_elements_allocator); } }; template struct create_node< Allocators, - leaf_variant + leaf_variant > { - static inline typename node::type * apply(Allocators & allocators) + static inline typename node::type * + apply(Allocators & allocators) { return create_node_variant< - typename Allocators::node_allocator_type, - leaf_variant + leaf_variant >::template apply< - typename node::type - >(allocators.node_allocator); + typename node::type + >(allocators.node_allocator, allocators.leaf_elements_allocator); } }; @@ -258,14 +282,13 @@ struct create_node< template struct destroy_node< Allocators, - internal_node_variant + internal_node_variant > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_variant< - typename Allocators::node_allocator_type, - internal_node_variant + internal_node_variant >::apply(allocators.node_allocator, n); } }; @@ -273,14 +296,13 @@ struct destroy_node< template struct destroy_node< Allocators, - leaf_variant + leaf_variant > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_variant< - typename Allocators::node_allocator_type, - leaf_variant + leaf_variant >::apply(allocators.node_allocator, n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index df14cb154..f7cec8b47 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -75,14 +75,14 @@ struct pick_seeds } // namespace quadratic -template -struct redistribute_elements +template +struct redistribute_elements { typedef typename Options::parameters_type parameters_type; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename index::default_content_result::type content_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index dab689d1a..caf86f030 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -27,12 +27,12 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { -template -class choose_next_node +template +class choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; typedef typename children_type::value_type child_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 2130c9bfc..2aad1f797 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -20,13 +20,13 @@ namespace detail { namespace rstar { -template +template class remove_elements_to_reinsert { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename Options::parameters_type parameters_type; @@ -103,19 +103,19 @@ private: } }; -template +template struct level_insert_elements_type { typedef typename rtree::elements_type< - typename rtree::internal_node::type + typename rtree::internal_node::type >::type type; }; -template -struct level_insert_elements_type<0, Value, Value, Options, Box> +template +struct level_insert_elements_type<0, Value, Value, Options, Box, Allocators> { typedef typename rtree::elements_type< - typename rtree::leaf::type + typename rtree::leaf::type >::type type; }; @@ -128,7 +128,7 @@ struct level_insert_base typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename level_insert_elements_type::type elements_type; + typedef typename level_insert_elements_type::type elements_type; typedef typename Options::parameters_type parameters_type; inline level_insert_base(node* & root, @@ -154,7 +154,7 @@ struct level_insert_base // node isn't root node if ( base::m_parent ) { - rstar::remove_elements_to_reinsert::apply( + rstar::remove_elements_to_reinsert::apply( result_elements, n, base::m_parent, base::m_current_child_index, base::m_tr); @@ -355,13 +355,13 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> // R*-tree insert visitor template class insert - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { private: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline insert(node* & root, diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 60676b45c..b1c024f7c 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -308,12 +308,12 @@ struct partial_sort } // namespace rstar -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d07a6487a..1ea7fd367 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -59,8 +59,6 @@ namespace boost { namespace geometry { namespace index { // TODO change remove() to erase() or just add erase() ? // erase works on iterators of this container so this may be confusing with remove(ValIt, ValIt) -// TODO delete unneeded nodes types (using vectors) and change the name of currently used one to node_default - template < typename Value, typename Parameters, @@ -75,18 +73,18 @@ public: typedef Translator translator_type; typedef typename translator_type::indexable_type indexable_type; typedef typename index::default_box_type::type box_type; - + typedef typename detail::rtree::options_type::type options_type; typedef typename options_type::node_tag node_tag; - typedef typename detail::rtree::node::type node; - typedef typename detail::rtree::internal_node::type internal_node; - typedef typename detail::rtree::leaf::type leaf; - typedef Allocator allocator_type; - typedef typename detail::rtree::allocators::type allocators_type; + typedef typename detail::rtree::allocators::type allocators_type; typedef typename allocators_type::size_type size_type; + typedef typename detail::rtree::node::type node; + typedef typename detail::rtree::internal_node::type internal_node; + typedef typename detail::rtree::leaf::type leaf; + inline explicit rtree(translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) : m_values_count(0) , m_root(0) @@ -220,7 +218,7 @@ public: template inline size_type query(Predicates const& pred, OutIter out_it) const { - detail::rtree::visitors::query + detail::rtree::visitors::query find_v(m_translator, pred, out_it); detail::rtree::apply_visitor(find_v, *m_root); @@ -277,7 +275,7 @@ public: return result; } - detail::rtree::visitors::children_box + detail::rtree::visitors::children_box children_box_v(m_translator); detail::rtree::apply_visitor(children_box_v, *m_root); @@ -356,6 +354,7 @@ private: options_type, translator_type, box_type, + allocators_type, DistancesPredicates, Predicates, result_type @@ -385,6 +384,7 @@ private: options_type, translator_type, box_type, + allocators_type, DistancesPredicates, Predicates, result_type diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 94408eaf7..0c12b170f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -17,13 +17,13 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class are_boxes_ok - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_boxes_ok(Translator const& tr) @@ -109,15 +109,17 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_boxes_ok(rtree const& tree) +template +bool are_boxes_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; detail::rtree::visitors::are_boxes_ok< typename rt::value_type, typename rt::options_type, typename rt::translator_type, - typename rt::box_type> v(tree.translator()); + typename rt::box_type, + typename rt::allocators_type + > v(tree.translator()); tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index b9394dd24..946a4303c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -16,13 +16,13 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class are_levels_ok - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline are_levels_ok(Translator const& tr) @@ -87,15 +87,17 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_levels_ok(rtree const& tree) +template +bool are_levels_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; detail::rtree::visitors::are_levels_ok< typename rt::value_type, typename rt::options_type, typename rt::translator_type, - typename rt::box_type> v(tree.translator()); + typename rt::box_type, + typename rt::allocators_type + > v(tree.translator()); tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp index 34f493323..626553643 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp @@ -16,13 +16,13 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class children_box - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: inline children_box(Translator const& tr) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp index 31ea2b783..12fa86435 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -18,13 +18,13 @@ namespace detail { namespace rtree { namespace visitors { template class copy - : public rtree::visitor::type + : public rtree::visitor::type , boost::noncopyable { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; explicit inline copy(Allocators & allocators) : result(0) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 15fe5b126..eac919b6d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -18,13 +18,13 @@ namespace detail { namespace rtree { namespace visitors { template class destroy - : public rtree::visitor::type + : public rtree::visitor::type , boost::noncopyable { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline destroy(node * root_node, Allocators & allocators) : m_current_node(root_node) 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 1d4e9feb7..9b51e51a1 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -93,11 +93,11 @@ inline void gl_draw_indexable(Indexable const& i, typename index::traits::coordi } // namespace detail -template -struct gl_draw : public rtree::visitor::type +template +struct gl_draw : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline gl_draw(Translator const& t, size_t level_first = 0, @@ -186,21 +186,24 @@ struct gl_draw : public rtree::visitor -void gl_draw(rtree const& tree, +template +void gl_draw(rtree const& tree, size_t level_first = 0, size_t level_last = std::numeric_limits::max(), typename index::traits::coordinate_type< - typename rtree::box_type + typename rtree::box_type >::type z_coord_level_multiplier = 1 ) { - typedef typename rtree::value_type value_type; - typedef typename rtree::options_type options_type; - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; + typedef rtree rtree_type; - detail::rtree::visitors::gl_draw + typedef typename rtree_type::value_type value_type; + typedef typename rtree_type::options_type options_type; + typedef typename rtree_type::translator_type translator_type; + typedef typename rtree_type::box_type box_type; + typedef typename rtree_type::allocators_type allocators_type; + + detail::rtree::visitors::gl_draw gl_draw_v(tree.translator(), level_first, level_last, z_coord_level_multiplier); tree.apply_visitor(gl_draw_v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index c164186c3..97c5a242f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -21,15 +21,15 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { // Default choose_next_node -template +template struct choose_next_node; -template -struct choose_next_node +template +struct choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename rtree::elements_type::type children_type; @@ -80,28 +80,28 @@ struct choose_next_node // ----------------------------------------------------------------------- // // Not implemented here -template +template struct redistribute_elements; // ----------------------------------------------------------------------- // // Split algorithm -template +template class split; // Default split algorithm -template -class split +template +class split { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename Options::parameters_type parameters_type; public: - template + template static inline void apply(node* & root_node, size_t & leafs_level, Node & n, @@ -116,7 +116,7 @@ public: // redistribute elements Box box1, box2; - redistribute_elements:: + redistribute_elements:: apply(n, n2, box1, box2, tr); // check numbers of elements @@ -157,13 +157,13 @@ public: // Default insert visitor template class insert - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { protected: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename Options::parameters_type parameters_type; @@ -196,7 +196,7 @@ protected: inline void traverse(Visitor & visitor, internal_node & n) { // choose next node - size_t choosen_node_index = detail::choose_next_node:: + size_t choosen_node_index = detail::choose_next_node:: apply(n, rtree::element_indexable(m_element, m_tr), m_leafs_level - m_current_level); // expand the node to contain value @@ -248,7 +248,7 @@ protected: template inline void split(Node & n) const { - detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr, m_allocators); + detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr, m_allocators); } // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index 529bd99c8..f07bc7d15 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -16,11 +16,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct is_leaf : public rtree::visitor::type +template +struct is_leaf : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline void operator()(internal_node const&) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 2796bd480..913653619 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -141,18 +141,19 @@ template < typename Options, typename Translator, typename Box, + typename Allocators, typename DistancesPredicates, typename Predicates, typename Result > class nearest - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef index::detail::distances_calc node_distances_calc; typedef typename node_distances_calc::result_type node_distances_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 45928e1e0..71d7658d4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -111,11 +111,11 @@ inline void print_indexable(std::ostream & os, Indexable const& i) } // namespace detail -template -struct print : public rtree::visitor::type +template +struct print : public rtree::visitor::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; inline print(std::ostream & o, Translator const& t) : os(o), tr(t), level(0) @@ -178,14 +178,16 @@ struct print : public rtree::visitor -std::ostream & operator<<(std::ostream & os, rtree const& tree) +template +std::ostream & operator<<(std::ostream & os, rtree const& tree) { - typedef typename rtree::value_type value_type; - typedef typename rtree::options_type options_type; - typedef typename rtree::translator_type translator_type; - typedef typename rtree::box_type box_type; - detail::rtree::visitors::print print_v(os, tree.translator()); + typedef rtree rtree_type; + typedef typename rtree_type::value_type value_type; + typedef typename rtree_type::options_type options_type; + typedef typename rtree_type::translator_type translator_type; + typedef typename rtree_type::box_type box_type; + typedef typename rtree_type::allocators_type allocators_type; + detail::rtree::visitors::print print_v(os, tree.translator()); tree.apply_visitor(print_v); return os; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp index 39a12a345..9b420e54b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -16,14 +16,14 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template struct query - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + 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) : tr(t), pred(p), out_iter(out_it), found_count(0) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 3a743585e..db267702b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -23,12 +23,12 @@ namespace detail { namespace rtree { namespace visitors { // Default remove algorithm template class remove - : public rtree::visitor::type + : public rtree::visitor::type , index::nonassignable { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; typedef typename Options::parameters_type parameters_type; @@ -114,7 +114,7 @@ public: for ( typename std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); it != m_underflowed_nodes.rend() ; ++it ) { - is_leaf ilv; + is_leaf ilv; rtree::apply_visitor(ilv, *it->second); if ( ilv.result ) { From ac8acebab67b9c63a74b38bce0d6c629e555dd4b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 3 Oct 2011 20:59:44 +0000 Subject: [PATCH 093/366] Allocator default constructor as default rtree parameter fixed. [SVN r74678] --- .../boost/geometry/extensions/index/rtree/rtree.hpp | 4 +++- tests/additional_glut_vis.cpp | 10 ++++++---- tests/additional_sizes_and_times.cpp | 13 ++++++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 1ea7fd367..0eb685547 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -59,6 +59,8 @@ namespace boost { namespace geometry { namespace index { // TODO change remove() to erase() or just add erase() ? // erase works on iterators of this container so this may be confusing with remove(ValIt, ValIt) +// bgi::near and bgi::far conflicts with WINDOWS macros!!! + template < typename Value, typename Parameters, @@ -85,7 +87,7 @@ public: typedef typename detail::rtree::internal_node::type internal_node; typedef typename detail::rtree::leaf::type leaf; - inline explicit rtree(translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) + inline explicit rtree(translator_type const& translator = translator_type(), Allocator allocator = Allocator()) : m_values_count(0) , m_root(0) , m_leafs_level(0) diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index c1a21b5e9..eb540c93a 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -25,7 +25,8 @@ typedef bg::model::box

B; bgi::rtree< B, - bgi::rstar<4, 2> > t; + bgi::rstar<4, 2> +> t; std::vector vect; size_t found_count = 0; @@ -51,9 +52,10 @@ void knn() nearest_boxes.clear(); found_count = t.nearest( bgi::bounded( - search_point, - bgi::far(min_distance), - bgi::near(max_distance)), + search_point, + bgi::far(min_distance), + bgi::near(max_distance) + ), count, std::back_inserter(nearest_boxes) ); diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 2d8352e12..304b66a43 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -20,6 +20,12 @@ #include #include +/*#include +#undef near +#undef far +#undef min +#undef max*/ + template struct test_pred { @@ -39,7 +45,12 @@ int main() //typedef bg::model::d2::point_xy P; typedef bg::model::point P; typedef bg::model::box

B; - typedef bgi::rtree, bgi::linear<32, 8> > RT; + typedef bgi::rtree< + std::pair, + bgi::linear<32, 8>, + bgi::translator::def< std::pair >/*, + boost::fast_pool_allocator< std::pair >*/ + > RT; //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; //typedef bgi::rtree, bgi::rstar<32, 8> > RT; /*typedef bgi::rtree< From 8dbee3a8f6fe6b1baa74bb212b2f2638fd9ef07d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 31 Oct 2011 15:06:21 +0000 Subject: [PATCH 094/366] rtree is no longer noncopyable [SVN r75193] --- include/boost/geometry/extensions/index/rtree/rtree.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 0eb685547..f00c51b3c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -68,7 +68,6 @@ template < typename Allocator = std::allocator > class rtree - : public boost::noncopyable { public: typedef Value value_type; From f9a7e410175a57a21c94da2fead8b2dbb5af226f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 1 Nov 2011 20:30:06 +0000 Subject: [PATCH 095/366] cR-tree kmeans options and files added (not yet implemented) [SVN r75238] --- .../extensions/index/rtree/kmeans/kmeans.hpp | 15 +++ .../extensions/index/rtree/kmeans/split.hpp | 91 +++++++++++++++++++ .../extensions/index/rtree/options.hpp | 21 +++++ .../geometry/extensions/index/rtree/rtree.hpp | 1 + .../index/rtree/visitors/insert.hpp | 16 +++- 5 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/kmeans/split.hpp diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp b/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp new file mode 100644 index 000000000..2577d9fec --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp @@ -0,0 +1,15 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree +// +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_KMEANS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_KMEANS_HPP + +#include + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_KMEANS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp b/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp new file mode 100644 index 000000000..0c87a947e --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp @@ -0,0 +1,91 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Boost.Index - R-tree linear split algorithm implementation +// +// Copyright 2008 Federico J. Fernandez. +// Copyright 2011 Adam Wulkiewicz. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_SPLIT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_SPLIT_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +namespace detail { + +namespace kmeans { + +// some details + +} // namespace kmeans + +// split_kmeans_tag +// OR +// split_clusters_tag and redistribute_kmeans_tag - then redistribute will probably slightly different interface +// or some other than "redistribute" + +// 1. for this algorithm one probably MUST USE NON-STATIC NODES with node_default_tag +// or the algorithm must be changed somehow - to not store additional nodes in the current node +// but return excessive element/elements container instead (possibly pushable_array<1> or std::vector) +// this would also cause building of smaller trees since +1 element in nodes wouldn't be needed in different redistributing algorithms +// 2. it is probably possible to add e.g. 2 levels of tree in one insert + +// Edge case is that every node split generates M + 1 children, in parent containing M nodes +// result is 2M + 1 nodes in parent on this level +// On next level the same, next the same and so on. +// We have Depth*M+1 nodes in the root +// The tree may then gain some > 1 levels in one insert +// split::apply() manages this but special attention is required + +// which algorithm should be used to choose current node in traversing while inserting? +// some of the currently used ones or some using mean values as well? + +// TODO +// 1. Zmienic troche algorytm zeby przekazywal nadmiarowe elementy do split +// i pobieral ze split nadmiarowe elementy rodzica +// W zaleznosci od algorytmu w rozny sposob - l/q/r* powinny zwracac np pushable_array<1> +// wtedy tez is_overerflow (z R* insert?) bedzie nieportrzebne +// Dla kmeans zapewne std::vector, jednak w wezlach nadal moglaby byc pushable_array +// 2. Fajnie byloby tez uproscic te wszystkie parametry root,parent,index itd. Mozliwe ze okazalyby sie zbedne +// 3. Sprawdzyc czasy wykonywania i zajetosc pamieci +// 4. Pamietac o parametryzacji kontenera z nadmiarowymi elementami +// PS. Z R* reinsertami moze byc masakra + +template +class split +{ +protected: + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef typename Options::parameters_type parameters_type; + +public: + template + static inline void apply(node* & root_node, + size_t & leafs_level, + Node & n, + internal_node *parent_node, + size_t current_child_index, + Translator const& tr, + Allocators & allocators) + { + + } +}; + +} // namespace detail + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_SPLIT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 667e0161c..2f59b6c3e 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -22,6 +22,7 @@ struct choose_by_overlap_diff_tag {}; // SplitTag struct split_default_tag {}; +//struct split_kmeans_tag {}; // RedistributeTag struct linear_tag {}; @@ -92,6 +93,13 @@ struct rtree } // namespace options +//template +//struct kmeans +//{ +// static const size_t max_elements = MaxElements; +// static const size_t min_elements = MinElements; +//}; + namespace detail { namespace rtree { template @@ -139,6 +147,19 @@ struct options_type< rstar type; }; +//template +//struct options_type< kmeans > +//{ +// typedef options::rtree< +// kmeans, +// insert_default_tag, +// choose_by_content_diff_tag, // change it? +// split_kmeans_tag, +// int, // dummy tag - not used for now +// node_default_static_tag +// > type; +//}; + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index f00c51b3c..51e0d000d 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -40,6 +40,7 @@ #include #include #include +//#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 97c5a242f..4af4af84d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -81,13 +81,25 @@ struct choose_next_node -struct redistribute_elements; +struct redistribute_elements +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_REDISTRIBUTE_TAG_TYPE, + (redistribute_elements)); +}; // ----------------------------------------------------------------------- // // Split algorithm template -class split; +class split +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_SPLIT_TAG_TYPE, + (split)); +}; // Default split algorithm template From d3497141430fb881f4f1cb959d99abb498e4a008 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 4 Nov 2011 13:54:27 +0000 Subject: [PATCH 096/366] split modify only one node and assigns newly created to output iterator. pushable_array works with back_inserter. [SVN r75314] --- .../extensions/index/pushable_array.hpp | 2 + .../index/rtree/visitors/insert.hpp | 73 +++++++++++-------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index f0123b1c8..80fcc258f 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -28,6 +28,8 @@ public: typedef typename array_type::const_iterator const_iterator; typedef typename array_type::reverse_iterator reverse_iterator; typedef typename array_type::const_reverse_iterator const_reverse_iterator; + typedef typename array_type::reference reference; + typedef typename array_type::const_reference const_reference; inline pushable_array() : m_size(0) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 4af4af84d..0a49b4875 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -113,23 +113,21 @@ protected: typedef typename Options::parameters_type parameters_type; public: - template - static inline void apply(node* & root_node, - size_t & leafs_level, - Node & n, - internal_node *parent_node, - size_t current_child_index, + template + static inline void apply(Node & n, + Box & n_box, Translator const& tr, - Allocators & allocators) + Allocators & allocators, + OutIter out_it) { // create additional node node * second_node = rtree::create_node::apply(allocators); Node & n2 = rtree::get(*second_node); // redistribute elements - Box box1, box2; + Box box2; redistribute_elements:: - apply(n, n2, box1, box2, tr); + apply(n, n2, n_box, box2, tr); // check numbers of elements BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= rtree::elements(n).size() && @@ -139,28 +137,7 @@ public: rtree::elements(n2).size() <= parameters_type::max_elements, "unexpected number of elements"); - // node is not the root - just add the new node - if ( parent_node != 0 ) - { - // update old node's box - rtree::elements(*parent_node)[current_child_index].first = box1; - // add new node to the parent's children - rtree::elements(*parent_node).push_back(std::make_pair(box2, second_node)); - } - // node is the root - add level - else - { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(root_node), "node should be the root"); - - // create new root and add nodes - node * new_root = rtree::create_node::apply(allocators); - - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box1, root_node)); - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(box2, second_node)); - - root_node = new_root; - ++leafs_level; - } + *out_it++ = std::make_pair(box2, second_node); } }; @@ -260,7 +237,39 @@ protected: template inline void split(Node & n) const { - detail::split::apply(m_root_node, m_leafs_level, n, m_parent, m_current_child_index, m_tr, m_allocators); + index::pushable_array< + std::pair, 1 + > additional_nodes; + + Box n_box; + + detail::split + ::apply(n, n_box, m_tr, m_allocators, std::back_inserter(additional_nodes)); + + BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); + + // node is not the root - just add the new node + if ( m_parent != 0 ) + { + // update old node's box + rtree::elements(*m_parent)[m_current_child_index].first = n_box; + // add new node to the parent's children + rtree::elements(*m_parent).push_back(additional_nodes[0]); + } + // node is the root - add level + else + { + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); + + // create new root and add nodes + node * new_root = rtree::create_node::apply(m_allocators); + + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); + rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); + + m_root_node = new_root; + ++m_leafs_level; + } } // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation From 65b31372a400963b0f152c62b007eb756625198a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 4 Nov 2011 14:57:11 +0000 Subject: [PATCH 097/366] split result OutIter replaced by reference to the container. [SVN r75316] --- .../index/rtree/visitors/insert.hpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 0a49b4875..74644c0bc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -113,12 +113,14 @@ protected: typedef typename Options::parameters_type parameters_type; public: - template - static inline void apply(Node & n, + typedef index::pushable_array, 1> nodes_container_type; + + template + static inline void apply(nodes_container_type & additional_nodes, + Node & n, Box & n_box, Translator const& tr, - Allocators & allocators, - OutIter out_it) + Allocators & allocators) { // create additional node node * second_node = rtree::create_node::apply(allocators); @@ -137,7 +139,7 @@ public: rtree::elements(n2).size() <= parameters_type::max_elements, "unexpected number of elements"); - *out_it++ = std::make_pair(box2, second_node); + additional_nodes.push_back(std::make_pair(box2, second_node)); } }; @@ -237,14 +239,12 @@ protected: template inline void split(Node & n) const { - index::pushable_array< - std::pair, 1 - > additional_nodes; + typedef detail::split split_algo; + typename split_algo::nodes_container_type additional_nodes; Box n_box; - detail::split - ::apply(n, n_box, m_tr, m_allocators, std::back_inserter(additional_nodes)); + split_algo::apply(additional_nodes, n, n_box, m_tr, m_allocators); BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); From 6b85fedf0ede5f56a3e203abb7718ca9cf50845d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 5 Nov 2011 20:39:59 +0000 Subject: [PATCH 098/366] some comments added. [SVN r75325] --- .../extensions/index/rtree/visitors/insert.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 74644c0bc..2823bacf4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -236,6 +236,8 @@ protected: m_current_level = current_level_bckup; } + // TODO: consider - split result returned as OutIter is faster than reference to the container. Why? + template inline void split(Node & n) const { @@ -248,6 +250,15 @@ protected: BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); + // TODO add all additional nodes + // elements number may be greater than node max elements count + // split and reinsert must take node with some elements count + // and container of additional elements (std::pairs or Values) + // and translator + allocators + // where node_elements_count + additional_elements > node_max_elements_count + // What with elements other than std::pair ??? + // Implement template struct node_element_type or something like that + // node is not the root - just add the new node if ( m_parent != 0 ) { From 6718ae179edccd52acab8f806bca71620596b068 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 28 Nov 2011 04:16:43 +0000 Subject: [PATCH 099/366] docs added [SVN r75702] --- doc/Jamfile.v2 | 20 +++ doc/html/index.html | 73 ++++++++++ doc/html/index/rtree.html | 280 ++++++++++++++++++++++++++++++++++++++ doc/index.xml | 255 ++++++++++++++++++++++++++++++++++ 4 files changed, 628 insertions(+) create mode 100644 doc/Jamfile.v2 create mode 100644 doc/html/index.html create mode 100644 doc/html/index/rtree.html create mode 100644 doc/index.xml diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 new file mode 100644 index 000000000..452d93760 --- /dev/null +++ b/doc/Jamfile.v2 @@ -0,0 +1,20 @@ +# Boost.Geometry.Index (Spatial Indexes Library) +# +# Copyright (c) 2008 Federico J. Fernandez. +# Copyright (c) 2011 Adam Wulkiewicz. + +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +project boost/doc ; +import boostbook : boostbook ; + +boostbook geometry-index-doc + : + index.xml + : + boost.root=http://www.boost.org/doc/libs/release + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html + ; + diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 000000000..166f29cad --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,73 @@ + + + +Chapter 1. Boost.Geometry.Index + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+


+
Next
+
+
+

+Chapter 1. Boost.Geometry.Index

+

+Federico J. Fernandez +

+

+Adam Wulkiewicz +

+
+
+
+

Use, modification and distribution is subject to the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

+
+
+ +
+

+Introduction

+

The Boost.Geometry.Index library is intetended to gather containers +(spatial indexes) used for speeding spatial queries up. In general, indexes +stores geometric objects' representations and allows searching for objects +occupying some space or close to some point in space. +

+

Currently, only one spatial index is implemented - the R-tree.

+
+
+ + + +
+
+
Next
+ + diff --git a/doc/html/index/rtree.html b/doc/html/index/rtree.html new file mode 100644 index 000000000..3fc70121c --- /dev/null +++ b/doc/html/index/rtree.html @@ -0,0 +1,280 @@ + + + +R-tree + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHome +
+
+

+R-tree

+ +

+R-tree is a self-balancing search tree with nodes stored with their axis aligned +bounding boxes. Each node's box describes 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 the node are user defined. +

+
+

+R-tree creation

+

+R-tree has 4 parameters: +

+
+rtree<Value, Parameters, Translator, Allocator>
+
+

+

+
    +
  • +Value - type of object which will be stored in the container. +
  • +
  • +Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. +
  • +
  • +Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle. +
  • +
  • +Allocator - the allocator. +
  • +
+

+

+

+In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code +

+
+using namespace boost::geometry;
+typedef std::pair<Box, int> Value;
+index::rtree< Value, index::quadratic<32, 8> > rt;
+
+

+

+
+
+

+Values, Indexables and default Translator

+

+R-tree may store Values of any type as long as there is passed the Translator which knows how to interpret +those Values and extract an object understandable by the R-tree. Those objects are called Indexables +and they are simply of type adapted to Point or Box concept. Default translator +index::translator::def<Value> is able to handle Points, Boxes, std::pairs, pointers and iterators. +

+
    +
  • Indexable = Point | Box
  • +
  • BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable>
  • +
  • Value = BasicValue | BasicValue* | Iterator<BasicValue>
  • +
+

+Examples of Value types: +

+
    +
  • geometry::model::point<...>
  • +
  • geometry::model::point_xy<...>
  • +
  • geometry::model::box<...>
  • +
  • std::pair≤geometry::model::box<...>, size_t>
  • +
+

+

+
+
+

+Inserting and splitting algorithms

+

+Values may be inserted to the R-tree in many various ways. Final structure of nodes depends +on algorithms used in the process, especially nodes' splitting algorithm. Currently, three +well-known types of R-trees may be created. +

+
    +
  • +Linear - classic R-tree using splitting algorithm of linear complexity +
    +index::rtree< Value, index::linear<32, 8> > rt;
    +
    +
  • +
  • +Quadratic - classic R-tree using splitting algorithm of quadratic complexity +
    +index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +
  • +
  • +R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions +
    +index::rtree< Value, index::rstar<32, 8> > rt;
    +
    +
  • +
+

+

+
+
+

+Inserting and removing Values

+

+Create +

+
+using namespace boost::geometry;
+typedef std::pair<Box, int> Value;
+index::rtree< Value, index::quadratic<32, 8> > rt;
+
+

+Insert and remove by method call +

+
+rt.insert(std::make_pair(Box(...), 0));
+rt.remove(std::make_pair(Box(...), 0));
+
+

+or by function call +

+
+index::insert(rt, std::make_pair(Box(...), 0));
+index::remove(rt, std::make_pair(Box(...), 0));
+
+

+

+
+
+

+Spatial queries

+

+There are three ways to perform a spatial query. Following queries returns +Values intersecting some box_region. +

+
    +
  • +Method call +
    +std::vector<Value> returned_values;
    +Box box_region(...);
    +rt.query(box_region, std::back_inserter(returned_values));
    +
    +
  • +
  • +Function call +
    +std::vector<Value> returned_values;
    +Box box_region(...);
    +index::query(rt, box_region, std::back_inserter(returned_values));
    +
    +
  • +
  • +Use of operator | (as with ranges) +
    +Box box_region(...);
    +BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region))
    +  ;// do something with v
    +
    +
  • +
+

+

+
+
+

+Spatial predicates

+

+It is possible to define other relations between queried Values 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)); // 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));
+
+

+All predicates may be negated, e.g.: +

+
+rt.query(index::not_intersects(box), std::back_inserter(result));
+// or
+rt.query(!index::intersects(box), std::back_inserter(result));
+// the same as
+rt.query(index::disjoint(box), std::back_inserter(result));
+
+

+It's possible to use some number of predicates by passing std::pair<P1, P2> +

+
+rt.query(
+  std::make_pair(index::intersects(box1), !index::within(box2))
+  , std::back_inserter(result));
+
+

+or boost::tuple<P1, P2, P3, ...> +

+
+rt.query(
+  boost::make_tuple(index::intersects(box1), !index::within(box2), index::overlaps(box3))
+  , std::back_inserter(result));
+
+

+There is special predicate index::value taking user-defined function/functor +which checks if Value should be returned by the query. +

+
+bool fun(Value const& v)
+{
+  return v.is_red();
+}
+
+// ...
+
+rt.query(
+  boost::make_pair(index::intersects(box), index::value(fun))
+  , std::back_inserter(result));
+
+

+

+
+
+

+Nearest neighbor queries

+TODO +
+
+ + + +
+
+
+PrevUpHome +
+ + diff --git a/doc/index.xml b/doc/index.xml new file mode 100644 index 000000000..440fa90df --- /dev/null +++ b/doc/index.xml @@ -0,0 +1,255 @@ + + + + + + Federico J. + Fernandez + + + Adam + Wulkiewicz + + + + 2008 + Federico J. Fernandez + + + 2011 + Adam Wulkiewicz + + + + Use, modification and distribution is subject to the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + + Spatial indexes for faster spatial and knn queries. + + + +Boost.Geometry.Index + +
+Introduction +The Boost.Geometry.Index library is intetended to gather containers +(spatial indexes) used for speeding spatial queries up. In general, indexes +stores geometric objects' representations and allows searching for objects +occupying some space or close to some point in space. + + +Currently, only one spatial index is implemented - the R-tree. +
+ +
+R-tree + +R-tree is a self-balancing search tree with nodes stored with their axis aligned +bounding boxes. Each node's box describes 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 the node are user defined. + + +
+R-tree creation + +R-tree has 4 parameters: + +rtree<Value, Parameters, Translator, Allocator> + + + +Value - type of object which will be stored in the container. + + +Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. + + +Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle. + + +Allocator - the allocator. + + + + +In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code + +using namespace boost::geometry; +typedef std::pair<Box, int> Value; +index::rtree< Value, index::quadratic<32, 8> > rt; + + +
+ +
+Values, Indexables and default Translator + +R-tree may store Values of any type as long as there is passed the Translator which knows how to interpret +those Values and extract an object understandable by the R-tree. Those objects are called Indexables +and they are simply of type adapted to Point or Box concept. Default translator +index::translator::def<Value> is able to handle Points, Boxes, std::pairs, pointers and iterators. + +Indexable = Point | Box +BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable> +Value = BasicValue | BasicValue* | Iterator<BasicValue> + +Examples of Value types: + +geometry::model::point<...> +geometry::model::point_xy<...> +geometry::model::box<...> +std::pair≤geometry::model::box<...>, size_t> + + +
+ +
+Inserting and splitting algorithms + +Values may be inserted to the R-tree in many various ways. Final structure of nodes depends +on algorithms used in the process, especially nodes' splitting algorithm. Currently, three +well-known types of R-trees may be created. + + +Linear - classic R-tree using splitting algorithm of linear complexity + +index::rtree< Value, index::linear<32, 8> > rt; + + + +Quadratic - classic R-tree using splitting algorithm of quadratic complexity + +index::rtree< Value, index::quadratic<32, 8> > rt; + + + +R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions + +index::rtree< Value, index::rstar<32, 8> > rt; + + + + +
+ +
+Inserting and removing Values + +Create + +using namespace boost::geometry; +typedef std::pair<Box, int> Value; +index::rtree< Value, index::quadratic<32, 8> > rt; + +Insert and remove by method call + +rt.insert(std::make_pair(Box(...), 0)); +rt.remove(std::make_pair(Box(...), 0)); + +or by function call + +index::insert(rt, std::make_pair(Box(...), 0)); +index::remove(rt, std::make_pair(Box(...), 0)); + + +
+ +
+Spatial queries + +There are three ways to perform a spatial query. Following queries returns +Values intersecting some box_region. + + +Method call + +std::vector<Value> returned_values; +Box box_region(...); +rt.query(box_region, std::back_inserter(returned_values)); + + + +Function call + +std::vector<Value> returned_values; +Box box_region(...); +index::query(rt, box_region, std::back_inserter(returned_values)); + + + +Use of operator | (as with ranges) + +Box box_region(...); +BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region)) + ;// do something with v + + + + +
+ +
+Spatial predicates + +It is possible to define other relations between queried Values 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)); // 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)); + +All predicates may be negated, e.g.: + +rt.query(index::not_intersects(box), std::back_inserter(result)); +// or +rt.query(!index::intersects(box), std::back_inserter(result)); +// the same as +rt.query(index::disjoint(box), std::back_inserter(result)); + +It's possible to use some number of predicates by passing std::pair<P1, P2> + +rt.query( + std::make_pair(index::intersects(box1), !index::within(box2)) + , std::back_inserter(result)); + +or boost::tuple<P1, P2, P3, ...> + +rt.query( + boost::make_tuple(index::intersects(box1), !index::within(box2), index::overlaps(box3)) + , std::back_inserter(result)); + +There is special predicate index::value taking user-defined function/functor +which checks if Value should be returned by the query. + +bool fun(Value const& v) +{ + return v.is_red(); +} + +// ... + +rt.query( + boost::make_pair(index::intersects(box), index::value(fun)) + , std::back_inserter(result)); + + +
+ +
+Nearest neighbor queries +TODO +
+ +
+ +
From 672f654aaa57bb19e1e63d5f342794f4f47166b3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 28 Nov 2011 13:47:04 +0000 Subject: [PATCH 100/366] formatting changed in docs [SVN r75712] --- doc/html/index.html | 16 ++++----- doc/html/index/rtree.html | 73 ++++++++++++++++++++------------------- doc/index.xml | 45 +++++++++++++----------- 3 files changed, 70 insertions(+), 64 deletions(-) diff --git a/doc/html/index.html b/doc/html/index.html index 166f29cad..1456ee433 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -31,7 +31,7 @@
-

Use, modification and distribution is subject to the Boost +

Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

@@ -42,13 +42,13 @@
Introduction
R-tree
-
R-tree creation
-
Values, Indexables and default Translator
-
Inserting and splitting algorithms
-
Inserting and removing Values
-
Spatial queries
-
Spatial predicates
-
Nearest neighbor queries
+
R-tree creation
+
Values, Indexables and default Translator
+
Inserting and splitting algorithms
+
Inserting and removing Values
+
Spatial queries
+
Spatial predicates
+
Nearest neighbor queries
diff --git a/doc/html/index/rtree.html b/doc/html/index/rtree.html index 3fc70121c..4dba80168 100644 --- a/doc/html/index/rtree.html +++ b/doc/html/index/rtree.html @@ -25,13 +25,13 @@

R-tree

R-tree is a self-balancing search tree with nodes stored with their axis aligned @@ -42,7 +42,7 @@ which may be stored inside the node are user defined.

-R-tree creation

+R-tree creation

R-tree has 4 parameters:

@@ -53,22 +53,22 @@ rtree<Value, Parameters, Translator, Allocator>

  • -Value - type of object which will be stored in the container. +Value - type of object which will be stored in the container.
  • -Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. +Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers.
  • -Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle. +Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle.
  • -Allocator - the allocator. +Allocator - the allocator.

-In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code +In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code

 using namespace boost::geometry;
@@ -80,33 +80,34 @@ index::rtree< Value, index::quadratic<32, 8> > rt;
 
 

-Values, Indexables and default Translator

+Values, Indexables and default Translator

R-tree may store Values of any type as long as there is passed the Translator which knows how to interpret those Values and extract an object understandable by the R-tree. Those objects are called Indexables and they are simply of type adapted to Point or Box concept. Default translator -index::translator::def<Value> is able to handle Points, Boxes, std::pairs, pointers and iterators. +index::translator::def<Value> is able to handle Point, Box, +std::pair<...>, pointer, iterator or smart pointer.

    -
  • Indexable = Point | Box
  • -
  • BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable>
  • -
  • Value = BasicValue | BasicValue* | Iterator<BasicValue>
  • +
  • Indexable = Point | Box
  • +
  • BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable>
  • +
  • Value = BasicValue | BasicValue* | Iterator<BasicValue> | SmartPtr<BasicValue>

Examples of Value types:

    -
  • geometry::model::point<...>
  • -
  • geometry::model::point_xy<...>
  • -
  • geometry::model::box<...>
  • -
  • std::pair≤geometry::model::box<...>, size_t>
  • +
  • geometry::model::point<...>
  • +
  • geometry::model::point_xy<...>
  • +
  • geometry::model::box<...>
  • +
  • std::pair<geometry::model::box<...>, size_t>

-Inserting and splitting algorithms

+Inserting and splitting algorithms

Values may be inserted to the R-tree in many various ways. Final structure of nodes depends on algorithms used in the process, especially nodes' splitting algorithm. Currently, three @@ -137,7 +138,7 @@ index::rtree< Value, index::rstar<32, 8> > rt;

-Inserting and removing Values

+Inserting and removing Values

Create

@@ -150,22 +151,24 @@ index::rtree< Value, index::quadratic<32, 8> > rt; Insert and remove by method call

-rt.insert(std::make_pair(Box(...), 0));
-rt.remove(std::make_pair(Box(...), 0));
+Value v = std::make_pair(Box(...), 0);
+rt.insert(v);
+rt.remove(v);
 

or by function call

-index::insert(rt, std::make_pair(Box(...), 0));
-index::remove(rt, std::make_pair(Box(...), 0));
+Value v = std::make_pair(Box(...), 0);
+index::insert(rt, v);
+index::remove(rt, v);
 

-Spatial queries

+Spatial queries

There are three ways to perform a spatial query. Following queries returns Values intersecting some box_region. @@ -188,7 +191,7 @@ index::query(rt, box_region, std::back_inserter(returned_values));

  • -Use of operator | (as with ranges) +Use of operator | (as with ranges)
     Box box_region(...);
     BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region))
    @@ -201,7 +204,7 @@ BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region))
     
     

    -Spatial predicates

    +Spatial predicates

    It is possible to define other relations between queried Values and region/regions of interest. Names of predicates corresponds to names of Boost.Geometry algorithms. @@ -225,7 +228,7 @@ rt.query(!index::intersects(box), std::back_inserter(result)); rt.query(index::disjoint(box), std::back_inserter(result));

    -It's possible to use some number of predicates by passing std::pair<P1, P2> +It's possible to use some number of predicates by passing std::pair<Pred1, Pred2>

     rt.query(
    @@ -233,7 +236,7 @@ rt.query(
       , std::back_inserter(result));
     

    -or boost::tuple<P1, P2, P3, ...> +or boost::tuple<Pred1, Pred2, Pred3, ...>

     rt.query(
    @@ -241,7 +244,7 @@ rt.query(
       , std::back_inserter(result));
     

    -There is special predicate index::value taking user-defined function/functor +There is special predicate index::value(Fun) taking user-defined function/functor which checks if Value should be returned by the query.

    @@ -261,7 +264,7 @@ rt.query(
     
     

    -Nearest neighbor queries

    +Nearest neighbor queries
    TODO diff --git a/doc/index.xml b/doc/index.xml index 440fa90df..720454e6a 100644 --- a/doc/index.xml +++ b/doc/index.xml @@ -65,21 +65,21 @@ rtree<Value, Parameters, Translator, Allocator> -Value - type of object which will be stored in the container. +Value - type of object which will be stored in the container. -Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. +Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. -Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle. +Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle. -Allocator - the allocator. +Allocator - the allocator. -In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code +In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code using namespace boost::geometry; typedef std::pair<Box, int> Value; @@ -94,18 +94,19 @@ index::rtree< Value, index::quadratic<32, 8> > rt; R-tree may store Values of any type as long as there is passed the Translator which knows how to interpret those Values and extract an object understandable by the R-tree. Those objects are called Indexables and they are simply of type adapted to Point or Box concept. Default translator -index::translator::def<Value> is able to handle Points, Boxes, std::pairs, pointers and iterators. +index::translator::def<Value> is able to handle Point, Box, +std::pair<...>, pointer, iterator or smart pointer. -Indexable = Point | Box -BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable> -Value = BasicValue | BasicValue* | Iterator<BasicValue> +Indexable = Point | Box +BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable> +Value = BasicValue | BasicValue* | Iterator<BasicValue> | SmartPtr<BasicValue> Examples of Value types: -geometry::model::point<...> -geometry::model::point_xy<...> -geometry::model::box<...> -std::pair≤geometry::model::box<...>, size_t> +geometry::model::point<...> +geometry::model::point_xy<...> +geometry::model::box<...> +std::pair<geometry::model::box<...>, size_t> @@ -150,13 +151,15 @@ index::rtree< Value, index::quadratic<32, 8> > rt; Insert and remove by method call -rt.insert(std::make_pair(Box(...), 0)); -rt.remove(std::make_pair(Box(...), 0)); +Value v = std::make_pair(Box(...), 0); +rt.insert(v); +rt.remove(v); or by function call -index::insert(rt, std::make_pair(Box(...), 0)); -index::remove(rt, std::make_pair(Box(...), 0)); +Value v = std::make_pair(Box(...), 0); +index::insert(rt, v); +index::remove(rt, v); @@ -184,7 +187,7 @@ index::query(rt, box_region, std::back_inserter(returned_values)); -Use of operator | (as with ranges) +Use of operator | (as with ranges) Box box_region(...); BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region)) @@ -216,19 +219,19 @@ rt.query(!index::intersects(box), std::back_inserter(result)); // the same as rt.query(index::disjoint(box), std::back_inserter(result)); -It's possible to use some number of predicates by passing std::pair<P1, P2> +It's possible to use some number of predicates by passing std::pair<Pred1, Pred2> rt.query( std::make_pair(index::intersects(box1), !index::within(box2)) , std::back_inserter(result)); -or boost::tuple<P1, P2, P3, ...> +or boost::tuple<Pred1, Pred2, Pred3, ...> rt.query( boost::make_tuple(index::intersects(box1), !index::within(box2), index::overlaps(box3)) , std::back_inserter(result)); -There is special predicate index::value taking user-defined function/functor +There is special predicate index::value(Fun) taking user-defined function/functor which checks if Value should be returned by the query. bool fun(Value const& v) From 60dc343582de7d584b6c0e8df027495168d3bd2d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 28 Nov 2011 15:43:13 +0000 Subject: [PATCH 101/366] knn queries description added to doc [SVN r75713] --- doc/html/index.html | 16 +-- doc/html/index/rtree.html | 213 +++++++++++++++++++++++++++++++++----- doc/index.xml | 175 ++++++++++++++++++++++++++++--- 3 files changed, 353 insertions(+), 51 deletions(-) diff --git a/doc/html/index.html b/doc/html/index.html index 1456ee433..ae1ad02c5 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -31,7 +31,7 @@
    -

    Use, modification and distribution is subject to the Boost +

    Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    @@ -42,13 +42,13 @@
    Introduction
    R-tree
    -
    R-tree creation
    -
    Values, Indexables and default Translator
    -
    Inserting and splitting algorithms
    -
    Inserting and removing Values
    -
    Spatial queries
    -
    Spatial predicates
    -
    Nearest neighbor queries
    +
    R-tree creation
    +
    Values, Indexables and default Translator
    +
    Inserting and splitting algorithms
    +
    Inserting and removing Values
    +
    Spatial queries
    +
    Spatial predicates
    +
    Nearest neighbors queries
    diff --git a/doc/html/index/rtree.html b/doc/html/index/rtree.html index 4dba80168..7df2cd5d7 100644 --- a/doc/html/index/rtree.html +++ b/doc/html/index/rtree.html @@ -25,13 +25,13 @@

    R-tree

    R-tree is a self-balancing search tree with nodes stored with their axis aligned @@ -42,7 +42,7 @@ which may be stored inside the node are user defined.

    -R-tree creation

    +R-tree creation

    R-tree has 4 parameters:

    @@ -56,10 +56,13 @@ rtree<Value, Parameters, Translator, Allocator> Value - type of object which will be stored in the container.
  • -Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. +Parameters - compile-time parameters, e.g. inserting/splitting +algorithm with min and max nodes' elements numbers.
  • -Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle. +Translator - type of object translating Value objects +to Indexable objects (Point or Box) which +R-tree can handle.
  • Allocator - the allocator. @@ -68,7 +71,8 @@ rtree<Value, Parameters, Translator, Allocator>

    -In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code +In order to create a R-tree object storing values of type +std::pair<Box, int> one may use the following code

     using namespace boost::geometry;
    @@ -80,13 +84,15 @@ index::rtree< Value, index::quadratic<32, 8> > rt;
     
     

    -Values, Indexables and default Translator

    +Values, Indexables and default Translator

    -R-tree may store Values of any type as long as there is passed the Translator which knows how to interpret -those Values and extract an object understandable by the R-tree. Those objects are called Indexables -and they are simply of type adapted to Point or Box concept. Default translator -index::translator::def<Value> is able to handle Point, Box, -std::pair<...>, pointer, iterator or smart pointer. +R-tree may store Values of any type as long as there is passed +the Translator which knows how to interpret those Values +and extract an object understandable by the R-tree. Those objects are called +Indexables and they are simply of type adapted to Point +or Box concept. Default translator index::translator::def<Value> +is able to handle Point, Box, std::pair<...>, +pointer, iterator or smart pointer.

    • Indexable = Point | Box
    • @@ -94,7 +100,7 @@ and they are simply of type adapted to Point or Box concept. Default translator
    • Value = BasicValue | BasicValue* | Iterator<BasicValue> | SmartPtr<BasicValue>

    -Examples of Value types: +Examples of Value types:

    • geometry::model::point<...>
    • @@ -107,9 +113,9 @@ Examples of Value types:

    -Inserting and splitting algorithms

    +Inserting and splitting algorithms

    -Values may be inserted to the R-tree in many various ways. Final structure of nodes depends +Values may be inserted to the R-tree in many various ways. Final structure of nodes depends on algorithms used in the process, especially nodes' splitting algorithm. Currently, three well-known types of R-trees may be created.

    @@ -138,7 +144,7 @@ index::rtree< Value, index::rstar<32, 8> > rt;

    -Inserting and removing Values

    +Inserting and removing Values

    Create

    @@ -168,10 +174,10 @@ index::remove(rt, v);

    -Spatial queries

    +Spatial queries

    There are three ways to perform a spatial query. Following queries returns -Values intersecting some box_region. +Values intersecting some box_region.

    • @@ -204,9 +210,9 @@ BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region))

    -Spatial predicates

    +Spatial predicates

    -It is possible to define other relations between queried Values and region/regions +It is possible to define other relations between queried Values and region/regions of interest. Names of predicates corresponds to names of Boost.Geometry algorithms.

    @@ -245,7 +251,7 @@ rt.query(
     

    There is special predicate index::value(Fun) taking user-defined function/functor -which checks if Value should be returned by the query. +which checks if Value should be returned by the query.

     bool fun(Value const& v)
    @@ -264,8 +270,159 @@ rt.query(
     
     

    -Nearest neighbor queries

    -TODO +Nearest neighbors queries
    + +
    +

    +k nearest neighbors

    +

    +There are three ways of performing knn queries. Following queries returns +k Values closest to some point in space. For Boxes +Indexables closest point of a Box is taken into +account by default. +

    +
      +
    • +Method call +
      +std::vector<Value> returned_values;
      +Point pt(...);
      +rt.nearest(pt, k, std::back_inserter(returned_values));
      +
      +
    • +
    • +Function call +
      +std::vector<Value> returned_values;
      +Point pt(...);
      +index::nearest(rt, pt, k, std::back_inserter(returned_values));
      +
      +
    • +
    • +Use of operator |
      +Point pt(...);
      +BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k))
      +  ;// do something with v
      +
      +
    • +
    +

    +

    +
    +
    +

    +One nearest neighbor

    +

    +Another type of nearest neighbor query is searching for the one closest Value. +If it is found, 1 is returned by the method or function. This kind of query +has only two forms. +

    +
      +
    • +Method call +
      +Value returned_value;
      +Point pt(...);
      +size_t n = rt.nearest(pt, returned_value);
      +
      +
    • +
    • +Function call +
      +Value returned_value;
      +Point pt(...);
      +size_t n = index::nearest(rt, pt, returned_value);
      +
      +
    • +
    +

    +

    +
    +
    +

    +Distances predicates

    +

    +It is possible to define if calculated distance between query point and Value should be +greater, lesser or between some other distances. Those are called DistancesPredicates and +may be defined as follows. +

    +
    +std::vector<Value> returned_values;
    +Point pt(...);
    +
    +/* default - without bounds */
    +index::nearest(rt, pt, k, std::back_inserter(returned_values));
    +
    +/* same as default */
    +index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values));
    +
    +/* distance must be greater than or equal to 10 */
    +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    +
    +/* distance must be lesser than or equal to 500 */
    +index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values));
    +
    +/* distance must be between 10 and 500 */
    +index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values));
    +
    +
    +

    +

    +

    +Furthermore, it's possible to define if the closest, furthest or centroidal point of the +non-point Indexable should be taken into account in the routine calculating distance. +

    +
    +std::vector<Value> returned_values;
    +Point pt(...);
    +
    +/* default - distance between Indexable's closest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    +
    +/* same as default - distance between Indexable's closest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values));
    +
    +/* distance between Indexable's furthest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values));
    +
    +/* distance between Indexable's centroid and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values));
    +
    +

    +

    +
    +
    +

    +Using spatial predicates

    +

    +It is possible to use spatial predicates described before in knn queries. +

    +
    +Value returned_value;
    +std::vector<Value> returned_values;
    +
    +Point pt(...);
    +Box b(...);
    +
    +size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value);
    +
    +size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values));
    +
    +BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k, index::covered_by(b)))
    +  ;// do something with v
    +
    +

    +

    +
    diff --git a/doc/index.xml b/doc/index.xml index 720454e6a..722e2c286 100644 --- a/doc/index.xml +++ b/doc/index.xml @@ -68,10 +68,13 @@ rtree<Value, Parameters, Translator, Allocator> Value - type of object which will be stored in the container. -Parameters - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. +Parameters - compile-time parameters, e.g. inserting/splitting +algorithm with min and max nodes' elements numbers. -Translator - type of object translating Value objects to Indexable objects (Point or Box) which R-tree can handle. +Translator - type of object translating Value objects +to Indexable objects (Point or Box) which +R-tree can handle. Allocator - the allocator. @@ -79,7 +82,8 @@ rtree<Value, Parameters, Translator, Allocator> -In order to create a R-tree object storing values of type std::pair<Box, int> one may use the following code +In order to create a R-tree object storing values of type +std::pair<Box, int> one may use the following code using namespace boost::geometry; typedef std::pair<Box, int> Value; @@ -91,17 +95,19 @@ index::rtree< Value, index::quadratic<32, 8> > rt;
    Values, Indexables and default Translator -R-tree may store Values of any type as long as there is passed the Translator which knows how to interpret -those Values and extract an object understandable by the R-tree. Those objects are called Indexables -and they are simply of type adapted to Point or Box concept. Default translator -index::translator::def<Value> is able to handle Point, Box, -std::pair<...>, pointer, iterator or smart pointer. +R-tree may store Values of any type as long as there is passed +the Translator which knows how to interpret those Values +and extract an object understandable by the R-tree. Those objects are called +Indexables and they are simply of type adapted to Point +or Box concept. Default translator index::translator::def<Value> +is able to handle Point, Box, std::pair<...>, +pointer, iterator or smart pointer. Indexable = Point | Box BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable> Value = BasicValue | BasicValue* | Iterator<BasicValue> | SmartPtr<BasicValue> -Examples of Value types: +Examples of Value types: geometry::model::point<...> geometry::model::point_xy<...> @@ -114,7 +120,7 @@ Examples of Value types:
    Inserting and splitting algorithms -Values may be inserted to the R-tree in many various ways. Final structure of nodes depends +Values may be inserted to the R-tree in many various ways. Final structure of nodes depends on algorithms used in the process, especially nodes' splitting algorithm. Currently, three well-known types of R-trees may be created. @@ -168,7 +174,7 @@ index::remove(rt, v); Spatial queries There are three ways to perform a spatial query. Following queries returns -Values intersecting some box_region. +Values intersecting some box_region. Method call @@ -201,7 +207,7 @@ BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region))
    Spatial predicates -It is possible to define other relations between queried Values and region/regions +It is possible to define other relations between queried Values 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 @@ -232,7 +238,7 @@ rt.query( , std::back_inserter(result)); There is special predicate index::value(Fun) taking user-defined function/functor -which checks if Value should be returned by the query. +which checks if Value should be returned by the query. bool fun(Value const& v) { @@ -249,8 +255,147 @@ rt.query(
    -Nearest neighbor queries -TODO +Nearest neighbors queries + +
    +k nearest neighbors + +There are three ways of performing knn queries. Following queries returns +k Values closest to some point in space. For Boxes +Indexables closest point of a Box is taken into +account by default. + + +Method call + +std::vector<Value> returned_values; +Point pt(...); +rt.nearest(pt, k, std::back_inserter(returned_values)); + + + +Function call + +std::vector<Value> returned_values; +Point pt(...); +index::nearest(rt, pt, k, std::back_inserter(returned_values)); + + + +Use of operator | + +Point pt(...); +BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k)) + ;// do something with v + + + + +
    + +
    +One nearest neighbor + +Another type of nearest neighbor query is searching for the one closest Value. +If it is found, 1 is returned by the method or function. This kind of query +has only two forms. + + +Method call + +Value returned_value; +Point pt(...); +size_t n = rt.nearest(pt, returned_value); + + + +Function call + +Value returned_value; +Point pt(...); +size_t n = index::nearest(rt, pt, returned_value); + + + + +
    + +
    +Distances predicates + +It is possible to define if calculated distance between query point and Value should be +greater, lesser or between some other distances. Those are called DistancesPredicates and +may be defined as follows. + +std::vector<Value> returned_values; +Point pt(...); + +/* default - without bounds */ +index::nearest(rt, pt, k, std::back_inserter(returned_values)); + +/* same as default */ +index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); + +/* distance must be greater than or equal to 10 */ +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + +/* distance must be lesser than or equal to 500 */ +index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); + +/* distance must be between 10 and 500 */ +index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); + + + + + +Furthermore, it's possible to define if the closest, furthest or centroidal point of the +non-point Indexable should be taken into account in the routine calculating distance. + +std::vector<Value> returned_values; +Point pt(...); + +/* default - distance between Indexable's closest point and a query point +must be greater than 10 */ +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + +/* same as default - distance between Indexable's closest point and a query point +must be greater than 10 */ +index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); + +/* distance between Indexable's furthest point and a query point +must be greater than 10 */ +index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); + +/* distance between Indexable's centroid and a query point +must be greater than 10 */ +index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); + + + +
    + +
    +Using spatial predicates + +It is possible to use spatial predicates described before in knn queries. + +Value returned_value; +std::vector<Value> returned_values; + +Point pt(...); +Box b(...); + +size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); + +size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); + +BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k, index::covered_by(b))) + ;// do something with v + + +
    +
    From 1dea89be753069388fed7c2d6b136795f080d296 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 29 Nov 2011 00:17:08 +0000 Subject: [PATCH 102/366] r-tree doc structure slightly changed. [SVN r75718] --- doc/html/index.html | 14 +++-- doc/html/index/rtree.html | 106 +++++++++++++++++++++++++------------- doc/index.xml | 45 ++++++++++++---- 3 files changed, 110 insertions(+), 55 deletions(-) diff --git a/doc/html/index.html b/doc/html/index.html index ae1ad02c5..3e4d34b68 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -31,7 +31,7 @@
    -

    Use, modification and distribution is subject to the Boost +

    Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    @@ -42,13 +42,11 @@
    Introduction
    R-tree
    -
    R-tree creation
    -
    Values, Indexables and default Translator
    -
    Inserting and splitting algorithms
    -
    Inserting and removing Values
    -
    Spatial queries
    -
    Spatial predicates
    -
    Nearest neighbors queries
    +
    Introduction
    +
    R-tree creation
    +
    Inserting and removing Values
    +
    Spatial queries
    +
    Nearest neighbors queries
    diff --git a/doc/html/index/rtree.html b/doc/html/index/rtree.html index 7df2cd5d7..efa6bc1a8 100644 --- a/doc/html/index/rtree.html +++ b/doc/html/index/rtree.html @@ -25,14 +25,15 @@

    R-tree

    +
    +

    +Introduction

    R-tree is a self-balancing search tree with nodes stored with their axis aligned bounding boxes. Each node's box describes the space occupied by children nodes. @@ -40,9 +41,42 @@ 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 the node are user defined.

    +

    +In order to use the R-tree one must include folowing file. +

    +
    +#include <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +

    +

    +

    -R-tree creation

    +R-tree creation
    + +
    +

    +Quick start

    +

    +In order to create a R-tree object storing values of type +std::pair<Box, int> one may use the following code +

    +
    +using namespace boost::geometry;
    +typedef std::pair<Box, int> Value;
    +index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +

    +

    +
    +
    +

    +R-tree template parameters

    R-tree has 4 parameters:

    @@ -70,21 +104,10 @@ R-tree can handle.

    -

    -In order to create a R-tree object storing values of type -std::pair<Box, int> one may use the following code -

    -
    -using namespace boost::geometry;
    -typedef std::pair<Box, int> Value;
    -index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -

    -

    -

    -Values, Indexables and default Translator

    +

    +Values, Indexables and default Translator

    R-tree may store Values of any type as long as there is passed the Translator which knows how to interpret those Values @@ -112,8 +135,8 @@ Examples of Value types:

    -

    -Inserting and splitting algorithms

    +

    +Inserting and splitting algorithms

    Values may be inserted to the R-tree in many various ways. Final structure of nodes depends on algorithms used in the process, especially nodes' splitting algorithm. Currently, three @@ -142,9 +165,10 @@ index::rtree< Value, index::rstar<32, 8> > rt;

    +

    -Inserting and removing Values

    +Inserting and removing Values

    Create

    @@ -174,7 +198,14 @@ index::remove(rt, v);

    -Spatial queries

    +Spatial queries
    + +
    +

    +Basic queries

    There are three ways to perform a spatial query. Following queries returns Values intersecting some box_region. @@ -209,8 +240,8 @@ BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region))

    -

    -Spatial predicates

    +

    +Spatial predicates

    It is possible to define other relations between queried Values and region/regions of interest. Names of predicates corresponds to names of Boost.Geometry algorithms. @@ -268,18 +299,19 @@ rt.query(

    +

    -Nearest neighbors queries

    +Nearest neighbors queries

    -k nearest neighbors

    +k nearest neighbors

    There are three ways of performing knn queries. Following queries returns k Values closest to some point in space. For Boxes @@ -316,7 +348,7 @@ BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k))

    -One nearest neighbor

    +One nearest neighbor

    Another type of nearest neighbor query is searching for the one closest Value. If it is found, 1 is returned by the method or function. This kind of query @@ -345,7 +377,7 @@ size_t n = index::nearest(rt, pt, returned_value);

    -Distances predicates

    +Distances predicates

    It is possible to define if calculated distance between query point and Value should be greater, lesser or between some other distances. Those are called DistancesPredicates and @@ -402,9 +434,9 @@ index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_ins

    -Using spatial predicates

    +Using spatial predicates

    -It is possible to use spatial predicates described before in knn queries. +It is possible to use spatial predicates described before in nearest neighbors queries.

     Value returned_value;
    diff --git a/doc/index.xml b/doc/index.xml
    index 722e2c286..f41b06921 100644
    --- a/doc/index.xml
    +++ b/doc/index.xml
    @@ -48,6 +48,9 @@ occupying some space or close to some point in space.
     
     
    R-tree + +
    +Introduction R-tree is a self-balancing search tree with nodes stored with their axis aligned bounding boxes. Each node's box describes the space occupied by children nodes. @@ -56,8 +59,32 @@ At the bottom of the structure, there are leaf-nodes which contains values which may be stored inside the node are user defined. + +In order to use the R-tree one must include folowing file. + +#include <boost/geometry/extensions/index/rtree/rtree.hpp> + + +
    +
    R-tree creation + +
    +Quick start + +In order to create a R-tree object storing values of type +std::pair<Box, int> one may use the following code + +using namespace boost::geometry; +typedef std::pair<Box, int> Value; +index::rtree< Value, index::quadratic<32, 8> > rt; + + +
    + +
    +R-tree template parameters R-tree has 4 parameters: @@ -81,15 +108,6 @@ R-tree can handle. - -In order to create a R-tree object storing values of type -std::pair<Box, int> one may use the following code - -using namespace boost::geometry; -typedef std::pair<Box, int> Value; -index::rtree< Value, index::quadratic<32, 8> > rt; - -
    @@ -146,6 +164,8 @@ index::rtree< Value, index::rstar<32, 8> > rt;
    +
    +
    Inserting and removing Values @@ -172,6 +192,9 @@ index::remove(rt, v);
    Spatial queries + +
    +Basic queries There are three ways to perform a spatial query. Following queries returns Values intersecting some box_region. @@ -254,6 +277,8 @@ rt.query(
    +
    +
    Nearest neighbors queries @@ -378,7 +403,7 @@ index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_ins
    Using spatial predicates -It is possible to use spatial predicates described before in knn queries. +It is possible to use spatial predicates described before in nearest neighbors queries. Value returned_value; std::vector<Value> returned_values; From 049446cbca26fc0f00eadc41d03029f318ebb092 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 30 Nov 2011 03:22:14 +0000 Subject: [PATCH 103/366] changed docs format - from BoostBook to QuickBook [SVN r75740] --- doc/Jamfile.v2 | 29 +- doc/html/geometry_index/introduction.html | 53 +++ doc/html/geometry_index/r_tree.html | 502 ++++++++++++++++++++++ doc/html/index.html | 56 ++- doc/html/index/rtree.html | 472 -------------------- doc/index.qbk | 47 ++ doc/index.xml | 428 ------------------ doc/introduction.qbk | 22 + doc/rtree.qbk | 317 ++++++++++++++ 9 files changed, 985 insertions(+), 941 deletions(-) create mode 100644 doc/html/geometry_index/introduction.html create mode 100644 doc/html/geometry_index/r_tree.html delete mode 100644 doc/html/index/rtree.html create mode 100644 doc/index.qbk delete mode 100644 doc/index.xml create mode 100644 doc/introduction.qbk create mode 100644 doc/rtree.qbk diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 452d93760..2da6b592f 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -1,4 +1,4 @@ -# Boost.Geometry.Index (Spatial Indexes Library) +# Boost.Geometry Index (Spatial Indexes) # # Copyright (c) 2008 Federico J. Fernandez. # Copyright (c) 2011 Adam Wulkiewicz. @@ -7,14 +7,25 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -project boost/doc ; -import boostbook : boostbook ; +project geometry_index/doc ; -boostbook geometry-index-doc - : - index.xml +import boostbook ; +import quickbook ; + +boostbook geometry_index-doc : - boost.root=http://www.boost.org/doc/libs/release - pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html + index.qbk + : +# off +# on +# off +# index.on.type=1 + html + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html + chunk.first.sections=1 + toc.section.depth=3 + toc.max.depth=2 + generate.section.toc.level=4 + boost.root=http://www.boost.org/doc/libs/release + enable_index ; - diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html new file mode 100644 index 000000000..51e8b0631 --- /dev/null +++ b/doc/html/geometry_index/introduction.html @@ -0,0 +1,53 @@ + + + +Introduction + + + + + + + + +
    + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +

    + The Boost.Geometry Index is intetended to gather containers (spatial indexes) + used for speeding spatial queries up. It is a part of the Boost.Geometry + library. In general, spatial indexes stores geometric objects' representations + and allows searching for objects occupying some space or close to some point + in space. +

    +

    + Currently, only one spatial index is implemented - R-tree. +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html new file mode 100644 index 000000000..655a08466 --- /dev/null +++ b/doc/html/geometry_index/r_tree.html @@ -0,0 +1,502 @@ + + + +R-tree + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHome +
    +
    +

    +R-tree +

    + +
    + +

    + R-tree is a self-balancing search tree with nodes stored with their axis + aligned bounding boxes. Each node's box describes 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 the node are user defined. +

    +

    + In order to use the R-tree one must include folowing file. +

    +
    #include <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +
    + + +
    + +

    + In order to create a R-tree object storing values of type std::pair<Box, size_t> one may use the following code: +

    +
    using namespace boost::geometry;
    +typedef std::pair<Box, size_t> Value;
    +index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +
    +
    + +

    + R-tree has 4 parameters: +

    +
    rtree<Value, Parameters, Translator, Allocator>
    +
    +
      +
    • + Value - type of object + which will be stored in the container. +
    • +
    • + Parameters - compile-time + parameters, e.g. inserting/splitting algorithm with min and max nodes' + elements numbers. +
    • +
    • + Translator - type of + object translating Value + objects to Indexable + objects (Point + or Box) + which R-tree can handle. +
    • +
    • + Allocator - the allocator. +
    • +
    +
    +
    + +

    + R-tree may store Values of any type as long as there is passed + the Translator which knows how to interpret those Values + and extract an object understandable by the R-tree. Those objects are called + Indexables and they are simply of type adapted to Point + or Box + concept. Default Translator index::translator::def<Value> is able to handle Point, + Box, + std::pair<...>, + pointer, iterator or smart pointer. +

    +
      +
    • + Indexable = Point + | Box +
    • +
    • + BasicValue = + Indexable | + std::pair<Indexable, T> | std::pair<T, Indexable> +
    • +
    • + Value = BasicValue + | BasicValue* | Iterator<BasicValue> + | SmartPtr<BasicValue> +
    • +
    +

    + Examples of Value types: +

    +
    geometry::model::point<...>
    +geometry::model::point_xy<...>
    +geometry::model::box<...>
    +std::pair<geometry::model::box<...>, size_t>
    +
    +
    +
    + +

    + Values may be inserted to the R-tree in many various ways. + Final structure of nodes depends on algorithms used in the process, especially + nodes' splitting algorithm. Currently, three well-known types of R-trees + may be created. +

    +

    + Linear - classic R-tree using splitting algorithm of linear complexity +

    +
    index::rtree< Value, index::linear<32, 8> > rt;
    +
    +

    + Quadratic - classic R-tree using splitting algorithm of quadratic complexity +

    +
    index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +

    + R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions +

    +
    index::rtree< Value, index::rstar<32, 8> > rt;
    +
    +
    +
    +
    + +

    + Create +

    +
    using namespace boost::geometry;
    +typedef std::pair<Box, int> Value;
    +index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +

    + Insert and remove by method call +

    +
    Value v = std::make_pair(Box(...), 0);
    +rt.insert(v);
    +rt.remove(v);
    +
    +

    + or by function call +

    +
    Value v = std::make_pair(Box(...), 0);
    +index::insert(rt, v);
    +index::remove(rt, v);
    +
    +
    +
    + + +
    + +

    + There are three ways to perform a spatial query. Following queries returns + Values intersecting some box_region. +

    +

    + Method call +

    +
    std::vector<Value> returned_values;
    +Box box_region(...);
    +rt.query(box_region, std::back_inserter(returned_values));
    +
    +

    + Function call +

    +
    std::vector<Value> returned_values;
    +Box box_region(...);
    +index::query(rt, box_region, std::back_inserter(returned_values));
    +
    +

    + Use of operator | + (as with ranges) +

    +
    Box box_region(...);
    +BOOST_FOREACH(Value & v, rt | index::query_filtered(box_region))
    +  ; // do something with v
    +
    +
    +
    + +

    + It is possible to define other relations between queried Values + 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)); // 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));
    +
    +

    + All predicates may be negated, e.g.: +

    +
    rt.query(index::not_intersects(box), std::back_inserter(result));
    +// or
    +rt.query(!index::intersects(box), std::back_inserter(result));
    +// the same as
    +rt.query(index::disjoint(box), std::back_inserter(result));
    +
    +

    + It's possible to use some number of predicates by passing std::pair<Pred1, Pred2> +

    +
    rt.query(
    +  std::make_pair(index::intersects(box1), !index::within(box2))
    +  , std::back_inserter(result));
    +
    +

    + or boost::tuple<Pred1, Pred2, Pred3, ...> +

    +
    rt.query(
    +  boost::make_tuple(
    +    index::intersects(box1), !index::within(box2), index::overlaps(box3))
    +  , std::back_inserter(result));
    +
    +

    + There is also a unique predicate index::value(...) taking user-defined function/functor + which checks if Value should be returned by the query. +

    +
    bool fun(__value const& v)
    +{
    +  return v.is_red();
    +}
    +
    +// ...
    +
    +rt.query(
    +  boost::make_pair(index::intersects(box), index::value(fun))
    +  , std::back_inserter(result));
    +
    +
    +
    +
    + + +
    + +

    + There are three ways of performing knn queries. Following queries returns + k Values closest to some point in space. For Boxes + Indexables closest point of a Box + is taken into account by default. +

    +

    + Method call +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +rt.nearest(pt, k, std::back_inserter(returned_values));
    +
    +

    + Function call +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +index::nearest(rt, pt, k, std::back_inserter(returned_values));
    +
    +

    + Use of operator | +

    +
    Point pt(...);
    +BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k))
    +  ; // do something with v
    +
    +
    +
    + +

    + Another type of nearest neighbor query is searching for the one closest + Value. If it is found, 1 is returned by the method or function. + This kind of query has only two forms. +

    +

    + Method call +

    +
    Value returned_value;
    +Point pt(...);
    +size_t n = rt.nearest(pt, returned_value);
    +
    +

    + Function call +

    +
    Value Value returned_value;
    +Point pt(...);
    +size_t n = index::nearest(rt, pt, returned_value);
    +
    +
    +
    + +

    + It is possible to define if calculated distance between query point and + Value should be greater, lesser or between some other distances. + Those are called DistancesPredicates + and may be defined as follows. +

    +
    std::vector<__Value__> returned_values;
    +Point pt(...);
    +
    +/* default - without bounds */
    +index::nearest(rt, pt, k, std::back_inserter(returned_values));
    +
    +/* same as default */
    +index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values));
    +
    +/* distance must be greater than or equal to 10 */
    +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    +
    +/* distance must be lesser than or equal to 500 */
    +index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values));
    +
    +/* distance must be between 10 and 500 */
    +index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values));
    +
    +

    + Furthermore, it's possible to define if the closest, furthest or centroidal + point of the non-point __Indexable__ + should be taken into account in the routine calculating distance. +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +
    +/* default - distance between __indexable__'s closest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    +
    +/* same as default - distance between __indexable__'s closest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values));
    +
    +/* distance between __indexable__'s furthest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values));
    +
    +/* distance between __indexable__'s centroid and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values));
    +
    +
    +
    + +

    + It is possible to use spatial predicates described before in nearest neighbors + queries. +

    +
    Value returned_value;
    +std::vector<Value> returned_values;
    +
    +Point pt(...);
    +Box b(...);
    +
    +size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value);
    +
    +size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values));
    +
    +BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b)))
    +  ; // do something with v
    +
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHome +
    + + diff --git a/doc/html/index.html b/doc/html/index.html index 3e4d34b68..e4aca4690 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,11 +1,11 @@ -Chapter 1. Boost.Geometry.Index +Chapter 1. Geometry Index 0.7 - - + + @@ -17,55 +17,47 @@
    More

    -
    Next
    +
    Next

    -Chapter 1. Boost.Geometry.Index

    -

    -Federico J. Fernandez -

    +Chapter 1. Geometry Index 0.7

    Adam Wulkiewicz

    -
    -
    +

    +Federico J. Fernandez +

    +
    -

    Use, modification and distribution is subject to the Boost - Software License, Version 1.0. (See accompanying file - LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    +

    + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +

    -
    -

    -Introduction

    -

    The Boost.Geometry.Index library is intetended to gather containers -(spatial indexes) used for speeding spatial queries up. In general, indexes -stores geometric objects' representations and allows searching for objects -occupying some space or close to some point in space. -

    -

    Currently, only one spatial index is implemented - the R-tree.

    -
    - +

    Last revised: November 30, 2011 at 03:13:32 GMT


    -
    Next
    +
    Next
    diff --git a/doc/html/index/rtree.html b/doc/html/index/rtree.html deleted file mode 100644 index efa6bc1a8..000000000 --- a/doc/html/index/rtree.html +++ /dev/null @@ -1,472 +0,0 @@ - - - -R-tree - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHome -
    -
    -

    -R-tree

    - -
    -

    -Introduction

    -

    -R-tree is a self-balancing search tree with nodes stored with their axis aligned -bounding boxes. Each node's box describes 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 the node are user defined. -

    -

    -In order to use the R-tree one must include folowing file. -

    -
    -#include <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -

    -

    -
    -
    -

    -R-tree creation

    - -
    -

    -Quick start

    -

    -In order to create a R-tree object storing values of type -std::pair<Box, int> one may use the following code -

    -
    -using namespace boost::geometry;
    -typedef std::pair<Box, int> Value;
    -index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -

    -

    -
    -
    -

    -R-tree template parameters

    -

    -R-tree has 4 parameters: -

    -
    -rtree<Value, Parameters, Translator, Allocator>
    -
    -

    -

    -
      -
    • -Value - type of object which will be stored in the container. -
    • -
    • -Parameters - compile-time parameters, e.g. inserting/splitting -algorithm with min and max nodes' elements numbers. -
    • -
    • -Translator - type of object translating Value objects -to Indexable objects (Point or Box) which -R-tree can handle. -
    • -
    • -Allocator - the allocator. -
    • -
    -

    -

    -
    -
    -

    -Values, Indexables and default Translator

    -

    -R-tree may store Values of any type as long as there is passed -the Translator which knows how to interpret those Values -and extract an object understandable by the R-tree. Those objects are called -Indexables and they are simply of type adapted to Point -or Box concept. Default translator index::translator::def<Value> -is able to handle Point, Box, std::pair<...>, -pointer, iterator or smart pointer. -

    -
      -
    • Indexable = Point | Box
    • -
    • BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable>
    • -
    • Value = BasicValue | BasicValue* | Iterator<BasicValue> | SmartPtr<BasicValue>
    • -
    -

    -Examples of Value types: -

    -
      -
    • geometry::model::point<...>
    • -
    • geometry::model::point_xy<...>
    • -
    • geometry::model::box<...>
    • -
    • std::pair<geometry::model::box<...>, size_t>
    • -
    -

    -

    -
    -
    -

    -Inserting and splitting algorithms

    -

    -Values may be inserted to the R-tree in many various ways. Final structure of nodes depends -on algorithms used in the process, especially nodes' splitting algorithm. Currently, three -well-known types of R-trees may be created. -

    -
      -
    • -Linear - classic R-tree using splitting algorithm of linear complexity -
      -index::rtree< Value, index::linear<32, 8> > rt;
      -
      -
    • -
    • -Quadratic - classic R-tree using splitting algorithm of quadratic complexity -
      -index::rtree< Value, index::quadratic<32, 8> > rt;
      -
      -
    • -
    • -R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions -
      -index::rtree< Value, index::rstar<32, 8> > rt;
      -
      -
    • -
    -

    -

    -
    -
    -
    -

    -Inserting and removing Values

    -

    -Create -

    -
    -using namespace boost::geometry;
    -typedef std::pair<Box, int> Value;
    -index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -

    -Insert and remove by method call -

    -
    -Value v = std::make_pair(Box(...), 0);
    -rt.insert(v);
    -rt.remove(v);
    -
    -

    -or by function call -

    -
    -Value v = std::make_pair(Box(...), 0);
    -index::insert(rt, v);
    -index::remove(rt, v);
    -
    -

    -

    -
    -
    -

    -Spatial queries

    - -
    -

    -Basic queries

    -

    -There are three ways to perform a spatial query. Following queries returns -Values intersecting some box_region. -

    -
      -
    • -Method call -
      -std::vector<Value> returned_values;
      -Box box_region(...);
      -rt.query(box_region, std::back_inserter(returned_values));
      -
      -
    • -
    • -Function call -
      -std::vector<Value> returned_values;
      -Box box_region(...);
      -index::query(rt, box_region, std::back_inserter(returned_values));
      -
      -
    • -
    • -Use of operator | (as with ranges) -
      -Box box_region(...);
      -BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region))
      -  ;// do something with v
      -
      -
    • -
    -

    -

    -
    -
    -

    -Spatial predicates

    -

    -It is possible to define other relations between queried Values 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)); // 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));
    -
    -

    -All predicates may be negated, e.g.: -

    -
    -rt.query(index::not_intersects(box), std::back_inserter(result));
    -// or
    -rt.query(!index::intersects(box), std::back_inserter(result));
    -// the same as
    -rt.query(index::disjoint(box), std::back_inserter(result));
    -
    -

    -It's possible to use some number of predicates by passing std::pair<Pred1, Pred2> -

    -
    -rt.query(
    -  std::make_pair(index::intersects(box1), !index::within(box2))
    -  , std::back_inserter(result));
    -
    -

    -or boost::tuple<Pred1, Pred2, Pred3, ...> -

    -
    -rt.query(
    -  boost::make_tuple(index::intersects(box1), !index::within(box2), index::overlaps(box3))
    -  , std::back_inserter(result));
    -
    -

    -There is special predicate index::value(Fun) taking user-defined function/functor -which checks if Value should be returned by the query. -

    -
    -bool fun(Value const& v)
    -{
    -  return v.is_red();
    -}
    -
    -// ...
    -
    -rt.query(
    -  boost::make_pair(index::intersects(box), index::value(fun))
    -  , std::back_inserter(result));
    -
    -

    -

    -
    -
    -
    -

    -Nearest neighbors queries

    - -
    -

    -k nearest neighbors

    -

    -There are three ways of performing knn queries. Following queries returns -k Values closest to some point in space. For Boxes -Indexables closest point of a Box is taken into -account by default. -

    -
      -
    • -Method call -
      -std::vector<Value> returned_values;
      -Point pt(...);
      -rt.nearest(pt, k, std::back_inserter(returned_values));
      -
      -
    • -
    • -Function call -
      -std::vector<Value> returned_values;
      -Point pt(...);
      -index::nearest(rt, pt, k, std::back_inserter(returned_values));
      -
      -
    • -
    • -Use of operator |
      -Point pt(...);
      -BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k))
      -  ;// do something with v
      -
      -
    • -
    -

    -

    -
    -
    -

    -One nearest neighbor

    -

    -Another type of nearest neighbor query is searching for the one closest Value. -If it is found, 1 is returned by the method or function. This kind of query -has only two forms. -

    -
      -
    • -Method call -
      -Value returned_value;
      -Point pt(...);
      -size_t n = rt.nearest(pt, returned_value);
      -
      -
    • -
    • -Function call -
      -Value returned_value;
      -Point pt(...);
      -size_t n = index::nearest(rt, pt, returned_value);
      -
      -
    • -
    -

    -

    -
    -
    -

    -Distances predicates

    -

    -It is possible to define if calculated distance between query point and Value should be -greater, lesser or between some other distances. Those are called DistancesPredicates and -may be defined as follows. -

    -
    -std::vector<Value> returned_values;
    -Point pt(...);
    -
    -/* default - without bounds */
    -index::nearest(rt, pt, k, std::back_inserter(returned_values));
    -
    -/* same as default */
    -index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values));
    -
    -/* distance must be greater than or equal to 10 */
    -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    -
    -/* distance must be lesser than or equal to 500 */
    -index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values));
    -
    -/* distance must be between 10 and 500 */
    -index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values));
    -
    -
    -

    -

    -

    -Furthermore, it's possible to define if the closest, furthest or centroidal point of the -non-point Indexable should be taken into account in the routine calculating distance. -

    -
    -std::vector<Value> returned_values;
    -Point pt(...);
    -
    -/* default - distance between Indexable's closest point and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    -
    -/* same as default - distance between Indexable's closest point and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values));
    -
    -/* distance between Indexable's furthest point and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values));
    -
    -/* distance between Indexable's centroid and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values));
    -
    -

    -

    -
    -
    -

    -Using spatial predicates

    -

    -It is possible to use spatial predicates described before in nearest neighbors queries. -

    -
    -Value returned_value;
    -std::vector<Value> returned_values;
    -
    -Point pt(...);
    -Box b(...);
    -
    -size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value);
    -
    -size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values));
    -
    -BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k, index::covered_by(b)))
    -  ;// do something with v
    -
    -

    -

    -
    -
    -
    - - - -
    -
    -
    -PrevUpHome -
    - - diff --git a/doc/index.qbk b/doc/index.qbk new file mode 100644 index 000000000..feb00e062 --- /dev/null +++ b/doc/index.qbk @@ -0,0 +1,47 @@ +[/============================================================================ + Boost.Geometry Index (Spatial Indexes) + + Copyright (c) 2008 Federico J. Fernandez. + Copyright (c) 2011 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[library Geometry Index + [quickbook 1.5] + [version 0.7] + [authors [Wulkiewicz, Adam], [Fernandez, Federico J.]] + [copyright 2011 Adam Wulkiewicz, Federico J. Fernandez] + [purpose Documentation of Boost.Geometry Index library] + [license + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + [@http://www.boost.org/LICENSE_1_0.txt]) + ] + [id geometry] + [category geometry] +] + +[def __box__ [@http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html Box]] +[def __point__ [@http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_point.html Point]] + +[def __boost__ [@http://www.boost.org/libs/libraries.htm Boost]] +[def __boost_geometry__ [@http://www.boost.org/libs/geometry/doc/html/index.html Boost.Geometry]] +[def __boost_geometry_index__ Boost.Geometry Index] + +[def __rtree__ R-tree] + +[def __value__ Value] +[def __parameters__ Parameters] +[def __translator__ Translator] +[def __allocator__ Allocator] +[def __indexable__ Indexable] + +[def __cgeometry__ [@http://www.boost.org/libs/geometry/doc/html/index.html geometry]] +[def __cboost__ [@http://www.boost.org/libs/libraries.htm boost]] + +[include introduction.qbk] + +[include rtree.qbk] diff --git a/doc/index.xml b/doc/index.xml deleted file mode 100644 index f41b06921..000000000 --- a/doc/index.xml +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - Federico J. - Fernandez - - - Adam - Wulkiewicz - - - - 2008 - Federico J. Fernandez - - - 2011 - Adam Wulkiewicz - - - - Use, modification and distribution is subject to the Boost - Software License, Version 1.0. (See accompanying file - LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - - Spatial indexes for faster spatial and knn queries. - - - -Boost.Geometry.Index - -
    -Introduction -The Boost.Geometry.Index library is intetended to gather containers -(spatial indexes) used for speeding spatial queries up. In general, indexes -stores geometric objects' representations and allows searching for objects -occupying some space or close to some point in space. - - -Currently, only one spatial index is implemented - the R-tree. -
    - -
    -R-tree - -
    -Introduction - -R-tree is a self-balancing search tree with nodes stored with their axis aligned -bounding boxes. Each node's box describes 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 the node are user defined. - - - -In order to use the R-tree one must include folowing file. - -#include <boost/geometry/extensions/index/rtree/rtree.hpp> - - -
    - -
    -R-tree creation - -
    -Quick start - -In order to create a R-tree object storing values of type -std::pair<Box, int> one may use the following code - -using namespace boost::geometry; -typedef std::pair<Box, int> Value; -index::rtree< Value, index::quadratic<32, 8> > rt; - - -
    - -
    -R-tree template parameters - -R-tree has 4 parameters: - -rtree<Value, Parameters, Translator, Allocator> - - - -Value - type of object which will be stored in the container. - - -Parameters - compile-time parameters, e.g. inserting/splitting -algorithm with min and max nodes' elements numbers. - - -Translator - type of object translating Value objects -to Indexable objects (Point or Box) which -R-tree can handle. - - -Allocator - the allocator. - - - -
    - -
    -Values, Indexables and default Translator - -R-tree may store Values of any type as long as there is passed -the Translator which knows how to interpret those Values -and extract an object understandable by the R-tree. Those objects are called -Indexables and they are simply of type adapted to Point -or Box concept. Default translator index::translator::def<Value> -is able to handle Point, Box, std::pair<...>, -pointer, iterator or smart pointer. - -Indexable = Point | Box -BasicValue = Indexable | std::pair<Indexable, T> | std::pair<T, Indexable> -Value = BasicValue | BasicValue* | Iterator<BasicValue> | SmartPtr<BasicValue> - -Examples of Value types: - -geometry::model::point<...> -geometry::model::point_xy<...> -geometry::model::box<...> -std::pair<geometry::model::box<...>, size_t> - - -
    - -
    -Inserting and splitting algorithms - -Values may be inserted to the R-tree in many various ways. Final structure of nodes depends -on algorithms used in the process, especially nodes' splitting algorithm. Currently, three -well-known types of R-trees may be created. - - -Linear - classic R-tree using splitting algorithm of linear complexity - -index::rtree< Value, index::linear<32, 8> > rt; - - - -Quadratic - classic R-tree using splitting algorithm of quadratic complexity - -index::rtree< Value, index::quadratic<32, 8> > rt; - - - -R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions - -index::rtree< Value, index::rstar<32, 8> > rt; - - - - -
    - -
    - -
    -Inserting and removing Values - -Create - -using namespace boost::geometry; -typedef std::pair<Box, int> Value; -index::rtree< Value, index::quadratic<32, 8> > rt; - -Insert and remove by method call - -Value v = std::make_pair(Box(...), 0); -rt.insert(v); -rt.remove(v); - -or by function call - -Value v = std::make_pair(Box(...), 0); -index::insert(rt, v); -index::remove(rt, v); - - -
    - -
    -Spatial queries - -
    -Basic queries - -There are three ways to perform a spatial query. Following queries returns -Values intersecting some box_region. - - -Method call - -std::vector<Value> returned_values; -Box box_region(...); -rt.query(box_region, std::back_inserter(returned_values)); - - - -Function call - -std::vector<Value> returned_values; -Box box_region(...); -index::query(rt, box_region, std::back_inserter(returned_values)); - - - -Use of operator | (as with ranges) - -Box box_region(...); -BOOST_FOREACH(Value &v, rt | index::query_filtered(box_region)) - ;// do something with v - - - - -
    - -
    -Spatial predicates - -It is possible to define other relations between queried Values 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)); // 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)); - -All predicates may be negated, e.g.: - -rt.query(index::not_intersects(box), std::back_inserter(result)); -// or -rt.query(!index::intersects(box), std::back_inserter(result)); -// the same as -rt.query(index::disjoint(box), std::back_inserter(result)); - -It's possible to use some number of predicates by passing std::pair<Pred1, Pred2> - -rt.query( - std::make_pair(index::intersects(box1), !index::within(box2)) - , std::back_inserter(result)); - -or boost::tuple<Pred1, Pred2, Pred3, ...> - -rt.query( - boost::make_tuple(index::intersects(box1), !index::within(box2), index::overlaps(box3)) - , std::back_inserter(result)); - -There is special predicate index::value(Fun) taking user-defined function/functor -which checks if Value should be returned by the query. - -bool fun(Value const& v) -{ - return v.is_red(); -} - -// ... - -rt.query( - boost::make_pair(index::intersects(box), index::value(fun)) - , std::back_inserter(result)); - - -
    - -
    - -
    -Nearest neighbors queries - -
    -k nearest neighbors - -There are three ways of performing knn queries. Following queries returns -k Values closest to some point in space. For Boxes -Indexables closest point of a Box is taken into -account by default. - - -Method call - -std::vector<Value> returned_values; -Point pt(...); -rt.nearest(pt, k, std::back_inserter(returned_values)); - - - -Function call - -std::vector<Value> returned_values; -Point pt(...); -index::nearest(rt, pt, k, std::back_inserter(returned_values)); - - - -Use of operator | - -Point pt(...); -BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k)) - ;// do something with v - - - - -
    - -
    -One nearest neighbor - -Another type of nearest neighbor query is searching for the one closest Value. -If it is found, 1 is returned by the method or function. This kind of query -has only two forms. - - -Method call - -Value returned_value; -Point pt(...); -size_t n = rt.nearest(pt, returned_value); - - - -Function call - -Value returned_value; -Point pt(...); -size_t n = index::nearest(rt, pt, returned_value); - - - - -
    - -
    -Distances predicates - -It is possible to define if calculated distance between query point and Value should be -greater, lesser or between some other distances. Those are called DistancesPredicates and -may be defined as follows. - -std::vector<Value> returned_values; -Point pt(...); - -/* default - without bounds */ -index::nearest(rt, pt, k, std::back_inserter(returned_values)); - -/* same as default */ -index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); - -/* distance must be greater than or equal to 10 */ -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); - -/* distance must be lesser than or equal to 500 */ -index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); - -/* distance must be between 10 and 500 */ -index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); - - - - - -Furthermore, it's possible to define if the closest, furthest or centroidal point of the -non-point Indexable should be taken into account in the routine calculating distance. - -std::vector<Value> returned_values; -Point pt(...); - -/* default - distance between Indexable's closest point and a query point -must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); - -/* same as default - distance between Indexable's closest point and a query point -must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); - -/* distance between Indexable's furthest point and a query point -must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); - -/* distance between Indexable's centroid and a query point -must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); - - - -
    - -
    -Using spatial predicates - -It is possible to use spatial predicates described before in nearest neighbors queries. - -Value returned_value; -std::vector<Value> returned_values; - -Point pt(...); -Box b(...); - -size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); - -size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); - -BOOST_FOREACH(Value &v, rt | index::nearest_filtered(pt, k, index::covered_by(b))) - ;// do something with v - - -
    - -
    - -
    - -
    diff --git a/doc/introduction.qbk b/doc/introduction.qbk new file mode 100644 index 000000000..cbb53fad2 --- /dev/null +++ b/doc/introduction.qbk @@ -0,0 +1,22 @@ +[/============================================================================ + Boost.Geometry Index (Spatial Indexes) + + Copyright (c) 2008 Federico J. Fernandez. + Copyright (c) 2011 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section Introduction] + +The __boost_geometry_index__ is intetended to gather containers +(spatial indexes) used for speeding spatial queries up. It is a part of the +__boost_geometry__ library. +In general, spatial indexes stores geometric objects' representations and +allows searching for objects occupying some space or close to some point in space. + +Currently, only one spatial index is implemented - __rtree__. + +[endsect] diff --git a/doc/rtree.qbk b/doc/rtree.qbk new file mode 100644 index 000000000..e449d7e34 --- /dev/null +++ b/doc/rtree.qbk @@ -0,0 +1,317 @@ +[/============================================================================ + Boost.Geometry Index (Spatial Indexes) + + Copyright (c) 2008 Federico J. Fernandez. + Copyright (c) 2011 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section R-tree] + +[section Introduction] + +__rtree__ is a self-balancing search tree with nodes stored with their axis aligned +bounding boxes. Each node's box describes 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 the node are user defined. + +In order to use the __rtree__ one must include folowing file. + + #include + +[endsect] + +[section R-tree creation] + +[section Quick start] + +In order to create a __rtree__ object storing values of type `std::pair<__box__, size_t>` +one may use the following code: + + using namespace __cboost__::__cgeometry__; + typedef std::pair<__box__, size_t> Value; + index::rtree< Value, index::quadratic<32, 8> > rt; + +[endsect] + +[section R-tree template parameters] + +__rtree__ has 4 parameters: + + rtree + +* `Value` - type of object which will be stored in the container. +* `Parameters` - compile-time parameters, e.g. inserting/splitting + algorithm with min and max nodes' elements numbers. +* `Translator` - type of object translating `Value` objects to + `Indexable` objects (`__point__` or `__box__`) which __rtree__ can handle. +* `Allocator` - the allocator. + +[endsect] + +[section Values, Indexables and default Translator] + +__rtree__ may store `__value__`s of any type as long as there is passed +the `__translator__` which knows how to interpret those `__value__`s +and extract an object understandable by the __rtree__. Those objects are called +`__indexable__`s and they are simply of type adapted to `__point__` +or `__box__` concept. Default `__translator__` `index::translator::def` +is able to handle `__point__`, `__box__`, `std::pair<...>`, pointer, iterator +or smart pointer. + +* `__indexable__ = __point__ | __box__` +* `BasicValue = Indexable | std::pair<__indexable__, T> | std::pair` +* `__value__ = BasicValue | BasicValue* | Iterator | SmartPtr` + +Examples of `__value__` types: + + geometry::model::point<...> + geometry::model::point_xy<...> + geometry::model::box<...> + std::pair, size_t> + +[endsect] + +[section Inserting and splitting algorithms] + +`__value__`s may be inserted to the __rtree__ in many various ways. Final structure of nodes depends +on algorithms used in the process, especially nodes' splitting algorithm. Currently, three +well-known types of R-trees may be created. + +Linear - classic __rtree__ using splitting algorithm of linear complexity + + index::rtree< __value__, index::linear<32, 8> > rt; + +Quadratic - classic __rtree__ using splitting algorithm of quadratic complexity + + index::rtree< __value__, index::quadratic<32, 8> > rt; + +R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions + + index::rtree< __value__, index::rstar<32, 8> > rt; + +[endsect] + +[endsect] [/ R-tree creation /] + +[section Inserting and removing Values] + +Create + + using namespace boost::geometry; + typedef std::pair __value__; + index::rtree< __value__, index::quadratic<32, 8> > rt; + +Insert and remove by method call + + __value__ v = std::make_pair(__box__(...), 0); + rt.insert(v); + rt.remove(v); + +or by function call + + __value__ v = std::make_pair(__box__(...), 0); + index::insert(rt, v); + index::remove(rt, v); + +[endsect] + +[section Spatial queries] + +[section Basic queries] + +There are three ways to perform a spatial query. Following queries returns +`__value__`s intersecting some box_region. + +Method call + + std::vector<__value__> returned_values; + __box__ box_region(...); + rt.query(box_region, std::back_inserter(returned_values)); + +Function call + + std::vector<__value__> returned_values; + __box__ box_region(...); + index::query(rt, box_region, std::back_inserter(returned_values)); + +Use of `operator |` (as with ranges) + + __box__ box_region(...); + BOOST_FOREACH(__value__ & v, rt | index::query_filtered(box_region)) + ; // do something with v +[endsect] + +[section Spatial predicates] + +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)); // 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)); + +All predicates may be negated, e.g.: + + rt.query(index::not_intersects(box), std::back_inserter(result)); + // or + rt.query(!index::intersects(box), std::back_inserter(result)); + // the same as + rt.query(index::disjoint(box), std::back_inserter(result)); + +It's possible to use some number of predicates by passing `std::pair` + + rt.query( + std::make_pair(index::intersects(box1), !index::within(box2)) + , std::back_inserter(result)); + +or `boost::tuple` + + rt.query( + boost::make_tuple( + index::intersects(box1), !index::within(box2), index::overlaps(box3)) + , std::back_inserter(result)); + +There is also a unique predicate `index::value(...)` taking user-defined function/functor +which checks if `__value__` should be returned by the query. + + bool fun(__value const& v) + { + return v.is_red(); + } + + // ... + + rt.query( + boost::make_pair(index::intersects(box), index::value(fun)) + , std::back_inserter(result)); + +[endsect] + +[endsect] [/ Spatial queries /] + +[section Nearest neighbors queries] + +[section k nearest neighbors] + +There are three ways of performing knn queries. Following queries returns +k `__value__`s closest to some point in space. For `__box__`es +`__indexable__`s closest point of a `__box__` is taken into account by default. + +Method call + + std::vector<__value__> returned_values; + __point__ pt(...); + rt.nearest(pt, k, std::back_inserter(returned_values)); + +Function call + + std::vector<__value__> returned_values; + __point__ pt(...); + index::nearest(rt, pt, k, std::back_inserter(returned_values)); + +Use of `operator |` + + __point__ pt(...); + BOOST_FOREACH(__value__ & v, rt | index::nearest_filtered(pt, k)) + ; // do something with v + +[endsect] + +[section One nearest neighbor] + +Another type of nearest neighbor query is searching for the one closest `__value__`. +If it is found, 1 is returned by the method or function. This kind of query +has only two forms. + +Method call + + __value__ returned_value; + __point__ pt(...); + size_t n = rt.nearest(pt, returned_value); + +Function call + + __value__ Value returned_value; + __point__ pt(...); + size_t n = index::nearest(rt, pt, returned_value); + +[endsect] + +[section Distances predicates] + +It is possible to define if calculated distance between query point and `__value__` should be +greater, lesser or between some other distances. Those are called `DistancesPredicate`s and +may be defined as follows. + + std::vector<__Value__> returned_values; + __point__ pt(...); + + /* default - without bounds */ + index::nearest(rt, pt, k, std::back_inserter(returned_values)); + + /* same as default */ + index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); + + /* distance must be greater than or equal to 10 */ + index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + + /* distance must be lesser than or equal to 500 */ + index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); + + /* distance must be between 10 and 500 */ + index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); + +Furthermore, it's possible to define if the closest, furthest or centroidal point of the +non-point `__Indexable__` should be taken into account in the routine calculating distance. + + std::vector<__value__> returned_values; + __point__ pt(...); + + /* default - distance between __indexable__'s closest point and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + + /* same as default - distance between __indexable__'s closest point and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); + + /* distance between __indexable__'s furthest point and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); + + /* distance between __indexable__'s centroid and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); + +[endsect] + +[section Using spatial predicates] + +It is possible to use spatial predicates described before in nearest neighbors queries. + + __value__ returned_value; + std::vector<__value__> returned_values; + + __point__ pt(...); + __box__ b(...); + + size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); + + size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); + + BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b))) + ; // do something with v + +[endsect] + +[endsect] [/ Nearest neighbors queries /] + +[endsect] [/ R-tree /] From 608241a9cc768ed1f1041a0bdc7f137484ead3c9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 30 Nov 2011 12:49:37 +0000 Subject: [PATCH 104/366] naming error fixed [SVN r75748] --- doc/html/geometry_index/r_tree.html | 8 ++++---- doc/html/index.html | 4 ++-- doc/rtree.qbk | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 655a08466..88c512551 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -444,19 +444,19 @@
    std::vector<Value> returned_values;
     Point pt(...);
     
    -/* default - distance between __indexable__'s closest point and a query point
    +/* default - distance between Indexable's closest point and a query point
     must be greater than 10 */
     index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
     
    -/* same as default - distance between __indexable__'s closest point and a query point
    +/* same as default - distance between Indexable's closest point and a query point
     must be greater than 10 */
     index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values));
     
    -/* distance between __indexable__'s furthest point and a query point
    +/* distance between Indexable's furthest point and a query point
     must be greater than 10 */
     index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values));
     
    -/* distance between __indexable__'s centroid and a query point
    +/* distance between Indexable's centroid and a query point
     must be greater than 10 */
     index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values));
     
    diff --git a/doc/html/index.html b/doc/html/index.html index e4aca4690..619b6272e 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -30,7 +30,7 @@
    -

    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    @@ -54,7 +54,7 @@
    - +

    Last revised: November 30, 2011 at 03:13:32 GMT

    Last revised: November 30, 2011 at 12:44:52 GMT


    diff --git a/doc/rtree.qbk b/doc/rtree.qbk index e449d7e34..ddd59445f 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -275,19 +275,19 @@ non-point `__Indexable__` should be taken into account in the routine calculatin std::vector<__value__> returned_values; __point__ pt(...); - /* default - distance between __indexable__'s closest point and a query point + /* default - distance between Indexable's closest point and a query point must be greater than 10 */ index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); - /* same as default - distance between __indexable__'s closest point and a query point + /* same as default - distance between Indexable's closest point and a query point must be greater than 10 */ index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); - /* distance between __indexable__'s furthest point and a query point + /* distance between Indexable's furthest point and a query point must be greater than 10 */ index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); - /* distance between __indexable__'s centroid and a query point + /* distance between Indexable's centroid and a query point must be greater than 10 */ index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); From 6079b53ff8f7b0f24be2260ddb665acbdb1b53f9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 30 Nov 2011 13:40:14 +0000 Subject: [PATCH 105/366] naming error fixed [SVN r75749] --- doc/html/geometry_index/r_tree.html | 4 ++-- doc/html/index.html | 4 ++-- doc/rtree.qbk | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 88c512551..1984cacc1 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -438,8 +438,8 @@

    Furthermore, it's possible to define if the closest, furthest or centroidal - point of the non-point __Indexable__ - should be taken into account in the routine calculating distance. + point of the non-point Indexable should be taken into account + in the routine calculating distance.

    std::vector<Value> returned_values;
     Point pt(...);
    diff --git a/doc/html/index.html b/doc/html/index.html
    index 619b6272e..74bcd3da9 100644
    --- a/doc/html/index.html
    +++ b/doc/html/index.html
    @@ -30,7 +30,7 @@
     
     
    -

    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    @@ -54,7 +54,7 @@
    - +

    Last revised: November 30, 2011 at 12:44:52 GMT

    Last revised: November 30, 2011 at 13:38:40 GMT


    diff --git a/doc/rtree.qbk b/doc/rtree.qbk index ddd59445f..69049b17c 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -270,7 +270,7 @@ may be defined as follows. index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); Furthermore, it's possible to define if the closest, furthest or centroidal point of the -non-point `__Indexable__` should be taken into account in the routine calculating distance. +non-point `__indexable__` should be taken into account in the routine calculating distance. std::vector<__value__> returned_values; __point__ pt(...); From dc4a922a0f089b3957952cb2b7990367815e8c5e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 2 Dec 2011 14:16:43 +0000 Subject: [PATCH 106/366] Reference to temporary - error fixed. [SVN r75771] --- .../index/rtree/node/node_default.hpp | 4 +- .../geometry/extensions/index/rtree/rtree.hpp | 2 +- .../index/rtree/visitors/nearest.hpp | 25 +++++-- .../extensions/index/translator/def.hpp | 16 ++--- .../extensions/index/translator/getter.hpp | 36 ---------- .../extensions/index/translator/index.hpp | 4 +- .../index/translator/translator.hpp | 15 ++++- tests/additional_glut_vis.cpp | 31 ++++++--- tests/rtree_function.hpp | 2 +- tests/t1.cpp | 45 +++++++++++++ tests/t2.cpp | 66 +++++++++++++++++++ tests/translators.hpp | 5 -- 12 files changed, 180 insertions(+), 71 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/translator/getter.hpp create mode 100644 tests/t1.cpp create mode 100644 tests/t2.cpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index a7f01533e..0360aaf29 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -147,7 +147,7 @@ inline void apply_visitor(Visitor &v, Visitable & n) template struct element_indexable_type { - typedef typename Translator::indexable_type type; + typedef typename translator::indexable_type::type type; }; template @@ -162,7 +162,7 @@ struct element_indexable_type< // element's indexable getter template -inline typename Translator::indexable_type const& +inline typename Translator::result_type element_indexable(Value const& el, Translator const& tr) { return tr(el); diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 51e0d000d..a76e5ded7 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -73,7 +73,7 @@ class rtree public: typedef Value value_type; typedef Translator translator_type; - typedef typename translator_type::indexable_type indexable_type; + typedef typename translator::indexable_type::type indexable_type; typedef typename index::default_box_type::type box_type; typedef typename detail::rtree::options_type::type options_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 913653619..abbf33676 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -13,6 +13,7 @@ #include #include +#include namespace boost { namespace geometry { namespace index { @@ -26,8 +27,10 @@ template struct nearest_one { public: - typedef typename Translator::indexable_type indexable_type; - typedef typename geometry::default_distance_result::type distance_type; + typedef typename geometry::default_distance_result< + Point, + typename translator::indexable_type::type + >::type distance_type; inline nearest_one() : m_comp_dist(std::numeric_limits::max()) @@ -67,8 +70,10 @@ template struct nearest_k { public: - typedef typename Translator::indexable_type indexable_type; - typedef typename geometry::default_distance_result::type distance_type; + typedef typename geometry::default_distance_result< + Point, + typename translator::indexable_type::type + >::type distance_type; inline explicit nearest_k(size_t k) : m_count(k) @@ -159,9 +164,17 @@ public: typedef typename node_distances_calc::result_type node_distances_type; typedef index::detail::distances_predicates_check node_distances_predicates_check; - typedef index::detail::distances_calc value_distances_calc; + typedef index::detail::distances_calc< + DistancesPredicates, + typename translator::indexable_type::type, + rtree::value_tag + > value_distances_calc; typedef typename value_distances_calc::result_type value_distances_type; - typedef index::detail::distances_predicates_check value_distances_predicates_check; + typedef index::detail::distances_predicates_check< + DistancesPredicates, + typename translator::indexable_type::type, + rtree::value_tag + > value_distances_predicates_check; inline nearest(Translator const& t, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r) : m_tr(t), m_dist_pred(dist_pred), m_pred(pred) diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index e3c9cfcae..673b7cf60 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -22,9 +22,9 @@ namespace dispatch { template struct def { - typedef typename detail::extract_indexable::type indexable_type; + typedef typename detail::extract_indexable::type const& result_type; - indexable_type const& operator()(Value const& v) const + result_type operator()(Value const& v) const { return detail::extract_indexable::get(v); } @@ -39,9 +39,9 @@ struct def template struct def { - typedef typename detail::extract_indexable::type indexable_type; + typedef typename detail::extract_indexable::type const& result_type; - indexable_type const& operator()(Value const& v) const + result_type operator()(Value const& v) const { return detail::extract_indexable::get(*v); } @@ -56,9 +56,9 @@ struct def template struct def { - typedef typename detail::extract_indexable::type indexable_type; + typedef typename detail::extract_indexable::type const& result_type; - indexable_type const& operator()(Value const& v) const + result_type operator()(Value const& v) const { return detail::extract_indexable::get(*v); } @@ -85,9 +85,9 @@ struct def template struct def { - typedef typename detail::extract_indexable::type indexable_type; + typedef typename detail::extract_indexable::type const& result_type; - indexable_type const& operator()(const Value *v) const + result_type operator()(const Value *v) const { return detail::extract_indexable::get(*v); } diff --git a/include/boost/geometry/extensions/index/translator/getter.hpp b/include/boost/geometry/extensions/index/translator/getter.hpp deleted file mode 100644 index 702b2779c..000000000 --- a/include/boost/geometry/extensions/index/translator/getter.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - value to bounding object translation as a getter (object's member function) -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_GETTER_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_GETTER_HPP - -namespace boost { namespace geometry { namespace index { namespace translator { - -template -struct getter -{ - typedef Indexable indexable_type; - - indexable_type const& operator()(Value const& v) const - { - return (v.*Getter)(); - } - - bool equals(Value const& v1, Value const& v2) const - { - //return geometry::equals(operator()(v1), operator()(v2)); - return v1 == v2; - } -}; - -// TODO: awulkiew - implement specialization for Value* ? - -}}}} // namespace boost::geometry::index::translator - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_GETTER_HPP diff --git a/include/boost/geometry/extensions/index/translator/index.hpp b/include/boost/geometry/extensions/index/translator/index.hpp index f96d0d433..242073417 100644 --- a/include/boost/geometry/extensions/index/translator/index.hpp +++ b/include/boost/geometry/extensions/index/translator/index.hpp @@ -19,11 +19,11 @@ class index { public: typedef typename detail::extract_indexable - ::type indexable_type; + ::type const& result_type; explicit index(Container const& c) : m_c(c) {} - indexable_type const& operator()(size_t i) const + result_type operator()(size_t i) const { return detail::extract_indexable ::get(m_c[i]); diff --git a/include/boost/geometry/extensions/index/translator/translator.hpp b/include/boost/geometry/extensions/index/translator/translator.hpp index 349e394f1..6a8654606 100644 --- a/include/boost/geometry/extensions/index/translator/translator.hpp +++ b/include/boost/geometry/extensions/index/translator/translator.hpp @@ -12,6 +12,19 @@ #include #include -#include + +namespace boost { namespace geometry { namespace index { namespace translator { + +template +struct indexable_type +{ + typedef typename boost::remove_const< + typename boost::remove_reference< + typename Translator::result_type + >::type + >::type type; +}; + +}}}} // namespace boost::geometry::index::translator #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_TRANSLATOR_HPP diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index eb540c93a..cd8eb5cc7 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -38,7 +38,7 @@ std::vector nearest_boxes; B search_box; enum query_mode_type { - qm_knn, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw + qm_knn, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw, qm_all } query_mode = qm_knn; bool search_valid = false; @@ -78,14 +78,23 @@ void knn() template void query() { - float x = ( rand() % 1000 ) / 10.0f; - float y = ( rand() % 1000 ) / 10.0f; - float w = 10 + ( rand() % 1000 ) / 100.0f; - float h = 10 + ( rand() % 1000 ) / 100.0f; + if ( query_mode != qm_all ) + { + float x = ( rand() % 1000 ) / 10.0f; + float y = ( rand() % 1000 ) / 10.0f; + float w = 10 + ( rand() % 1000 ) / 100.0f; + float h = 10 + ( rand() % 1000 ) / 100.0f; - search_box = B(P(x - w, y - h), P(x + w, y + h)); - nearest_boxes.clear(); - found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) ); + 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) ); + } + else + { + search_box = t.box(); + nearest_boxes.clear(); + found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) ); + } if ( found_count > 0 ) { @@ -99,7 +108,7 @@ void query() } } else - std::cout << "nearest not found\n"; + std::cout << "boxes not found\n"; } void search() @@ -126,6 +135,8 @@ void search() query< bgi::detail::not_overlaps >(); else if ( query_mode == qm_nw ) query< bgi::detail::not_within >(); + else if ( query_mode == qm_all ) + query< bgi::detail::intersects >(); search_valid = true; } @@ -305,6 +316,8 @@ void keyboard(unsigned char key, int x, int y) query_mode = qm_no; else if ( current_line == "nw" ) query_mode = qm_nw; + else if ( current_line == "all" ) + query_mode = qm_all; search(); glutPostRedisplay(); diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index 0d73289e4..a9e442aab 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -159,7 +159,7 @@ bool nearest_results_compare(Point const& p, Cont const& c1, Cont const& c2, Tra namespace bg = boost::geometry; namespace bgi = boost::geometry::index; - typedef typename Translator::indexable_type indexable_type; + typedef typename bgi::translator::indexable_type::type indexable_type; typedef bg::default_distance_result::type distance_type; if ( c1.size() != c2.size() ) diff --git a/tests/t1.cpp b/tests/t1.cpp new file mode 100644 index 000000000..4ad96e2e6 --- /dev/null +++ b/tests/t1.cpp @@ -0,0 +1,45 @@ +#include +#include + +#include + +namespace bg = boost::geometry; +namespace bgi = bg::index; + +typedef bg::model::point P; +typedef bg::model::box

    B; +typedef bgi::rtree< + B, + bgi::linear<4, 2> +> RTB; +typedef bgi::rtree< + P, + bgi::linear<4, 2> +> RTP; + +int main() +{ + RTB rtb; + rtb.insert(B(P(0,0),P(1,1))); + rtb.insert(B(P(1,0),P(2,1))); + rtb.insert(B(P(2,0),P(3,1))); + rtb.insert(B(P(2,2),P(3,3))); + rtb.insert(B(P(4,4),P(5,5))); + + std::vector res; + B bb = rtb.box(); + rtb.query(bb, std::back_inserter(res)); + + RTP rtp; + rtp.insert(P(0,0)); + rtp.insert(P(1,0)); + rtp.insert(P(2,0)); + rtp.insert(P(2,2)); + rtp.insert(P(4,4)); + + std::vector

    resp; + B bp = rtp.box(); + rtp.query(bp, std::back_inserter(resp)); + + int a = 10; +} diff --git a/tests/t2.cpp b/tests/t2.cpp new file mode 100644 index 000000000..e0eab887c --- /dev/null +++ b/tests/t2.cpp @@ -0,0 +1,66 @@ + +#include +#include + +#include +#include + +#include + + +typedef boost::geometry::model::point + BGCartesianPoint; +typedef boost::geometry::model::box + BGCartesianBox; +typedef boost::geometry::model::segment + BGCartesianSegment; +namespace bgi = boost::geometry::index; + + +struct myTranslator +{ + typedef BGCartesianBox result_type; + + result_type operator()(BGCartesianPoint const& seg) const + { + result_type envelope; + boost::geometry::envelope(seg, envelope); + return envelope; + } + + bool equals(BGCartesianPoint const& go1, BGCartesianPoint const& go2) const + { + return (go1.get<0>() == go2.get<0>()) && + (go1.get<1>() == go2.get<1>()); + } +}; + +typedef bgi::rtree + , + myTranslator> + BGRTree; + +int main() +{ + BGRTree rTree; + for (int i = 0; i < 50; ++i) + { + BGCartesianPoint p(i, i); + rTree.insert(p); + + BGCartesianBox envelope(BGCartesianPoint(i-0.5, i-0.5), + BGCartesianPoint(i+0.5, i+0.5)); + + std::deque dq; + + if (rTree.query(envelope, std::back_inserter(dq))) + std::cout << "Retrieved inserted object nr. " << i << "\n"; + else + std::cout << "Could not retrieve inserted object nr. " << i << "\n"; + } + + std::cout << "Total objects: " << rTree.size(); + std::cin.get(); + return 0; +} \ No newline at end of file diff --git a/tests/translators.hpp b/tests/translators.hpp index 827b59aff..133da68ec 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -95,11 +95,6 @@ BOOST_AUTO_TEST_CASE(tests_translators) BOOST_CHECK( bg::equals(tmp_b, ppb(tmp_ppb)) ); BOOST_CHECK( bg::equals(tmp_b, pbp(tmp_pbp)) ); - - tests_translators_val

    val_p(tmp_p); - bgit::getter, P, &tests_translators_val

    ::get_box> tr_get_p; - - BOOST_CHECK( bg::equals(tmp_p, tr_get_p(val_p)) ); } #endif // TESTS_TRANSLATORS_HPP From 7352afd5d90cfbd179cb2840f3ccfd06b5fa6348 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 8 Mar 2012 22:15:06 +0000 Subject: [PATCH 107/366] R-tree methods and functions documented. rtree::nearest() template parameter name changed. [SVN r77277] --- .../extensions/index/rtree/kmeans/split.hpp | 5 +- .../geometry/extensions/index/rtree/rtree.hpp | 301 ++++++++++++++++-- 2 files changed, 277 insertions(+), 29 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp b/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp index 0c87a947e..0f1842f25 100644 --- a/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp @@ -1,9 +1,8 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // -// Boost.Index - R-tree linear split algorithm implementation +// Boost.Index - R-tree kmeans split algorithm implementation // -// Copyright 2008 Federico J. Fernandez. -// Copyright 2011 Adam Wulkiewicz. +// Copyright 2011, 2012 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index a76e5ded7..715641849 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -3,7 +3,7 @@ // Boost.Index - R-tree implementation // // Copyright 2008 Federico J. Fernandez. -// Copyright 2011 Adam Wulkiewicz. +// Copyright 2011, 2012 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -44,24 +44,14 @@ namespace boost { namespace geometry { namespace index { -// TODO move extensional/debug visitors to the other folder -// move gldraw indexable (+ value with translator) to geometry::index namespace - -// TODO: awulkiew - implement iterators ? - -// TODO: allow copying of a tree with different template parameters? e.g. Parameters, Translator? - -// TODO: should funcions like empty(tree) clear(tree) box(tree) be free functions? -// change name of empty predicate generator - empty()? - -// TODO which types should be public and which one should be private? -// nodes, options etc. probably shouldn't be public - -// TODO change remove() to erase() or just add erase() ? -// erase works on iterators of this container so this may be confusing with remove(ValIt, ValIt) - -// bgi::near and bgi::far conflicts with WINDOWS macros!!! +/*! +The R-tree spatial index. +\tparam Value The type of objects stored in the container. +\tparam Parameters Compile-time parameters. +\tparam Translator The type of the translator. +\tparam Allocator The allocator. +*/ template < typename Value, typename Parameters, @@ -87,6 +77,12 @@ public: typedef typename detail::rtree::internal_node::type internal_node; typedef typename detail::rtree::leaf::type leaf; + /*! + The constructor. + + \param translator The translator object. + \param allocator The allocator object. + */ inline explicit rtree(translator_type const& translator = translator_type(), Allocator allocator = Allocator()) : m_values_count(0) , m_root(0) @@ -97,6 +93,14 @@ public: create(); } + /*! + The constructor. + + \param first The beginning of the range of Values. + \param last The end of the range of Values. + \param translator The translator object. + \param allocator The allocator object. + */ template inline explicit rtree(Iterator first, Iterator last, translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) : m_values_count(0) @@ -108,11 +112,17 @@ public: insert(first, last); } + /*! + The destructor. + */ inline ~rtree() { destroy(*this); } + /*! + The copy constructor. + */ inline rtree(rtree const& src) : m_allocators(src.m_allocators) { @@ -127,6 +137,9 @@ public: } } + /*! + The assignment operator. + */ inline rtree & operator=(rtree const& src) { if ( &src == this ) @@ -149,6 +162,11 @@ public: return *this; } + /*! + Insert a value to the index. + + \param value The value which will be stored in the container. + */ inline void insert(value_type const& value) { BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); @@ -176,6 +194,12 @@ public: } } + /*! + Insert a range of values to the index. + + \param first The beginning of the range of values. + \param last The end of the range of values. + */ template inline void insert(Iterator first, Iterator last) { @@ -183,6 +207,11 @@ public: insert(*first); } + /*! + Remove the value from the container. + + \param value The value which will be removed from the container. + */ inline void remove(value_type const& value) { // TODO: awulkiew - assert for correct value (indexable) ? @@ -210,6 +239,12 @@ public: } } + /*! + Remove the range of values from the container. + + \param first The beginning of the range of values. + \param last The end of the range of values. + */ template inline void remove(Iterator first, Iterator last) { @@ -217,6 +252,14 @@ public: remove(*first); } + /*! + Find values meeting spatial predicates, e.g. intersecting some box. + + \param pred The spatial predicates. + \param out_it The output iterator of the result range. E.g. a back_insert_iterator. + + \return The number of values found. + */ template inline size_type query(Predicates const& pred, OutIter out_it) const { @@ -228,46 +271,104 @@ public: return find_v.found_count; } - template - inline size_type nearest(DistancePredicate const& dpred, value_type & v) const + /*! + Find one value meeting distances predicates, e.g. nearest to some point. + + \param dpred The distances predicates. + \param v The reference to the object which will contain the result. + + \return The number of values found. + */ + template + inline size_type nearest(DistancesPredicates const& dpred, value_type & v) const { return nearest_one(dpred, detail::empty(), v); } - template - inline size_type nearest(DistancePredicate const& dpred, Predicates const& pred, value_type & v) const + /*! + Find one value meeting distances predicates and spatial predicates, + e.g. nearest to some point and intersecting some box. + + \param dpred The distances predicates. + \param pred The spatial predicates. + \param v The reference to the object which will contain the result. + + \return The number of values found. + */ + template + inline size_type nearest(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { return nearest_one(dpred, pred, v); } - template - inline size_type nearest(DistancePredicate const& dpred, size_t k, OutIter out_it) const + /*! + Find k values meeting distances predicates, e.g. k nearest values to some point. + + \param dpred The distance predicate. + \param k The max number of values. + \param out_it The output iterator of the result range. E.g. a back_insert_iterator. + + \return The number of values found. + */ + template + inline size_type nearest(DistancesPredicates const& dpred, size_t k, OutIter out_it) const { return nearest_k(dpred, k, detail::empty(), out_it); } - template - inline size_type nearest(DistancePredicate const& dpred, size_t k, Predicates const& pred, OutIter out_it) const + /*! + Find k values meeting distances predicates and spatial predicates, + e.g. k nearest values to some point and intersecting some box. + + \param dpred The distances predicates. + \param k The max number of values. + \param pred The spatial predicates. + \param out_it The output iterator of the result range. E.g. a back_insert_iterator. + + \return The number of values found. + */ + template + inline size_type nearest(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { return nearest_k(dpred, k, pred, out_it); } + /*! + Returns the number of stored values. + + \return The number of stored values. + */ inline size_type size() const { return m_values_count; } + /*! + Query if the container is empty. + + \return true if the container is empty. + */ inline bool empty() const { return 0 == m_values_count; } + /*! + Removes all values stored in the container. + */ inline void clear() { destroy(*this); create(); } + /*! + Returns the box containing all values stored in the container. + If the container is empty the result of geometry::assign_inverse() is returned. + + \return The box containing all values stored in the container or an invalid box if + there are no values in the container. + */ inline box_type box() const { if ( empty() ) @@ -285,35 +386,70 @@ public: return children_box_v.result; } + /*! + Apply a visitor to the nodes structure in order to perform some operator. + This function is not a part of the 'official' interface. However it makes + possible to e.g. draw the tree structure. + + \param visitor The visitor object. + */ template inline void apply_visitor(Visitor & visitor) const { detail::rtree::apply_visitor(visitor, *m_root); } + /*! + Returns the translator object. + This function is not a part of the 'official' interface. + + \return The translator object. + */ inline translator_type const& translator() const { return m_translator; } + /*! + Returns the number of stored objects. Same as size() + This function is not a part of the 'official' interface. + + \return The number of stored objects. + */ inline size_type values_count() const { return m_values_count; } + /*! + Returns the depth of the R-tree. + This function is not a part of the 'official' interface. + + \return The depth of the R-tree. + */ inline size_type depth() const { return m_leafs_level; } private: + /*! + Create an empty R-tree i.e. new empty root node and clear other attributes. + */ inline void create() { + assert(0 == m_root); + m_root = detail::rtree::create_node::apply(m_allocators); m_values_count = 0; m_leafs_level = 0; } + /*! + Destroy the R-tree i.e. all nodes and clear attributes. + + \param t The container which is going to be destroyed. + */ inline void destroy(rtree & t) { detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); @@ -324,6 +460,12 @@ private: t.m_leafs_level = 0; } + /*! + Copy the R-tree i.e. whole nodes structure, values and other attributes. + + \param src The source R-tree. + \param dst The destination R-tree. + */ inline void copy(rtree const& src, rtree & dst) const { //dst.m_allocators = src.m_allocators; @@ -337,6 +479,9 @@ private: dst.m_translator = src.m_translator; } + /*! + Find one value meeting distances and spatial predicates. + */ template inline size_type nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { @@ -367,6 +512,9 @@ private: return result.get(v); } + /*! + Find k values meeting distances and spatial predicates. + */ template inline size_type nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { @@ -404,78 +552,179 @@ private: allocators_type m_allocators; }; +/*! +Insert a value to the index. + +\param tree The spatial index. +\param v The value which will be stored in the index. +*/ template inline void insert(rtree & tree, Value const& v) { tree.insert(v); } +/*! +Insert a range of values to the index. + +\param tree The spatial index. +\param first The beginning of the range of values. +\param last The end of the range of values. +*/ template inline void insert(rtree & tree, Iterator first, Iterator last) { tree.insert(first, last); } +/*! +Remove a value from the index. + +\param tree The spatial index. +\param v The value which will be removed from the index. +*/ template inline void remove(rtree & tree, Value const& v) { tree.remove(v); } +/*! +Remove a range of values from the index. + +\param tree The spatial index. +\param first The beginning of the range of values. +\param last The end of the range of values. +*/ template inline void remove(rtree & tree, Iterator first, Iterator last) { tree.remove(first, last); } +/*! +Find values meeting spatial predicates. + +\param tree The spatial index. +\param pred The spatial predicates. +\param out_it The output iterator of the result range. + +\return The number of found values. +*/ template inline size_t query(rtree const& tree, Predicates const& pred, OutIter out_it) { return tree.query(pred, out_it); } +/*! +Find the value meeting distances predicates. + +\param tree The spatial index. +\param dpred The distances predicates. +\param v The result. + +\return The number of found values. +*/ template inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Value & v) { return tree.nearest(dpred, v); } +/*! +Find the value meeting distances and spatial predicates. + +\param tree The spatial index. +\param dpred The distances predicates. +\param pred The spatial predicates. +\param v The result. + +\return The number of found values. +*/ template inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v) { return tree.nearest(dpred, pred, v); } +/*! +Find k values meeting distances predicates. + +\param tree The spatial index. +\param dpred The distances predicates. +\param k The max number of values. +\param out_it The output iterator of the result range. + +\return The number of found values. +*/ template inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, OutIter out_it) { return tree.nearest(dpred, k, out_it); } +/*! +Find k values meeting distances and spatial predicates. + +\param tree The spatial index. +\param dpred The distances predicates. +\param k The max number of values. +\param pred The spatial predicates. +\param out_it The output iterator of the result range. + +\return The number of found values. +*/ template inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) { return tree.nearest(dpred, k, pred, out_it); } +/*! +Remove all values from the index. + +\param tree The spatial index. +*/ template inline void clear(rtree & tree) { return tree.clear(); } +/*! +Get the number of values stored in the index. + +\param tree The spatial index. + +\return The number of values stored in the index. +*/ template inline size_t size(rtree const& tree) { return tree.size(); } +/*! +Query if there are no values stored in the index. + +\param tree The spatial index. + +\return true if there are no values in the index. +*/ template inline bool empty(rtree const& tree) { return tree.empty(); } +/*! +Get the box containing all stored values or an invalid box if the index has no values. + +\param tree The spatial index. + +\return The box containing all stored values or an invalid box. +*/ template inline typename rtree::box_type box(rtree const& tree) From 3de87192fa2fd53badc0833b2314875d1186bcc1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 15 Apr 2012 01:46:20 +0000 Subject: [PATCH 108/366] size_t changed to Container::size_type in translator::index [SVN r77982] --- .../boost/geometry/extensions/index/translator/index.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/extensions/index/translator/index.hpp b/include/boost/geometry/extensions/index/translator/index.hpp index 242073417..73116c564 100644 --- a/include/boost/geometry/extensions/index/translator/index.hpp +++ b/include/boost/geometry/extensions/index/translator/index.hpp @@ -17,19 +17,21 @@ namespace boost { namespace geometry { namespace index { namespace translator { template class index { + typedef typename Container::size_type size_type; + public: typedef typename detail::extract_indexable ::type const& result_type; explicit index(Container const& c) : m_c(c) {} - result_type operator()(size_t i) const + result_type operator()(size_type i) const { return detail::extract_indexable ::get(m_c[i]); } - bool equals(size_t i1, size_t i2) const + bool equals(size_type i1, size_type i2) const { return i1 == i2; } From 31c5e016e74067331a6353195a65cfaf2e1bfedc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 25 Jun 2012 19:00:24 +0000 Subject: [PATCH 109/366] added tests of some index's algorithms + index::margin() optimization. [SVN r79090] --- .../extensions/index/algorithms/margin.hpp | 6 +- test/Jamfile.v2 | 27 +++ test/algorithms/Jamfile.v2 | 17 ++ test/algorithms/content.cpp | 77 +++++++++ test/algorithms/is_valid.cpp | 102 +++++++++++ test/algorithms/margin.cpp | 72 ++++++++ test/algorithms/test_content.hpp | 50 ++++++ test/algorithms/test_margin.hpp | 49 ++++++ test/geometry_index_test_common.hpp | 25 +++ test/geometry_test_common.hpp | 162 ++++++++++++++++++ 10 files changed, 584 insertions(+), 3 deletions(-) create mode 100644 test/Jamfile.v2 create mode 100644 test/algorithms/Jamfile.v2 create mode 100644 test/algorithms/content.cpp create mode 100644 test/algorithms/is_valid.cpp create mode 100644 test/algorithms/margin.cpp create mode 100644 test/algorithms/test_content.hpp create mode 100644 test/algorithms/test_margin.hpp create mode 100644 test/geometry_index_test_common.hpp create mode 100644 test/geometry_test_common.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/margin.hpp b/include/boost/geometry/extensions/index/algorithms/margin.hpp index ea235e9c9..a86d15811 100644 --- a/include/boost/geometry/extensions/index/algorithms/margin.hpp +++ b/include/boost/geometry/extensions/index/algorithms/margin.hpp @@ -76,7 +76,7 @@ struct margin_for_each_dimension static inline typename default_margin_result::type apply(Box const& b) { return margin_for_each_dimension::apply(b) + - 2 * margin_for_each_edge::value>::apply(b); + margin_for_each_edge::value>::apply(b); } }; @@ -85,7 +85,7 @@ struct margin_for_each_dimension { static inline typename default_margin_result::type apply(Box const& b) { - return 2 * margin_for_each_edge::value>::apply(b); + return margin_for_each_edge::value>::apply(b); } }; @@ -94,7 +94,7 @@ struct margin_for_each_dimension template typename default_margin_result::type margin(Box const& b) { - return detail::margin_for_each_dimension::value>::apply(b); + return 2 * detail::margin_for_each_dimension::value>::apply(b); } }}} // namespace boost::geometry::index diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 new file mode 100644 index 000000000..6760caf7d --- /dev/null +++ b/test/Jamfile.v2 @@ -0,0 +1,27 @@ +# Boost.Geometry (aka GGL, Generic Geometry Library) +# +# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +# Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import testing ; + +project boost-geometry-index-test + : + requirements + . + .. + ../.. + ../../.. + #../../../boost/geometry/extensions/contrib/ttmath + msvc:on + ; + +build-project algorithms ; +#build-project rtree ; +#build-project filters ; +#build-project translator ; diff --git a/test/algorithms/Jamfile.v2 b/test/algorithms/Jamfile.v2 new file mode 100644 index 000000000..6da7d6901 --- /dev/null +++ b/test/algorithms/Jamfile.v2 @@ -0,0 +1,17 @@ +# Boost.Geometry (aka GGL, Generic Geometry Library) +# +# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +# Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +test-suite boost-geometry-index-algorithms + : + [ run content.cpp ] + [ run is_valid.cpp ] + [ run margin.cpp ] + ; + diff --git a/test/algorithms/content.cpp b/test/algorithms/content.cpp new file mode 100644 index 000000000..b6d01d8cf --- /dev/null +++ b/test/algorithms/content.cpp @@ -0,0 +1,77 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + + +#include + +#include +#include +#include + +//#define GEOMETRY_TEST_DEBUG + +void test_large_integers() +{ + typedef bg::model::point int_point_type; + typedef bg::model::point double_point_type; + + bg::model::box int_box; + bg::model::box double_box; + + std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))"; + bg::read_wkt(box_li, int_box); + bg::read_wkt(box_li, double_box); + + double int_value = bgi::content(int_box); + double double_value = bgi::content(double_box); + + BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_content(P2ic(0, 0), 0); + test_content(P2fc(0, 0), 0); + test_content(P2dc(0, 0), 0); + test_content(P3ic(0, 0, 0), 0); + test_content(P3fc(0, 0, 0), 0); + test_content(P3dc(0, 0, 0), 0); + + test_geometry >("POLYGON((0 1,2 4))", 6.0); + test_geometry >("POLYGON((0 1,2 4))", 6.0); + test_geometry >("POLYGON((0 1,2 4))", 6.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", 24.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", 24.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", 24.0); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + typedef bg::model::point P3ttmc; + + test_geometry >("POLYGON((0 1,2 4))", 6.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", 24.0); +#endif + + test_large_integers(); + + return 0; +} diff --git a/test/algorithms/is_valid.cpp b/test/algorithms/is_valid.cpp new file mode 100644 index 000000000..4b339c527 --- /dev/null +++ b/test/algorithms/is_valid.cpp @@ -0,0 +1,102 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +#include + +#include +#include +#include + +//#define GEOMETRY_TEST_DEBUG + +template +void test(Geometry const& geometry, bool expected_value) +{ + BOOST_CHECK(bgi::is_valid(geometry) == expected_value); +} + +template +void test_box(std::string const& wkt, bool expected_value) +{ + Box box; + bg::read_wkt(wkt, box); + test(box, expected_value); + typename bg::point_type::type temp_pt; + temp_pt = box.min_corner(); + box.min_corner() = box.max_corner(); + box.max_corner() = temp_pt; + test(box, !expected_value); +} + +void test_large_integers() +{ + typedef bg::model::point int_point_type; + typedef bg::model::point double_point_type; + + bg::model::box int_box; + bg::model::box double_box; + + std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))"; + bg::read_wkt(box_li, int_box); + bg::read_wkt(box_li, double_box); + + BOOST_CHECK(bgi::is_valid(int_box) == bgi::is_valid(double_box)); + + std::string const box_li2 = "POLYGON((1872000 528000, 1536119 192000))"; + bg::read_wkt(box_li2, int_box); + bg::read_wkt(box_li2, double_box); + + BOOST_CHECK(bgi::is_valid(int_box) == bgi::is_valid(double_box)); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test(P2ic(0, 0), true); + test(P2fc(0, 0), true); + test(P2dc(0, 0), true); + test(P3ic(0, 0, 0), true); + test(P3fc(0, 0, 0), true); + test(P3dc(0, 0, 0), true); + + test_box >("POLYGON((0 1,2 4))", true); + test_box >("POLYGON((0 1,2 4))", true); + test_box >("POLYGON((0 1,2 4))", true); + test_box >("POLYGON((0 1 2,2 4 6))", true); + test_box >("POLYGON((0 1 2,2 4 6))", true); + test_box >("POLYGON((0 1 2,2 4 6))", true); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + typedef bg::model::point P3ttmc; + + test_geometry >("POLYGON((0 1,2 4))", true); + test_geometry >("POLYGON((0 1 2,2 4 6))", true); +#endif + + test_large_integers(); + + return 0; +} diff --git a/test/algorithms/margin.cpp b/test/algorithms/margin.cpp new file mode 100644 index 000000000..6a825b458 --- /dev/null +++ b/test/algorithms/margin.cpp @@ -0,0 +1,72 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + + +#include + +#include +#include +#include + +//#define GEOMETRY_TEST_DEBUG + +void test_large_integers() +{ + typedef bg::model::point int_point_type; + typedef bg::model::point double_point_type; + + bg::model::box int_box; + bg::model::box double_box; + + std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))"; + bg::read_wkt(box_li, int_box); + bg::read_wkt(box_li, double_box); + + double int_value = bgi::margin(int_box); + double double_value = bgi::margin(double_box); + + BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_geometry >("POLYGON((0 1,2 4))", 10.0); + test_geometry >("POLYGON((0 1,2 4))", 10.0); + test_geometry >("POLYGON((0 1,2 4))", 10.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", 52); + test_geometry >("POLYGON((0 1 2,2 4 6))", 52.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", 52.0); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + typedef bg::model::point P3ttmc; + + test_geometry >("POLYGON((0 1,2 4))", 10.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", 52.0); +#endif + + test_large_integers(); + + // test_empty_input >(); + + return 0; +} diff --git a/test/algorithms/test_content.hpp b/test/algorithms/test_content.hpp new file mode 100644 index 000000000..42143d575 --- /dev/null +++ b/test/algorithms/test_content.hpp @@ -0,0 +1,50 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_CONTENT_HPP + +#include + +#include + +//#include + + +template +void test_content(Geometry const& geometry, + typename bgi::default_content_result::type expected_value) +{ + typename bgi::default_content_result::type value = bgi::content(geometry); + +#ifdef GEOMETRY_TEST_DEBUG + std::ostringstream out; + out << typeid(typename bg::coordinate_type::type).name() + << " " + << typeid(typename bgi::default_content_result::type).name() + << " " + << "content : " << value + << std::endl; + std::cout << out.str(); +#endif + + BOOST_CHECK_CLOSE(value, expected_value, 0.0001); +} + +template +void test_geometry(std::string const& wkt, + typename bgi::default_content_result::type expected_value) +{ + Geometry geometry; + bg::read_wkt(wkt, geometry); + test_content(geometry, expected_value); +} + +#endif diff --git a/test/algorithms/test_margin.hpp b/test/algorithms/test_margin.hpp new file mode 100644 index 000000000..318478221 --- /dev/null +++ b/test/algorithms/test_margin.hpp @@ -0,0 +1,49 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_MARGIN_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_MARGIN_HPP + +#include + +#include + +//#include + +template +void test_margin(Geometry const& geometry, + typename bgi::default_margin_result::type expected_value) +{ + typename bgi::default_margin_result::type value = bgi::margin(geometry); + +#ifdef GEOMETRY_TEST_DEBUG + std::ostringstream out; + out << typeid(typename bg::coordinate_type::type).name() + << " " + << typeid(typename bgi::default_margin_result::type).name() + << " " + << "content : " << value + << std::endl; + std::cout << out.str(); +#endif + + BOOST_CHECK_CLOSE(value, expected_value, 0.0001); +} + +template +void test_geometry(std::string const& wkt, + typename bgi::default_margin_result::type expected_value) +{ + Geometry geometry; + bg::read_wkt(wkt, geometry); + test_margin(geometry, expected_value); +} + +#endif diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp new file mode 100644 index 000000000..3ca1da626 --- /dev/null +++ b/test/geometry_index_test_common.hpp @@ -0,0 +1,25 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + + +#ifndef GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP +#define GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP + +#include +#include + +#include + +namespace bgi = boost::geometry::index; + +#endif // GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP diff --git a/test/geometry_test_common.hpp b/test/geometry_test_common.hpp new file mode 100644 index 000000000..4777a0ab7 --- /dev/null +++ b/test/geometry_test_common.hpp @@ -0,0 +1,162 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + + +#ifndef GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP +#define GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP + +#if defined(_MSC_VER) +// We deliberately mix float/double's so turn off warnings +#pragma warning( disable : 4244 ) +// For (new since Boost 1.40) warning in Boost.Test on putenv/posix +#pragma warning( disable : 4996 ) + +//#pragma warning( disable : 4305 ) +#endif // defined(_MSC_VER) + +#include + + +#if defined(BOOST_INTEL_CXX_VERSION) +#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE +#endif + + +#include + + +// Include some always-included-for-testing files +#if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST) + +// Until Boost fixes it, silence warning issued by clang: +// warning: unused variable 'check_is_close' [-Wunused-variable] +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-variable" +#endif + +# include +# include +//# include +# include + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + +#endif + + +#if defined(HAVE_TTMATH) +# include +#endif + +#if defined(HAVE_CLN) || defined(HAVE_GMP) +# include +#endif + + +#if defined(HAVE_GMP) +# include +#endif +#if defined(HAVE_CLN) +# include +#endif + + +template +struct string_from_type {}; + +template <> struct string_from_type +{ static std::string name() { return "v"; } }; + +template <> struct string_from_type +{ static std::string name() { return "f"; } }; + +template <> struct string_from_type +{ static std::string name() { return "d"; } }; + +template <> struct string_from_type +{ static std::string name() { return "e"; } }; + +#if defined(HAVE_TTMATH) + template <> struct string_from_type + { static std::string name() { return "t"; } }; +#endif + +#if defined(BOOST_RATIONAL_HPP) +template struct string_from_type > +{ static std::string name() { return "r"; } }; +#endif + + +#if defined(HAVE_GMP) + template <> struct string_from_type + { static std::string name() { return "g"; } }; +#endif + +#if defined(HAVE_CLN) + template <> struct string_from_type + { static std::string name() { return "c"; } }; +#endif + + +template +inline T1 if_typed_tt(T1 value_tt, T2 value) +{ +#if defined(HAVE_TTMATH) + return boost::is_same::type::value ? value_tt : value; +#else + return value; +#endif +} + +template +inline T if_typed(T value_typed, T value) +{ + return boost::is_same::value ? value_typed : value; +} + + + + +struct geographic_policy +{ + template + static inline CoordinateType apply(CoordinateType const& value) + { + return value; + } +}; + +struct mathematical_policy +{ + template + static inline CoordinateType apply(CoordinateType const& value) + { + return 90 - value; + } + +}; + + + + +// For all tests: +// - do NOT use "using namespace boost::geometry" to make clear what is Boost.Geometry +// - use bg:: as short alias +#include +namespace bg = boost::geometry; + + +#endif // GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP From c00ddbd2a83ce6d1e49cc12e93d33d64691d3549 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jun 2012 11:49:56 +0000 Subject: [PATCH 110/366] some tests and optimizations. [SVN r79107] --- .../extensions/index/algorithms/content.hpp | 3 +- .../index/algorithms/intersection_content.hpp | 8 +- .../index/algorithms/minmaxdist.hpp | 15 ++- test/algorithms/Jamfile.v2 | 5 +- test/algorithms/intersection_content.cpp | 78 +++++++++++++ test/algorithms/is_valid.cpp | 15 ++- test/algorithms/minmaxdist.cpp | 106 ++++++++++++++++++ test/algorithms/test_intersection_content.hpp | 52 +++++++++ test/algorithms/test_union_content.hpp | 48 ++++++++ test/algorithms/union_content.cpp | 75 +++++++++++++ 10 files changed, 393 insertions(+), 12 deletions(-) create mode 100644 test/algorithms/intersection_content.cpp create mode 100644 test/algorithms/minmaxdist.cpp create mode 100644 test/algorithms/test_intersection_content.hpp create mode 100644 test/algorithms/test_union_content.hpp create mode 100644 test/algorithms/union_content.cpp diff --git a/include/boost/geometry/extensions/index/algorithms/content.hpp b/include/boost/geometry/extensions/index/algorithms/content.hpp index 0dfa24d66..52aa49710 100644 --- a/include/boost/geometry/extensions/index/algorithms/content.hpp +++ b/include/boost/geometry/extensions/index/algorithms/content.hpp @@ -2,7 +2,8 @@ // // Boost.SpatialIndex - n-dimensional box's content (2d-area/3d-volume/...) // -// Copyright 2011 Adam Wulkiewicz. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp index ae8286f2c..3cc969195 100644 --- a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp +++ b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp @@ -2,7 +2,8 @@ // // Boost.SpatialIndex - boxes union/intersection area/volume // -// Copyright 2011 Adam Wulkiewicz. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -21,14 +22,13 @@ namespace boost { namespace geometry { namespace index { template inline typename default_content_result::type intersection_content(Box const& box1, Box const& box2) { - typename default_content_result::type result = 0; if ( geometry::intersects(box1, box2) ) { Box box_intersection; geometry::intersection(box1, box2, box_intersection); - result = index::content(box_intersection); + return index::content(box_intersection); } - return result; + return 0; } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp index d7ed6d0f0..71e7dd8ca 100644 --- a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp +++ b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp @@ -2,7 +2,8 @@ // // Boost.Index - minmaxdist used in R-tree k nearest neighbors query // -// Copyright 2011 Adam Wulkiewicz. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -10,12 +11,13 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP +#include +#include + #include #include #include -#include - namespace boost { namespace geometry { namespace index { namespace detail { @@ -49,7 +51,7 @@ struct smallest_for_indexable_dimension inline static result_type apply(Point const& pt, Indexable const& i) { - result_type maxd = maxdist(pt, i); + result_type maxd = geometry::comparable_distance(pt, i); return smallest_for_indexable< Point, @@ -102,6 +104,9 @@ struct minmaxdist_impl } // namespace detail +/** + * This is comparable distace. + */ template typename geometry::default_distance_result::type minmaxdist(Point const& pt, Indexable const& i) diff --git a/test/algorithms/Jamfile.v2 b/test/algorithms/Jamfile.v2 index 6da7d6901..619f13dd3 100644 --- a/test/algorithms/Jamfile.v2 +++ b/test/algorithms/Jamfile.v2 @@ -11,7 +11,10 @@ test-suite boost-geometry-index-algorithms : [ run content.cpp ] + [ run intersection_content.cpp ] # this tests overlap() too [ run is_valid.cpp ] - [ run margin.cpp ] + [ run margin.cpp ] + #[ run minmaxdist.cpp ] + [ run union_content.cpp ] ; diff --git a/test/algorithms/intersection_content.cpp b/test/algorithms/intersection_content.cpp new file mode 100644 index 000000000..70819d20c --- /dev/null +++ b/test/algorithms/intersection_content.cpp @@ -0,0 +1,78 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +//#define GEOMETRY_TEST_DEBUG + +void test_large_integers() +{ + typedef bg::model::point int_point_type; + typedef bg::model::point double_point_type; + + bg::model::box int_box1, int_box2; + bg::model::box double_box1, double_box2; + + std::string const box_li1 = "POLYGON((1536119 192000, 1872000 528000))"; + std::string const box_li2 = "POLYGON((1701234 368250, 2673400 777400))"; + bg::read_wkt(box_li1, int_box1); + bg::read_wkt(box_li1, double_box1); + bg::read_wkt(box_li2, int_box2); + bg::read_wkt(box_li2, double_box2); + + double int_value = bgi::intersection_content(int_box1, int_box2); + double double_value = bgi::intersection_content(double_box1, double_box2); + + BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); + + // temp + BOOST_CHECK_CLOSE(bgi::overlap(int_box1, int_box2), bgi::overlap(double_box1, double_box2), 0.0001); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0); + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0); + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0); + + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((2 1,3 4))", 0.0); + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((2 4,3 5))", 0.0); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + typedef bg::model::point P3ttmc; + + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 2.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 6.0); +#endif + + test_large_integers(); + + return 0; +} diff --git a/test/algorithms/is_valid.cpp b/test/algorithms/is_valid.cpp index 4b339c527..b7f4983c1 100644 --- a/test/algorithms/is_valid.cpp +++ b/test/algorithms/is_valid.cpp @@ -27,7 +27,20 @@ template void test(Geometry const& geometry, bool expected_value) { - BOOST_CHECK(bgi::is_valid(geometry) == expected_value); + bool value = bgi::is_valid(geometry); + +#ifdef GEOMETRY_TEST_DEBUG + std::ostringstream out; + out << typeid(typename bg::coordinate_type::type).name() + << " " + << typeid(bool).name() + << " " + << "is_valid : " << value + << std::endl; + std::cout << out.str(); +#endif + + BOOST_CHECK(value == expected_value); } template diff --git a/test/algorithms/minmaxdist.cpp b/test/algorithms/minmaxdist.cpp new file mode 100644 index 000000000..b0a84915b --- /dev/null +++ b/test/algorithms/minmaxdist.cpp @@ -0,0 +1,106 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +#include + +#include +#include +#include + +#define GEOMETRY_TEST_DEBUG + +template +void test(Point const& pt, Indexable const& indexable, + typename bg::default_distance_result::type expected_value) +{ + typename bg::default_distance_result::type value = bgi::minmaxdist(pt, indexable); + +#ifdef GEOMETRY_TEST_DEBUG + std::ostringstream out; + out << typeid(typename bg::coordinate_type::type).name() + << " " + << typeid(typename bg::coordinate_type::type).name() + << " " + << typeid(bg::default_distance_result::type).name() + << " " + << "minmaxdist : " << value + << std::endl; + std::cout << out.str(); +#endif + + BOOST_CHECK_CLOSE(value, expected_value, 0.0001); +} + +template +void test_indexable(Point const& pt, std::string const& wkt, + typename bg::default_distance_result::type expected_value) +{ + Indexable indexable; + bg::read_wkt(wkt, indexable); + test(pt, indexable, expected_value); +} + +void test_large_integers() +{ + typedef bg::model::point int_point_type; + typedef bg::model::point double_point_type; + + int_point_type int_pt(0, 0); + double_point_type double_pt(0, 0); + + bg::model::box int_box; + bg::model::box double_box; + + std::string const box_li = "POLYGON((1536119 192000, 1872000 528000))"; + bg::read_wkt(box_li, int_box); + bg::read_wkt(box_li, double_box); + + BOOST_CHECK(bgi::minmaxdist(int_pt, int_box) == bgi::minmaxdist(double_pt, double_box)); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_indexable >(P2ic(1, 2), "POLYGON((0 1,2 4))", 5.0); + test_indexable >(P2fc(1, 2), "POLYGON((0 1,2 4))", 5.0); + test_indexable >(P2dc(1, 2), "POLYGON((0 1,2 4))", 5.0); + test_indexable >(P3ic(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0); + test_indexable >(P3fc(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0); + test_indexable >(P3dc(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0); + + test_indexable >(P2ic(1, 2), "POLYGON((1 2,3 5))", 4.0); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + typedef bg::model::point P3ttmc; + + test_indexable >(P2ttmc(1, 2), "POLYGON((0 1,2 4))", 5.0); + test_indexable >(P3ttmc(1, 2, 3), "POLYGON((0 1 2,2 4 6))", 14.0); +#endif + + test_large_integers(); + + return 0; +} diff --git a/test/algorithms/test_intersection_content.hpp b/test/algorithms/test_intersection_content.hpp new file mode 100644 index 000000000..415acfa61 --- /dev/null +++ b/test/algorithms/test_intersection_content.hpp @@ -0,0 +1,52 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_INTERSECTION_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_INTERSECTION_CONTENT_HPP + +#include + +#include +#include + +template +void test_intersection_content(Geometry const& geometry1, Geometry const& geometry2, + typename bgi::default_content_result::type expected_value) +{ + typename bgi::default_content_result::type value = bgi::intersection_content(geometry1, geometry2); + +#ifdef GEOMETRY_TEST_DEBUG + std::ostringstream out; + out << typeid(typename bg::coordinate_type::type).name() + << " " + << typeid(typename bgi::default_content_result::type).name() + << " " + << "intersection_content : " << value + << std::endl; + std::cout << out.str(); +#endif + + BOOST_CHECK_CLOSE(value, expected_value, 0.0001); + + // temp + BOOST_CHECK_CLOSE(bgi::overlap(geometry1, geometry2), expected_value, 0.0001); +} + +template +void test_geometry(std::string const& wkt1, std::string const& wkt2, + typename bgi::default_content_result::type expected_value) +{ + Geometry geometry1, geometry2; + bg::read_wkt(wkt1, geometry1); + bg::read_wkt(wkt2, geometry2); + test_intersection_content(geometry1, geometry2, expected_value); +} + +#endif diff --git a/test/algorithms/test_union_content.hpp b/test/algorithms/test_union_content.hpp new file mode 100644 index 000000000..dfbf2432e --- /dev/null +++ b/test/algorithms/test_union_content.hpp @@ -0,0 +1,48 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_UNION_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_UNION_CONTENT_HPP + +#include + +#include + +template +void test_union_content(Geometry const& geometry1, Geometry const& geometry2, + typename bgi::default_content_result::type expected_value) +{ + typename bgi::default_content_result::type value = bgi::union_content(geometry1, geometry2); + +#ifdef GEOMETRY_TEST_DEBUG + std::ostringstream out; + out << typeid(typename bg::coordinate_type::type).name() + << " " + << typeid(typename bgi::default_content_result::type).name() + << " " + << "union_content : " << value + << std::endl; + std::cout << out.str(); +#endif + + BOOST_CHECK_CLOSE(value, expected_value, 0.0001); +} + +template +void test_geometry(std::string const& wkt1, std::string const& wkt2, + typename bgi::default_content_result::type expected_value) +{ + Geometry geometry1, geometry2; + bg::read_wkt(wkt1, geometry1); + bg::read_wkt(wkt2, geometry2); + test_union_content(geometry1, geometry2, expected_value); +} + +#endif diff --git a/test/algorithms/union_content.cpp b/test/algorithms/union_content.cpp new file mode 100644 index 000000000..4a8c92e93 --- /dev/null +++ b/test/algorithms/union_content.cpp @@ -0,0 +1,75 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +//#define GEOMETRY_TEST_DEBUG + +void test_large_integers() +{ + typedef bg::model::point int_point_type; + typedef bg::model::point double_point_type; + + bg::model::box int_box1, int_box2; + bg::model::box double_box1, double_box2; + + std::string const box_li1 = "POLYGON((1536119 192000, 1872000 528000))"; + std::string const box_li2 = "POLYGON((1701234 368250, 2673400 777400))"; + bg::read_wkt(box_li1, int_box1); + bg::read_wkt(box_li1, double_box1); + bg::read_wkt(box_li2, int_box2); + bg::read_wkt(box_li2, double_box2); + + double int_value = bgi::union_content(int_box1, int_box2); + double double_value = bgi::union_content(double_box1, double_box2); + + BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0); + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0); + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0); + + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((2 1,3 4))", 9.0); + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((2 4,3 5))", 12.0); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + typedef bg::model::point P3ttmc; + + test_geometry >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0); + test_geometry >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0); +#endif + + test_large_integers(); + + return 0; +} From cfc4f8b4ad58cb4f5d8916fbc5dbb370d9f3a087 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jun 2012 13:36:34 +0000 Subject: [PATCH 111/366] tests added: rtree- 2d, linear<4,2>, quadratic<4,2>, rstar<4,2> queries - default, intersects, !intersects, !disjoint, not_disjoint [SVN r79108] --- test/Jamfile.v2 | 2 +- test/rtree/Jamfile.v2 | 15 ++++++++ test/rtree/rtree.cpp | 77 +++++++++++++++++++++++++++++++++++++++ test/rtree/test_rtree.hpp | 62 +++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 test/rtree/Jamfile.v2 create mode 100644 test/rtree/rtree.cpp create mode 100644 test/rtree/test_rtree.hpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 6760caf7d..d0dee4afd 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -22,6 +22,6 @@ project boost-geometry-index-test ; build-project algorithms ; -#build-project rtree ; +build-project rtree ; #build-project filters ; #build-project translator ; diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 new file mode 100644 index 000000000..a30a72129 --- /dev/null +++ b/test/rtree/Jamfile.v2 @@ -0,0 +1,15 @@ +# Boost.Geometry (aka GGL, Generic Geometry Library) +# +# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +# Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +test-suite boost-geometry-index-rtree + : + [ run rtree.cpp ] + ; + diff --git a/test/rtree/rtree.cpp b/test/rtree/rtree.cpp new file mode 100644 index 000000000..42d2eaefa --- /dev/null +++ b/test/rtree/rtree.cpp @@ -0,0 +1,77 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +template +void test_rtree_by_point2() +{ + typedef bg::model::box

    B; + + std::vector input; + + for ( size_t i = 0 ; i < 20 ; i += 3 ) + { + for ( size_t j = 1 ; j < 31 ; j += 4 ) + { + input.push_back(B(P(i, j), P(i + 2, j + 3))); + } + } + + bgi::rtree tree; + tree.insert(input.begin(), input.end()); + + std::vector expected_output; + expected_output.push_back(B(P(3, 1), P(5, 4))); + expected_output.push_back(B(P(6, 1), P(8, 4))); + + B qbox(P(4, 2), P(7, 3)); + + test(tree, qbox, expected_output); + test(tree, bgi::intersects(qbox), expected_output); + test(tree, !bgi::not_intersects(qbox), expected_output); + test(tree, !bgi::disjoint(qbox), expected_output); + test(tree, bgi::not_disjoint(qbox), expected_output); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); + test_rtree_by_point2 >(); +#endif + + return 0; +} diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp new file mode 100644 index 000000000..f2f6d6e71 --- /dev/null +++ b/test/rtree/test_rtree.hpp @@ -0,0 +1,62 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_HPP + +#include + +#include +#include + +#include + +// TODO: fix this issue differently +#ifdef max +#undef max +#endif +#include +#include + +template +Iter test_find(Rtree const& rtree, Iter first, Iter last, Value const& value) +{ + for ( ; first != last ; ++first ) + if ( rtree.translator().equals(value, *first) ) + return first; + return first; +} + +template +void test_compare_outputs(Rtree const& rtree, std::vector const& output, std::vector const& expected_output) +{ + typename Rtree::translator_type tr = rtree.translator(); + + BOOST_CHECK( expected_output.size() == output.size() ); + BOOST_FOREACH(Value const& v, expected_output) + { + BOOST_CHECK(test_find(rtree, output.begin(), output.end(), v) != output.end() ); + } +} + +template +void test(Rtree & rtree, Predicates const& pred, std::vector const& expected_output) +{ + BOOST_CHECK( bgi::are_levels_ok(rtree) ); + BOOST_CHECK( bgi::are_boxes_ok(rtree) ); + + std::vector output; + size_t n = rtree.query(pred, std::back_inserter(output)); + + BOOST_CHECK( expected_output.size() == n ); + test_compare_outputs(rtree, output, expected_output); +} + +#endif From 4d79f3dade98356c29f9f80013b6fe6899b928b2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jun 2012 13:42:37 +0000 Subject: [PATCH 112/366] tabs changed to spaces in rstar/redistribute_elements.hpp [SVN r79109] --- .../rtree/rstar/redistribute_elements.hpp | 468 +++++++++--------- 1 file changed, 234 insertions(+), 234 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index b1c024f7c..b8d04196f 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -30,280 +30,280 @@ namespace rstar { template class element_axis_corner_less - : index::nonassignable -{ + : index::nonassignable +{ public: - element_axis_corner_less(Translator const& tr) - : m_tr(tr) - {} + element_axis_corner_less(Translator const& tr) + : m_tr(tr) + {} - bool operator()(Element const& e1, Element const& e2) const - { - return index::get(rtree::element_indexable(e1, m_tr)) - < index::get(rtree::element_indexable(e2, m_tr)); - } + bool operator()(Element const& e1, Element const& e2) const + { + return index::get(rtree::element_indexable(e1, m_tr)) + < index::get(rtree::element_indexable(e2, m_tr)); + } private: - Translator const& m_tr; + Translator const& m_tr; }; template struct choose_split_axis_and_index_for_corner { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template - static inline void apply(Elements const& elements, - size_t & choosen_index, - margin_type & sum_of_margins, - content_type & smallest_overlap, - content_type & smallest_content, - Translator const& tr) - { - typedef typename Elements::value_type element_type; + template + static inline void apply(Elements const& elements, + size_t & choosen_index, + margin_type & sum_of_margins, + content_type & smallest_overlap, + content_type & smallest_content, + Translator const& tr) + { + typedef typename Elements::value_type element_type; - BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == Parameters::max_elements + 1, "wrong number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == Parameters::max_elements + 1, "wrong number of elements"); - // copy elements - boost::array elements_copy; - std::copy(elements.begin(), elements.end(), elements_copy.begin()); - - // sort elements - element_axis_corner_less elements_less(tr); - std::sort(elements_copy.begin(), elements_copy.end(), elements_less); + // copy elements + boost::array elements_copy; + std::copy(elements.begin(), elements.end(), elements_copy.begin()); + + // sort elements + element_axis_corner_less elements_less(tr); + std::sort(elements_copy.begin(), elements_copy.end(), elements_less); - // init outputs - choosen_index = Parameters::min_elements; - sum_of_margins = 0; - smallest_overlap = std::numeric_limits::max(); - smallest_content = std::numeric_limits::max(); + // init outputs + choosen_index = Parameters::min_elements; + sum_of_margins = 0; + smallest_overlap = std::numeric_limits::max(); + smallest_content = std::numeric_limits::max(); - // calculate sum of margins for all distributions - size_t index_last = Parameters::max_elements - Parameters::min_elements + 2; - for ( size_t i = Parameters::min_elements ; i < index_last ; ++i ) - { - // TODO - awulkiew: may be optimized - box of group 1 may be initialized with - // box of min_elems number of elements and expanded for each iteration by another element + // calculate sum of margins for all distributions + size_t index_last = Parameters::max_elements - Parameters::min_elements + 2; + for ( size_t i = Parameters::min_elements ; i < index_last ; ++i ) + { + // TODO - awulkiew: may be optimized - box of group 1 may be initialized with + // box of min_elems number of elements and expanded for each iteration by another element - Box box1 = rtree::elements_box(elements_copy.begin(), elements_copy.begin() + i, tr); - Box box2 = rtree::elements_box(elements_copy.begin() + i, elements_copy.end(), tr); - - sum_of_margins += index::margin(box1) + index::margin(box2); + Box box1 = rtree::elements_box(elements_copy.begin(), elements_copy.begin() + i, tr); + Box box2 = rtree::elements_box(elements_copy.begin() + i, elements_copy.end(), tr); + + sum_of_margins += index::margin(box1) + index::margin(box2); - content_type ovl = index::intersection_content(box1, box2); - content_type con = index::content(box1) + index::content(box2); + content_type ovl = index::intersection_content(box1, box2); + content_type con = index::content(box1) + index::content(box2); - if ( ovl < smallest_overlap || (ovl == smallest_overlap && con <= smallest_content) ) - { - choosen_index = i; - smallest_overlap = ovl; - smallest_content = con; - } - } - } + if ( ovl < smallest_overlap || (ovl == smallest_overlap && con <= smallest_content) ) + { + choosen_index = i; + smallest_overlap = ovl; + smallest_content = con; + } + } + } }; template struct choose_split_axis_and_index_for_axis { - //BOOST_STATIC_ASSERT(0); + //BOOST_STATIC_ASSERT(0); }; template struct choose_split_axis_and_index_for_axis { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template - static inline void apply(Elements const& elements, - size_t & choosen_corner, - size_t & choosen_index, - margin_type & sum_of_margins, - content_type & smallest_overlap, - content_type & smallest_content, - Translator const& tr) - { - size_t index1 = 0; - margin_type som1 = 0; - content_type ovl1 = std::numeric_limits::max(); - content_type con1 = std::numeric_limits::max(); + template + static inline void apply(Elements const& elements, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & sum_of_margins, + content_type & smallest_overlap, + content_type & smallest_content, + Translator const& tr) + { + size_t index1 = 0; + margin_type som1 = 0; + content_type ovl1 = std::numeric_limits::max(); + content_type con1 = std::numeric_limits::max(); - choose_split_axis_and_index_for_corner:: - apply(elements, index1, - som1, ovl1, con1, - tr); + choose_split_axis_and_index_for_corner:: + apply(elements, index1, + som1, ovl1, con1, + tr); - size_t index2 = 0; - margin_type som2 = 0; - content_type ovl2 = std::numeric_limits::max(); - content_type con2 = std::numeric_limits::max(); + size_t index2 = 0; + margin_type som2 = 0; + content_type ovl2 = std::numeric_limits::max(); + content_type con2 = std::numeric_limits::max(); - choose_split_axis_and_index_for_corner:: - apply(elements, index2, - som2, ovl2, con2, - tr); + choose_split_axis_and_index_for_corner:: + apply(elements, index2, + som2, ovl2, con2, + tr); - sum_of_margins = som1 + som2; + sum_of_margins = som1 + som2; - if ( ovl1 < ovl2 || (ovl1 == ovl2 && con1 <= con2) ) - { - choosen_corner = min_corner; - choosen_index = index1; - smallest_overlap = ovl1; - smallest_content = con1; - } - else - { - choosen_corner = max_corner; - choosen_index = index2; - smallest_overlap = ovl2; - smallest_content = con2; - } - } + if ( ovl1 < ovl2 || (ovl1 == ovl2 && con1 <= con2) ) + { + choosen_corner = min_corner; + choosen_index = index1; + smallest_overlap = ovl1; + smallest_content = con1; + } + else + { + choosen_corner = max_corner; + choosen_index = index2; + smallest_overlap = ovl2; + smallest_content = con2; + } + } }; template struct choose_split_axis_and_index_for_axis { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template - static inline void apply(Elements const& elements, - size_t & choosen_corner, - size_t & choosen_index, - margin_type & sum_of_margins, - content_type & smallest_overlap, - content_type & smallest_content, - Translator const& tr) - { - choose_split_axis_and_index_for_corner:: - apply(elements, choosen_index, - sum_of_margins, smallest_overlap, smallest_content, - tr); + template + static inline void apply(Elements const& elements, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & sum_of_margins, + content_type & smallest_overlap, + content_type & smallest_content, + Translator const& tr) + { + choose_split_axis_and_index_for_corner:: + apply(elements, choosen_index, + sum_of_margins, smallest_overlap, smallest_content, + tr); - choosen_corner = min_corner; - } + choosen_corner = min_corner; + } }; template struct choose_split_axis_and_index { - BOOST_STATIC_ASSERT(0 < Dimension); + BOOST_STATIC_ASSERT(0 < Dimension); - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template - static inline void apply(Elements const& elements, - size_t & choosen_axis, - size_t & choosen_corner, - size_t & choosen_index, - margin_type & smallest_sum_of_margins, - content_type & smallest_overlap, - content_type & smallest_content, - Translator const& tr) - { - typedef typename rtree::element_indexable_type::type element_indexable_type; + template + static inline void apply(Elements const& elements, + size_t & choosen_axis, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & smallest_sum_of_margins, + content_type & smallest_overlap, + content_type & smallest_content, + Translator const& tr) + { + typedef typename rtree::element_indexable_type::type element_indexable_type; - choose_split_axis_and_index:: - apply(elements, choosen_axis, choosen_corner, choosen_index, - smallest_sum_of_margins, smallest_overlap, smallest_content, - tr); + choose_split_axis_and_index:: + apply(elements, choosen_axis, choosen_corner, choosen_index, + smallest_sum_of_margins, smallest_overlap, smallest_content, + tr); - margin_type sum_of_margins = 0; + margin_type sum_of_margins = 0; - size_t corner = min_corner; - size_t index = 0; + size_t corner = min_corner; + size_t index = 0; - content_type overlap_val = std::numeric_limits::max(); - content_type content_val = std::numeric_limits::max(); + content_type overlap_val = std::numeric_limits::max(); + content_type content_val = std::numeric_limits::max(); - choose_split_axis_and_index_for_axis< - Parameters, - Box, - Dimension - 1, - typename index::traits::tag::type - >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, tr); + choose_split_axis_and_index_for_axis< + Parameters, + Box, + Dimension - 1, + typename index::traits::tag::type + >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, tr); - if ( sum_of_margins < smallest_sum_of_margins ) - { - choosen_axis = Dimension - 1; - choosen_corner = corner; - choosen_index = index; - smallest_sum_of_margins = sum_of_margins; - smallest_overlap = overlap_val; - smallest_content = content_val; - } - } + if ( sum_of_margins < smallest_sum_of_margins ) + { + choosen_axis = Dimension - 1; + choosen_corner = corner; + choosen_index = index; + smallest_sum_of_margins = sum_of_margins; + smallest_overlap = overlap_val; + smallest_content = content_val; + } + } }; template struct choose_split_axis_and_index { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template - static inline void apply(Elements const& elements, - size_t & choosen_axis, - size_t & choosen_corner, - size_t & choosen_index, - margin_type & smallest_sum_of_margins, - content_type & smallest_overlap, - content_type & smallest_content, - Translator const& tr) - { - typedef typename rtree::element_indexable_type::type element_indexable_type; + template + static inline void apply(Elements const& elements, + size_t & choosen_axis, + size_t & choosen_corner, + size_t & choosen_index, + margin_type & smallest_sum_of_margins, + content_type & smallest_overlap, + content_type & smallest_content, + Translator const& tr) + { + typedef typename rtree::element_indexable_type::type element_indexable_type; - choosen_axis = 0; + choosen_axis = 0; - choose_split_axis_and_index_for_axis< - Parameters, - Box, - 0, - typename index::traits::tag::type - >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, tr); - } + choose_split_axis_and_index_for_axis< + Parameters, + Box, + 0, + typename index::traits::tag::type + >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, tr); + } }; template struct partial_sort { - BOOST_STATIC_ASSERT(0 < Dimension); + BOOST_STATIC_ASSERT(0 < Dimension); - template - static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) - { - if ( axis < Dimension - 1 ) - { - partial_sort::apply(elements, axis, index, tr); - } - else - { - BOOST_GEOMETRY_INDEX_ASSERT(axis == Dimension - 1, "unexpected axis value"); + template + static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) + { + if ( axis < Dimension - 1 ) + { + partial_sort::apply(elements, axis, index, tr); + } + else + { + BOOST_GEOMETRY_INDEX_ASSERT(axis == Dimension - 1, "unexpected axis value"); - typedef typename Elements::value_type element_type; - element_axis_corner_less less(tr); - std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); - } - } + typedef typename Elements::value_type element_type; + element_axis_corner_less less(tr); + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); + } + } }; template struct partial_sort { - template - static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) - { - BOOST_GEOMETRY_INDEX_ASSERT(axis == 0, "unexpected axis value"); + template + static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) + { + BOOST_GEOMETRY_INDEX_ASSERT(axis == 0, "unexpected axis value"); - typedef typename Elements::value_type element_type; - element_axis_corner_less less(tr); - std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); - } + typedef typename Elements::value_type element_type; + element_axis_corner_less less(tr); + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); + } }; } // namespace rstar @@ -315,11 +315,11 @@ struct redistribute_elements::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename Options::parameters_type parameters_type; + typedef typename Options::parameters_type parameters_type; - static const size_t dimension = index::traits::dimension::value; + static const size_t dimension = index::traits::dimension::value; - typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_margin_result::type margin_type; typedef typename index::default_content_result::type content_type; template @@ -330,44 +330,44 @@ struct redistribute_elements::type elements_type; - + typedef typename rtree::elements_type::type elements_type; + elements_type & elements1 = rtree::elements(n); - elements_type & elements2 = rtree::elements(second_node); + elements_type & elements2 = rtree::elements(second_node); - size_t split_axis = 0; - size_t split_corner = 0; - size_t split_index = parameters_type::min_elements; - margin_type smallest_sum_of_margins = std::numeric_limits::max(); - content_type smallest_overlap = std::numeric_limits::max(); - content_type smallest_content = std::numeric_limits::max(); + size_t split_axis = 0; + size_t split_corner = 0; + size_t split_index = parameters_type::min_elements; + margin_type smallest_sum_of_margins = std::numeric_limits::max(); + content_type smallest_overlap = std::numeric_limits::max(); + content_type smallest_content = std::numeric_limits::max(); - rstar::choose_split_axis_and_index::value>:: - apply(elements1, - split_axis, split_corner, split_index, - smallest_sum_of_margins, smallest_overlap, smallest_content, - tr); + rstar::choose_split_axis_and_index::value>:: + apply(elements1, + split_axis, split_corner, split_index, + smallest_sum_of_margins, smallest_overlap, smallest_content, + tr); - // TODO: awulkiew - get rid of following static_casts? + // TODO: awulkiew - get rid of following static_casts? - BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension::value, "unexpected value"); - BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner), "unexpected value"); - BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= split_index && split_index <= parameters_type::max_elements - parameters_type::min_elements + 1, "unexpected value"); - - // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort - if ( split_corner == static_cast(min_corner) ) - rstar::partial_sort::apply(elements1, split_axis, split_index, tr); - else - rstar::partial_sort::apply(elements1, split_axis, split_index, tr); + BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension::value, "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner), "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(parameters_type::min_elements <= split_index && split_index <= parameters_type::max_elements - parameters_type::min_elements + 1, "unexpected value"); + + // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort + if ( split_corner == static_cast(min_corner) ) + rstar::partial_sort::apply(elements1, split_axis, split_index, tr); + else + rstar::partial_sort::apply(elements1, split_axis, split_index, tr); - // copy elements to node 2 and remove from node 1 - elements2.resize(parameters_type::max_elements + 1 - split_index); - std::copy(elements1.begin() + split_index, elements1.end(), elements2.begin()); - elements1.resize(split_index); + // copy elements to node 2 and remove from node 1 + elements2.resize(parameters_type::max_elements + 1 - split_index); + std::copy(elements1.begin() + split_index, elements1.end(), elements2.begin()); + elements1.resize(split_index); - // calculate boxes - box1 = rtree::elements_box(elements1.begin(), elements1.end(), tr); - box2 = rtree::elements_box(elements2.begin(), elements2.end(), tr); + // calculate boxes + box1 = rtree::elements_box(elements1.begin(), elements1.end(), tr); + box2 = rtree::elements_box(elements2.begin(), elements2.end(), tr); } }; From a1d3066d9af37a9c4e510529cce4ea7eab866916 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jun 2012 19:42:30 +0000 Subject: [PATCH 113/366] Fixed error in linear::find_greatest_normalized_separation. Implemented rtree inserts and intersection queries tests for Points and pair. [SVN r79122] --- .../rtree/linear/redistribute_elements.hpp | 32 ++++++-- test/rtree/rtree.cpp | 81 ++++++++++++++----- test/rtree/test_rtree.hpp | 67 +++++++++++++++ 3 files changed, 153 insertions(+), 27 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index a8d1ba090..afe978151 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP +#include + #include #include @@ -30,6 +32,11 @@ namespace linear { // iteration is done for each DimensionIndex. // Separations and seeds for all DimensionIndex(es) could be calculated at once, stored, then the greatest would be choosen. +// TODO: Implement separate version for Points + +// What if width calculated inside find_greatest_normalized_separation::apply() is near 0? +// What epsilon should be taken to calculation and what would be the value of resulting separation? + // from void find_normalized_separations(std::vector const& boxes, T& separation, unsigned int& first, unsigned int& second) const template @@ -89,16 +96,29 @@ struct find_greatest_normalized_separation coordinate_type const width = highest_high - lowest_low; - separation = (highest_low - lowest_high) / width; + // TODO: awulkiew - following separation calculation has two flaws: + // 1. for floating point numbers width should be compared witn some EPS + // 2. separation calculation won't work for unsigned numbers + // but there should be possible to calculate negative value (cast to some floating point type?) + + // Temporary workaround + BOOST_STATIC_ASSERT(!boost::is_unsigned::value); + + if ( width == 0 ) + separation = 0; + // (highest_low - lowest_high) == 0 + else + separation = (highest_low - lowest_high) / width; + seed1 = highest_low_index; seed2 = lowest_high_index; } }; -template +template struct pick_seeds_impl { - BOOST_STATIC_ASSERT(0 < DimensionIndex); + BOOST_STATIC_ASSERT(0 < Dimension); typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; @@ -110,11 +130,11 @@ struct pick_seeds_impl size_t & seed1, size_t & seed2) { - pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); + pick_seeds_impl::apply(elements, tr, separation, seed1, seed2); coordinate_type current_separation; size_t s1, s2; - find_greatest_normalized_separation::apply(elements, tr, current_separation, s1, s2); + find_greatest_normalized_separation::apply(elements, tr, current_separation, s1, s2); // in the old implementation different operator was used: <= (y axis prefered) if ( separation < current_separation ) @@ -209,7 +229,7 @@ struct redistribute_elements #include -template -void test_rtree_by_point2() +template +void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { - typedef bg::model::box

    B; + std::vector expected_output; - std::vector input; - - for ( size_t i = 0 ; i < 20 ; i += 3 ) - { - for ( size_t j = 1 ; j < 31 ; j += 4 ) - { - input.push_back(B(P(i, j), P(i + 2, j + 3))); - } - } - - bgi::rtree tree; - tree.insert(input.begin(), input.end()); - - std::vector expected_output; - expected_output.push_back(B(P(3, 1), P(5, 4))); - expected_output.push_back(B(P(6, 1), P(8, 4))); - - B qbox(P(4, 2), P(7, 3)); + BOOST_FOREACH(Value const& v, input) + if ( bg::intersects(tree.translator()(v), qbox) ) + expected_output.push_back(v); test(tree, qbox, expected_output); test(tree, bgi::intersects(qbox), expected_output); @@ -49,6 +34,60 @@ void test_rtree_by_point2() test(tree, bgi::not_disjoint(qbox), expected_output); } +template +void test_rtree_point_2d() +{ + typedef bg::model::box

    B; + + std::vector

    input; + B qbox; + test_generate<2>::apply(std::back_inserter(input), qbox, test_gen_point

    ); + + bgi::rtree tree; + tree.insert(input.begin(), input.end()); + + test_intersects(tree, input, qbox); +} + +template +void test_rtree_box_2d() +{ + typedef bg::model::box

    B; + + std::vector input; + B qbox; + test_generate<2>::apply(std::back_inserter(input), qbox, test_gen_box

    ); + + bgi::rtree tree; + tree.insert(input.begin(), input.end()); + + test_intersects(tree, input, qbox); +} + +template +void test_rtree_box_pair_2d() +{ + typedef bg::model::box

    B; + typedef std::pair V; + + std::vector input; + B qbox; + test_generate<2>::apply(std::back_inserter(input), qbox, test_gen_box_pair

    ); + + bgi::rtree tree; + tree.insert(input.begin(), input.end()); + + test_intersects(tree, input, qbox); +} + +template +void test_rtree_by_point2() +{ + test_rtree_point_2d(); + test_rtree_box_2d(); + test_rtree_box_pair_2d(); +} + int test_main(int, char* []) { typedef bg::model::point P2ic; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index f2f6d6e71..20fba1814 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -25,6 +25,73 @@ #include #include +template +struct test_generate +{}; + +template <> +struct test_generate<2> +{ + template + static void apply(OutIter out, Box & qbox, Gen gen) + { + for ( int i = 0 ; i < 12 ; i += 3 ) + { + for ( int j = 1 ; j < 25 ; j += 4 ) + { + *out++ = gen(i, j); + } + } + + typedef bg::traits::point_type::type P; + + qbox = Box(P(3, 0), P(10, 9)); + } +}; + +template <> +struct test_generate<3> +{ + template + static void apply(OutIter out, Box & qbox, Gen gen) + { + for ( int i = 0 ; i < 12 ; i += 3 ) + { + for ( int j = 1 ; j < 25 ; j += 4 ) + { + for ( int k = 2 ; k < 12 ; i += 5 ) + + *out++ = gen(i, j, k); + } + } + + typedef bg::traits::point_type::type P; + + qbox = Box(P(3, 0, 3), P(10, 9, 11)); + } +}; + +// TODO +// test_generate_value + specialization generating various types of values for 2d and 3d + +template +P test_gen_point(int x, int y) +{ + return P(x, y); +} + +template +bg::model::box

    test_gen_box(int x, int y) +{ + return bg::model::box

    (P(x, y), P(x + 2, y + 3)); +} + +template +std::pair, int> test_gen_box_pair(int x, int y) +{ + return std::make_pair(bg::model::box

    (P(x, y), P(x + 2, y + 3)), x + y * 100); +} + template Iter test_find(Rtree const& rtree, Iter first, Iter last, Value const& value) { From f20f6107b1ded114c2f8adb08223f3d30d8603a1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 26 Jun 2012 22:31:01 +0000 Subject: [PATCH 114/366] implemented rtree intersection queries tests for 3d. [SVN r79125] --- test/rtree/Jamfile.v2 | 3 +- test/rtree/rtree.cpp | 116 ---------------------------------- test/rtree/rtree2d.cpp | 72 +++++++++++++++++++++ test/rtree/rtree3d.cpp | 72 +++++++++++++++++++++ test/rtree/test_rtree.hpp | 130 +++++++++++++++++++++++++++++++------- 5 files changed, 254 insertions(+), 139 deletions(-) delete mode 100644 test/rtree/rtree.cpp create mode 100644 test/rtree/rtree2d.cpp create mode 100644 test/rtree/rtree3d.cpp diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index a30a72129..685361f2b 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -10,6 +10,7 @@ test-suite boost-geometry-index-rtree : - [ run rtree.cpp ] + [ run rtree2d.cpp ] + [ run rtree3d.cpp ] ; diff --git a/test/rtree/rtree.cpp b/test/rtree/rtree.cpp deleted file mode 100644 index aa372bb66..000000000 --- a/test/rtree/rtree.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// Unit Test - -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -template -void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) -{ - std::vector expected_output; - - BOOST_FOREACH(Value const& v, input) - if ( bg::intersects(tree.translator()(v), qbox) ) - expected_output.push_back(v); - - test(tree, qbox, expected_output); - test(tree, bgi::intersects(qbox), expected_output); - test(tree, !bgi::not_intersects(qbox), expected_output); - test(tree, !bgi::disjoint(qbox), expected_output); - test(tree, bgi::not_disjoint(qbox), expected_output); -} - -template -void test_rtree_point_2d() -{ - typedef bg::model::box

    B; - - std::vector

    input; - B qbox; - test_generate<2>::apply(std::back_inserter(input), qbox, test_gen_point

    ); - - bgi::rtree tree; - tree.insert(input.begin(), input.end()); - - test_intersects(tree, input, qbox); -} - -template -void test_rtree_box_2d() -{ - typedef bg::model::box

    B; - - std::vector input; - B qbox; - test_generate<2>::apply(std::back_inserter(input), qbox, test_gen_box

    ); - - bgi::rtree tree; - tree.insert(input.begin(), input.end()); - - test_intersects(tree, input, qbox); -} - -template -void test_rtree_box_pair_2d() -{ - typedef bg::model::box

    B; - typedef std::pair V; - - std::vector input; - B qbox; - test_generate<2>::apply(std::back_inserter(input), qbox, test_gen_box_pair

    ); - - bgi::rtree tree; - tree.insert(input.begin(), input.end()); - - test_intersects(tree, input, qbox); -} - -template -void test_rtree_by_point2() -{ - test_rtree_point_2d(); - test_rtree_box_2d(); - test_rtree_box_pair_2d(); -} - -int test_main(int, char* []) -{ - typedef bg::model::point P2ic; - typedef bg::model::point P2fc; - typedef bg::model::point P2dc; - - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - -#ifdef HAVE_TTMATH - typedef bg::model::point P2ttmc; - - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); - test_rtree_by_point2 >(); -#endif - - return 0; -} diff --git a/test/rtree/rtree2d.cpp b/test/rtree/rtree2d.cpp new file mode 100644 index 000000000..c9595b95c --- /dev/null +++ b/test/rtree/rtree2d.cpp @@ -0,0 +1,72 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +template +void test_rtree_by_point() +{ + typedef bg::model::box

    B; + typedef std::pair V; + B qbox; + { + bgi::rtree tree; + std::vector

    input; + test_generate_rtree(tree, input, qbox); + test_intersects(tree, input, qbox); + } + { + bgi::rtree tree; + std::vector input; + test_generate_rtree(tree, input, qbox); + test_intersects(tree, input, qbox); + } + { + bgi::rtree tree; + std::vector input; + test_generate_rtree(tree, input, qbox); + test_intersects(tree, input, qbox); + } +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); +#endif + + return 0; +} diff --git a/test/rtree/rtree3d.cpp b/test/rtree/rtree3d.cpp new file mode 100644 index 000000000..695243c61 --- /dev/null +++ b/test/rtree/rtree3d.cpp @@ -0,0 +1,72 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +template +void test_rtree_by_point() +{ + typedef bg::model::box

    B; + typedef std::pair V; + B qbox; + { + bgi::rtree tree; + std::vector

    input; + test_generate_rtree(tree, input, qbox); + test_intersects(tree, input, qbox); + } + { + bgi::rtree tree; + std::vector input; + test_generate_rtree(tree, input, qbox); + test_intersects(tree, input, qbox); + } + { + bgi::rtree tree; + std::vector input; + test_generate_rtree(tree, input, qbox); + test_intersects(tree, input, qbox); + } +} + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); + +#ifdef HAVE_TTMATH + typedef bg::model::point P3ttmc; + + test_rtree_by_point >(); + test_rtree_by_point >(); + test_rtree_by_point >(); +#endif + + return 0; +} diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 20fba1814..746513d02 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -25,6 +25,78 @@ #include #include +// Values, input and rtree generation + +template +struct test_generate_value +{}; + +template +struct test_generate_value< bg::model::point > +{ + typedef bg::model::point P; + static P apply(int x, int y) + { + return P(x, y); + } +}; + +template +struct test_generate_value< bg::model::box< bg::model::point > > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + static B apply(int x, int y) + { + return B(P(x, y), P(x + 2, y + 3)); + } +}; + +template +struct test_generate_value< std::pair >, int> > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + typedef std::pair R; + static R apply(int x, int y) + { + return std::make_pair(B(P(x, y), P(x + 2, y + 3)), x + y * 100); + } +}; + +template +struct test_generate_value< bg::model::point > +{ + typedef bg::model::point P; + static P apply(int x, int y, int z) + { + return P(x, y, z); + } +}; + +template +struct test_generate_value< bg::model::box< bg::model::point > > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + static B apply(int x, int y, int z) + { + return B(P(x, y, z), P(x + 2, y + 3, z + 4)); + } +}; + +template +struct test_generate_value< std::pair >, int> > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + typedef std::pair R; + static R apply(int x, int y, int z) + { + return std::make_pair(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000); + } +}; + template struct test_generate {}; @@ -32,14 +104,14 @@ struct test_generate template <> struct test_generate<2> { - template - static void apply(OutIter out, Box & qbox, Gen gen) + template + static void apply(std::vector & input, Box & qbox) { for ( int i = 0 ; i < 12 ; i += 3 ) { for ( int j = 1 ; j < 25 ; j += 4 ) { - *out++ = gen(i, j); + input.push_back( test_generate_value::apply(i, j) ); } } @@ -52,16 +124,17 @@ struct test_generate<2> template <> struct test_generate<3> { - template - static void apply(OutIter out, Box & qbox, Gen gen) + template + static void apply(std::vector & input, Box & qbox) { for ( int i = 0 ; i < 12 ; i += 3 ) { for ( int j = 1 ; j < 25 ; j += 4 ) { - for ( int k = 2 ; k < 12 ; i += 5 ) - - *out++ = gen(i, j, k); + for ( int k = 2 ; k < 12 ; k += 5 ) + { + input.push_back( test_generate_value::apply(i, j, k) ); + } } } @@ -71,26 +144,39 @@ struct test_generate<3> } }; -// TODO -// test_generate_value + specialization generating various types of values for 2d and 3d - -template -P test_gen_point(int x, int y) +template +void test_generate_rtree(bgi::rtree & tree, std::vector & input, Box & qbox) { - return P(x, y); + typedef bgi::rtree T; + typedef T::box_type B; + typedef T::value_type V; + + test_generate< + bgi::traits::dimension::value + >::apply(input, qbox); + + tree.insert(input.begin(), input.end()); } -template -bg::model::box

    test_gen_box(int x, int y) +// rtree queries tests + +template +void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { - return bg::model::box

    (P(x, y), P(x + 2, y + 3)); + std::vector expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::intersects(tree.translator()(v), qbox) ) + expected_output.push_back(v); + + test(tree, qbox, expected_output); + test(tree, bgi::intersects(qbox), expected_output); + test(tree, !bgi::not_intersects(qbox), expected_output); + test(tree, !bgi::disjoint(qbox), expected_output); + test(tree, bgi::not_disjoint(qbox), expected_output); } -template -std::pair, int> test_gen_box_pair(int x, int y) -{ - return std::make_pair(bg::model::box

    (P(x, y), P(x + 2, y + 3)), x + y * 100); -} +// low level test functions template Iter test_find(Rtree const& rtree, Iter first, Iter last, Value const& value) From 45c945b16251de89ed5a4e00881b471179cf125e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 27 Jun 2012 11:26:53 +0000 Subject: [PATCH 115/366] implemented tests for rtree spatial queries in 2d and 3d. [SVN r79133] --- test/rtree/rtree2d.cpp | 50 +++-------- test/rtree/rtree3d.cpp | 50 +++-------- test/rtree/test_rtree.hpp | 179 +++++++++++++++++++++++++++++++------- 3 files changed, 170 insertions(+), 109 deletions(-) diff --git a/test/rtree/rtree2d.cpp b/test/rtree/rtree2d.cpp index c9595b95c..b8f01990e 100644 --- a/test/rtree/rtree2d.cpp +++ b/test/rtree/rtree2d.cpp @@ -18,54 +18,28 @@ #include #include -template -void test_rtree_by_point() -{ - typedef bg::model::box

    B; - typedef std::pair V; - B qbox; - { - bgi::rtree tree; - std::vector

    input; - test_generate_rtree(tree, input, qbox); - test_intersects(tree, input, qbox); - } - { - bgi::rtree tree; - std::vector input; - test_generate_rtree(tree, input, qbox); - test_intersects(tree, input, qbox); - } - { - bgi::rtree tree; - std::vector input; - test_generate_rtree(tree, input, qbox); - test_intersects(tree, input, qbox); - } -} - int test_main(int, char* []) { typedef bg::model::point P2ic; typedef bg::model::point P2fc; typedef bg::model::point P2dc; - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); #ifdef HAVE_TTMATH typedef bg::model::point P2ttmc; - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); #endif return 0; diff --git a/test/rtree/rtree3d.cpp b/test/rtree/rtree3d.cpp index 695243c61..99525a026 100644 --- a/test/rtree/rtree3d.cpp +++ b/test/rtree/rtree3d.cpp @@ -18,54 +18,28 @@ #include #include -template -void test_rtree_by_point() -{ - typedef bg::model::box

    B; - typedef std::pair V; - B qbox; - { - bgi::rtree tree; - std::vector

    input; - test_generate_rtree(tree, input, qbox); - test_intersects(tree, input, qbox); - } - { - bgi::rtree tree; - std::vector input; - test_generate_rtree(tree, input, qbox); - test_intersects(tree, input, qbox); - } - { - bgi::rtree tree; - std::vector input; - test_generate_rtree(tree, input, qbox); - test_intersects(tree, input, qbox); - } -} - int test_main(int, char* []) { typedef bg::model::point P3ic; typedef bg::model::point P3fc; typedef bg::model::point P3dc; - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); #ifdef HAVE_TTMATH typedef bg::model::point P3ttmc; - test_rtree_by_point >(); - test_rtree_by_point >(); - test_rtree_by_point >(); + test_rtree >(); + test_rtree >(); + test_rtree >(); #endif return 0; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 746513d02..87c3e2152 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -28,11 +28,11 @@ // Values, input and rtree generation template -struct test_generate_value +struct generate_value {}; template -struct test_generate_value< bg::model::point > +struct generate_value< bg::model::point > { typedef bg::model::point P; static P apply(int x, int y) @@ -42,7 +42,7 @@ struct test_generate_value< bg::model::point > }; template -struct test_generate_value< bg::model::box< bg::model::point > > +struct generate_value< bg::model::box< bg::model::point > > { typedef bg::model::point P; typedef bg::model::box

    B; @@ -53,7 +53,18 @@ struct test_generate_value< bg::model::box< bg::model::point > > }; template -struct test_generate_value< std::pair >, int> > +struct generate_value< std::pair, int> > +{ + typedef bg::model::point P; + typedef std::pair R; + static R apply(int x, int y) + { + return std::make_pair(P(x, y), x + y * 100); + } +}; + +template +struct generate_value< std::pair >, int> > { typedef bg::model::point P; typedef bg::model::box

    B; @@ -65,7 +76,7 @@ struct test_generate_value< std::pair }; template -struct test_generate_value< bg::model::point > +struct generate_value< bg::model::point > { typedef bg::model::point P; static P apply(int x, int y, int z) @@ -75,7 +86,7 @@ struct test_generate_value< bg::model::point > }; template -struct test_generate_value< bg::model::box< bg::model::point > > +struct generate_value< bg::model::box< bg::model::point > > { typedef bg::model::point P; typedef bg::model::box

    B; @@ -86,7 +97,18 @@ struct test_generate_value< bg::model::box< bg::model::point > > }; template -struct test_generate_value< std::pair >, int> > +struct generate_value< std::pair, int> > +{ + typedef bg::model::point P; + typedef std::pair R; + static R apply(int x, int y, int z) + { + return std::make_pair(P(x, y, z), x + y * 100 + z * 10000); + } +}; + +template +struct generate_value< std::pair >, int> > { typedef bg::model::point P; typedef bg::model::box

    B; @@ -98,11 +120,11 @@ struct test_generate_value< std::pair }; template -struct test_generate +struct generate_input {}; template <> -struct test_generate<2> +struct generate_input<2> { template static void apply(std::vector & input, Box & qbox) @@ -111,7 +133,7 @@ struct test_generate<2> { for ( int j = 1 ; j < 25 ; j += 4 ) { - input.push_back( test_generate_value::apply(i, j) ); + input.push_back( generate_value::apply(i, j) ); } } @@ -122,7 +144,7 @@ struct test_generate<2> }; template <> -struct test_generate<3> +struct generate_input<3> { template static void apply(std::vector & input, Box & qbox) @@ -133,7 +155,7 @@ struct test_generate<3> { for ( int k = 2 ; k < 12 ; k += 5 ) { - input.push_back( test_generate_value::apply(i, j, k) ); + input.push_back( generate_value::apply(i, j, k) ); } } } @@ -145,37 +167,19 @@ struct test_generate<3> }; template -void test_generate_rtree(bgi::rtree & tree, std::vector & input, Box & qbox) +void generate_rtree(bgi::rtree & tree, std::vector & input, Box & qbox) { typedef bgi::rtree T; typedef T::box_type B; typedef T::value_type V; - test_generate< + generate_input< bgi::traits::dimension::value >::apply(input, qbox); tree.insert(input.begin(), input.end()); } -// rtree queries tests - -template -void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) -{ - std::vector expected_output; - - BOOST_FOREACH(Value const& v, input) - if ( bg::intersects(tree.translator()(v), qbox) ) - expected_output.push_back(v); - - test(tree, qbox, expected_output); - test(tree, bgi::intersects(qbox), expected_output); - test(tree, !bgi::not_intersects(qbox), expected_output); - test(tree, !bgi::disjoint(qbox), expected_output); - test(tree, bgi::not_disjoint(qbox), expected_output); -} - // low level test functions template @@ -200,7 +204,7 @@ void test_compare_outputs(Rtree const& rtree, std::vector const& output, } template -void test(Rtree & rtree, Predicates const& pred, std::vector const& expected_output) +void test_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) ); @@ -212,4 +216,113 @@ void test(Rtree & rtree, Predicates const& pred, std::vector const& expec test_compare_outputs(rtree, output, expected_output); } +// rtree queries tests + +template +void test_intersects_and_disjoint(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +{ + std::vector expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::intersects(tree.translator()(v), qbox) ) + expected_output.push_back(v); + + test_query(tree, qbox, expected_output); + test_query(tree, bgi::intersects(qbox), expected_output); + test_query(tree, !bgi::not_intersects(qbox), expected_output); + test_query(tree, !bgi::disjoint(qbox), expected_output); + test_query(tree, bgi::not_disjoint(qbox), expected_output); +} + +template +void test_covered_by(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +{ + std::vector expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::covered_by(tree.translator()(v), qbox) ) + expected_output.push_back(v); + + test_query(tree, bgi::covered_by(qbox), expected_output); +} + +template +struct test_overlap_impl {}; + +template <> +struct test_overlap_impl +{ + template + static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) + {} +}; + +template <> +struct test_overlap_impl +{ + template + static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) + { + std::vector expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::overlaps(tree.translator()(v), qbox) ) + expected_output.push_back(v); + + test_query(tree, bgi::overlaps(qbox), expected_output); + } +}; + +template +void test_overlaps(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +{ + test_overlap_impl< + bgi::traits::tag< + typename bgi::rtree::indexable_type + >::type + >::apply(tree, input, qbox); +} + +template +void test_within(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +{ + std::vector expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::within(tree.translator()(v), qbox) ) + expected_output.push_back(v); + + test_query(tree, bgi::within(qbox), expected_output); +} + +template +void test_rtree_queries() +{ + typedef bgi::rtree Tree; + typedef Tree::box_type B; + + Tree tree; + std::vector input; + B qbox; + + generate_rtree(tree, input, qbox); + test_intersects_and_disjoint(tree, input, qbox); + test_covered_by(tree, input, qbox); + test_overlaps(tree, input, qbox); + test_within(tree, input, qbox); +} + +template +void test_rtree() +{ + typedef bg::model::box Box; + typedef std::pair PairB; + typedef std::pair PairP; + + test_rtree_queries(); + test_rtree_queries(); + test_rtree_queries(); + test_rtree_queries(); +} + #endif From 8339c81d8843d2ce82a89ded11c41aca407341f5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 27 Jun 2012 11:44:44 +0000 Subject: [PATCH 116/366] rtree tests divided into several files. [SVN r79134] --- test/Jamfile.v2 | 7 ++-- test/algorithms/Jamfile.v2 | 1 + test/algorithms/content.cpp | 1 + test/algorithms/intersection_content.cpp | 1 + test/algorithms/is_valid.cpp | 1 + test/algorithms/margin.cpp | 1 + test/algorithms/minmaxdist.cpp | 1 + test/algorithms/union_content.cpp | 1 + test/geometry_index_test_common.hpp | 1 + test/rtree/Jamfile.v2 | 9 ++++- test/rtree/rtree2d_linear.cpp | 39 +++++++++++++++++++ .../{rtree2d.cpp => rtree2d_quadratic.cpp} | 9 +---- test/rtree/rtree2d_rstar.cpp | 39 +++++++++++++++++++ test/rtree/rtree3d_linear.cpp | 39 +++++++++++++++++++ .../{rtree3d.cpp => rtree3d_quadratic.cpp} | 9 +---- test/rtree/rtree3d_rstar.cpp | 39 +++++++++++++++++++ 16 files changed, 177 insertions(+), 21 deletions(-) create mode 100644 test/rtree/rtree2d_linear.cpp rename test/rtree/{rtree2d.cpp => rtree2d_quadratic.cpp} (78%) create mode 100644 test/rtree/rtree2d_rstar.cpp create mode 100644 test/rtree/rtree3d_linear.cpp rename test/rtree/{rtree3d.cpp => rtree3d_quadratic.cpp} (78%) create mode 100644 test/rtree/rtree3d_rstar.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index d0dee4afd..8eeb345e3 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -3,6 +3,7 @@ # Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. # Copyright (c) 2008-2012 Bruno Lalande, Paris, France. # Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,9 +15,9 @@ project boost-geometry-index-test : requirements . - .. - ../.. - ../../.. + .. + ../.. + ../../.. #../../../boost/geometry/extensions/contrib/ttmath msvc:on ; diff --git a/test/algorithms/Jamfile.v2 b/test/algorithms/Jamfile.v2 index 619f13dd3..a1eecfe3b 100644 --- a/test/algorithms/Jamfile.v2 +++ b/test/algorithms/Jamfile.v2 @@ -3,6 +3,7 @@ # Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. # Copyright (c) 2008-2012 Bruno Lalande, Paris, France. # Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/algorithms/content.cpp b/test/algorithms/content.cpp index b6d01d8cf..d49253d01 100644 --- a/test/algorithms/content.cpp +++ b/test/algorithms/content.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. diff --git a/test/algorithms/intersection_content.cpp b/test/algorithms/intersection_content.cpp index 70819d20c..07f427c12 100644 --- a/test/algorithms/intersection_content.cpp +++ b/test/algorithms/intersection_content.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. diff --git a/test/algorithms/is_valid.cpp b/test/algorithms/is_valid.cpp index b7f4983c1..64ee21137 100644 --- a/test/algorithms/is_valid.cpp +++ b/test/algorithms/is_valid.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. diff --git a/test/algorithms/margin.cpp b/test/algorithms/margin.cpp index 6a825b458..39284901d 100644 --- a/test/algorithms/margin.cpp +++ b/test/algorithms/margin.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. diff --git a/test/algorithms/minmaxdist.cpp b/test/algorithms/minmaxdist.cpp index b0a84915b..4fd0af130 100644 --- a/test/algorithms/minmaxdist.cpp +++ b/test/algorithms/minmaxdist.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. diff --git a/test/algorithms/union_content.cpp b/test/algorithms/union_content.cpp index 4a8c92e93..84313cc8e 100644 --- a/test/algorithms/union_content.cpp +++ b/test/algorithms/union_content.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp index 3ca1da626..c7680a2a2 100644 --- a/test/geometry_index_test_common.hpp +++ b/test/geometry_index_test_common.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index 685361f2b..cb0004356 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -3,6 +3,7 @@ # Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. # Copyright (c) 2008-2012 Bruno Lalande, Paris, France. # Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -10,7 +11,11 @@ test-suite boost-geometry-index-rtree : - [ run rtree2d.cpp ] - [ run rtree3d.cpp ] + [ run rtree2d_linear.cpp ] + [ run rtree2d_quadratic.cpp ] + [ run rtree2d_rstar.cpp ] + [ run rtree3d_linear.cpp ] + [ run rtree3d_quadratic.cpp ] + [ run rtree3d_rstar.cpp ] ; diff --git a/test/rtree/rtree2d_linear.cpp b/test/rtree/rtree2d_linear.cpp new file mode 100644 index 000000000..5be2f5fa7 --- /dev/null +++ b/test/rtree/rtree2d_linear.cpp @@ -0,0 +1,39 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + test_rtree >(); + test_rtree >(); + test_rtree >(); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + + test_rtree >(); +#endif + + return 0; +} diff --git a/test/rtree/rtree2d.cpp b/test/rtree/rtree2d_quadratic.cpp similarity index 78% rename from test/rtree/rtree2d.cpp rename to test/rtree/rtree2d_quadratic.cpp index b8f01990e..c97d5ec66 100644 --- a/test/rtree/rtree2d.cpp +++ b/test/rtree/rtree2d_quadratic.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -24,22 +25,14 @@ int test_main(int, char* []) typedef bg::model::point P2fc; typedef bg::model::point P2dc; - test_rtree >(); - test_rtree >(); - test_rtree >(); test_rtree >(); test_rtree >(); test_rtree >(); - test_rtree >(); - test_rtree >(); - test_rtree >(); #ifdef HAVE_TTMATH typedef bg::model::point P2ttmc; - test_rtree >(); test_rtree >(); - test_rtree >(); #endif return 0; diff --git a/test/rtree/rtree2d_rstar.cpp b/test/rtree/rtree2d_rstar.cpp new file mode 100644 index 000000000..9c5bd52d3 --- /dev/null +++ b/test/rtree/rtree2d_rstar.cpp @@ -0,0 +1,39 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + typedef bg::model::point P2fc; + typedef bg::model::point P2dc; + + test_rtree >(); + test_rtree >(); + test_rtree >(); + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + + test_rtree >(); +#endif + + return 0; +} diff --git a/test/rtree/rtree3d_linear.cpp b/test/rtree/rtree3d_linear.cpp new file mode 100644 index 000000000..cc123a8fd --- /dev/null +++ b/test/rtree/rtree3d_linear.cpp @@ -0,0 +1,39 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_rtree >(); + test_rtree >(); + test_rtree >(); + +#ifdef HAVE_TTMATH + typedef bg::model::point P3ttmc; + + test_rtree >(); +#endif + + return 0; +} diff --git a/test/rtree/rtree3d.cpp b/test/rtree/rtree3d_quadratic.cpp similarity index 78% rename from test/rtree/rtree3d.cpp rename to test/rtree/rtree3d_quadratic.cpp index 99525a026..a2894c5ef 100644 --- a/test/rtree/rtree3d.cpp +++ b/test/rtree/rtree3d_quadratic.cpp @@ -4,6 +4,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -24,22 +25,14 @@ int test_main(int, char* []) typedef bg::model::point P3fc; typedef bg::model::point P3dc; - test_rtree >(); - test_rtree >(); - test_rtree >(); test_rtree >(); test_rtree >(); test_rtree >(); - test_rtree >(); - test_rtree >(); - test_rtree >(); #ifdef HAVE_TTMATH typedef bg::model::point P3ttmc; - test_rtree >(); test_rtree >(); - test_rtree >(); #endif return 0; diff --git a/test/rtree/rtree3d_rstar.cpp b/test/rtree/rtree3d_rstar.cpp new file mode 100644 index 000000000..1af873a46 --- /dev/null +++ b/test/rtree/rtree3d_rstar.cpp @@ -0,0 +1,39 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + typedef bg::model::point P3fc; + typedef bg::model::point P3dc; + + test_rtree >(); + test_rtree >(); + test_rtree >(); + +#ifdef HAVE_TTMATH + typedef bg::model::point P3ttmc; + + test_rtree >(); +#endif + + return 0; +} From f9b2279725cafd5ad5b2287320ced01f7e38a621 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 27 Jun 2012 12:25:38 +0000 Subject: [PATCH 117/366] Added rtree predicate index::touches(). The code is commented out since the geometry::touches() algorithm is probably not finished yet. Fixed GCC compile errors in tests. [SVN r79135] --- .../geometry/extensions/index/predicates.hpp | 60 +++++++++++++++ .../extensions/index/rtree/predicates.hpp | 20 +++++ test/rtree/test_rtree.hpp | 74 ++++++++++++++----- 3 files changed, 135 insertions(+), 19 deletions(-) diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 1c40fa604..63358a94f 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -60,6 +60,13 @@ struct overlaps Geometry geometry; }; +//template +//struct touches +//{ +// touches(Geometry const& g) : geometry(g) {} +// Geometry geometry; +//}; + template struct within { @@ -95,6 +102,13 @@ struct not_overlaps Geometry geometry; }; +//template +//struct not_touches +//{ +// not_touches(Geometry const& g) : geometry(g) {} +// Geometry geometry; +//}; + template struct not_within { @@ -141,6 +155,12 @@ inline detail::overlaps overlaps(Geometry const& g) return detail::overlaps(g); } +//template +//inline detail::touches touches(Geometry const& g) +//{ +// return detail::touches(g); +//} + template inline detail::within within(Geometry const& g) { @@ -171,6 +191,12 @@ inline detail::not_overlaps not_overlaps(Geometry const& g) return detail::not_overlaps(g); } +//template +//inline detail::not_touches not_touches(Geometry const& g) +//{ +// return detail::not_touches(g); +//} + template inline detail::not_within not_within(Geometry const& g) { @@ -255,6 +281,16 @@ struct predicate_check, Tag> } }; +//template +//struct predicate_check, Tag> +//{ +// template +// static inline bool apply(touches const& p, Value const&, Indexable const& i) +// { +// return geometry::touches(i, p.geometry); +// } +//}; + template struct predicate_check, Tag> { @@ -305,6 +341,16 @@ struct predicate_check, Tag> } }; +//template +//struct predicate_check, Tag> +//{ +// template +// static inline bool apply(not_touches const& p, Value const&, Indexable const& i) +// { +// return !geometry::touches(i, p.geometry); +// } +//}; + template struct predicate_check, Tag> { @@ -457,6 +503,20 @@ operator!(boost::geometry::index::detail::not_overlaps const& p) return boost::geometry::index::detail::overlaps(p.geometry); } +//template +//boost::geometry::index::detail::not_touches +//operator!(boost::geometry::index::detail::touches const& p) +//{ +// return boost::geometry::index::detail::not_touches(p.geometry); +//} +// +//template +//boost::geometry::index::detail::touches +//operator!(boost::geometry::index::detail::not_touches const& p) +//{ +// return boost::geometry::index::detail::touches(p.geometry); +//} + template boost::geometry::index::detail::not_within operator!(boost::geometry::index::detail::within const& p) diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index 5718e520d..2d6c6ae27 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -92,6 +92,16 @@ struct predicate_check, rtree::node_tag> } }; +//template +//struct predicate_check, rtree::node_tag> +//{ +// template +// static bool apply(touches const& p, Value const&, Box const& i) +// { +// return geometry::intersects(i, p.geometry); +// } +//}; + template struct predicate_check, rtree::node_tag> { @@ -144,6 +154,16 @@ struct predicate_check, rtree::node_tag> } }; +//template +//struct predicate_check, rtree::node_tag> +//{ +// template +// static bool apply(not_touches const& p, Value const&, Box const& i) +// { +// return !geometry::intersects(i, p.geometry); +// } +//}; + template struct predicate_check, rtree::node_tag> { diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 87c3e2152..5b01ce710 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -137,7 +137,7 @@ struct generate_input<2> } } - typedef bg::traits::point_type::type P; + typedef typename bg::traits::point_type::type P; qbox = Box(P(3, 0), P(10, 9)); } @@ -160,7 +160,7 @@ struct generate_input<3> } } - typedef bg::traits::point_type::type P; + typedef typename bg::traits::point_type::type P; qbox = Box(P(3, 0, 3), P(10, 9, 11)); } @@ -170,11 +170,12 @@ template void generate_rtree(bgi::rtree & tree, std::vector & input, Box & qbox) { typedef bgi::rtree T; - typedef T::box_type B; - typedef T::value_type V; + typedef typename T::box_type B; + typedef typename T::value_type V; + typedef typename T::indexable_type I; generate_input< - bgi::traits::dimension::value + bgi::traits::dimension::value >::apply(input, qbox); tree.insert(input.begin(), input.end()); @@ -247,18 +248,7 @@ void test_covered_by(bgi::rtree const& tree, std::vector con } template -struct test_overlap_impl {}; - -template <> -struct test_overlap_impl -{ - template - static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) - {} -}; - -template <> -struct test_overlap_impl +struct test_overlap_impl { template static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) @@ -273,16 +263,61 @@ struct test_overlap_impl } }; +template <> +struct test_overlap_impl +{ + template + static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) + {} +}; + template void test_overlaps(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { test_overlap_impl< - bgi::traits::tag< + typename bgi::traits::tag< typename bgi::rtree::indexable_type >::type >::apply(tree, input, qbox); } +//template +//struct test_touches_impl +//{ +// template +// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +// {} +//}; +// +//template <> +//struct test_touches_impl +//{ +// template +// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +// { +// std::vector expected_output; +// +// BOOST_FOREACH(Value const& v, input) +// if ( bg::touches(tree.translator()(v), qbox) ) +// expected_output.push_back(v); +// +// test_query(tree, bgi::touches(qbox), expected_output); +// } +//}; +// +//template +//void test_touches(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +//{ +// test_touches_impl< +// bgi::traits::tag< +// typename bgi::rtree::indexable_type +// >::type, +// bgi::traits::dimension< +// typename bgi::rtree::indexable_type +// >::value +// >::apply(tree, input, qbox); +//} + template void test_within(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { @@ -299,7 +334,7 @@ template void test_rtree_queries() { typedef bgi::rtree Tree; - typedef Tree::box_type B; + typedef typename Tree::box_type B; Tree tree; std::vector input; @@ -309,6 +344,7 @@ void test_rtree_queries() test_intersects_and_disjoint(tree, input, qbox); test_covered_by(tree, input, qbox); test_overlaps(tree, input, qbox); + //test_touches(tree, input, qbox); test_within(tree, input, qbox); } From 34be8fbad5bad66c6dffaed7672a1a3610eb10f7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 27 Jun 2012 13:45:10 +0000 Subject: [PATCH 118/366] removed doubled algorithm index::overlap(). [SVN r79137] --- .../extensions/index/algorithms/overlap.hpp | 35 ------------------- .../index/rtree/rstar/choose_next_node.hpp | 27 +++++++------- test/algorithms/intersection_content.cpp | 3 -- test/algorithms/test_intersection_content.hpp | 4 --- 4 files changed, 13 insertions(+), 56 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/algorithms/overlap.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/overlap.hpp b/include/boost/geometry/extensions/index/algorithms/overlap.hpp deleted file mode 100644 index ce0e0a260..000000000 --- a/include/boost/geometry/extensions/index/algorithms/overlap.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - n-dimensional area/volume of boxes intersecion/overlap -// -// Copyright 2011 Adam Wulkiewicz. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP - -#include -#include - -namespace boost { namespace geometry { namespace index { - -template -struct default_overlap_result -{ - typedef typename default_area_result::type type; -}; - -template -typename default_overlap_result::type overlap(Box const& b1, Box const& b2) -{ - Box inters; - geometry::assign_zero(inters); - geometry::intersection(b1, b2, inters); - return index::content(inters); -} - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index caf86f030..1c781ea82 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include @@ -40,7 +40,6 @@ class choose_next_node::type content_type; - typedef typename index::default_overlap_result::type overlap_type; public: template @@ -70,7 +69,7 @@ private: // choose index with smallest overlap change value, or content change or smallest content size_t choosen_index = 0; - overlap_type smallest_overlap_diff = std::numeric_limits::max(); + content_type smallest_overlap_diff = std::numeric_limits::max(); content_type smallest_content_diff = std::numeric_limits::max(); content_type smallest_content = std::numeric_limits::max(); @@ -87,8 +86,8 @@ private: content_type content = index::content(ch_i.first); content_type content_diff = index::content(box_exp) - content; - overlap_type overlap = 0; - overlap_type overlap_exp = 0; + content_type overlap = 0; + content_type overlap_exp = 0; // calculate overlap for ( size_t j = 0 ; j < children_count ; ++j ) @@ -97,12 +96,12 @@ private: { child_type const& ch_j = children[j]; - overlap += index::overlap(ch_i.first, ch_j.first); - overlap_exp += index::overlap(box_exp, ch_j.first); + overlap += index::intersection_content(ch_i.first, ch_j.first); + overlap_exp += index::intersection_content(box_exp, ch_j.first); } } - overlap_type overlap_diff = overlap_exp - overlap; + content_type overlap_diff = overlap_exp - overlap; // update result if ( overlap_diff < smallest_overlap_diff || @@ -148,7 +147,7 @@ private: // for overlap_cost_threshold child nodes find the one with smallest overlap value size_t choosen_index = 0; - overlap_type smallest_overlap_diff = std::numeric_limits::max(); + content_type smallest_overlap_diff = std::numeric_limits::max(); // for each node for (size_t i = 0 ; i < parameters_type::overlap_cost_threshold ; ++i ) @@ -162,8 +161,8 @@ private: // calculate expanded box of child node ch_i geometry::expand(box_exp, indexable); - overlap_type overlap = 0; - overlap_type overlap_exp = 0; + content_type overlap = 0; + content_type overlap_exp = 0; // calculate overlap for ( size_t j = 0 ; j < children_count ; ++j ) @@ -172,12 +171,12 @@ private: { child_type const& ch_j = children[j]; - overlap += index::overlap(ch_i.first, ch_j.first); - overlap_exp += index::overlap(box_exp, ch_j.first); + overlap += index::intersection_content(ch_i.first, ch_j.first); + overlap_exp += index::intersection_content(box_exp, ch_j.first); } } - overlap_type overlap_diff = overlap_exp - overlap; + content_type overlap_diff = overlap_exp - overlap; // update result if ( overlap_diff < smallest_overlap_diff ) diff --git a/test/algorithms/intersection_content.cpp b/test/algorithms/intersection_content.cpp index 07f427c12..864276d2b 100644 --- a/test/algorithms/intersection_content.cpp +++ b/test/algorithms/intersection_content.cpp @@ -40,9 +40,6 @@ void test_large_integers() double double_value = bgi::intersection_content(double_box1, double_box2); BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); - - // temp - BOOST_CHECK_CLOSE(bgi::overlap(int_box1, int_box2), bgi::overlap(double_box1, double_box2), 0.0001); } int test_main(int, char* []) diff --git a/test/algorithms/test_intersection_content.hpp b/test/algorithms/test_intersection_content.hpp index 415acfa61..c07ff6ee8 100644 --- a/test/algorithms/test_intersection_content.hpp +++ b/test/algorithms/test_intersection_content.hpp @@ -14,7 +14,6 @@ #include #include -#include template void test_intersection_content(Geometry const& geometry1, Geometry const& geometry2, @@ -34,9 +33,6 @@ void test_intersection_content(Geometry const& geometry1, Geometry const& geomet #endif BOOST_CHECK_CLOSE(value, expected_value, 0.0001); - - // temp - BOOST_CHECK_CLOSE(bgi::overlap(geometry1, geometry2), expected_value, 0.0001); } template From 58e9b22f9bb6c53e70ca4a4f7f60be1ee1f1eb40 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 22 Aug 2012 14:59:29 +0000 Subject: [PATCH 119/366] Implemented moving semantics in the r-tree. [SVN r80142] --- .../geometry/extensions/index/rtree/rtree.hpp | 132 ++++++++++++++---- 1 file changed, 107 insertions(+), 25 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 715641849..132fee23d 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -12,7 +12,9 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP #include + #include +#include #include @@ -60,6 +62,8 @@ template < > class rtree { + BOOST_COPYABLE_AND_MOVABLE(rtree) + public: typedef Value value_type; typedef Translator translator_type; @@ -90,7 +94,7 @@ public: , m_translator(translator) , m_allocators(allocator) { - create(); + this->create(); } /*! @@ -102,14 +106,15 @@ public: \param allocator The allocator object. */ template - inline explicit rtree(Iterator first, Iterator last, translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) + inline rtree(Iterator first, Iterator last, translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) : m_values_count(0) , m_root(0) , m_leafs_level(0) , m_translator(translator) + , m_allocators(allocator) { - create(); - insert(first, last); + this->create(); + this->insert(first, last); } /*! @@ -117,7 +122,8 @@ public: */ inline ~rtree() { - destroy(*this); + if ( !this->empty() ) + this->destroy(*this); } /*! @@ -126,42 +132,118 @@ public: inline rtree(rtree const& src) : m_allocators(src.m_allocators) { + //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() + try { - copy(src, *this); + this->copy(src, *this); } catch(...) { - destroy(*this); + this->destroy(*this); throw; } } /*! - The assignment operator. + The copy constructor. */ - inline rtree & operator=(rtree const& src) + inline rtree(rtree const& src, Allocator const& allocator) + : m_allocators(allocator) { - if ( &src == this ) - return *this; - - destroy(*this); - - m_allocators = src.m_allocators; - try { - copy(src, *this); + this->copy(src, *this); } catch(...) { - destroy(*this); + this->destroy(*this); + throw; + } + } + + /*! + The moving constructor. + */ + inline rtree(BOOST_RV_REF(rtree) src) + : m_values_count(src.m_values_count) + , m_root(src.m_root) + , m_leafs_level(src.m_leafs_level) + , m_translator(src.m_translator) + , m_allocators(src.m_allocators) + { + src.m_values_count = 0; + src.m_root = 0; + src.m_leafs_level = 0; + } + + /*! + The assignment operator. + */ + inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) + { + //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment + + if ( &src == this ) + return *this; + + if ( !this->empty() ) + this->destroy(*this); + + //m_allocators = src.m_allocators; + + try + { + this->copy(src, *this); + } + catch(...) + { + this->destroy(*this); throw; } return *this; } + /*! + The moving assignment. + */ + inline rtree & operator=(BOOST_RV_REF(rtree) src) + { + //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment + + if ( this == &src ) + return *this; + + if ( !this->empty() ) + this->destroy(*this); + + //m_allocators = src.m_allocators; + + if ( m_allocators == src.m_allocators) + { + m_values_count = src.m_values_count; + src.m_values_count = 0; + m_root = src.m_root; + src.m_root = 0; + m_leafs_level = src.m_leafs_level; + src.m_leafs_level = 0; + m_translator = src.m_translator; + } + else + { + try + { + this->copy(src, *this); + } + catch(...) + { + this->destroy(*this); + throw; + } + } + } + /*! Insert a value to the index. @@ -189,7 +271,7 @@ public: } catch(...) { - destroy(*this); + this->destroy(*this); throw; } } @@ -204,7 +286,7 @@ public: inline void insert(Iterator first, Iterator last) { for ( ; first != last ; ++first ) - insert(*first); + this->insert(*first); } /*! @@ -234,7 +316,7 @@ public: } catch(...) { - destroy(*this); + this->destroy(*this); throw; } } @@ -249,7 +331,7 @@ public: inline void remove(Iterator first, Iterator last) { for ( ; first != last ; ++first ) - remove(*first); + this->remove(*first); } /*! @@ -358,8 +440,8 @@ public: */ inline void clear() { - destroy(*this); - create(); + this->destroy(*this); + this->create(); } /*! @@ -371,7 +453,7 @@ public: */ inline box_type box() const { - if ( empty() ) + if ( this->empty() ) { box_type result; geometry::assign_inverse(result); From 0231d54d6d880a7ab2b494213f809e3ad8db08a4 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 22 Aug 2012 18:52:05 +0000 Subject: [PATCH 120/366] r-tree reference return in moving assignment operator added, r-tree copying and moving tests implemented. [SVN r80144] --- .../geometry/extensions/index/rtree/rtree.hpp | 6 +- test/rtree/test_rtree.hpp | 90 ++++++++++++++++--- 2 files changed, 84 insertions(+), 12 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 132fee23d..6bc99b767 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -184,7 +184,7 @@ public: { //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( &src == this ) + if ( this == &src ) return *this; if ( !this->empty() ) @@ -220,7 +220,7 @@ public: //m_allocators = src.m_allocators; - if ( m_allocators == src.m_allocators) + if ( m_allocators.allocator == src.m_allocators.allocator) { m_values_count = src.m_values_count; src.m_values_count = 0; @@ -242,6 +242,8 @@ public: throw; } } + + return *this; } /*! diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 5b01ce710..38411aeaf 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -195,12 +195,36 @@ Iter test_find(Rtree const& rtree, Iter first, Iter last, Value const& value) template void test_compare_outputs(Rtree const& rtree, std::vector const& output, std::vector const& expected_output) { - typename Rtree::translator_type tr = rtree.translator(); - - BOOST_CHECK( expected_output.size() == output.size() ); - BOOST_FOREACH(Value const& v, expected_output) + bool are_sizes_ok = (expected_output.size() == output.size()); + BOOST_CHECK( are_sizes_ok ); + if ( are_sizes_ok ) { - BOOST_CHECK(test_find(rtree, output.begin(), output.end(), v) != output.end() ); + BOOST_FOREACH(Value const& v, expected_output) + { + BOOST_CHECK(test_find(rtree, output.begin(), output.end(), v) != output.end() ); + } + } +} + +template +void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Range2 const& expected_output) +{ + size_t s1 = std::distance(output.begin(), output.end()); + size_t s2 = std::distance(expected_output.begin(), expected_output.end()); + BOOST_CHECK(s1 == s2); + + if ( s1 == s2 ) + { + Range1::const_iterator it1 = output.begin(); + Range2::const_iterator it2 = expected_output.begin(); + for ( ; it1 != output.end() && it2 != expected_output.end() ; ++it1, ++it2 ) + { + if ( !rtree.translator().equals(*it1, *it2) ) + { + BOOST_CHECK(false); + break; + } + } } } @@ -215,6 +239,14 @@ void test_query(Rtree & rtree, Predicates const& pred, std::vector const& BOOST_CHECK( expected_output.size() == n ); test_compare_outputs(rtree, output, expected_output); + + std::vector output2; + size_t n2 = query(rtree, pred, std::back_inserter(output2)); + + BOOST_CHECK( n == n2 ); + test_exactly_the_same_outputs(rtree, output, output2); + + test_exactly_the_same_outputs(rtree, output, rtree | bgi::query_filtered(pred)); } // rtree queries tests @@ -330,8 +362,43 @@ void test_within(bgi::rtree const& tree, std::vector const& test_query(tree, bgi::within(qbox), expected_output); } +template +void test_copy_assignment_move(bgi::rtree & tree, Box const& qbox) +{ + std::vector expected_output; + tree.query(qbox, std::back_inserter(expected_output)); + + // copy constructor + bgi::rtree t1(tree); + + std::vector output; + t1.query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t1, output, expected_output); + + // copying assignment operator + t1 = tree; + + output.clear(); + t1.query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t1, output, expected_output); + + // moving constructor + bgi::rtree t2(boost::move(tree)); + + output.clear(); + t2.query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t2, output, expected_output); + + // moving assignment operator + t2 = boost::move(t1); + + output.clear(); + t2.query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t2, output, expected_output); +} + template -void test_rtree_queries() +void test_rtree_by_value() { typedef bgi::rtree Tree; typedef typename Tree::box_type B; @@ -341,11 +408,14 @@ void test_rtree_queries() B qbox; generate_rtree(tree, input, qbox); + test_intersects_and_disjoint(tree, input, qbox); test_covered_by(tree, input, qbox); test_overlaps(tree, input, qbox); //test_touches(tree, input, qbox); test_within(tree, input, qbox); + + test_copy_assignment_move(tree, qbox); } template @@ -355,10 +425,10 @@ void test_rtree() typedef std::pair PairB; typedef std::pair PairP; - test_rtree_queries(); - test_rtree_queries(); - test_rtree_queries(); - test_rtree_queries(); + test_rtree_by_value(); + test_rtree_by_value(); + test_rtree_by_value(); + test_rtree_by_value(); } #endif From 6302ef001e14ac748a087ecd87b78a4b8650990b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 22 Aug 2012 22:16:35 +0000 Subject: [PATCH 121/366] added r-tree basic knn search test, gcc compilation errors fixed, *.cpp test files divided to more smaller files. [SVN r80148] --- test/rtree/Jamfile.v2 | 35 ++++- test/rtree/rtree2d_linear_d.cpp | 29 ++++ test/rtree/rtree2d_linear_f.cpp | 29 ++++ test/rtree/rtree2d_linear_i.cpp | 29 ++++ ...ree2d_linear.cpp => rtree2d_linear_tt.cpp} | 7 - test/rtree/rtree2d_quadratic_d.cpp | 29 ++++ test/rtree/rtree2d_quadratic_f.cpp | 29 ++++ test/rtree/rtree2d_quadratic_i.cpp | 29 ++++ ...quadratic.cpp => rtree2d_quadratic_tt.cpp} | 7 - test/rtree/rtree2d_rstar_d.cpp | 29 ++++ test/rtree/rtree2d_rstar_f.cpp | 29 ++++ test/rtree/rtree2d_rstar_i.cpp | 29 ++++ ...rtree2d_rstar.cpp => rtree2d_rstar_tt.cpp} | 7 - test/rtree/rtree3d_linear_d.cpp | 29 ++++ test/rtree/rtree3d_linear_f.cpp | 29 ++++ test/rtree/rtree3d_linear_i.cpp | 29 ++++ ...ree3d_linear.cpp => rtree3d_linear_tt.cpp} | 7 - test/rtree/rtree3d_quadratic_d.cpp | 29 ++++ test/rtree/rtree3d_quadratic_f.cpp | 29 ++++ test/rtree/rtree3d_quadratic_i.cpp | 29 ++++ ...quadratic.cpp => rtree3d_quadratic_tt.cpp} | 7 - test/rtree/rtree3d_rstar_d.cpp | 29 ++++ test/rtree/rtree3d_rstar_f.cpp | 29 ++++ test/rtree/rtree3d_rstar_i.cpp | 29 ++++ ...rtree3d_rstar.cpp => rtree3d_rstar_tt.cpp} | 7 - test/rtree/test_rtree.hpp | 146 +++++++++++++++++- 26 files changed, 693 insertions(+), 52 deletions(-) create mode 100644 test/rtree/rtree2d_linear_d.cpp create mode 100644 test/rtree/rtree2d_linear_f.cpp create mode 100644 test/rtree/rtree2d_linear_i.cpp rename test/rtree/{rtree2d_linear.cpp => rtree2d_linear_tt.cpp} (75%) create mode 100644 test/rtree/rtree2d_quadratic_d.cpp create mode 100644 test/rtree/rtree2d_quadratic_f.cpp create mode 100644 test/rtree/rtree2d_quadratic_i.cpp rename test/rtree/{rtree2d_quadratic.cpp => rtree2d_quadratic_tt.cpp} (75%) create mode 100644 test/rtree/rtree2d_rstar_d.cpp create mode 100644 test/rtree/rtree2d_rstar_f.cpp create mode 100644 test/rtree/rtree2d_rstar_i.cpp rename test/rtree/{rtree2d_rstar.cpp => rtree2d_rstar_tt.cpp} (75%) create mode 100644 test/rtree/rtree3d_linear_d.cpp create mode 100644 test/rtree/rtree3d_linear_f.cpp create mode 100644 test/rtree/rtree3d_linear_i.cpp rename test/rtree/{rtree3d_linear.cpp => rtree3d_linear_tt.cpp} (75%) create mode 100644 test/rtree/rtree3d_quadratic_d.cpp create mode 100644 test/rtree/rtree3d_quadratic_f.cpp create mode 100644 test/rtree/rtree3d_quadratic_i.cpp rename test/rtree/{rtree3d_quadratic.cpp => rtree3d_quadratic_tt.cpp} (75%) create mode 100644 test/rtree/rtree3d_rstar_d.cpp create mode 100644 test/rtree/rtree3d_rstar_f.cpp create mode 100644 test/rtree/rtree3d_rstar_i.cpp rename test/rtree/{rtree3d_rstar.cpp => rtree3d_rstar_tt.cpp} (75%) diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index cb0004356..c9004cc2b 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -11,11 +11,34 @@ test-suite boost-geometry-index-rtree : - [ run rtree2d_linear.cpp ] - [ run rtree2d_quadratic.cpp ] - [ run rtree2d_rstar.cpp ] - [ run rtree3d_linear.cpp ] - [ run rtree3d_quadratic.cpp ] - [ run rtree3d_rstar.cpp ] + [ run rtree2d_linear_i.cpp ] + [ run rtree2d_linear_f.cpp ] + [ run rtree2d_linear_d.cpp ] + [ run rtree2d_linear_tt.cpp ] + + [ run rtree2d_quadratic_i.cpp ] + [ run rtree2d_quadratic_f.cpp ] + [ run rtree2d_quadratic_d.cpp ] + [ run rtree2d_quadratic_tt.cpp ] + + [ run rtree2d_rstar_i.cpp ] + [ run rtree2d_rstar_f.cpp ] + [ run rtree2d_rstar_d.cpp ] + [ run rtree2d_rstar_tt.cpp ] + + [ run rtree3d_linear_i.cpp ] + [ run rtree3d_linear_f.cpp ] + [ run rtree3d_linear_d.cpp ] + [ run rtree3d_linear_tt.cpp ] + + [ run rtree3d_quadratic_i.cpp ] + [ run rtree3d_quadratic_f.cpp ] + [ run rtree3d_quadratic_d.cpp ] + [ run rtree3d_quadratic_tt.cpp ] + + [ run rtree3d_rstar_i.cpp ] + [ run rtree3d_rstar_f.cpp ] + [ run rtree3d_rstar_d.cpp ] + [ run rtree3d_rstar_tt.cpp ] ; diff --git a/test/rtree/rtree2d_linear_d.cpp b/test/rtree/rtree2d_linear_d.cpp new file mode 100644 index 000000000..81f38c00e --- /dev/null +++ b/test/rtree/rtree2d_linear_d.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2dc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_linear_f.cpp b/test/rtree/rtree2d_linear_f.cpp new file mode 100644 index 000000000..73c703468 --- /dev/null +++ b/test/rtree/rtree2d_linear_f.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2fc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_linear_i.cpp b/test/rtree/rtree2d_linear_i.cpp new file mode 100644 index 000000000..3b48b6912 --- /dev/null +++ b/test/rtree/rtree2d_linear_i.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_linear.cpp b/test/rtree/rtree2d_linear_tt.cpp similarity index 75% rename from test/rtree/rtree2d_linear.cpp rename to test/rtree/rtree2d_linear_tt.cpp index 5be2f5fa7..374991ff2 100644 --- a/test/rtree/rtree2d_linear.cpp +++ b/test/rtree/rtree2d_linear_tt.cpp @@ -21,14 +21,7 @@ int test_main(int, char* []) { - typedef bg::model::point P2ic; - typedef bg::model::point P2fc; - typedef bg::model::point P2dc; - test_rtree >(); - test_rtree >(); - test_rtree >(); - #ifdef HAVE_TTMATH typedef bg::model::point P2ttmc; diff --git a/test/rtree/rtree2d_quadratic_d.cpp b/test/rtree/rtree2d_quadratic_d.cpp new file mode 100644 index 000000000..b813fef75 --- /dev/null +++ b/test/rtree/rtree2d_quadratic_d.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2dc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_quadratic_f.cpp b/test/rtree/rtree2d_quadratic_f.cpp new file mode 100644 index 000000000..547d17094 --- /dev/null +++ b/test/rtree/rtree2d_quadratic_f.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2fc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_quadratic_i.cpp b/test/rtree/rtree2d_quadratic_i.cpp new file mode 100644 index 000000000..4ae90d053 --- /dev/null +++ b/test/rtree/rtree2d_quadratic_i.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_quadratic.cpp b/test/rtree/rtree2d_quadratic_tt.cpp similarity index 75% rename from test/rtree/rtree2d_quadratic.cpp rename to test/rtree/rtree2d_quadratic_tt.cpp index c97d5ec66..9ab30853f 100644 --- a/test/rtree/rtree2d_quadratic.cpp +++ b/test/rtree/rtree2d_quadratic_tt.cpp @@ -21,14 +21,7 @@ int test_main(int, char* []) { - typedef bg::model::point P2ic; - typedef bg::model::point P2fc; - typedef bg::model::point P2dc; - test_rtree >(); - test_rtree >(); - test_rtree >(); - #ifdef HAVE_TTMATH typedef bg::model::point P2ttmc; diff --git a/test/rtree/rtree2d_rstar_d.cpp b/test/rtree/rtree2d_rstar_d.cpp new file mode 100644 index 000000000..ed23fa405 --- /dev/null +++ b/test/rtree/rtree2d_rstar_d.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2dc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_rstar_f.cpp b/test/rtree/rtree2d_rstar_f.cpp new file mode 100644 index 000000000..5be07e3a1 --- /dev/null +++ b/test/rtree/rtree2d_rstar_f.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2fc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_rstar_i.cpp b/test/rtree/rtree2d_rstar_i.cpp new file mode 100644 index 000000000..00502cacc --- /dev/null +++ b/test/rtree/rtree2d_rstar_i.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree2d_rstar.cpp b/test/rtree/rtree2d_rstar_tt.cpp similarity index 75% rename from test/rtree/rtree2d_rstar.cpp rename to test/rtree/rtree2d_rstar_tt.cpp index 9c5bd52d3..4e6ff71f8 100644 --- a/test/rtree/rtree2d_rstar.cpp +++ b/test/rtree/rtree2d_rstar_tt.cpp @@ -21,14 +21,7 @@ int test_main(int, char* []) { - typedef bg::model::point P2ic; - typedef bg::model::point P2fc; - typedef bg::model::point P2dc; - test_rtree >(); - test_rtree >(); - test_rtree >(); - #ifdef HAVE_TTMATH typedef bg::model::point P2ttmc; diff --git a/test/rtree/rtree3d_linear_d.cpp b/test/rtree/rtree3d_linear_d.cpp new file mode 100644 index 000000000..7f202f6f0 --- /dev/null +++ b/test/rtree/rtree3d_linear_d.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3dc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_linear_f.cpp b/test/rtree/rtree3d_linear_f.cpp new file mode 100644 index 000000000..459c37ee6 --- /dev/null +++ b/test/rtree/rtree3d_linear_f.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3fc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_linear_i.cpp b/test/rtree/rtree3d_linear_i.cpp new file mode 100644 index 000000000..191860bce --- /dev/null +++ b/test/rtree/rtree3d_linear_i.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_linear.cpp b/test/rtree/rtree3d_linear_tt.cpp similarity index 75% rename from test/rtree/rtree3d_linear.cpp rename to test/rtree/rtree3d_linear_tt.cpp index cc123a8fd..fb99c3186 100644 --- a/test/rtree/rtree3d_linear.cpp +++ b/test/rtree/rtree3d_linear_tt.cpp @@ -21,13 +21,6 @@ int test_main(int, char* []) { - typedef bg::model::point P3ic; - typedef bg::model::point P3fc; - typedef bg::model::point P3dc; - - test_rtree >(); - test_rtree >(); - test_rtree >(); #ifdef HAVE_TTMATH typedef bg::model::point P3ttmc; diff --git a/test/rtree/rtree3d_quadratic_d.cpp b/test/rtree/rtree3d_quadratic_d.cpp new file mode 100644 index 000000000..8d447ff38 --- /dev/null +++ b/test/rtree/rtree3d_quadratic_d.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3dc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_quadratic_f.cpp b/test/rtree/rtree3d_quadratic_f.cpp new file mode 100644 index 000000000..5b7e88210 --- /dev/null +++ b/test/rtree/rtree3d_quadratic_f.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3fc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_quadratic_i.cpp b/test/rtree/rtree3d_quadratic_i.cpp new file mode 100644 index 000000000..ef811af87 --- /dev/null +++ b/test/rtree/rtree3d_quadratic_i.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_quadratic.cpp b/test/rtree/rtree3d_quadratic_tt.cpp similarity index 75% rename from test/rtree/rtree3d_quadratic.cpp rename to test/rtree/rtree3d_quadratic_tt.cpp index a2894c5ef..093725739 100644 --- a/test/rtree/rtree3d_quadratic.cpp +++ b/test/rtree/rtree3d_quadratic_tt.cpp @@ -21,13 +21,6 @@ int test_main(int, char* []) { - typedef bg::model::point P3ic; - typedef bg::model::point P3fc; - typedef bg::model::point P3dc; - - test_rtree >(); - test_rtree >(); - test_rtree >(); #ifdef HAVE_TTMATH typedef bg::model::point P3ttmc; diff --git a/test/rtree/rtree3d_rstar_d.cpp b/test/rtree/rtree3d_rstar_d.cpp new file mode 100644 index 000000000..6e6820315 --- /dev/null +++ b/test/rtree/rtree3d_rstar_d.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3dc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_rstar_f.cpp b/test/rtree/rtree3d_rstar_f.cpp new file mode 100644 index 000000000..4033e1463 --- /dev/null +++ b/test/rtree/rtree3d_rstar_f.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3fc; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_rstar_i.cpp b/test/rtree/rtree3d_rstar_i.cpp new file mode 100644 index 000000000..43f2a6a29 --- /dev/null +++ b/test/rtree/rtree3d_rstar_i.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + + test_rtree >(); + + return 0; +} diff --git a/test/rtree/rtree3d_rstar.cpp b/test/rtree/rtree3d_rstar_tt.cpp similarity index 75% rename from test/rtree/rtree3d_rstar.cpp rename to test/rtree/rtree3d_rstar_tt.cpp index 1af873a46..dbf564e76 100644 --- a/test/rtree/rtree3d_rstar.cpp +++ b/test/rtree/rtree3d_rstar_tt.cpp @@ -21,14 +21,7 @@ int test_main(int, char* []) { - typedef bg::model::point P3ic; - typedef bg::model::point P3fc; - typedef bg::model::point P3dc; - test_rtree >(); - test_rtree >(); - test_rtree >(); - #ifdef HAVE_TTMATH typedef bg::model::point P3ttmc; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 38411aeaf..5ec0f9023 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -15,6 +15,7 @@ #include #include +#include #include @@ -215,19 +216,21 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran if ( s1 == s2 ) { - Range1::const_iterator it1 = output.begin(); - Range2::const_iterator it2 = expected_output.begin(); + typename Range1::const_iterator it1 = output.begin(); + typename Range2::const_iterator it2 = expected_output.begin(); for ( ; it1 != output.end() && it2 != expected_output.end() ; ++it1, ++it2 ) { if ( !rtree.translator().equals(*it1, *it2) ) { - BOOST_CHECK(false); + BOOST_CHECK(false && "rtree.translator().equals(*it1, *it2)"); break; } } } } +// spatial query + template void test_query(Rtree & rtree, Predicates const& pred, std::vector const& expected_output) { @@ -249,7 +252,7 @@ void test_query(Rtree & rtree, Predicates const& pred, std::vector const& test_exactly_the_same_outputs(rtree, output, rtree | bgi::query_filtered(pred)); } -// rtree queries tests +// rtree specific queries tests template void test_intersects_and_disjoint(bgi::rtree const& tree, std::vector const& input, Box const& qbox) @@ -362,6 +365,128 @@ void test_within(bgi::rtree const& tree, std::vector const& test_query(tree, bgi::within(qbox), expected_output); } +// rtree nearest queries + +template +void test_nearest(Rtree const& rtree, std::vector const& input, Point const& pt) +{ + // TODO: Nearest object may not be the same as found by the rtree if distances are equal + // Should all objects with the same closest distance be picked? + + typedef typename bg::default_distance_result::type D; + D smallest_d = std::numeric_limits::max(); + Value expected_output; + BOOST_FOREACH(Value const& v, input) + { + D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + if ( d < smallest_d ) + { + smallest_d = d; + expected_output = v; + } + } + size_t n = ( std::numeric_limits::max() == smallest_d ) ? 0 : 1; + + Value output; + size_t n_res = rtree.nearest(pt, output); + + BOOST_CHECK(n == n_res); + if ( n == n_res && 0 < n ) + { + // TODO - perform explicit check here? + // should all objects which are closest be checked and should exactly the same be found? + + if ( !rtree.translator().equals(output, expected_output) ) + { + D d1 = bgi::comparable_distance_near(pt, rtree.translator()(output)); + D d2 = bgi::comparable_distance_near(pt, rtree.translator()(expected_output)); + BOOST_CHECK(d1 == d2); + } + } +} + +template +struct TestNearestKLess +{ + typedef typename bg::default_distance_result::type D; + + template + bool operator()(std::pair const& p1, std::pair const& p2) const + { + return p1.first < p2.first; + } +}; + +template +struct TestNearestKTransform +{ + typedef typename bg::default_distance_result::type D; + + template + Value const& operator()(std::pair const& p) const + { + return p.second; + } +}; + +template +void test_nearest_k(Rtree const& rtree, std::vector const& input, Point const& pt, size_t k) +{ + // TODO: Nearest object may not be the same as found by the rtree if distances are equal + // All objects with the same closest distance should be picked + + typedef typename bg::default_distance_result::type D; + + std::vector< std::pair > test_output; + + // calculate test output - k closest values pairs + BOOST_FOREACH(Value const& v, input) + { + D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + + if ( test_output.size() < k ) + test_output.push_back(std::make_pair(d, v)); + else + { + std::sort(test_output.begin(), test_output.end(), TestNearestKLess()); + if ( d < test_output.back().first ) + test_output.back() = std::make_pair(d, v); + } + } + + // caluclate biggest distance + std::sort(test_output.begin(), test_output.end(), TestNearestKLess()); + D biggest_d = test_output.back().first; + + // transform test output to vector of values + std::vector expected_output(test_output.size()); + std::transform(test_output.begin(), test_output.end(), expected_output.begin(), TestNearestKTransform()); + + // calculate output using rtree + std::vector output; + rtree.nearest(pt, k, std::back_inserter(output)); + + // check output + bool are_sizes_ok = (expected_output.size() == output.size()); + BOOST_CHECK( are_sizes_ok ); + if ( are_sizes_ok ) + { + BOOST_FOREACH(Value const& v, output) + { + // TODO - perform explicit check here? + // should all objects which are closest be checked and should exactly the same be found? + + if ( test_find(rtree, expected_output.begin(), expected_output.end(), v) == expected_output.end() ) + { + D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + BOOST_CHECK(d == biggest_d); + } + } + } +} + +// rtree copying and moving + template void test_copy_assignment_move(bgi::rtree & tree, Box const& qbox) { @@ -397,6 +522,9 @@ void test_copy_assignment_move(bgi::rtree & tree, Box const& qbox) test_exactly_the_same_outputs(t2, output, expected_output); } +// run all tests for a single Algorithm and single rtree +// defined by Value + template void test_rtree_by_value() { @@ -415,9 +543,19 @@ void test_rtree_by_value() //test_touches(tree, input, qbox); test_within(tree, input, qbox); + typedef typename bgi::traits::point_type::type P; + P pt; + bg::centroid(qbox, pt); + + test_nearest(tree, input, pt); + test_nearest_k(tree, input, pt, 10); + test_copy_assignment_move(tree, qbox); } +// run all tests for one Algorithm for some number of rtrees +// defined by some number of Values constructed from given Point + template void test_rtree() { From 761a80e1a9731080ad66bdd2bd02cc05cb052cda Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 22 Aug 2012 23:32:01 +0000 Subject: [PATCH 122/366] Description of predicates and distance_predicates added. [SVN r80149] --- .../extensions/index/distance_predicates.hpp | 98 +++++++++++++++ .../geometry/extensions/index/predicates.hpp | 119 ++++++++++++++++++ 2 files changed, 217 insertions(+) diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index ddd58c9b5..1df5c6b03 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -100,18 +100,56 @@ struct relation< far > // relations generators +/*! +Generate a nearest query Point and Value's Indexable relationship while calculating +distances. This function may be used to define that knn query should calculate distances +as smallest as possible between query Point and Indexable's points. In other words it +should be the distance to the nearest Indexable's point. This function may be also used +to define distances bounds which indicates that Indexable's nearest point should be +closer or further than value v. This is default relation. + +\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for + MinRelation or MaxRelation + +\param v Point or bound value. +*/ template detail::near near(T const& v) { return detail::near(v); } +/*! +Generate a nearest query Point and Value's Indexable relationship while calculating +distances. This function may be used to define that knn query should calculate distances +between query Point and Indexable's centroid. This function may be also used +to define distances bounds which indicates that Indexable's centroid should be +closer or further than value v. + +\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for + MinRelation or MaxRelation + +\param v Point or bound value. +*/ template detail::centroid centroid(T const& v) { return detail::centroid(v); } +/*! +Generate a nearest query Point and Value's Indexable relationship while calculating +distances. This function may be used to define that knn query should calculate distances +as biggest as possible between query Point and Indexable's points. In other words it +should be the distance to the furthest Indexable's point. This function may be also used +to define distances bounds which indicates that Indexable's furthest point should be +closer or further than value v. + +\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for + MinRelation or MaxRelation + +\param v Point or bound value. +*/ template detail::far far(T const& v) { @@ -197,6 +235,17 @@ struct bounded // distance predicates generators +/*! +Generate a distance predicate. This defines distances bounds which are used by knn query. +This function indicates that there is no distance bounds and Values should be returned +if distances between Point and Indexable are the smallest. Distance calculation is defined +by PointRelation. This is default nearest predicate. + +\tparam PointRelation PointRelation type. + +\param pr The point relation. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). +*/ template inline detail::unbounded unbounded(PointRelation const& pr) @@ -204,6 +253,21 @@ unbounded(PointRelation const& pr) return detail::unbounded(pr); } +/*! +Generate a distance predicate. This defines distances bounds which are used by knn query. +This function indicates that Values should be returned only if distances between Point and +Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is +defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some +Point but only if nearest points are further than some distance. + +\tparam PointRelation PointRelation type. +\tparam MinRelation MinRelation type. + +\param pr The point relation. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). +\param minr The minimum bound relation. This may be generated by bgi::near(min_distance), + bgi::centroid(min_distance) or bgi::far(min_distance). +*/ template inline detail::min_bounded min_bounded(PointRelation const& pr, MinRelation const& minr) @@ -211,6 +275,21 @@ min_bounded(PointRelation const& pr, MinRelation const& minr) return detail::min_bounded(pr, minr); } +/*! +Generate a distance predicate. This defines distances bounds which are used by knn query. +This function indicates that Values should be returned only if distances between Point and +Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is +defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some +Point but only if nearest points are closer than some distance. + +\tparam PointRelation PointRelation type. +\tparam MaxRelation MaxRelation type. + +\param pr The point relation. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). +\param maxr The maximum bound relation. This may be generated by bgi::near(max_distance), + bgi::centroid(max_distance) or bgi::far(max_distance). +*/ template inline detail::max_bounded max_bounded(PointRelation const& pr, MaxRelation const& maxr) @@ -218,6 +297,25 @@ max_bounded(PointRelation const& pr, MaxRelation const& maxr) return detail::max_bounded(pr, maxr); } +/*! +Generate a distance predicate. This defines distances bounds which are used by knn query. +This function indicates that Values should be returned only if distances between Point and +Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to +some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. +So it is possible e.g. to return Values with centroids closest to some Point but only if nearest +points are further than some distance and closer than some other distance. + +\tparam PointRelation PointRelation type. +\tparam MinRelation MinRelation type. +\tparam MaxRelation MaxRelation type. + +\param pr The point relation. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). +\param minr The minimum bound relation. This may be generated by bgi::near(min_distance), + bgi::centroid(min_distance) or bgi::far(min_distance). +\param maxr The maximum bound relation. This may be generated by bgi::near(max_distance), + bgi::centroid(max_distance) or bgi::far(max_distance). +*/ template inline detail::bounded bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& maxr) diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 63358a94f..57b0d088d 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -120,83 +120,202 @@ struct not_within // generators +/*! +Generate empty predicate. +*/ inline detail::empty empty() { return detail::empty(); } +/*! +Generate value predicate. A wrapper around user-defined functor +describing if Value should be returned by spatial query. + +\tparam ValuePredicate Functor type. + +\param vpred The functor. +*/ template inline detail::value value(ValuePredicate const& vpred) { return detail::value(vpred); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::covered_by(Indexable, Geometry) +returns true. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::covered_by covered_by(Geometry const& g) { return detail::covered_by(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::disjoint(Indexable, Geometry) +returns true. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::disjoint disjoint(Geometry const& g) { return detail::disjoint(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::intersects(Indexable, Geometry) +returns true. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::intersects intersects(Geometry const& g) { return detail::intersects(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::overlaps(Indexable, Geometry) +returns true. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::overlaps overlaps(Geometry const& g) { return detail::overlaps(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::touches(Indexable, Geometry) +returns true. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ //template //inline detail::touches touches(Geometry const& g) //{ // return detail::touches(g); //} +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::within(Indexable, Geometry) +returns true. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::within within(Geometry const& g) { return detail::within(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::covered_by(Indexable, Geometry) +returns false. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::not_covered_by not_covered_by(Geometry const& g) { return detail::not_covered_by(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::disjoint(Indexable, Geometry) +returns false. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::not_disjoint not_disjoint(Geometry const& g) { return detail::not_disjoint(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::intersects(Indexable, Geometry) +returns false. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::not_intersects not_intersects(Geometry const& g) { return detail::not_intersects(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::overlaps(Indexable, Geometry) +returns false. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::not_overlaps not_overlaps(Geometry const& g) { return detail::not_overlaps(g); } +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::touches(Indexable, Geometry) +returns false. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ //template //inline detail::not_touches not_touches(Geometry const& g) //{ // return detail::not_touches(g); //} +/*! +Generate a predicate defining Value and Geometry relationship. +Value will be returned by the query if bg::within(Indexable, Geometry) +returns false. + +\tparam Geometry The Geometry type. + +\param g The Geometry object. +*/ template inline detail::not_within not_within(Geometry const& g) { From be4cb4d9a8e032cdc29c9be7a14b166898b49fa6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 23 Aug 2012 00:51:24 +0000 Subject: [PATCH 123/366] r-tree methods description expanded, default translator description added [SVN r80150] --- .../geometry/extensions/index/rtree/rtree.hpp | 86 ++++++++++++++++--- .../extensions/index/translator/def.hpp | 13 +++ 2 files changed, 88 insertions(+), 11 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 6bc99b767..77021eadb 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -47,11 +47,22 @@ namespace boost { namespace geometry { namespace index { /*! -The R-tree spatial index. +The R-tree spatial index. This is self-balancing spatial index capable to store various types +of Values and balancing algorithms. \tparam Value The type of objects stored in the container. -\tparam Parameters Compile-time parameters. -\tparam Translator The type of the translator. +\tparam Parameters Compile-time parameters. The user must pass a type defining the Parameters which will + be used in rtree creation process. This type is used e.g. to specify balancing algorithm + with compile-time parameters like min and max number of elements in node. + Predefined Algorithms/Parameters are: + bgi::linear, + bgi::quadratic, + bgi::rstar. +\tparam Translator The type of the translator which translates from Value to Indexable. This translation is done each time + the r-tree wants to know Value's Indexable. Default translator can translate all types adapted to Point + or Box concepts (which are Indexables). It also handles std::pair, pointers, smart pointers, + and iterators. E.g. If std::pair is stored, the default translator translates from + std::pair const& to Box const&. \tparam Allocator The allocator. */ template < @@ -339,8 +350,16 @@ public: /*! Find values meeting spatial predicates, e.g. intersecting some box. - \param pred The spatial predicates. - \param out_it The output iterator of the result range. E.g. a back_insert_iterator. + \param pred The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together in std::pair + or boost::tuple. + + \param out_it The output iterator of the result range. E.g. an iterator generated by + std::back_inserter(container) \return The number of values found. */ @@ -358,7 +377,16 @@ public: /*! Find one value meeting distances predicates, e.g. nearest to some point. - \param dpred The distances predicates. + \param dpred The distances predicates. May be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), + bgi::centroid(dist_bound) or bgi::far(dist_bound). + \param v The reference to the object which will contain the result. \return The number of values found. @@ -373,8 +401,22 @@ public: Find one value meeting distances predicates and spatial predicates, e.g. nearest to some point and intersecting some box. - \param dpred The distances predicates. - \param pred The spatial predicates. + \param dpred The distances predicates. May be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), + bgi::centroid(dist_bound) or bgi::far(dist_bound). + \param pred The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together in std::pair + or boost::tuple. \param v The reference to the object which will contain the result. \return The number of values found. @@ -388,7 +430,15 @@ public: /*! Find k values meeting distances predicates, e.g. k nearest values to some point. - \param dpred The distance predicate. + \param dpred The distances predicates. May be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), + bgi::centroid(dist_bound) or bgi::far(dist_bound). \param k The max number of values. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. @@ -404,9 +454,23 @@ public: Find k values meeting distances predicates and spatial predicates, e.g. k nearest values to some point and intersecting some box. - \param dpred The distances predicates. + \param dpred The distances predicates. May be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::near(Point), + bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), + bgi::centroid(dist_bound) or bgi::far(dist_bound). \param k The max number of values. - \param pred The spatial predicates. + \param pred The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together in std::pair + or boost::tuple. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. \return The number of values found. diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index 673b7cf60..c20fff09c 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -71,6 +71,12 @@ struct def } // 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 @@ -82,6 +88,13 @@ struct def { }; +/*! +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 { From e625a0913bb44959393c81b86618fbfda7686924 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 23 Aug 2012 01:04:00 +0000 Subject: [PATCH 124/366] Predefined r-tree creation algorithms parameters described. [SVN r80151] --- .../extensions/index/rtree/options.hpp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 2f59b6c3e..64ebae231 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -41,6 +41,12 @@ struct node_default_static_variant_tag {}; //if ( m_max_elems_per_node < 2 ) // m_max_elems_per_node = 2; +/*! +Linear r-tree creation algorithm parameters. + +\tparam MaxElements Maximum number of elements in nodes. +\tparam MinElements Minimum number of elements in nodes. +*/ template struct linear { @@ -48,6 +54,12 @@ struct linear static const size_t min_elements = MinElements; }; +/*! +Quadratic r-tree creation algorithm parameters. + +\tparam MaxElements Maximum number of elements in nodes. +\tparam MinElements Minimum number of elements in nodes. +*/ template struct quadratic { @@ -65,6 +77,16 @@ struct default_rstar_reinserted_elements }} // namespace options::detail +/*! +Quadratic r-tree creation algorithm parameters. + +\tparam MaxElements Maximum number of elements in nodes. +\tparam MinElements Minimum number of elements in nodes. +\tparam OverlapCostThreshold The number of leaf node children elements above which + nearly minimum overlap cost is calculated instead of minimum + overlap cost. If 0 minimum overlap cost is always calculated. +\tparam ReinsertedElements Number of elements reinserted by forced reinsertions algorithm. +*/ template Date: Thu, 23 Aug 2012 21:55:34 +0000 Subject: [PATCH 125/366] Modified docs, files descriptions, added quick_start example. [SVN r80164] --- doc/Jamfile.v2 | 10 +- doc/html/geometry_index/introduction.html | 8 +- doc/html/geometry_index/r_tree.html | 475 +----------------- .../geometry_index/r_tree/introduction.html | 50 ++ .../r_tree/nearest_neighbours_queries.html | 188 +++++++ .../r_tree/r_tree_creation.html | 184 +++++++ .../r_tree/rtree_quickstart.html | 132 +++++ .../r_tree/spatial_queries.html | 138 +++++ doc/html/index.html | 25 +- doc/imports.qbk | 11 + doc/index.qbk | 8 +- doc/introduction.qbk | 5 +- doc/rtree.qbk | 312 +----------- doc/rtree/creation.qbk | 95 ++++ doc/rtree/introduction.qbk | 18 + doc/rtree/nearest.qbk | 126 +++++ doc/rtree/query.qbk | 86 ++++ doc/rtree/quickstart.qbk | 47 ++ doc/src/examples/rtree/quick_start.cpp | 57 +++ .../comparable_distance_centroid.hpp | 7 +- .../algorithms/comparable_distance_far.hpp | 7 +- .../algorithms/comparable_distance_near.hpp | 7 +- .../extensions/index/algorithms/content.hpp | 4 +- .../index/algorithms/detail/diff_abs.hpp | 7 +- .../detail/smallest_for_indexable.hpp | 7 +- .../algorithms/detail/sum_for_indexable.hpp | 7 +- .../index/algorithms/intersection_content.hpp | 4 +- .../extensions/index/algorithms/is_valid.hpp | 7 +- .../extensions/index/algorithms/margin.hpp | 7 +- .../index/algorithms/minmaxdist.hpp | 4 +- .../index/algorithms/union_content.hpp | 9 +- .../geometry/extensions/index/assert.hpp | 5 +- .../extensions/index/distance_predicates.hpp | 7 +- .../index/filters/nearest_filter.hpp | 7 +- .../extensions/index/filters/query_filter.hpp | 7 +- .../geometry/extensions/index/indexable.hpp | 7 +- .../geometry/extensions/index/inserter.hpp | 7 +- .../extensions/index/nonassignable.hpp | 7 +- .../geometry/extensions/index/predicates.hpp | 7 +- .../extensions/index/pushable_array.hpp | 5 +- .../index/rtree/distance_predicates.hpp | 9 +- .../extensions/index/rtree/filters.hpp | 7 +- .../extensions/index/rtree/kmeans/kmeans.hpp | 7 +- .../extensions/index/rtree/kmeans/split.hpp | 7 +- .../extensions/index/rtree/linear/linear.hpp | 7 +- .../rtree/linear/redistribute_elements.hpp | 9 +- .../extensions/index/rtree/node/node.hpp | 7 +- .../index/rtree/node/node_default.hpp | 7 +- .../index/rtree/node/node_default_static.hpp | 7 +- .../node/node_default_static_variant.hpp | 7 +- .../index/rtree/node/node_default_variant.hpp | 7 +- .../extensions/index/rtree/options.hpp | 7 +- .../extensions/index/rtree/predicates.hpp | 7 +- .../index/rtree/quadratic/quadratic.hpp | 7 +- .../rtree/quadratic/redistribute_elements.hpp | 7 +- .../index/rtree/rstar/choose_next_node.hpp | 7 +- .../extensions/index/rtree/rstar/insert.hpp | 7 +- .../rtree/rstar/redistribute_elements.hpp | 7 +- .../extensions/index/rtree/rstar/rstar.hpp | 7 +- .../geometry/extensions/index/rtree/rtree.hpp | 9 +- .../geometry/extensions/index/rtree/tags.hpp | 7 +- .../index/rtree/visitors/are_boxes_ok.hpp | 7 +- .../index/rtree/visitors/are_levels_ok.hpp | 7 +- .../index/rtree/visitors/children_box.hpp | 7 +- .../extensions/index/rtree/visitors/copy.hpp | 7 +- .../index/rtree/visitors/destroy.hpp | 7 +- .../index/rtree/visitors/gl_draw.hpp | 7 +- .../index/rtree/visitors/insert.hpp | 7 +- .../index/rtree/visitors/is_leaf.hpp | 7 +- .../index/rtree/visitors/nearest.hpp | 7 +- .../extensions/index/rtree/visitors/print.hpp | 8 +- .../extensions/index/rtree/visitors/query.hpp | 7 +- .../index/rtree/visitors/remove.hpp | 7 +- .../extensions/index/translator/def.hpp | 7 +- .../extensions/index/translator/helpers.hpp | 7 +- .../extensions/index/translator/index.hpp | 7 +- .../index/translator/translator.hpp | 5 +- .../geometry/extensions/index/tuples.hpp | 5 +- test/Jamfile.v2 | 5 +- test/algorithms/Jamfile.v2 | 5 +- test/algorithms/content.cpp | 9 +- test/algorithms/intersection_content.cpp | 8 +- test/algorithms/is_valid.cpp | 8 +- test/algorithms/margin.cpp | 9 +- test/algorithms/minmaxdist.cpp | 8 +- test/algorithms/test_content.hpp | 3 +- test/algorithms/test_intersection_content.hpp | 3 +- test/algorithms/test_margin.hpp | 3 +- test/algorithms/test_union_content.hpp | 3 +- test/algorithms/union_content.cpp | 8 +- test/geometry_index_test_common.hpp | 10 +- test/rtree/Jamfile.v2 | 5 +- test/rtree/rtree2d_linear_d.cpp | 8 +- test/rtree/rtree2d_linear_f.cpp | 8 +- test/rtree/rtree2d_linear_i.cpp | 8 +- test/rtree/rtree2d_linear_tt.cpp | 8 +- test/rtree/rtree2d_quadratic_d.cpp | 8 +- test/rtree/rtree2d_quadratic_f.cpp | 8 +- test/rtree/rtree2d_quadratic_i.cpp | 8 +- test/rtree/rtree2d_quadratic_tt.cpp | 8 +- test/rtree/rtree2d_rstar_d.cpp | 8 +- test/rtree/rtree2d_rstar_f.cpp | 8 +- test/rtree/rtree2d_rstar_i.cpp | 8 +- test/rtree/rtree2d_rstar_tt.cpp | 8 +- test/rtree/rtree3d_linear_d.cpp | 8 +- test/rtree/rtree3d_linear_f.cpp | 8 +- test/rtree/rtree3d_linear_i.cpp | 8 +- test/rtree/rtree3d_linear_tt.cpp | 8 +- test/rtree/rtree3d_quadratic_d.cpp | 8 +- test/rtree/rtree3d_quadratic_f.cpp | 8 +- test/rtree/rtree3d_quadratic_i.cpp | 8 +- test/rtree/rtree3d_quadratic_tt.cpp | 8 +- test/rtree/rtree3d_rstar_d.cpp | 8 +- test/rtree/rtree3d_rstar_f.cpp | 8 +- test/rtree/rtree3d_rstar_i.cpp | 8 +- test/rtree/rtree3d_rstar_tt.cpp | 8 +- test/rtree/test_rtree.hpp | 3 +- 117 files changed, 1458 insertions(+), 1204 deletions(-) create mode 100644 doc/html/geometry_index/r_tree/introduction.html create mode 100644 doc/html/geometry_index/r_tree/nearest_neighbours_queries.html create mode 100644 doc/html/geometry_index/r_tree/r_tree_creation.html create mode 100644 doc/html/geometry_index/r_tree/rtree_quickstart.html create mode 100644 doc/html/geometry_index/r_tree/spatial_queries.html create mode 100644 doc/imports.qbk create mode 100644 doc/rtree/creation.qbk create mode 100644 doc/rtree/introduction.qbk create mode 100644 doc/rtree/nearest.qbk create mode 100644 doc/rtree/query.qbk create mode 100644 doc/rtree/quickstart.qbk create mode 100644 doc/src/examples/rtree/quick_start.cpp diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 2da6b592f..b30e99393 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -1,8 +1,7 @@ -# Boost.Geometry Index (Spatial Indexes) +# Boost.Geometry Index +# +# Copyright (c) 2011-2012 Adam Wulkiewicz. # -# Copyright (c) 2008 Federico J. Fernandez. -# Copyright (c) 2011 Adam Wulkiewicz. - # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -16,16 +15,19 @@ boostbook geometry_index-doc : index.qbk : + Jamfile.v2 # off # on # off # index.on.type=1 html pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html + chunk.section.depth=2 chunk.first.sections=1 toc.section.depth=3 toc.max.depth=2 generate.section.toc.level=4 boost.root=http://www.boost.org/doc/libs/release enable_index + $(here) ; diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index 51e8b0631..0f8691293 100644 --- a/doc/html/geometry_index/introduction.html +++ b/doc/html/geometry_index/introduction.html @@ -3,10 +3,10 @@ Introduction - - - - + + + + diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 1984cacc1..5b228da05 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,10 +3,11 @@ R-tree - - - + + + + @@ -19,472 +20,46 @@


    -PrevUpHome +PrevUpHomeNext
    -
    - -

    - R-tree is a self-balancing search tree with nodes stored with their axis - aligned bounding boxes. Each node's box describes 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 the node are user defined. -

    -

    - In order to use the R-tree one must include folowing file. -

    -
    #include <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -
    - - -
    - -

    - In order to create a R-tree object storing values of type std::pair<Box, size_t> one may use the following code: -

    -
    using namespace boost::geometry;
    -typedef std::pair<Box, size_t> Value;
    -index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -
    -
    - -

    - R-tree has 4 parameters: -

    -
    rtree<Value, Parameters, Translator, Allocator>
    -
    -
      -
    • - Value - type of object - which will be stored in the container. -
    • -
    • - Parameters - compile-time - parameters, e.g. inserting/splitting algorithm with min and max nodes' - elements numbers. -
    • -
    • - Translator - type of - object translating Value - objects to Indexable - objects (Point - or Box) - which R-tree can handle. -
    • -
    • - Allocator - the allocator. -
    • -
    -
    -
    - -

    - R-tree may store Values of any type as long as there is passed - the Translator which knows how to interpret those Values - and extract an object understandable by the R-tree. Those objects are called - Indexables and they are simply of type adapted to Point - or Box - concept. Default Translator index::translator::def<Value> is able to handle Point, - Box, - std::pair<...>, - pointer, iterator or smart pointer. -

    -
      -
    • - Indexable = Point - | Box -
    • -
    • - BasicValue = - Indexable | - std::pair<Indexable, T> | std::pair<T, Indexable> -
    • -
    • - Value = BasicValue - | BasicValue* | Iterator<BasicValue> - | SmartPtr<BasicValue> -
    • -
    -

    - Examples of Value types: -

    -
    geometry::model::point<...>
    -geometry::model::point_xy<...>
    -geometry::model::box<...>
    -std::pair<geometry::model::box<...>, size_t>
    -
    -
    -
    - -

    - Values may be inserted to the R-tree in many various ways. - Final structure of nodes depends on algorithms used in the process, especially - nodes' splitting algorithm. Currently, three well-known types of R-trees - may be created. -

    -

    - Linear - classic R-tree using splitting algorithm of linear complexity -

    -
    index::rtree< Value, index::linear<32, 8> > rt;
    -
    -

    - Quadratic - classic R-tree using splitting algorithm of quadratic complexity -

    -
    index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -

    - R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions -

    -
    index::rtree< Value, index::rstar<32, 8> > rt;
    -
    -
    -
    -
    - -

    - Create -

    -
    using namespace boost::geometry;
    -typedef std::pair<Box, int> Value;
    -index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -

    - Insert and remove by method call -

    -
    Value v = std::make_pair(Box(...), 0);
    -rt.insert(v);
    -rt.remove(v);
    -
    -

    - or by function call -

    -
    Value v = std::make_pair(Box(...), 0);
    -index::insert(rt, v);
    -index::remove(rt, v);
    -
    -
    -
    - - -
    - -

    - There are three ways to perform a spatial query. Following queries returns - Values intersecting some box_region. -

    -

    - Method call -

    -
    std::vector<Value> returned_values;
    -Box box_region(...);
    -rt.query(box_region, std::back_inserter(returned_values));
    -
    -

    - Function call -

    -
    std::vector<Value> returned_values;
    -Box box_region(...);
    -index::query(rt, box_region, std::back_inserter(returned_values));
    -
    -

    - Use of operator | - (as with ranges) -

    -
    Box box_region(...);
    -BOOST_FOREACH(Value & v, rt | index::query_filtered(box_region))
    -  ; // do something with v
    -
    -
    -
    - -

    - It is possible to define other relations between queried Values - 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)); // 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));
    -
    -

    - All predicates may be negated, e.g.: -

    -
    rt.query(index::not_intersects(box), std::back_inserter(result));
    -// or
    -rt.query(!index::intersects(box), std::back_inserter(result));
    -// the same as
    -rt.query(index::disjoint(box), std::back_inserter(result));
    -
    -

    - It's possible to use some number of predicates by passing std::pair<Pred1, Pred2> -

    -
    rt.query(
    -  std::make_pair(index::intersects(box1), !index::within(box2))
    -  , std::back_inserter(result));
    -
    -

    - or boost::tuple<Pred1, Pred2, Pred3, ...> -

    -
    rt.query(
    -  boost::make_tuple(
    -    index::intersects(box1), !index::within(box2), index::overlaps(box3))
    -  , std::back_inserter(result));
    -
    -

    - There is also a unique predicate index::value(...) taking user-defined function/functor - which checks if Value should be returned by the query. -

    -
    bool fun(__value const& v)
    -{
    -  return v.is_red();
    -}
    -
    -// ...
    -
    -rt.query(
    -  boost::make_pair(index::intersects(box), index::value(fun))
    -  , std::back_inserter(result));
    -
    -
    -
    -
    - - -
    - -

    - There are three ways of performing knn queries. Following queries returns - k Values closest to some point in space. For Boxes - Indexables closest point of a Box - is taken into account by default. -

    -

    - Method call -

    -
    std::vector<Value> returned_values;
    -Point pt(...);
    -rt.nearest(pt, k, std::back_inserter(returned_values));
    -
    -

    - Function call -

    -
    std::vector<Value> returned_values;
    -Point pt(...);
    -index::nearest(rt, pt, k, std::back_inserter(returned_values));
    -
    -

    - Use of operator | -

    -
    Point pt(...);
    -BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k))
    -  ; // do something with v
    -
    -
    -
    - -

    - Another type of nearest neighbor query is searching for the one closest - Value. If it is found, 1 is returned by the method or function. - This kind of query has only two forms. -

    -

    - Method call -

    -
    Value returned_value;
    -Point pt(...);
    -size_t n = rt.nearest(pt, returned_value);
    -
    -

    - Function call -

    -
    Value Value returned_value;
    -Point pt(...);
    -size_t n = index::nearest(rt, pt, returned_value);
    -
    -
    -
    - -

    - It is possible to define if calculated distance between query point and - Value should be greater, lesser or between some other distances. - Those are called DistancesPredicates - and may be defined as follows. -

    -
    std::vector<__Value__> returned_values;
    -Point pt(...);
    -
    -/* default - without bounds */
    -index::nearest(rt, pt, k, std::back_inserter(returned_values));
    -
    -/* same as default */
    -index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values));
    -
    -/* distance must be greater than or equal to 10 */
    -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    -
    -/* distance must be lesser than or equal to 500 */
    -index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values));
    -
    -/* distance must be between 10 and 500 */
    -index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values));
    -
    -

    - Furthermore, it's possible to define if the closest, furthest or centroidal - point of the non-point Indexable should be taken into account - in the routine calculating distance. -

    -
    std::vector<Value> returned_values;
    -Point pt(...);
    -
    -/* default - distance between Indexable's closest point and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    -
    -/* same as default - distance between Indexable's closest point and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values));
    -
    -/* distance between Indexable's furthest point and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values));
    -
    -/* distance between Indexable's centroid and a query point
    -must be greater than 10 */
    -index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values));
    -
    -
    -
    - -

    - It is possible to use spatial predicates described before in nearest neighbors - queries. -

    -
    Value returned_value;
    -std::vector<Value> returned_values;
    -
    -Point pt(...);
    -Box b(...);
    -
    -size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value);
    -
    -size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values));
    -
    -BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b)))
    -  ; // do something with v
    -
    -
    -
    @@ -496,7 +71,7 @@ must be greater than 10 */

    -PrevUpHome +PrevUpHomeNext
    diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html new file mode 100644 index 000000000..cc12a4724 --- /dev/null +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -0,0 +1,50 @@ + + + +Introduction + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +

    + 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. +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html new file mode 100644 index 000000000..a6e000f36 --- /dev/null +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -0,0 +1,188 @@ + + + +Nearest neighbours queries + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHome +
    +
    + + +
    + +

    + There are three ways of performing knn queries. Following queries returns + k Values closest to some point in space. For Boxes + Indexables the distance to the nearest point is calculated + by default. +

    +

    + Method call +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +rt.nearest(pt, k, std::back_inserter(returned_values));
    +
    +

    + Function call +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +index::nearest(rt, pt, k, std::back_inserter(returned_values));
    +
    +

    + Use of operator | +

    +
    Point pt(...);
    +BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k))
    +  ; // do something with v
    +
    +
    +
    + +

    + Another type of nearest neighbour query is searching for the one closest + Value. If it is found, 1 is returned by the method or function. + This kind of query has only two forms. +

    +

    + Method call +

    +
    Value returned_value;
    +Point pt(...);
    +size_t n = rt.nearest(pt, returned_value);
    +
    +

    + Function call +

    +
    Value Value returned_value;
    +Point pt(...);
    +size_t n = index::nearest(rt, pt, returned_value);
    +
    +
    +
    + +

    + It is possible to define if calculated distance between query point and + Value should be greater, lesser or between some other distances. + Those are called DistancesPredicates + and may be defined as follows. +

    +
    std::vector<__Value__> returned_values;
    +Point pt(...);
    +
    +/* default - without bounds */
    +index::nearest(rt, pt, k, std::back_inserter(returned_values));
    +
    +/* same as default */
    +index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values));
    +
    +/* distance must be greater than or equal to 10 */
    +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    +
    +/* distance must be lesser than or equal to 500 */
    +index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values));
    +
    +/* distance must be between 10 and 500 */
    +index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values));
    +
    +

    + Furthermore, it's possible to define if the closest, furthest or centroidal + point of the non-point Indexable should be taken into account + in the routine calculating distance. +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +
    +/* default - distance between Indexable's closest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    +
    +/* same as default - distance between Indexable's closest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values));
    +
    +/* distance between Indexable's furthest point and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values));
    +
    +/* distance between Indexable's centroid and a query point
    +must be greater than 10 */
    +index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values));
    +
    +
    +
    + +

    + It is possible to use spatial predicates described before in nearest neighbours + queries. +

    +
    Value returned_value;
    +std::vector<Value> returned_values;
    +
    +Point pt(...);
    +Box b(...);
    +
    +size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value);
    +
    +size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values));
    +
    +BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b)))
    +  ; // do something with v
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHome +
    + + diff --git a/doc/html/geometry_index/r_tree/r_tree_creation.html b/doc/html/geometry_index/r_tree/r_tree_creation.html new file mode 100644 index 000000000..a31e3c53a --- /dev/null +++ b/doc/html/geometry_index/r_tree/r_tree_creation.html @@ -0,0 +1,184 @@ + + + +R-tree creation + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + + +
    + +

    + R-tree has 4 parameters: +

    +
    rtree<Value, Parameters, Translator, Allocator>
    +
    +
      +
    • + Value - type of object + which will be stored in the container. +
    • +
    • + Parameters - compile-time + parameters, e.g. inserting/splitting algorithm with min and max nodes' + elements numbers. +
    • +
    • + Translator - type of + object translating Value + objects to Indexable + objects (Point + or Box) + which R-tree can handle. +
    • +
    • + Allocator - the allocator. +
    • +
    +
    +
    + +

    + R-tree may store Values of any type as long the Translator + is passed as parameter. It knows how to interpret those Values + and extract an object understandable by the R-tree. Those objects are called + 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. +

    +
      +
    • + Indexable = Point + | Box +
    • +
    • + BasicValue = + Indexable | + std::pair<Indexable, T> | std::pair<T, Indexable> +
    • +
    • + Value = BasicValue + | BasicValue* | Iterator<BasicValue> + | SmartPtr<BasicValue> +
    • +
    +

    + Examples of Value types: +

    +
    geometry::model::point<...>
    +geometry::model::point_xy<...>
    +geometry::model::box<...>
    +std::pair<geometry::model::box<...>, size_t>
    +
    +
    +
    + +

    + Values may be inserted to the R-tree in many various ways. + Final internal structure of the R-tree depends on algorithms used in the + insertion process. The most important is nodes' splitting algorithm. Currently, + three well-known types of R-trees may be created. +

    +

    + Linear - classic R-tree using splitting algorithm of linear complexity +

    +
    index::rtree< Value, index::linear<32, 8> > rt;
    +
    +

    + Quadratic - classic R-tree using splitting algorithm of quadratic complexity +

    +
    index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +

    + R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions +

    +
    index::rtree< Value, index::rstar<32, 8> > rt;
    +
    +
    +
    + +

    + Following code creates an R-tree using quadratic algorithm. +

    +
    using namespace boost::geometry;
    +typedef std::pair<Box, int> Value;
    +index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +

    + To insert or remove Value's by method calls one may use the following code. +

    +
    Value v = std::make_pair(Box(...), 0);
    +rt.insert(v);
    +rt.remove(v);
    +
    +

    + To insert or remove Value's by function calls one may use the following + code. +

    +
    Value v = std::make_pair(Box(...), 0);
    +index::insert(rt, v);
    +index::remove(rt, v);
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html new file mode 100644 index 000000000..857993868 --- /dev/null +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -0,0 +1,132 @@ + + + +Quick Start + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +

    + This Quick Start section shows simple way to creating a typical R-tree and + perform spatial query. +

    +

    + The code below assumes that following files are included and namespaces used. +

    +

    +

    +
    #include <vector>
    +
    +#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>
    +
    +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. +

    +

    +

    +
    typedef bg::model::point<float, 2, bg::cs::cartesian> point;
    +typedef bg::model::box<point> box;
    +typedef std::pair<box, unsigned> value;
    +
    +

    +

    +

    + 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. +

    +

    +

    +
    bgi::rtree< value, bgi::quadratic<32, 8> > rtree;
    +
    +

    +

    +

    + Inserting values into the R-tree may be done by calling 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));
    +
    +

    +

    +

    + There are various types of queries that may be performed, they can be even + combined together in one call. For simplicity, default one is used. +

    +

    +

    +
    // find values intersecting a box
    +std::vector<value> result;
    +rtree.query(b, std::back_inserter(result));
    +
    +

    +

    +

    + Default k-nearest neighbors query may be performed as follows. +

    +

    +

    +
    // find 5 nearest values to a point
    +rtree.nearest(point(0, 0), 5, std::back_inserter(result));
    +
    +

    +

    +

    + + More +

    +

    + More information about the R-tree implementation, other algorithms and queries + may be found in other parts of this documentation. +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html new file mode 100644 index 000000000..d158c340d --- /dev/null +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -0,0 +1,138 @@ + + + +Spatial queries + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + + +
    + +

    + There are three ways to perform a spatial query. Following queries returns + Values intersecting some box_region. +

    +

    + Method call +

    +
    std::vector<Value> returned_values;
    +Box box_region(...);
    +rt.query(box_region, std::back_inserter(returned_values));
    +
    +

    + Function call +

    +
    std::vector<Value> returned_values;
    +Box box_region(...);
    +index::query(rt, box_region, std::back_inserter(returned_values));
    +
    +

    + Use of pipe operator generating a range +

    +
    Box box_region(...);
    +BOOST_FOREACH(Value & v, rt | index::query_filtered(box_region))
    +  ; // do something with v
    +
    +
    +
    + +

    + It is possible to define other relations between queried Values + 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)); // 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));
    +
    +

    + All predicates may be negated, e.g.: +

    +
    rt.query(index::not_intersects(box), std::back_inserter(result));
    +// or
    +rt.query(!index::intersects(box), std::back_inserter(result));
    +// the same as
    +rt.query(index::disjoint(box), std::back_inserter(result));
    +
    +

    + It's possible to use some number of predicates by passing std::pair<Pred1, Pred2> +

    +
    rt.query(
    +  std::make_pair(index::intersects(box1), !index::within(box2))
    +  , std::back_inserter(result));
    +
    +

    + or boost::tuple<Pred1, Pred2, Pred3, ...> +

    +
    rt.query(
    +  boost::make_tuple(
    +    index::intersects(box1), !index::within(box2), index::overlaps(box3))
    +  , std::back_inserter(result));
    +
    +

    + There is also a unique predicate index::value(...) taking user-defined function/functor + which checks if Value should be returned by the query. +

    +
    bool fun(Value const& v)
    +{
    +  return v.is_red();
    +}
    +
    +// ...
    +
    +rt.query(
    +  boost::make_pair(index::intersects(box), index::value(fun))
    +  , std::back_inserter(result));
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/index.html b/doc/html/index.html index 74bcd3da9..2dec2b327 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,10 +1,10 @@ -Chapter 1. Geometry Index 0.7 +Chapter 1. Geometry Index - - + + @@ -21,7 +21,7 @@

    -Chapter 1. Geometry Index 0.7

    +Chapter 1. Geometry Index

    Adam Wulkiewicz

    @@ -30,7 +30,7 @@
    -

    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    @@ -42,19 +42,18 @@
    Introduction
    R-tree
    -
    Introduction
    -
    R-tree creation
    -
    Inserting - and removing Values
    -
    Spatial queries
    -
    Nearest - neighbors queries
    +
    Introduction
    +
    Quick Start
    +
    R-tree creation
    +
    Spatial queries
    +
    Nearest + neighbours queries
    - +

    Last revised: November 30, 2011 at 13:38:40 GMT

    Last revised: August 23, 2012 at 21:48:12 GMT


    diff --git a/doc/imports.qbk b/doc/imports.qbk new file mode 100644 index 000000000..f05ec3443 --- /dev/null +++ b/doc/imports.qbk @@ -0,0 +1,11 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[import src/examples/rtree/quick_start.cpp] diff --git a/doc/index.qbk b/doc/index.qbk index feb00e062..35683effd 100644 --- a/doc/index.qbk +++ b/doc/index.qbk @@ -1,8 +1,7 @@ [/============================================================================ - Boost.Geometry Index (Spatial Indexes) + Boost.Geometry Index - Copyright (c) 2008 Federico J. Fernandez. - Copyright (c) 2011 Adam Wulkiewicz. + Copyright (c) 2011-2012 Adam Wulkiewicz. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -11,7 +10,6 @@ [library Geometry Index [quickbook 1.5] - [version 0.7] [authors [Wulkiewicz, Adam], [Fernandez, Federico J.]] [copyright 2011 Adam Wulkiewicz, Federico J. Fernandez] [purpose Documentation of Boost.Geometry Index library] @@ -42,6 +40,8 @@ [def __cgeometry__ [@http://www.boost.org/libs/geometry/doc/html/index.html geometry]] [def __cboost__ [@http://www.boost.org/libs/libraries.htm boost]] +[include imports.qbk] + [include introduction.qbk] [include rtree.qbk] diff --git a/doc/introduction.qbk b/doc/introduction.qbk index cbb53fad2..6c695d2a7 100644 --- a/doc/introduction.qbk +++ b/doc/introduction.qbk @@ -1,8 +1,7 @@ [/============================================================================ - Boost.Geometry Index (Spatial Indexes) + Boost.Geometry Index - Copyright (c) 2008 Federico J. Fernandez. - Copyright (c) 2011 Adam Wulkiewicz. + Copyright (c) 2011-2012 Adam Wulkiewicz. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 69049b17c..07b5274c1 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -1,8 +1,7 @@ [/============================================================================ - Boost.Geometry Index (Spatial Indexes) + Boost.Geometry Index - Copyright (c) 2008 Federico J. Fernandez. - Copyright (c) 2011 Adam Wulkiewicz. + Copyright (c) 2011-2012 Adam Wulkiewicz. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -11,307 +10,10 @@ [section R-tree] -[section Introduction] - -__rtree__ is a self-balancing search tree with nodes stored with their axis aligned -bounding boxes. Each node's box describes 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 the node are user defined. - -In order to use the __rtree__ one must include folowing file. - - #include +[include rtree/introduction.qbk] +[include rtree/quickstart.qbk] +[include rtree/creation.qbk] +[include rtree/query.qbk] +[include rtree/nearest.qbk] [endsect] - -[section R-tree creation] - -[section Quick start] - -In order to create a __rtree__ object storing values of type `std::pair<__box__, size_t>` -one may use the following code: - - using namespace __cboost__::__cgeometry__; - typedef std::pair<__box__, size_t> Value; - index::rtree< Value, index::quadratic<32, 8> > rt; - -[endsect] - -[section R-tree template parameters] - -__rtree__ has 4 parameters: - - rtree - -* `Value` - type of object which will be stored in the container. -* `Parameters` - compile-time parameters, e.g. inserting/splitting - algorithm with min and max nodes' elements numbers. -* `Translator` - type of object translating `Value` objects to - `Indexable` objects (`__point__` or `__box__`) which __rtree__ can handle. -* `Allocator` - the allocator. - -[endsect] - -[section Values, Indexables and default Translator] - -__rtree__ may store `__value__`s of any type as long as there is passed -the `__translator__` which knows how to interpret those `__value__`s -and extract an object understandable by the __rtree__. Those objects are called -`__indexable__`s and they are simply of type adapted to `__point__` -or `__box__` concept. Default `__translator__` `index::translator::def` -is able to handle `__point__`, `__box__`, `std::pair<...>`, pointer, iterator -or smart pointer. - -* `__indexable__ = __point__ | __box__` -* `BasicValue = Indexable | std::pair<__indexable__, T> | std::pair` -* `__value__ = BasicValue | BasicValue* | Iterator | SmartPtr` - -Examples of `__value__` types: - - geometry::model::point<...> - geometry::model::point_xy<...> - geometry::model::box<...> - std::pair, size_t> - -[endsect] - -[section Inserting and splitting algorithms] - -`__value__`s may be inserted to the __rtree__ in many various ways. Final structure of nodes depends -on algorithms used in the process, especially nodes' splitting algorithm. Currently, three -well-known types of R-trees may be created. - -Linear - classic __rtree__ using splitting algorithm of linear complexity - - index::rtree< __value__, index::linear<32, 8> > rt; - -Quadratic - classic __rtree__ using splitting algorithm of quadratic complexity - - index::rtree< __value__, index::quadratic<32, 8> > rt; - -R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions - - index::rtree< __value__, index::rstar<32, 8> > rt; - -[endsect] - -[endsect] [/ R-tree creation /] - -[section Inserting and removing Values] - -Create - - using namespace boost::geometry; - typedef std::pair __value__; - index::rtree< __value__, index::quadratic<32, 8> > rt; - -Insert and remove by method call - - __value__ v = std::make_pair(__box__(...), 0); - rt.insert(v); - rt.remove(v); - -or by function call - - __value__ v = std::make_pair(__box__(...), 0); - index::insert(rt, v); - index::remove(rt, v); - -[endsect] - -[section Spatial queries] - -[section Basic queries] - -There are three ways to perform a spatial query. Following queries returns -`__value__`s intersecting some box_region. - -Method call - - std::vector<__value__> returned_values; - __box__ box_region(...); - rt.query(box_region, std::back_inserter(returned_values)); - -Function call - - std::vector<__value__> returned_values; - __box__ box_region(...); - index::query(rt, box_region, std::back_inserter(returned_values)); - -Use of `operator |` (as with ranges) - - __box__ box_region(...); - BOOST_FOREACH(__value__ & v, rt | index::query_filtered(box_region)) - ; // do something with v -[endsect] - -[section Spatial predicates] - -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)); // 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)); - -All predicates may be negated, e.g.: - - rt.query(index::not_intersects(box), std::back_inserter(result)); - // or - rt.query(!index::intersects(box), std::back_inserter(result)); - // the same as - rt.query(index::disjoint(box), std::back_inserter(result)); - -It's possible to use some number of predicates by passing `std::pair` - - rt.query( - std::make_pair(index::intersects(box1), !index::within(box2)) - , std::back_inserter(result)); - -or `boost::tuple` - - rt.query( - boost::make_tuple( - index::intersects(box1), !index::within(box2), index::overlaps(box3)) - , std::back_inserter(result)); - -There is also a unique predicate `index::value(...)` taking user-defined function/functor -which checks if `__value__` should be returned by the query. - - bool fun(__value const& v) - { - return v.is_red(); - } - - // ... - - rt.query( - boost::make_pair(index::intersects(box), index::value(fun)) - , std::back_inserter(result)); - -[endsect] - -[endsect] [/ Spatial queries /] - -[section Nearest neighbors queries] - -[section k nearest neighbors] - -There are three ways of performing knn queries. Following queries returns -k `__value__`s closest to some point in space. For `__box__`es -`__indexable__`s closest point of a `__box__` is taken into account by default. - -Method call - - std::vector<__value__> returned_values; - __point__ pt(...); - rt.nearest(pt, k, std::back_inserter(returned_values)); - -Function call - - std::vector<__value__> returned_values; - __point__ pt(...); - index::nearest(rt, pt, k, std::back_inserter(returned_values)); - -Use of `operator |` - - __point__ pt(...); - BOOST_FOREACH(__value__ & v, rt | index::nearest_filtered(pt, k)) - ; // do something with v - -[endsect] - -[section One nearest neighbor] - -Another type of nearest neighbor query is searching for the one closest `__value__`. -If it is found, 1 is returned by the method or function. This kind of query -has only two forms. - -Method call - - __value__ returned_value; - __point__ pt(...); - size_t n = rt.nearest(pt, returned_value); - -Function call - - __value__ Value returned_value; - __point__ pt(...); - size_t n = index::nearest(rt, pt, returned_value); - -[endsect] - -[section Distances predicates] - -It is possible to define if calculated distance between query point and `__value__` should be -greater, lesser or between some other distances. Those are called `DistancesPredicate`s and -may be defined as follows. - - std::vector<__Value__> returned_values; - __point__ pt(...); - - /* default - without bounds */ - index::nearest(rt, pt, k, std::back_inserter(returned_values)); - - /* same as default */ - index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); - - /* distance must be greater than or equal to 10 */ - index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); - - /* distance must be lesser than or equal to 500 */ - index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); - - /* distance must be between 10 and 500 */ - index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); - -Furthermore, it's possible to define if the closest, furthest or centroidal point of the -non-point `__indexable__` should be taken into account in the routine calculating distance. - - std::vector<__value__> returned_values; - __point__ pt(...); - - /* default - distance between Indexable's closest point and a query point - must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); - - /* same as default - distance between Indexable's closest point and a query point - must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); - - /* distance between Indexable's furthest point and a query point - must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); - - /* distance between Indexable's centroid and a query point - must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); - -[endsect] - -[section Using spatial predicates] - -It is possible to use spatial predicates described before in nearest neighbors queries. - - __value__ returned_value; - std::vector<__value__> returned_values; - - __point__ pt(...); - __box__ b(...); - - size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); - - size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); - - BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b))) - ; // do something with v - -[endsect] - -[endsect] [/ Nearest neighbors queries /] - -[endsect] [/ R-tree /] diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk new file mode 100644 index 000000000..73d614090 --- /dev/null +++ b/doc/rtree/creation.qbk @@ -0,0 +1,95 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section R-tree creation] + +[section R-tree template parameters] + +__rtree__ has 4 parameters: + + rtree + +* `Value` - type of object which will be stored in the container. +* `Parameters` - compile-time parameters, e.g. inserting/splitting + algorithm with min and max nodes' elements numbers. +* `Translator` - type of object translating `Value` objects to + `Indexable` objects (`__point__` or `__box__`) which __rtree__ can handle. +* `Allocator` - the allocator. + +[endsect] + +[section Values, Indexables and default Translator] + +__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. + +* `__indexable__ = __point__ | __box__` +* `BasicValue = Indexable | std::pair<__indexable__, T> | std::pair` +* `__value__ = BasicValue | BasicValue* | Iterator | SmartPtr` + +Examples of `__value__` types: + + geometry::model::point<...> + geometry::model::point_xy<...> + geometry::model::box<...> + std::pair, size_t> + +[endsect] + +[section Inserting and splitting algorithms] + +`__value__`s may be inserted to the __rtree__ in many various ways. Final internal structure +of the __rtree__ depends on algorithms used in the insertion process. The most important is +nodes' splitting algorithm. Currently, three well-known types of R-trees may be created. + +Linear - classic __rtree__ using splitting algorithm of linear complexity + + index::rtree< __value__, index::linear<32, 8> > rt; + +Quadratic - classic __rtree__ using splitting algorithm of quadratic complexity + + index::rtree< __value__, index::quadratic<32, 8> > rt; + +R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions + + index::rtree< __value__, index::rstar<32, 8> > rt; + +[endsect] + +[section Inserting and removing Values] + +Following code creates an __rtree__ using quadratic algorithm. + + using namespace boost::geometry; + typedef std::pair __value__; + index::rtree< __value__, index::quadratic<32, 8> > rt; + +To insert or remove __value__'s by method calls one may use the following +code. + + __value__ v = std::make_pair(__box__(...), 0); + rt.insert(v); + rt.remove(v); + +To insert or remove __value__'s by function calls one may use the following +code. + + __value__ v = std::make_pair(__box__(...), 0); + index::insert(rt, v); + index::remove(rt, v); + +[endsect] + +[endsect] [/ R-tree creation /] diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk new file mode 100644 index 000000000..dc283360f --- /dev/null +++ b/doc/rtree/introduction.qbk @@ -0,0 +1,18 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[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. + +[endsect] diff --git a/doc/rtree/nearest.qbk b/doc/rtree/nearest.qbk new file mode 100644 index 000000000..2ecdf5717 --- /dev/null +++ b/doc/rtree/nearest.qbk @@ -0,0 +1,126 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section Nearest neighbours queries] + +[section k nearest neighbours] + +There are three ways of performing knn queries. Following queries returns +k `__value__`s closest to some point in space. For `__box__`es +`__indexable__`s the distance to the nearest point is calculated by default. + +Method call + + std::vector<__value__> returned_values; + __point__ pt(...); + rt.nearest(pt, k, std::back_inserter(returned_values)); + +Function call + + std::vector<__value__> returned_values; + __point__ pt(...); + index::nearest(rt, pt, k, std::back_inserter(returned_values)); + +Use of `operator |` + + __point__ pt(...); + BOOST_FOREACH(__value__ & v, rt | index::nearest_filtered(pt, k)) + ; // do something with v + +[endsect] + +[section One nearest neighbour] + +Another type of nearest neighbour query is searching for the one closest `__value__`. +If it is found, 1 is returned by the method or function. This kind of query +has only two forms. + +Method call + + __value__ returned_value; + __point__ pt(...); + size_t n = rt.nearest(pt, returned_value); + +Function call + + __value__ Value returned_value; + __point__ pt(...); + size_t n = index::nearest(rt, pt, returned_value); + +[endsect] + +[section Distances predicates] + +It is possible to define if calculated distance between query point and `__value__` should be +greater, lesser or between some other distances. Those are called `DistancesPredicate`s and +may be defined as follows. + + std::vector<__Value__> returned_values; + __point__ pt(...); + + /* default - without bounds */ + index::nearest(rt, pt, k, std::back_inserter(returned_values)); + + /* same as default */ + index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); + + /* distance must be greater than or equal to 10 */ + index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + + /* distance must be lesser than or equal to 500 */ + index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); + + /* distance must be between 10 and 500 */ + index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); + +Furthermore, it's possible to define if the closest, furthest or centroidal point of the +non-point `__indexable__` should be taken into account in the routine calculating distance. + + std::vector<__value__> returned_values; + __point__ pt(...); + + /* default - distance between Indexable's closest point and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + + /* same as default - distance between Indexable's closest point and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); + + /* distance between Indexable's furthest point and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); + + /* distance between Indexable's centroid and a query point + must be greater than 10 */ + index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); + +[endsect] + +[section Using spatial predicates] + +It is possible to use spatial predicates described before in nearest neighbours queries. + + __value__ returned_value; + std::vector<__value__> returned_values; + + __point__ pt(...); + __box__ b(...); + + size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); + + size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); + + BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b))) + ; // do something with v + +[endsect] + +[endsect] [/ Nearest neighbours queries /] diff --git a/doc/rtree/query.qbk b/doc/rtree/query.qbk new file mode 100644 index 000000000..65d687f7f --- /dev/null +++ b/doc/rtree/query.qbk @@ -0,0 +1,86 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section Spatial queries] + +[section Basic queries] + +There are three ways to perform a spatial query. Following queries returns +`__value__`s intersecting some box_region. + +Method call + + std::vector<__value__> returned_values; + __box__ box_region(...); + rt.query(box_region, std::back_inserter(returned_values)); + +Function call + + std::vector<__value__> returned_values; + __box__ box_region(...); + index::query(rt, box_region, std::back_inserter(returned_values)); + +Use of pipe operator generating a range + + __box__ box_region(...); + BOOST_FOREACH(__value__ & v, rt | index::query_filtered(box_region)) + ; // do something with v +[endsect] + +[section Spatial predicates] + +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)); // 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)); + +All predicates may be negated, e.g.: + + rt.query(index::not_intersects(box), std::back_inserter(result)); + // or + rt.query(!index::intersects(box), std::back_inserter(result)); + // the same as + rt.query(index::disjoint(box), std::back_inserter(result)); + +It's possible to use some number of predicates by passing `std::pair` + + rt.query( + std::make_pair(index::intersects(box1), !index::within(box2)) + , std::back_inserter(result)); + +or `boost::tuple` + + rt.query( + boost::make_tuple( + index::intersects(box1), !index::within(box2), index::overlaps(box3)) + , std::back_inserter(result)); + +There is also a unique predicate `index::value(...)` taking user-defined function/functor +which checks if `__value__` should be returned by the query. + + bool fun(__value__ const& v) + { + return v.is_red(); + } + + // ... + + rt.query( + boost::make_pair(index::intersects(box), index::value(fun)) + , std::back_inserter(result)); + +[endsect] + +[endsect] [/ Spatial queries /] diff --git a/doc/rtree/quickstart.qbk b/doc/rtree/quickstart.qbk new file mode 100644 index 000000000..2bbb5dda2 --- /dev/null +++ b/doc/rtree/quickstart.qbk @@ -0,0 +1,47 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section:rtree_quickstart Quick Start] + +This Quick Start section shows simple way to creating a typical R-tree and perform +spatial query. + +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__. + +[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. + +[rtree_quickstart_create] + +Inserting values into the R-tree may be done by calling insert() method. + +[rtree_quickstart_insert] + +There are various types of queries that may be performed, they can be even combined together +in one call. For simplicity, default one is used. + +[rtree_quickstart_query] + +Default k-nearest neighbors query may be performed as follows. + +[rtree_quickstart_nearest] + +[h3 More] +More information about the R-tree implementation, other algorithms and queries may be found in +other parts of this documentation. + +[endsect] diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp new file mode 100644 index 000000000..25523f8b4 --- /dev/null +++ b/doc/src/examples/rtree/quick_start.cpp @@ -0,0 +1,57 @@ +// Boost.Geometry Index +// +// Quickbook Examples +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +//[rtree_quickstart_include + +#include + +#include +#include +#include + +#include + +namespace bg = boost::geometry; +namespace bgi = boost::geometry::index; +//] + +int main(void) +{ + //[rtree_quickstart_valuetype + typedef bg::model::point point; + typedef bg::model::box box; + typedef std::pair value; + //] + + //[rtree_quickstart_create + 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)); + //] + + //[rtree_quickstart_query + // find values intersecting a box + std::vector result; + rtree.query(b, std::back_inserter(result)); + //] + + //[rtree_quickstart_nearest + // find 5 nearest values to a point + rtree.nearest(point(0, 0), 5, std::back_inserter(result)); + //] + + return 0; +} diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp index 156edece2..36620535b 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - squared distance between point and centroid of the box or point +// squared distance between point and centroid of the box or point +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp index a80e98e3b..30fb83e74 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - squared distance between point and furthest point of the box or point +// squared distance between point and furthest point of the box or point +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp index a6021c82e..8b809d41d 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - squared distance between point and nearest point of the box or point +// squared distance between point and nearest point of the box or point +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/content.hpp b/include/boost/geometry/extensions/index/algorithms/content.hpp index 52aa49710..12c9471f0 100644 --- a/include/boost/geometry/extensions/index/algorithms/content.hpp +++ b/include/boost/geometry/extensions/index/algorithms/content.hpp @@ -1,6 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - n-dimensional box's content (2d-area/3d-volume/...) +// n-dimensional box's content (hypervolume) - 2d area, 3d volume, ... // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // diff --git a/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp b/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp index 4c89b31c1..0490976a7 100644 --- a/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp +++ b/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - Abs of difference +// Abs of difference +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp b/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp index aeae612fa..1181f6193 100644 --- a/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp +++ b/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - Get smallest value calculated for indexable's dimensions, used in R-tree k nearest neighbors query +// Get smallest value calculated for indexable's dimensions, used in R-tree k nearest neighbors query +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp b/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp index 4a6c11b0f..44c64fd64 100644 --- a/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp +++ b/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - Sum values calculated for indexable's dimensions, used e.g. in R-tree k nearest neighbors query +// Sum values calculated for indexable's dimensions, used e.g. in R-tree k nearest neighbors query +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp index 3cc969195..60762473e 100644 --- a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp +++ b/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp @@ -1,6 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - boxes union/intersection area/volume +// boxes union/intersection area/volume // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // diff --git a/include/boost/geometry/extensions/index/algorithms/is_valid.hpp b/include/boost/geometry/extensions/index/algorithms/is_valid.hpp index 77f6ede62..4468b3684 100644 --- a/include/boost/geometry/extensions/index/algorithms/is_valid.hpp +++ b/include/boost/geometry/extensions/index/algorithms/is_valid.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - n-dimensional box's / point validity check +// n-dimensional box's / point validity check +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/margin.hpp b/include/boost/geometry/extensions/index/algorithms/margin.hpp index a86d15811..aee9c4dc7 100644 --- a/include/boost/geometry/extensions/index/algorithms/margin.hpp +++ b/include/boost/geometry/extensions/index/algorithms/margin.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - n-dimensional box's margin value, 2d perimeter, 3d surface, etc... +// n-dimensional box's margin value (hypersurface), 2d perimeter, 3d surface, etc... +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp index 71e7dd8ca..fd2b43c13 100644 --- a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp +++ b/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp @@ -1,6 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - minmaxdist used in R-tree k nearest neighbors query +// minmaxdist used in R-tree k nearest neighbors query // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // diff --git a/include/boost/geometry/extensions/index/algorithms/union_content.hpp b/include/boost/geometry/extensions/index/algorithms/union_content.hpp index b25f5e23d..30070d4b0 100644 --- a/include/boost/geometry/extensions/index/algorithms/union_content.hpp +++ b/include/boost/geometry/extensions/index/algorithms/union_content.hpp @@ -1,9 +1,10 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - boxes union/sum area/volume +// boxes union/sum area/volume +// +// Copyright (c) 2008 Federico J. Fernandez. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2008 Federico J. Fernandez. -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/assert.hpp b/include/boost/geometry/extensions/index/assert.hpp index d614165ea..e42dc6210 100644 --- a/include/boost/geometry/extensions/index/assert.hpp +++ b/include/boost/geometry/extensions/index/assert.hpp @@ -1,8 +1,7 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - ASSERT +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 1df5c6b03..70901c720 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - Spatial index distance predicates, calculators and checkers used in nearest query +// Spatial index distance predicates, calculators and checkers used in nearest neighbor query +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp index f16774937..49afbb18a 100644 --- a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - nearest neighbour filter implementation +// Nearest neighbour filter implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/filters/query_filter.hpp b/include/boost/geometry/extensions/index/filters/query_filter.hpp index 185278cd0..025cfa069 100644 --- a/include/boost/geometry/extensions/index/filters/query_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/query_filter.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - query filter implementation +// Query filter implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/indexable.hpp b/include/boost/geometry/extensions/index/indexable.hpp index 5092b5086..1729c3699 100644 --- a/include/boost/geometry/extensions/index/indexable.hpp +++ b/include/boost/geometry/extensions/index/indexable.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - indexable traits and functions +// Indexable's traits and related functions +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/inserter.hpp b/include/boost/geometry/extensions/index/inserter.hpp index 73fe21fc7..15f4b176b 100644 --- a/include/boost/geometry/extensions/index/inserter.hpp +++ b/include/boost/geometry/extensions/index/inserter.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - inserter +// Insert iterator +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/nonassignable.hpp b/include/boost/geometry/extensions/index/nonassignable.hpp index a272c9289..c6ee9ebeb 100644 --- a/include/boost/geometry/extensions/index/nonassignable.hpp +++ b/include/boost/geometry/extensions/index/nonassignable.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - nonassignable +// Spatial query predicates +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 57b0d088d..07350416e 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - Spatial index query predicates +// Spatial query predicates +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index 80fcc258f..fa859149f 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -1,8 +1,7 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - pushable array +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp index 3b19559f5..fd4f90a42 100644 --- a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp @@ -1,9 +1,10 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - Spatial index distance predicates, calculators and checkers -// used in nearest query - rtree's nodes specializations +// Spatial index distance predicates, calculators and checkers +// used in nearest query - specialized for nodes +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 1c63b0fa4..6cda2401d 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - rtree queries filters implementation +// R-tree queries filters implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp b/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp index 2577d9fec..7e2ff2285 100644 --- a/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp +++ b/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree +// R-tree kmeans algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp b/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp index 0f1842f25..55512ec5e 100644 --- a/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp +++ b/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree kmeans split algorithm implementation +// R-tree kmeans split algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011, 2012 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp index bf8db77ca..1f249bd04 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/linear.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree +// R-tree linear algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index afe978151..022f9aea0 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -1,9 +1,10 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree linear split algorithm implementation +// R-tree linear split algorithm implementation +// +// Copyright (c) 2008 Federico J. Fernandez. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2008 Federico J. Fernandez. -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 2f5c9a943..5b25b003d 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree nodes +// R-tree nodes +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index 0360aaf29..1c1954633 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree polymorphic nodes +// R-tree nodes based on run-time polymorphism, storing std::vectors +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp index 854680811..540cc751a 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree polymorphic nodes with static-size containers +// R-tree nodes based on runtime-polymorphism, storing static-size containers +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp index ba7a6dba0..2a97c255c 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree variant nodes with static-size containers +// R-tree nodes based on Boost.Variant, storing static-size containers +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index b5fff6942..51e08d1f8 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree variant nodes +// R-tree nodes based on Boost.Variant, storing std::vectors +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 64ebae231..96ca9e54b 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - rtree variants options +// R-tree options, algorithms, parameters +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp index 2d6c6ae27..106d938b7 100644 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/predicates.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - Spatial index query predicates +// Spatial query predicates checks specialized for nodes +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp index 5927a2b27..071311d39 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree +// R-tree quadratic algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index f7cec8b47..bf0e8a77c 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree quadratic split algorithm implementation +// R-tree quadratic split algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index 1c781ea82..d2811b86d 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R*-tree ChooseNextNode algorithm +// R-tree R*-tree next node choosing algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 2aad1f797..57f7a41fd 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R*-tree insert +// R-tree R*-tree insert algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index b8d04196f..049eea0b9 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R*-tree split algorithm implementation +// R-tree R*-tree split algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp index 973d9a572..a8db3364e 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R*-tree +// R-tree R*-tree algorithm implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 77021eadb..3153a3905 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -1,9 +1,10 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree implementation +// R-tree implementation +// +// Copyright (c) 2008 Federico J. Fernandez. +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2008 Federico J. Fernandez. -// Copyright 2011, 2012 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/tags.hpp b/include/boost/geometry/extensions/index/rtree/tags.hpp index 682368f72..7170755a2 100644 --- a/include/boost/geometry/extensions/index/rtree/tags.hpp +++ b/include/boost/geometry/extensions/index/rtree/tags.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - tags related to rtree used in various files +// Tags used by the R-tree implementation. +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 0c12b170f..85aa5eb05 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree boxes checking visitor +// R-tree boxes validating visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index 946a4303c..16a443ace 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree levels checking visitor +// R-tree levels validating visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp index 626553643..860d5e9cc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree node children box calculating visitor +// R-tree node children box calculating visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp index 12fa86435..a2cda3647 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree copying visitor +// R-tree deep copying visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index eac919b6d..7be482930 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree destroy visitor +// R-tree destroying visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) 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 9b51e51a1..6b2a8121a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree GL-draw visitor +// R-tree OpenGL drawing visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 2823bacf4..300b9b83a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree insert details +// R-tree inserting visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index f07bc7d15..9fd479b4f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree is leaf visitor +// R-tree leaf node checking visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index abbf33676..b789a706f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree k nearest neighbors query +// R-tree k nearest neighbour querying visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp index 71d7658d4..8c48ecb08 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/print.hpp @@ -1,9 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree printing visitor +// R-tree ostreaming visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2008 Federico J. Fernandez. -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp index 9b420e54b..b7aa9643d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree spatial query +// R-tree querying visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index db267702b..59827d6ee 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.Index - R-tree remove +// R-tree removing visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index c20fff09c..d880e2b13 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - default value to bounding object translation +// Default translator +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/translator/helpers.hpp b/include/boost/geometry/extensions/index/translator/helpers.hpp index 1bc57ccd3..02610f31e 100644 --- a/include/boost/geometry/extensions/index/translator/helpers.hpp +++ b/include/boost/geometry/extensions/index/translator/helpers.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - translators helper functions +// Translators helper functions +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/translator/index.hpp b/include/boost/geometry/extensions/index/translator/index.hpp index 73116c564..8245e3c38 100644 --- a/include/boost/geometry/extensions/index/translator/index.hpp +++ b/include/boost/geometry/extensions/index/translator/index.hpp @@ -1,8 +1,9 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - container index value to bounding object translation +// Translator translating random-access container index value to Indexable object +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/translator/translator.hpp b/include/boost/geometry/extensions/index/translator/translator.hpp index 6a8654606..8caef4dab 100644 --- a/include/boost/geometry/extensions/index/translator/translator.hpp +++ b/include/boost/geometry/extensions/index/translator/translator.hpp @@ -1,8 +1,7 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - translators +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/geometry/extensions/index/tuples.hpp b/include/boost/geometry/extensions/index/tuples.hpp index 5d0f4c0a0..3e63c49bc 100644 --- a/include/boost/geometry/extensions/index/tuples.hpp +++ b/include/boost/geometry/extensions/index/tuples.hpp @@ -1,8 +1,7 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // -// Boost.SpatialIndex - tags related to rtree used in various files +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // -// Copyright 2011 Adam Wulkiewicz. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 8eeb345e3..c38dfdf12 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,8 +1,5 @@ -# Boost.Geometry (aka GGL, Generic Geometry Library) +# Boost.Geometry Index # -# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -# Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -# Copyright (c) 2009-2012 Mateusz Loskot, London, UK. # Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, diff --git a/test/algorithms/Jamfile.v2 b/test/algorithms/Jamfile.v2 index a1eecfe3b..43c9a4217 100644 --- a/test/algorithms/Jamfile.v2 +++ b/test/algorithms/Jamfile.v2 @@ -1,8 +1,5 @@ -# Boost.Geometry (aka GGL, Generic Geometry Library) +# Boost.Geometry Index # -# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -# Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -# Copyright (c) 2009-2012 Mateusz Loskot, London, UK. # Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, diff --git a/test/algorithms/content.cpp b/test/algorithms/content.cpp index d49253d01..1d52cc5c2 100644 --- a/test/algorithms/content.cpp +++ b/test/algorithms/content.cpp @@ -1,19 +1,12 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) - #include #include diff --git a/test/algorithms/intersection_content.cpp b/test/algorithms/intersection_content.cpp index 864276d2b..4692f7a6b 100644 --- a/test/algorithms/intersection_content.cpp +++ b/test/algorithms/intersection_content.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/algorithms/is_valid.cpp b/test/algorithms/is_valid.cpp index 64ee21137..f2190cd7f 100644 --- a/test/algorithms/is_valid.cpp +++ b/test/algorithms/is_valid.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/algorithms/margin.cpp b/test/algorithms/margin.cpp index 39284901d..fa4205897 100644 --- a/test/algorithms/margin.cpp +++ b/test/algorithms/margin.cpp @@ -1,19 +1,12 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) - #include #include diff --git a/test/algorithms/minmaxdist.cpp b/test/algorithms/minmaxdist.cpp index 4fd0af130..df770cb83 100644 --- a/test/algorithms/minmaxdist.cpp +++ b/test/algorithms/minmaxdist.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/algorithms/test_content.hpp b/test/algorithms/test_content.hpp index 42143d575..9d880ae71 100644 --- a/test/algorithms/test_content.hpp +++ b/test/algorithms/test_content.hpp @@ -1,7 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, diff --git a/test/algorithms/test_intersection_content.hpp b/test/algorithms/test_intersection_content.hpp index c07ff6ee8..9998e4543 100644 --- a/test/algorithms/test_intersection_content.hpp +++ b/test/algorithms/test_intersection_content.hpp @@ -1,7 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, diff --git a/test/algorithms/test_margin.hpp b/test/algorithms/test_margin.hpp index 318478221..2dfef3b34 100644 --- a/test/algorithms/test_margin.hpp +++ b/test/algorithms/test_margin.hpp @@ -1,7 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, diff --git a/test/algorithms/test_union_content.hpp b/test/algorithms/test_union_content.hpp index dfbf2432e..0310ae266 100644 --- a/test/algorithms/test_union_content.hpp +++ b/test/algorithms/test_union_content.hpp @@ -1,7 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, diff --git a/test/algorithms/union_content.cpp b/test/algorithms/union_content.cpp index 84313cc8e..6acac580f 100644 --- a/test/algorithms/union_content.cpp +++ b/test/algorithms/union_content.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp index c7680a2a2..0f21bdc20 100644 --- a/test/geometry_index_test_common.hpp +++ b/test/geometry_index_test_common.hpp @@ -1,18 +1,12 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index +// Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) - #ifndef GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP #define GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index c9004cc2b..b4bca41d0 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -1,8 +1,5 @@ -# Boost.Geometry (aka GGL, Generic Geometry Library) +# Boost.Geometry Index # -# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -# Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -# Copyright (c) 2009-2012 Mateusz Loskot, London, UK. # Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, diff --git a/test/rtree/rtree2d_linear_d.cpp b/test/rtree/rtree2d_linear_d.cpp index 81f38c00e..c73a356bc 100644 --- a/test/rtree/rtree2d_linear_d.cpp +++ b/test/rtree/rtree2d_linear_d.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_linear_f.cpp b/test/rtree/rtree2d_linear_f.cpp index 73c703468..8ea8d04ff 100644 --- a/test/rtree/rtree2d_linear_f.cpp +++ b/test/rtree/rtree2d_linear_f.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_linear_i.cpp b/test/rtree/rtree2d_linear_i.cpp index 3b48b6912..f1ea68bd0 100644 --- a/test/rtree/rtree2d_linear_i.cpp +++ b/test/rtree/rtree2d_linear_i.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_linear_tt.cpp b/test/rtree/rtree2d_linear_tt.cpp index 374991ff2..d8ade8b74 100644 --- a/test/rtree/rtree2d_linear_tt.cpp +++ b/test/rtree/rtree2d_linear_tt.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_quadratic_d.cpp b/test/rtree/rtree2d_quadratic_d.cpp index b813fef75..0da13f9b3 100644 --- a/test/rtree/rtree2d_quadratic_d.cpp +++ b/test/rtree/rtree2d_quadratic_d.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_quadratic_f.cpp b/test/rtree/rtree2d_quadratic_f.cpp index 547d17094..b7cd17f6c 100644 --- a/test/rtree/rtree2d_quadratic_f.cpp +++ b/test/rtree/rtree2d_quadratic_f.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_quadratic_i.cpp b/test/rtree/rtree2d_quadratic_i.cpp index 4ae90d053..c3a5d9180 100644 --- a/test/rtree/rtree2d_quadratic_i.cpp +++ b/test/rtree/rtree2d_quadratic_i.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_quadratic_tt.cpp b/test/rtree/rtree2d_quadratic_tt.cpp index 9ab30853f..1ff26daa5 100644 --- a/test/rtree/rtree2d_quadratic_tt.cpp +++ b/test/rtree/rtree2d_quadratic_tt.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_rstar_d.cpp b/test/rtree/rtree2d_rstar_d.cpp index ed23fa405..a9ffbb38d 100644 --- a/test/rtree/rtree2d_rstar_d.cpp +++ b/test/rtree/rtree2d_rstar_d.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_rstar_f.cpp b/test/rtree/rtree2d_rstar_f.cpp index 5be07e3a1..a9b436323 100644 --- a/test/rtree/rtree2d_rstar_f.cpp +++ b/test/rtree/rtree2d_rstar_f.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_rstar_i.cpp b/test/rtree/rtree2d_rstar_i.cpp index 00502cacc..0ede4c08f 100644 --- a/test/rtree/rtree2d_rstar_i.cpp +++ b/test/rtree/rtree2d_rstar_i.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree2d_rstar_tt.cpp b/test/rtree/rtree2d_rstar_tt.cpp index 4e6ff71f8..789581c08 100644 --- a/test/rtree/rtree2d_rstar_tt.cpp +++ b/test/rtree/rtree2d_rstar_tt.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_linear_d.cpp b/test/rtree/rtree3d_linear_d.cpp index 7f202f6f0..0f9fa35e6 100644 --- a/test/rtree/rtree3d_linear_d.cpp +++ b/test/rtree/rtree3d_linear_d.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_linear_f.cpp b/test/rtree/rtree3d_linear_f.cpp index 459c37ee6..12d54f332 100644 --- a/test/rtree/rtree3d_linear_f.cpp +++ b/test/rtree/rtree3d_linear_f.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_linear_i.cpp b/test/rtree/rtree3d_linear_i.cpp index 191860bce..8b776b5ed 100644 --- a/test/rtree/rtree3d_linear_i.cpp +++ b/test/rtree/rtree3d_linear_i.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_linear_tt.cpp b/test/rtree/rtree3d_linear_tt.cpp index fb99c3186..12ddbd444 100644 --- a/test/rtree/rtree3d_linear_tt.cpp +++ b/test/rtree/rtree3d_linear_tt.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_quadratic_d.cpp b/test/rtree/rtree3d_quadratic_d.cpp index 8d447ff38..721290dbe 100644 --- a/test/rtree/rtree3d_quadratic_d.cpp +++ b/test/rtree/rtree3d_quadratic_d.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_quadratic_f.cpp b/test/rtree/rtree3d_quadratic_f.cpp index 5b7e88210..9236da6fd 100644 --- a/test/rtree/rtree3d_quadratic_f.cpp +++ b/test/rtree/rtree3d_quadratic_f.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_quadratic_i.cpp b/test/rtree/rtree3d_quadratic_i.cpp index ef811af87..e38865a71 100644 --- a/test/rtree/rtree3d_quadratic_i.cpp +++ b/test/rtree/rtree3d_quadratic_i.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_quadratic_tt.cpp b/test/rtree/rtree3d_quadratic_tt.cpp index 093725739..9ed655257 100644 --- a/test/rtree/rtree3d_quadratic_tt.cpp +++ b/test/rtree/rtree3d_quadratic_tt.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_rstar_d.cpp b/test/rtree/rtree3d_rstar_d.cpp index 6e6820315..7552edeb2 100644 --- a/test/rtree/rtree3d_rstar_d.cpp +++ b/test/rtree/rtree3d_rstar_d.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_rstar_f.cpp b/test/rtree/rtree3d_rstar_f.cpp index 4033e1463..f258ce1ae 100644 --- a/test/rtree/rtree3d_rstar_f.cpp +++ b/test/rtree/rtree3d_rstar_f.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_rstar_i.cpp b/test/rtree/rtree3d_rstar_i.cpp index 43f2a6a29..6688566a3 100644 --- a/test/rtree/rtree3d_rstar_i.cpp +++ b/test/rtree/rtree3d_rstar_i.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/rtree3d_rstar_tt.cpp b/test/rtree/rtree3d_rstar_tt.cpp index dbf564e76..2f03ed6a9 100644 --- a/test/rtree/rtree3d_rstar_tt.cpp +++ b/test/rtree/rtree3d_rstar_tt.cpp @@ -1,14 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. - // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 5ec0f9023..a583654b4 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1,7 +1,6 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) +// Boost.Geometry Index // Unit Test -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, From 1f72fc54cb1a40b76af9585cb9cc30497339535e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 26 Aug 2012 00:41:11 +0000 Subject: [PATCH 126/366] Implemented r-tree run-time parameters. Tests modified. Added remove() test. [SVN r80230] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../geometry_index/r_tree/introduction.html | 2 +- .../r_tree/nearest_neighbours_queries.html | 2 +- .../r_tree/r_tree_creation.html | 2 +- .../r_tree/rtree_quickstart.html | 2 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 11 +- doc/index.qbk | 4 +- .../extensions/index/pushable_array.hpp | 6 + .../rtree/linear/redistribute_elements.hpp | 62 +++++----- .../index/rtree/node/node_default.hpp | 7 ++ .../index/rtree/node/node_default_static.hpp | 7 ++ .../extensions/index/rtree/options.hpp | 115 ++++++++++++++++++ .../rtree/quadratic/redistribute_elements.hpp | 37 +++--- .../index/rtree/rstar/choose_next_node.hpp | 22 ++-- .../extensions/index/rtree/rstar/insert.hpp | 75 ++++++++---- .../rtree/rstar/redistribute_elements.hpp | 63 +++++----- .../geometry/extensions/index/rtree/rtree.hpp | 35 ++++-- .../index/rtree/visitors/insert.hpp | 75 +++++++----- .../index/rtree/visitors/nearest.hpp | 34 +++--- .../index/rtree/visitors/remove.hpp | 38 +++--- test/rtree/rtree2d_linear_d.cpp | 1 + test/rtree/rtree2d_linear_f.cpp | 1 + test/rtree/rtree2d_linear_i.cpp | 1 + test/rtree/rtree2d_linear_tt.cpp | 2 + test/rtree/rtree2d_quadratic_d.cpp | 1 + test/rtree/rtree2d_quadratic_f.cpp | 1 + test/rtree/rtree2d_quadratic_i.cpp | 1 + test/rtree/rtree2d_quadratic_tt.cpp | 1 + test/rtree/rtree2d_rstar_d.cpp | 1 + test/rtree/rtree2d_rstar_f.cpp | 1 + test/rtree/rtree2d_rstar_i.cpp | 1 + test/rtree/rtree2d_rstar_tt.cpp | 1 + test/rtree/rtree3d_linear_d.cpp | 1 + test/rtree/rtree3d_linear_f.cpp | 1 + test/rtree/rtree3d_linear_i.cpp | 3 +- test/rtree/rtree3d_linear_tt.cpp | 1 + test/rtree/rtree3d_quadratic_d.cpp | 1 + test/rtree/rtree3d_quadratic_f.cpp | 1 + test/rtree/rtree3d_quadratic_i.cpp | 3 +- test/rtree/rtree3d_quadratic_tt.cpp | 1 + test/rtree/rtree3d_rstar_d.cpp | 1 + test/rtree/rtree3d_rstar_f.cpp | 1 + test/rtree/rtree3d_rstar_i.cpp | 1 + test/rtree/rtree3d_rstar_tt.cpp | 1 + test/rtree/test_rtree.hpp | 68 ++++++++--- 47 files changed, 485 insertions(+), 217 deletions(-) diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index 0f8691293..ca188b486 100644 --- a/doc/html/geometry_index/introduction.html +++ b/doc/html/geometry_index/introduction.html @@ -39,7 +39,7 @@ - @@ -185,7 +185,7 @@ @@ -344,7 +344,7 @@ @@ -392,15 +392,15 @@ @@ -800,6 +799,13 @@ The R-tree spatial index.
    -
    - @@ -185,7 +185,7 @@ @@ -344,7 +344,7 @@ @@ -392,15 +392,15 @@
    -
    - @@ -185,7 +185,7 @@ @@ -344,7 +344,7 @@ @@ -392,15 +392,15 @@
    - @@ -185,7 +185,7 @@ @@ -344,7 +344,7 @@ @@ -392,15 +392,15 @@ @@ -205,7 +222,7 @@ @@ -223,7 +240,11 @@

    template<typename Iterator>
    -rtree(Iterator first, Iterator last, Parameters parameters = Parameters(), translator_type const & translator = translator_type(), Allocator allocator = std::allocator< value_type >())
    +rtree(Iteratorfirst, + Iteratorlast, + parameters_typeparameters=parameters_type(), + translator_typeconst&translator=translator_type(), + allocator_typeallocator=allocator_type())

    @@ -242,7 +263,7 @@ The end of the range of Values.

    - Parameters: parameters: + parameters_type: parameters: The parameters object.

    @@ -250,7 +271,7 @@ translator: The translator object.

    - Allocator: allocator: + allocator_type: allocator: The allocator object.

    @@ -260,7 +281,10 @@

    template<typename Range>
    -rtree(Range const & rng, Parameters parameters = Parameters(), translator_type const & translator = translator_type(), Allocator allocator = std::allocator< value_type >())
    +rtree(Rangeconst&rng, + parameters_typeparameters=parameters_type(), + translator_typeconst&translator=translator_type(), + allocator_typeallocator=allocator_type())

    @@ -275,7 +299,7 @@ The range of Values.

    - Parameters: parameters: + parameters_type: parameters: The parameters object.

    @@ -283,7 +307,7 @@ translator: The translator object.

    - Allocator: allocator: + allocator_type: allocator: The allocator object.

    @@ -313,7 +337,7 @@ @@ -329,8 +353,8 @@ The rtree which content will be copied.

    - Allocator const &: allocator: - The allocator which will be used. + allocator_type const &: + allocator: The allocator which will be used.

    @@ -338,7 +362,7 @@ @@ -350,7 +374,7 @@ @@ -413,7 +437,7 @@ @@ -425,8 +449,8 @@ @@ -435,7 +459,7 @@ @@ -447,7 +471,7 @@ @@ -501,7 +525,8 @@

    template<typename Iterator>
    -void insert(Iterator first, Iterator last)
    +void +insert(Iteratorfirst,Iteratorlast)

    @@ -575,7 +600,8 @@

    template<typename Iterator>
    -size_type remove(Iterator first, Iterator last)
    +size_type +remove(Iteratorfirst,Iteratorlast)

    @@ -638,7 +664,8 @@

    template<typename Predicates, typename OutIter>
    -size_type spatial_query(Predicates const & pred, OutIter out_it)
    +size_type +spatial_query(Predicatesconst&pred,OutIterout_it)

    @@ -676,7 +703,8 @@

    template<typename DistancesPredicates>
    -size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
    +size_type +nearest_query(DistancesPredicatesconst&dpred,value_type&v)

    @@ -719,7 +747,10 @@

    template<typename DistancesPredicates, typename Predicates>
    -size_type nearest_query(DistancesPredicates const & dpred, Predicates const & pred, value_type & v)
    +size_type +nearest_query(DistancesPredicatesconst&dpred, + Predicatesconst&pred, + value_type&v)

    @@ -772,7 +803,10 @@

    template<typename DistancesPredicates, typename OutIter>
    -size_type nearest_query(DistancesPredicates const & dpred, size_t k, OutIter out_it)
    +size_type +nearest_query(DistancesPredicatesconst&dpred, + size_tk, + OutIterout_it)

    @@ -818,8 +852,14 @@ diff --git a/doc/html/index.html b/doc/html/index.html index da79de784..a5aed9f76 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@
    -
    - + + + + + + + + - - - - + + + + - - - - + + + + @@ -197,7 +197,7 @@ @@ -209,7 +209,7 @@ @@ -221,7 +221,7 @@ @@ -234,7 +234,7 @@ @@ -246,7 +246,7 @@ @@ -343,7 +343,7 @@ @@ -395,6 +395,11 @@ nothrow - if allocators are equal, strong - otherwise

    [b] + If this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may + return invalid data. +

    +

    [c] nothrow - if CoordinateType has nonthrowing copy constructor, strong - otherwise diff --git a/doc/html/index.html b/doc/html/index.html index 1e374d495..2db321f3a 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@

    - @@ -308,7 +308,7 @@ @@ -350,10 +350,10 @@ + + +
    - @@ -93,6 +94,12 @@ + + + + + + + + @@ -137,11 +151,17 @@ + + + + + + + + + + + + + + + + + + + + - +
    -
    -
    -
    -
    @@ -163,7 +163,7 @@ must be greater than 10 */ Point pt(...); Box b(...); -size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); +size_t n1 = rt.nearest(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); diff --git a/doc/html/index.html b/doc/html/index.html index cb1da7e6c..dfa4be92f 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -54,7 +54,7 @@
    - +

    Last revised: August 26, 2012 at 01:34:23 GMT

    Last revised: September 04, 2012 at 18:00:33 GMT


    diff --git a/doc/rtree/nearest.qbk b/doc/rtree/nearest.qbk index 2ecdf5717..8b157b1de 100644 --- a/doc/rtree/nearest.qbk +++ b/doc/rtree/nearest.qbk @@ -92,15 +92,15 @@ non-point `__indexable__` should be taken into account in the routine calculatin /* same as default - distance between Indexable's closest point and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::near(10)), k, std::back_inserter(returned_values)); + index::nearest(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's furthest point and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::far(10)), k, std::back_inserter(returned_values)); + index::nearest(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's centroid and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::centroid(10)), k, std::back_inserter(returned_values)); + index::nearest(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values)); [endsect] @@ -114,7 +114,7 @@ It is possible to use spatial predicates described before in nearest neighbours __point__ pt(...); __box__ b(...); - size_t n1 = rt.nearest(index::bounded(pt, index::far(1), 10), index::intersects(b), returned_value); + size_t n1 = rt.nearest(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 70901c720..afc0d2bdf 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -33,31 +33,31 @@ namespace detail { // relations template -struct near +struct to_nearest { - near(T const& v) : value(v) {} + to_nearest(T const& v) : value(v) {} T value; }; template -struct centroid +struct to_centroid { - centroid(T const& v) : value(v) {} + to_centroid(T const& v) : value(v) {} T value; }; template -struct far +struct to_furthest { - far(T const& v) : value(v) {} + to_furthest(T const& v) : value(v) {} T value; }; // tags -struct near_tag {}; -struct centroid_tag {}; -struct far_tag {}; +struct to_nearest_tag {}; +struct to_centroid_tag {}; +struct to_furthest_tag {}; // relation @@ -65,36 +65,36 @@ template struct relation { typedef T value_type; - typedef near_tag tag; + typedef to_nearest_tag tag; static inline T const& value(T const& v) { return v; } static inline T & value(T & v) { return v; } }; template -struct relation< near > +struct relation< to_nearest > { typedef T value_type; - typedef near_tag tag; - static inline T const& value(near const& r) { return r.value; } - static inline T & value(near & r) { return r.value; } + typedef to_nearest_tag tag; + static inline T const& value(to_nearest const& r) { return r.value; } + static inline T & value(to_nearest & r) { return r.value; } }; template -struct relation< centroid > +struct relation< to_centroid > { typedef T value_type; - typedef centroid_tag tag; - static inline T const& value(centroid const& r) { return r.value; } - static inline T & value(centroid & r) { return r.value; } + typedef to_centroid_tag tag; + static inline T const& value(to_centroid const& r) { return r.value; } + static inline T & value(to_centroid & r) { return r.value; } }; template -struct relation< far > +struct relation< to_furthest > { typedef T value_type; - typedef far_tag tag; - static inline T const& value(far const& r) { return r.value; } - static inline T & value(far & r) { return r.value; } + typedef to_furthest_tag tag; + static inline T const& value(to_furthest const& r) { return r.value; } + static inline T & value(to_furthest & r) { return r.value; } }; } // namespace detail @@ -115,9 +115,9 @@ closer or further than value v. This is default relation. \param v Point or bound value. */ template -detail::near near(T const& v) +detail::to_nearest to_nearest(T const& v) { - return detail::near(v); + return detail::to_nearest(v); } /*! @@ -133,9 +133,9 @@ closer or further than value v. \param v Point or bound value. */ template -detail::centroid centroid(T const& v) +detail::to_centroid to_centroid(T const& v) { - return detail::centroid(v); + return detail::to_centroid(v); } /*! @@ -152,9 +152,9 @@ closer or further than value v. \param v Point or bound value. */ template -detail::far far(T const& v) +detail::to_furthest to_furthest(T const& v) { - return detail::far(v); + return detail::to_furthest(v); } // distance predicates @@ -244,8 +244,8 @@ by PointRelation. This is default nearest predicate. \tparam PointRelation PointRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). */ template inline detail::unbounded @@ -264,10 +264,10 @@ Point but only if nearest points are further than some distance. \tparam PointRelation PointRelation type. \tparam MinRelation MinRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). -\param minr The minimum bound relation. This may be generated by bgi::near(min_distance), - bgi::centroid(min_distance) or bgi::far(min_distance). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +\param minr The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). */ template inline detail::min_bounded @@ -286,10 +286,10 @@ Point but only if nearest points are closer than some distance. \tparam PointRelation PointRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). -\param maxr The maximum bound relation. This may be generated by bgi::near(max_distance), - bgi::centroid(max_distance) or bgi::far(max_distance). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +\param maxr The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). */ template inline detail::max_bounded @@ -310,12 +310,12 @@ points are further than some distance and closer than some other distance. \tparam MinRelation MinRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). -\param minr The minimum bound relation. This may be generated by bgi::near(min_distance), - bgi::centroid(min_distance) or bgi::far(min_distance). -\param maxr The maximum bound relation. This may be generated by bgi::near(max_distance), - bgi::centroid(max_distance) or bgi::far(max_distance). +\param pr The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +\param minr The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). +\param maxr The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). */ template inline detail::bounded @@ -483,7 +483,7 @@ struct distances_calc_impl_rel template struct distances_calc_impl_rel< - cdist + cdist > { template @@ -496,7 +496,7 @@ struct distances_calc_impl_rel< template struct distances_calc_impl_rel< - cdist + cdist > { template @@ -509,7 +509,7 @@ struct distances_calc_impl_rel< template struct distances_calc_impl_rel< - cdist + cdist > { template diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp index fd4f90a42..73e10e188 100644 --- a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp @@ -30,7 +30,7 @@ struct distances_calc< typedef typename detail::relation::value_type point_type; typedef typename geometry::default_distance_result::type distance_type; - typedef detail::cdist result_type; + typedef detail::cdist result_type; static inline result_type apply(PointRelation const& p, Box const& i) { @@ -51,7 +51,7 @@ struct distances_calc< typedef typename detail::relation::value_type point_type; typedef typename geometry::default_distance_result::type distance_type; - typedef detail::cdist result_type; + typedef detail::cdist result_type; static inline result_type apply(detail::unbounded const& pp, Box const& i) { @@ -73,8 +73,8 @@ struct distances_calc< typedef typename geometry::default_distance_result::type distance_type; typedef typename detail::cdist_merge< - cdist, - cdist + cdist, + cdist >::type result_type; static inline result_type apply(detail::min_bounded const& pp, Box const& i) @@ -96,7 +96,7 @@ struct distances_calc< typedef typename detail::relation::value_type point_type; typedef typename geometry::default_distance_result::type distance_type; - typedef cdist result_type; + typedef cdist result_type; static inline result_type apply(detail::max_bounded const& pp, Box const& i) { @@ -118,8 +118,8 @@ struct distances_calc< typedef typename geometry::default_distance_result::type distance_type; typedef typename detail::cdist_merge< - cdist, - cdist + cdist, + cdist >::type result_type; static inline result_type apply(detail::bounded const& pp, Box const& i) @@ -173,7 +173,7 @@ struct distances_predicates_check< Distances const& d) { return pred.comparable_min - <= cdist_value::template get(d); + <= cdist_value::template get(d); } }; @@ -188,7 +188,7 @@ struct distances_predicates_check< detail::max_bounded const& pred, Distances const& d) { - return cdist_value::template get(d) + return cdist_value::template get(d) <= pred.comparable_max; } }; @@ -205,8 +205,8 @@ struct distances_predicates_check< Distances const& d) { return pred.comparable_min - <= cdist_value::template get(d) - && cdist_value::template get(d) + <= cdist_value::template get(d) + && cdist_value::template get(d) <= pred.comparable_max; } }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index fea5be68b..10b3272b2 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -392,13 +392,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param v The reference to the object which will contain the result. @@ -416,13 +416,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param pred The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), @@ -445,13 +445,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param k The max number of values. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. @@ -469,13 +469,13 @@ public: \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::near(Point), - bgi::centroid(Point) or bgi::far(Point). DistancesPredicates may also define distances + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::near(dist_bound), - bgi::centroid(dist_bound) or bgi::far(dist_bound). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \param k The max number of values. \param pred The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index 685f9c239..c85bfaf74 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -308,9 +308,9 @@ private: std::pair const& p2) { return index::detail::cdist_value - ::template get(p1.first) + ::template get(p1.first) < index::detail::cdist_value - ::template get(p2.first); + ::template get(p2.first); } template @@ -318,7 +318,7 @@ private: { return smallest_dist < index::detail::cdist_value - ::template get(d); + ::template get(d); } parameters_type const& m_parameters; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 0c3c76bcb..6749725b8 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -20,12 +20,6 @@ #include #include -/*#include -#undef near -#undef far -#undef min -#undef max*/ - template struct test_pred { From 85730539be9af46229a537cb0f4f6580f00085f4 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 20 Sep 2012 23:42:09 +0000 Subject: [PATCH 130/366] Added query_expr.hpp [SVN r80611] --- .../geometry/extensions/index/query_expr.hpp | 246 ++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100644 include/boost/geometry/extensions/index/query_expr.hpp diff --git a/include/boost/geometry/extensions/index/query_expr.hpp b/include/boost/geometry/extensions/index/query_expr.hpp new file mode 100644 index 000000000..46fef4231 --- /dev/null +++ b/include/boost/geometry/extensions/index/query_expr.hpp @@ -0,0 +1,246 @@ +// Boost.Geometry Index +// +// Query expression +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// TODO - CHANGE FILENAME TO query_expr.hpp +// create separate namespace etc. + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_QUERY_EXPR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_QUERY_EXPR_HPP + +namespace boost { namespace geometry { namespace index { + +namespace query_expr { + +// predicates tags + +struct empty_tag {}; +struct value_tag {}; +struct covered_by_tag {}; +struct disjoint_tag {}; +struct intersects_tag {}; +struct overlaps_tag {}; +//struct touches_tag {}; +struct within_tag {}; +struct nearest_tag {}; + +// predicates data + +template +struct predicate +{ + explicit predicate(Geometry const& geometry_) : geometry(geometry_) {} + Geometry geometry; +}; + +template +struct predicate +{ + explicit predicate(ValuePredicate const& value_predicate_) : value_predicate(value_predicate_) {} + ValuePredicate value_predicate; +}; + +template +struct predicate +{}; + +template +struct predicate +{ + predicate(size_t k_, DistancesPredicates const& distances_predicates_) + : k(k_), distances_predicates(distances_predicates_) + {} + + size_t k; + DistancesPredicates distances_predicates; +}; + +// expression && + +template +struct and_expr +{ + typedef Left left_type; + typedef Right right_type; + + and_expr(Left const& left_, Right const& right_) + : left(left_), right(right_) + {} + + Left const& left; + Right const& right; +}; + +// predicates_count + +template +struct predicates_count +{ + BOOST_MPL_ASSERT( + (false), + NOT_VALID_QUERY_EXPRESSION, + (Expr)); +}; + +template +struct predicates_count< and_expr > +{ + static const size_t value = predicates_count::value + predicates_count::value; +}; + +template +struct predicates_count< predicate > +{ + static const size_t value = 1; +}; + +// if_v + +template +struct if_v +{ + static const size_t value = V1; +}; +template +struct if_v +{ + static const size_t value = V2; +}; + +// if_t + +template +struct if_t +{ + typedef T1 type; +}; +template +struct if_t +{ + typedef T2 type; +}; + +// if_ret + +template +struct if_ret +{ + template + static inline T const& apply(T const& v) { return v; } +}; +template <> +struct if_ret +{ + template + void apply(T const&) {} +}; + +// predicate_access_impl - used by predicate_type and get_predicate() + +template +struct predicate_access +{ + BOOST_MPL_ASSERT( + (false), + NOT_VALID_QUERY_EXPRESSION, + (Expr)); +}; + +template +struct predicate_access, I, Curr> +{ + static const size_t curr = if_v< + I == predicate_access::curr, + predicate_access::curr, + predicate_access::curr + 1>::curr + >::value; + + typedef typename if_t< + I == predicate_access::curr, + typename predicate_access::type, + typename predicate_access::curr + 1>::type + >::type type; + + //TODO + + /*static inline + typename if_t< + I == predicate_access::curr, + typename predicate_access::return_type, + typename predicate_access::curr + 1>::return_type + >::type + apply(and_expr const& e) + { + return if_ret::apply(p); + }*/ +}; + +template +struct predicate_access, I, Curr> +{ + static const size_t curr = Curr; + + typedef typename if_t, void>::type type; + + typedef typename if_t::type return_type; + + static inline return_type apply(predicate const& p) + { + return if_ret::apply(p); + } +}; + +// predicate_type + +template +struct predicate_type +{ + typedef typename predicate_access::type type; +}; + +// get_predicate + +template +typename predicate_type::type const& +get_predicate(Expr const& expr) +{ + return predicate_access::apply(expr); +}; + +} // namespace query_expr + +}}} // namespace boost::geometry::index + +template +boost::geometry::index::query_expr::and_expr< + boost::geometry::index::query_expr::predicate, + boost::geometry::index::query_expr::predicate +> +operator&&(boost::geometry::index::query_expr::predicate const& left, + boost::geometry::index::query_expr::predicate const& right) +{ + using namespace boost::geometry::index::query_expr; + + return and_expr< predicate, predicate >(left, right); +} + +template +boost::geometry::index::query_expr::and_expr< + boost::geometry::index::query_expr::and_expr, + boost::geometry::index::query_expr::predicate +> +operator&&(boost::geometry::index::query_expr::and_expr const& left, + boost::geometry::index::query_expr::predicate const& right) +{ + using namespace boost::geometry::index::query_expr; + + return and_expr< and_expr, predicate >(left, right); +} + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_QUERY_EXPR_HPP From d0ce652bb7edf50a85035669fe09a6b0afd8453c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 21 Sep 2012 01:57:29 +0000 Subject: [PATCH 131/366] implemented additional query_expr helpers. [SVN r80612] --- .../geometry/extensions/index/query_expr.hpp | 186 +++++++++++++++--- 1 file changed, 158 insertions(+), 28 deletions(-) diff --git a/include/boost/geometry/extensions/index/query_expr.hpp b/include/boost/geometry/extensions/index/query_expr.hpp index 46fef4231..7fb6dbd38 100644 --- a/include/boost/geometry/extensions/index/query_expr.hpp +++ b/include/boost/geometry/extensions/index/query_expr.hpp @@ -15,21 +15,33 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_QUERY_EXPR_HPP namespace boost { namespace geometry { namespace index { - + namespace query_expr { // predicates tags struct empty_tag {}; struct value_tag {}; + struct covered_by_tag {}; struct disjoint_tag {}; struct intersects_tag {}; struct overlaps_tag {}; //struct touches_tag {}; struct within_tag {}; + +struct not_covered_by_tag {}; +struct not_disjoint_tag {}; +struct not_intersects_tag {}; +struct not_overlaps_tag {}; +//struct not_touches_tag {}; +struct not_within_tag {}; + struct nearest_tag {}; +// closer_than_tag ? +// further_than_tag ? + // predicates data template @@ -77,25 +89,38 @@ struct and_expr Right const& right; }; -// predicates_count +// predicate_tag +template +struct predicate_tag +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_VALID_PREDICATE, + (Predicate)); +}; +template +struct predicate_tag< predicate > +{ + typedef Tag type; +}; + +// predicates_length template -struct predicates_count +struct predicates_length { - BOOST_MPL_ASSERT( + BOOST_MPL_ASSERT_MSG( (false), NOT_VALID_QUERY_EXPRESSION, (Expr)); }; - template -struct predicates_count< and_expr > +struct predicates_length< and_expr > { - static const size_t value = predicates_count::value + predicates_count::value; + static const size_t value = predicates_length::value + predicates_length::value; }; - template -struct predicates_count< predicate > +struct predicates_length< predicate > { static const size_t value = 1; }; @@ -126,8 +151,19 @@ struct if_t typedef T2 type; }; -// if_ret +// if_ret_t +template +struct if_ret_t +{ + typedef T const& type; +}; +template +struct if_ret_t +{ + typedef void type; +}; +// if_ret template struct if_ret { @@ -141,12 +177,40 @@ struct if_ret void apply(T const&) {} }; +// if_ret2 +template +struct if_ret2 +{ + template + static inline typename L::return_type + apply(Expr const& e) { return L::apply(e.left); } +}; +template +struct if_ret2 +{ + template + static inline typename R::return_type + apply(Expr const& e) { return R::apply(e.right); } +}; + +// types_equal +template +struct types_equal +{ + static const bool value = false; +}; +template +struct types_equal +{ + static const bool value = true; +}; + // predicate_access_impl - used by predicate_type and get_predicate() template struct predicate_access { - BOOST_MPL_ASSERT( + BOOST_MPL_ASSERT_MSG( (false), NOT_VALID_QUERY_EXPRESSION, (Expr)); @@ -155,30 +219,32 @@ struct predicate_access template struct predicate_access, I, Curr> { + typedef predicate_access L; + typedef predicate_access::curr + 1> R; + static const size_t curr = if_v< - I == predicate_access::curr, - predicate_access::curr, - predicate_access::curr + 1>::curr + I == L::curr, + L::curr, + R::curr >::value; typedef typename if_t< - I == predicate_access::curr, - typename predicate_access::type, - typename predicate_access::curr + 1>::type + I == L::curr, + typename L::type, + typename R::type >::type type; - //TODO + typedef typename if_t< + I == L::curr, + typename L::return_type, + typename R::return_type + >::type return_type; - /*static inline - typename if_t< - I == predicate_access::curr, - typename predicate_access::return_type, - typename predicate_access::curr + 1>::return_type - >::type + static inline return_type apply(and_expr const& e) { - return if_ret::apply(p); - }*/ + return if_ret2::apply(e); + } }; template @@ -188,7 +254,7 @@ struct predicate_access, I, Curr> typedef typename if_t, void>::type type; - typedef typename if_t::type return_type; + typedef typename if_ret_t::type return_type; static inline return_type apply(predicate const& p) { @@ -207,12 +273,76 @@ struct predicate_type // get_predicate template -typename predicate_type::type const& +typename predicate_access::return_type get_predicate(Expr const& expr) { return predicate_access::apply(expr); }; +// predicate_index +template +struct predicate_index_impl +{ + static const size_t value = if_v< + types_equal< + Tag, + typename predicate_tag< + typename predicate_type::type + >::type + >::value, + I, + predicate_index_impl::value + >::value; +}; +template +struct predicate_index_impl +{ + static const size_t value = N; +}; + +template +struct predicate_index +{ + static const size_t value = + predicate_index_impl< + Expr, Tag, I, predicates_length::value + >::value; +}; + +// count_predicate +template +struct count_predicate_impl +{ + static const size_t value = + count_predicate_impl::value + + if_v< + types_equal< + Tag, + typename predicate_tag< + typename predicate_type::type + >::type + >::value, + 1, + 0 + >::value; +}; +template +struct count_predicate_impl +{ + static const size_t value = 0; +}; + +template +struct count_predicate +{ + static const size_t value = + count_predicate_impl< + Expr, Tag, I, predicates_length::value + >::value; +}; + +// count_predicate + } // namespace query_expr }}} // namespace boost::geometry::index From de6f314304a8fe10634edf3957525b0f107adf52 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 28 Sep 2012 23:20:26 +0000 Subject: [PATCH 132/366] creation of geometry index dev branch [SVN r80749] From df4497d35a7aa363e78213441577af5617816238 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 28 Sep 2012 23:27:12 +0000 Subject: [PATCH 133/366] rtree node xxx_poly visitor and node types renamed to dynamic_xxx and moved to dynamic_visitor.hpp [SVN r80750] --- .../index/rtree/node/dynamic_visitor.hpp | 70 ++++++++++++ .../index/rtree/node/node_default.hpp | 100 ++++++------------ .../index/rtree/node/node_default_static.hpp | 31 +++--- .../node/node_default_static_variant.hpp | 2 +- .../index/rtree/node/node_default_variant.hpp | 2 +- 5 files changed, 120 insertions(+), 85 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp b/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp new file mode 100644 index 000000000..0514bc907 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp @@ -0,0 +1,70 @@ +// Boost.Geometry Index +// +// R-tree nodes dynamic visitor and nodes base type +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +// visitor forward declaration +template +struct dynamic_visitor; + +// node + +template +struct dynamic_node +{ + virtual ~dynamic_node() {} + virtual void apply_visitor(dynamic_visitor &) = 0; + virtual void apply_visitor(dynamic_visitor &) const = 0; +}; + +// nodes variants forward declarations + +template +struct dynamic_internal_node; + +template +struct dynamic_leaf; + +// visitor + +template +struct dynamic_visitor +{ + typedef dynamic_internal_node internal_node; + typedef dynamic_leaf leaf; + + virtual ~dynamic_visitor() {} + + virtual void operator()(internal_node const&) = 0; + virtual void operator()(leaf const&) = 0; +}; + +template +struct dynamic_visitor +{ + typedef dynamic_internal_node internal_node; + typedef dynamic_leaf leaf; + + virtual ~dynamic_visitor() {} + + virtual void operator()(internal_node &) = 0; + virtual void operator()(leaf &) = 0; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index d2ca25d81..baeeb3871 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -13,56 +13,46 @@ #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { -// visitor forward declaration -template -struct visitor_poly; - -// nodes types - -template -struct node_poly -{ - virtual ~node_poly() {} - virtual void apply_visitor(visitor_poly &) = 0; - virtual void apply_visitor(visitor_poly &) const = 0; -}; - -template -struct internal_node_poly : public node_poly +template +struct dynamic_internal_node + : public dynamic_node { typedef std::vector< - std::pair *>, + std::pair *>, typename Allocators::internal_node_elements_allocator_type > elements_type; - inline internal_node_poly(typename Allocators::internal_node_elements_allocator_type & al) + inline dynamic_internal_node(typename Allocators::internal_node_elements_allocator_type & al) : elements(al) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; -template -struct leaf_poly : public node_poly +template +struct dynamic_leaf + : public dynamic_node { typedef std::vector< Value, typename Allocators::leaf_elements_allocator_type > elements_type; - inline leaf_poly(typename Allocators::leaf_elements_allocator_type & al) + inline dynamic_leaf(typename Allocators::leaf_elements_allocator_type & al) : elements(al) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; @@ -72,69 +62,43 @@ struct leaf_poly : public node_poly template struct node { - typedef node_poly type; + typedef dynamic_node type; }; template struct internal_node { - typedef internal_node_poly type; + typedef dynamic_internal_node type; }; template struct leaf { - typedef leaf_poly type; + typedef dynamic_leaf type; }; // nodes conversion template -inline Derived & get(node_poly & n) +inline Derived & get(dynamic_node & n) { assert(dynamic_cast(&n)); return static_cast(n); } template -inline Derived * get(node_poly * n) +inline Derived * get(dynamic_node * n) { assert(dynamic_cast(n)); return static_cast(n); } -// visitor - -template -struct visitor_poly -{ - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; - - virtual ~visitor_poly() {} - - virtual void operator()(internal_node const&) = 0; - virtual void operator()(leaf const&) = 0; -}; - -template -struct visitor_poly -{ - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; - - virtual ~visitor_poly() {} - - virtual void operator()(internal_node &) = 0; - virtual void operator()(leaf &) = 0; -}; - // visitor traits template struct visitor { - typedef visitor_poly type; + typedef dynamic_visitor type; }; template @@ -153,7 +117,7 @@ struct element_indexable_type template struct element_indexable_type< - std::pair *>, + std::pair *>, Translator > { @@ -172,7 +136,7 @@ element_indexable(Value const& el, Translator const& tr) template inline Box const& element_indexable( - std::pair< Box, node_poly *> const& el, + std::pair< Box, dynamic_node *> const& el, Translator const&) { return el.first; @@ -224,7 +188,7 @@ struct allocators_poly >::other leaf_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< @@ -309,14 +273,14 @@ struct create_node template struct create_node< Allocators, - internal_node_poly + dynamic_internal_node > { static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - internal_node_poly + dynamic_internal_node >::template apply< typename node::type >(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); @@ -326,14 +290,14 @@ struct create_node< template struct create_node< Allocators, - leaf_poly + dynamic_leaf > { static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - leaf_poly + dynamic_leaf >::template apply< typename node::type >(allocators.leaf_allocator, allocators.leaf_elements_allocator); @@ -354,13 +318,13 @@ struct destroy_node template struct destroy_node< Allocators, - internal_node_poly + dynamic_internal_node > { static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_poly< - internal_node_poly + dynamic_internal_node >::apply(allocators.internal_node_allocator, n); } }; @@ -368,13 +332,13 @@ struct destroy_node< template struct destroy_node< Allocators, - leaf_poly + dynamic_leaf > { static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_poly< - leaf_poly + dynamic_leaf >::apply(allocators.leaf_allocator, n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp index 6c4f8563c..0025902fb 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP +#include #include namespace boost { namespace geometry { namespace index { @@ -18,37 +19,37 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { template -struct internal_node_poly - : public node_poly +struct dynamic_internal_node + : public dynamic_node { typedef index::pushable_array< std::pair< Box, - node_poly * + dynamic_node * >, Parameters::max_elements + 1 > elements_type; template - inline internal_node_poly(Dummy) {} + inline dynamic_internal_node(Dummy) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; template -struct leaf_poly - : public node_poly +struct dynamic_leaf + : public dynamic_node { typedef index::pushable_array elements_type; template - inline leaf_poly(Dummy) {} + inline dynamic_leaf(Dummy) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; @@ -92,14 +93,14 @@ struct allocators_poly struct create_node< Allocators, - internal_node_poly + dynamic_internal_node > { static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - internal_node_poly + dynamic_internal_node >::template apply< typename node::type >(allocators.internal_node_allocator, allocators.internal_node_allocator); @@ -109,14 +110,14 @@ struct create_node< template struct create_node< Allocators, - leaf_poly + dynamic_leaf > { static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - leaf_poly + dynamic_leaf >::template apply< typename node::type >(allocators.leaf_allocator, allocators.leaf_allocator); diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp index 2a97c255c..cc1ada7e6 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp @@ -92,7 +92,7 @@ struct allocators_variant::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair::type *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index 51e08d1f8..a219c4143 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -174,7 +174,7 @@ struct allocators_variant >::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair::type *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< From 3541621b70b7f3fa83e962c1f6bb9ee171a0fd58 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 29 Sep 2012 11:37:57 +0000 Subject: [PATCH 134/366] added node/concept.hpp and moved some of empty definitions there. [SVN r80751] --- .../extensions/index/rtree/node/concept.hpp | 85 +++++++++++++++++++ .../extensions/index/rtree/node/node.hpp | 2 + .../index/rtree/node/node_default.hpp | 80 ++++++----------- .../index/rtree/node/node_default_static.hpp | 70 ++++++++++----- .../node/node_default_static_variant.hpp | 56 ++++++------ .../index/rtree/node/node_default_variant.hpp | 34 +++----- .../extensions/index/rtree/options.hpp | 22 ++--- .../geometry/extensions/index/rtree/rtree.hpp | 4 +- 8 files changed, 213 insertions(+), 140 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node/concept.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/concept.hpp b/include/boost/geometry/extensions/index/rtree/node/concept.hpp new file mode 100644 index 000000000..55238ddb0 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/concept.hpp @@ -0,0 +1,85 @@ +// Boost.Geometry Index +// +// R-tree node concept +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +struct node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (node)); +}; + +template +struct internal_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (internal_node)); +}; + +template +struct leaf +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (leaf)); +}; + +template +struct visitor +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (visitor)); +}; + +template +struct allocators +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (allocators)); +}; + +template +struct create_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, + (create_node)); +}; + +template +struct destroy_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, + (destroy_node)); +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 5b25b003d..8eb6a79af 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP +#include + #include #include diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp index baeeb3871..54790364c 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default.hpp @@ -20,11 +20,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { template -struct dynamic_internal_node - : public dynamic_node +struct dynamic_internal_node + : public dynamic_node { typedef std::vector< - std::pair *>, + std::pair *>, typename Allocators::internal_node_elements_allocator_type > elements_type; @@ -32,15 +32,15 @@ struct dynamic_internal_node & v) { v(*this); } - void apply_visitor(dynamic_visitor & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; template -struct dynamic_leaf - : public dynamic_node +struct dynamic_leaf + : public dynamic_node { typedef std::vector< Value, @@ -51,30 +51,30 @@ struct dynamic_leaf : elements(al) {} - void apply_visitor(dynamic_visitor & v) { v(*this); } - void apply_visitor(dynamic_visitor & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; // nodes traits -template -struct node +template +struct node { - typedef dynamic_node type; + typedef dynamic_node type; }; -template -struct internal_node +template +struct internal_node { - typedef dynamic_internal_node type; + typedef dynamic_internal_node type; }; -template -struct leaf +template +struct leaf { - typedef dynamic_leaf type; + typedef dynamic_leaf type; }; // nodes conversion @@ -95,10 +95,10 @@ inline Derived * get(dynamic_node * n) // visitor traits -template -struct visitor +template +struct visitor { - typedef dynamic_visitor type; + typedef dynamic_visitor type; }; template @@ -173,29 +173,29 @@ struct container_from_elements_type // allocators -template -struct allocators_poly +template +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename internal_node::type + typename internal_node::type >::other internal_node_allocator_type; typedef typename allocator_type::template rebind< - typename leaf::type + typename leaf::type >::other leaf_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< Value >::other leaf_elements_allocator_type; - inline explicit allocators_poly(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) @@ -210,14 +210,6 @@ struct allocators_poly leaf_elements_allocator_type leaf_elements_allocator; }; -// allocators - -template -struct allocators -{ - typedef allocators_poly type; -}; - // create_node_impl template @@ -261,15 +253,6 @@ struct destroy_node_poly // create_node -template -struct create_node -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, - (create_node)); -}; - template struct create_node< Allocators, @@ -306,15 +289,6 @@ struct create_node< // destroy_node -template -struct destroy_node -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, - (destroy_node)); -}; - template struct destroy_node< Allocators, diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp index 0025902fb..820d88ddf 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp @@ -19,13 +19,13 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { template -struct dynamic_internal_node - : public dynamic_node +struct dynamic_internal_node + : public dynamic_node { typedef index::pushable_array< std::pair< Box, - dynamic_node * + dynamic_node * >, Parameters::max_elements + 1 > elements_type; @@ -33,27 +33,53 @@ struct dynamic_internal_node inline dynamic_internal_node(Dummy) {} - void apply_visitor(dynamic_visitor & v) { v(*this); } - void apply_visitor(dynamic_visitor & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; template -struct dynamic_leaf - : public dynamic_node +struct dynamic_leaf + : public dynamic_node { typedef index::pushable_array elements_type; template inline dynamic_leaf(Dummy) {} - void apply_visitor(dynamic_visitor & v) { v(*this); } - void apply_visitor(dynamic_visitor & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; +// nodes traits + +template +struct node +{ + typedef dynamic_node type; +}; + +template +struct internal_node +{ + typedef dynamic_internal_node type; +}; + +template +struct leaf +{ + typedef dynamic_leaf type; +}; + +template +struct visitor +{ + typedef dynamic_visitor type; +}; + // elements derived type template struct container_from_elements_type, NewValue> @@ -61,23 +87,23 @@ struct container_from_elements_type, NewValue typedef index::pushable_array type; }; -// allocators_poly +// allocators template -struct allocators_poly +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename internal_node::type + typename internal_node::type >::other internal_node_allocator_type; typedef typename allocator_type::template rebind< - typename leaf::type + typename leaf::type >::other leaf_allocator_type; - inline explicit allocators_poly(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) @@ -93,16 +119,16 @@ struct allocators_poly struct create_node< Allocators, - dynamic_internal_node + dynamic_internal_node > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - dynamic_internal_node + dynamic_internal_node >::template apply< - typename node::type + typename node::type >(allocators.internal_node_allocator, allocators.internal_node_allocator); } }; @@ -110,16 +136,16 @@ struct create_node< template struct create_node< Allocators, - dynamic_leaf + dynamic_leaf > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - dynamic_leaf + dynamic_leaf >::template apply< - typename node::type + typename node::type >(allocators.leaf_allocator, allocators.leaf_allocator); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp index cc1ada7e6..78e63b62e 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp @@ -21,12 +21,12 @@ namespace detail { namespace rtree { // nodes default types template -struct internal_node_variant +struct internal_node_variant { typedef index::pushable_array< std::pair< Box, - typename node::type * + typename node::type * >, Parameters::max_elements + 1 > elements_type; @@ -38,7 +38,7 @@ struct internal_node_variant -struct leaf_variant +struct leaf_variant { typedef index::pushable_array elements_type; @@ -51,55 +51,55 @@ struct leaf_variant -struct node +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; template -struct internal_node +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; template -struct leaf +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // visitor traits template -struct visitor +struct visitor { typedef static_visitor<> type; }; -// allocators_variant +// allocators template -struct allocators_variant +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename node::type + typename node::type >::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair::type *> + std::pair::type *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< Value >::other leaf_elements_allocator_type; - inline explicit allocators_variant(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , node_allocator(allocator) {} @@ -108,29 +108,21 @@ struct allocators_variant -struct allocators -{ - typedef allocators_variant type; -}; - // create_node template struct create_node< Allocators, - internal_node_variant + internal_node_variant > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - internal_node_variant + internal_node_variant >::template apply< - typename node::type + typename node::type >(allocators.node_allocator, allocators.node_allocator); } }; @@ -138,16 +130,16 @@ struct create_node< template struct create_node< Allocators, - leaf_variant + leaf_variant > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - leaf_variant + leaf_variant >::template apply< - typename node::type + typename node::type >(allocators.node_allocator, allocators.node_allocator); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp index a219c4143..7ba08aabc 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp @@ -56,24 +56,24 @@ struct leaf_variant // nodes traits template -struct node +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; template -struct internal_node +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; template -struct leaf +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // nodes conversion @@ -103,7 +103,7 @@ inline V * get( // visitor traits template -struct visitor +struct visitor { typedef static_visitor<> type; }; @@ -163,25 +163,25 @@ element_indexable(std::pair< // allocators -template -struct allocators_variant +template +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename node::type + typename node::type >::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair::type *> + std::pair::type *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< Value >::other leaf_elements_allocator_type; - inline explicit allocators_variant(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , node_allocator(allocator) , internal_node_elements_allocator(allocator) @@ -194,14 +194,6 @@ struct allocators_variant leaf_elements_allocator_type leaf_elements_allocator; }; -// allocators - -template -struct allocators -{ - typedef allocators_variant type; -}; - // create_node_variant template diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 52300faf9..87d26a02f 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -33,10 +33,10 @@ struct quadratic_tag {}; struct rstar_tag {}; // NodeTag -struct node_default_tag {}; -struct node_default_variant_tag {}; -struct node_default_static_tag {}; -struct node_default_static_variant_tag {}; +struct node_d_mem_dynamic_tag {}; +struct node_d_mem_static_tag {}; +struct node_s_mem_dynamic_tag {}; +struct node_s_mem_static_tag {}; // TODO: awulkiew - implement those: //if ( m_min_elems_per_node < 1 ) @@ -216,7 +216,7 @@ struct options_type< linear > choose_by_content_diff_tag, split_default_tag, linear_tag, - node_default_static_tag + node_d_mem_static_tag > type; }; @@ -229,7 +229,7 @@ struct options_type< quadratic > choose_by_content_diff_tag, split_default_tag, quadratic_tag, - node_default_static_tag + node_d_mem_static_tag > type; }; @@ -242,7 +242,7 @@ struct options_type< rstar type; }; @@ -255,7 +255,7 @@ struct options_type< rstar type; //}; @@ -268,7 +268,7 @@ struct options_type< runtime::linear > choose_by_content_diff_tag, split_default_tag, linear_tag, - node_default_tag + node_d_mem_dynamic_tag > type; }; @@ -281,7 +281,7 @@ struct options_type< runtime::quadratic > choose_by_content_diff_tag, split_default_tag, quadratic_tag, - node_default_tag + node_d_mem_dynamic_tag > type; }; @@ -294,7 +294,7 @@ struct options_type< runtime::rstar > choose_by_overlap_diff_tag, split_default_tag, rstar_tag, - node_default_tag + node_d_mem_dynamic_tag > type; }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 10b3272b2..ed2a31a06 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -47,6 +47,8 @@ namespace boost { namespace geometry { namespace index { + + /*! The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. @@ -86,7 +88,7 @@ public: typedef typename options_type::node_tag node_tag; typedef Allocator allocator_type; - typedef typename detail::rtree::allocators::type allocators_type; + typedef detail::rtree::allocators allocators_type; typedef typename allocators_type::size_type size_type; typedef typename detail::rtree::node::type node; From d38a6ad5e6a7c9a27866a886e1058a584e456d37 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 29 Sep 2012 11:44:21 +0000 Subject: [PATCH 135/366] renamed node types files [SVN r80752] --- .../boost/geometry/extensions/index/rtree/node/node.hpp | 9 ++++----- .../node/{node_default.hpp => node_d_mem_dynamic.hpp} | 0 .../{node_default_static.hpp => node_d_mem_static.hpp} | 0 .../{node_default_variant.hpp => node_s_mem_dynamic.hpp} | 0 ..._default_static_variant.hpp => node_s_mem_static.hpp} | 0 5 files changed, 4 insertions(+), 5 deletions(-) rename include/boost/geometry/extensions/index/rtree/node/{node_default.hpp => node_d_mem_dynamic.hpp} (100%) rename include/boost/geometry/extensions/index/rtree/node/{node_default_static.hpp => node_d_mem_static.hpp} (100%) rename include/boost/geometry/extensions/index/rtree/node/{node_default_variant.hpp => node_s_mem_dynamic.hpp} (100%) rename include/boost/geometry/extensions/index/rtree/node/{node_default_static_variant.hpp => node_s_mem_static.hpp} (100%) diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 8eb6a79af..0dac1b8f7 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -13,11 +13,10 @@ #include -#include -#include - -#include -#include +#include +#include +#include +#include #include diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/node_default.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp From b17a68cc09255b00ebe5a6ea2720ea316c6f0e5e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 29 Sep 2012 12:56:38 +0000 Subject: [PATCH 136/366] implemented basic functionality of node_proxy [SVN r80753] --- .../extensions/index/rtree/node_proxy.hpp | 96 +++++++++++++ .../geometry/extensions/index/rtree/rtree.hpp | 134 +++++++----------- 2 files changed, 149 insertions(+), 81 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node_proxy.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node_proxy.hpp b/include/boost/geometry/extensions/index/rtree/node_proxy.hpp new file mode 100644 index 000000000..0b7410fcf --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node_proxy.hpp @@ -0,0 +1,96 @@ +// Boost.Geometry Index +// +// R-tree node proxy +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_PROXY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_PROXY_HPP + +namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { + +template < + typename Value, + typename Parameters, + typename Translator = translator::def, + typename Allocator = std::allocator +> +class node_proxy +{ +public: + typedef Value value_type; + typedef Translator translator_type; + typedef typename translator::indexable_type::type indexable_type; + typedef typename index::default_box_type::type box_type; + + typedef typename detail::rtree::options_type::type options_type; + typedef typename options_type::parameters_type parameters_type; + typedef typename options_type::node_tag node_tag; + + typedef Allocator allocator_type; + + typedef detail::rtree::allocators< + allocator_type, value_type, parameters_type, box_type, node_tag + > allocators_type; + + typedef typename allocators_type::size_type size_type; + + typedef typename detail::rtree::node< + value_type, parameters_type, box_type, allocators_type, node_tag + >::type node; + + typedef typename detail::rtree::internal_node< + value_type, parameters_type, box_type, allocators_type, node_tag + >::type internal_node; + + typedef typename detail::rtree::leaf< + value_type, parameters_type, box_type, allocators_type, node_tag + >::type leaf; + + node_proxy(Parameters parameters, translator_type const& translator, Allocator allocator) + : m_parameters(parameters) + , m_translator(translator) + , m_allocators(allocator) + {} + + template + node * create_node() + { + return detail::rtree::create_node::apply(m_allocators); + } + + template + void destroy_node(node * n) + { + return detail::rtree::destroy_node::apply(m_allocators, n); + } + + template + void apply_visitor(Visitor & visitor, node * n) const + { + detail::rtree::apply_visitor(visitor, *n); + } + + indexable_type const& translate(value_type const& v) const + { + return m_translator(v); + } + + translator_type const& translator() const + { + return m_translator; + } + +private: + Parameters m_parameters; + translator_type m_translator; + allocators_type m_allocators; +}; + +}}} // namespace boost::geometry::index::detail::rtree + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_PROXY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index ed2a31a06..def510d47 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -30,6 +30,8 @@ #include +#include + #include #include @@ -47,8 +49,6 @@ namespace boost { namespace geometry { namespace index { - - /*! The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. @@ -78,22 +78,16 @@ class rtree { BOOST_COPYABLE_AND_MOVABLE(rtree) + typedef node_proxy node_proxy_type; + public: - typedef Value value_type; - typedef Translator translator_type; - typedef typename translator::indexable_type::type indexable_type; - typedef typename index::default_box_type::type box_type; + typedef typename node_proxy_type::value_type value_type; + typedef typename node_proxy_type::translator_type translator_type; + typedef typename node_proxy_type::indexable_type indexable_type; + typedef typename node_proxy_type::box_type box_type; - typedef typename detail::rtree::options_type::type options_type; - typedef typename options_type::node_tag node_tag; - - typedef Allocator allocator_type; - typedef detail::rtree::allocators allocators_type; - typedef typename allocators_type::size_type size_type; - - typedef typename detail::rtree::node::type node; - typedef typename detail::rtree::internal_node::type internal_node; - typedef typename detail::rtree::leaf::type leaf; + typedef typename node_proxy_type::allocator_type allocator_type; + typedef typename node_proxy_type::size_type size_type size_type; /*! The constructor. @@ -102,13 +96,11 @@ public: \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()) + inline explicit rtree(Parameters parameters = Parameters(), translator_type const& translator = translator_type(), allocator_type allocator = allocator_type()) : m_values_count(0) , m_root(0) , m_leafs_level(0) - , m_parameters(parameters) - , m_translator(translator) - , m_allocators(allocator) + , m_node_proxy(parameters, translator, allocator) { this->create(); } @@ -127,9 +119,7 @@ public: : m_values_count(0) , m_root(0) , m_leafs_level(0) - , m_parameters(parameters) - , m_translator(translator) - , m_allocators(allocator) + , m_node_proxy(parameters, translator, allocator) { this->create(); this->insert(first, last); @@ -148,9 +138,7 @@ public: The copy constructor. */ inline rtree(rtree const& src) - : m_parameters(src.m_parameters) - , m_translator(src.m_translator) - , m_allocators(src.m_allocators) + : m_node_proxy(src.m_node_proxy) { //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() @@ -169,9 +157,7 @@ public: The copy constructor. */ inline rtree(rtree const& src, Allocator const& allocator) - : m_parameters(src.m_parameters) - , m_translator(src.m_translator) - , m_allocators(allocator) + : m_node_proxy(src.m_parameters, src.m_translator, allocator) { try { @@ -191,9 +177,7 @@ public: : m_values_count(src.m_values_count) , m_root(src.m_root) , m_leafs_level(src.m_leafs_level) - , m_parameters(src.m_parameters) - , m_translator(src.m_translator) - , m_allocators(src.m_allocators) + , m_node_proxy(src.m_node_proxy) { src.m_values_count = 0; src.m_root = 0; @@ -213,9 +197,7 @@ public: if ( !this->empty() ) this->destroy(*this); - m_parameters = src.m_parameters; - m_translator = src.m_translator; - //m_allocators = src.m_allocators; + m_node_proxy = src.m_node_proxy; try { @@ -243,9 +225,7 @@ public: if ( !this->empty() ) this->destroy(*this); - m_parameters = src.m_parameters; - m_translator = src.m_translator; - //m_allocators = src.m_allocators; + m_node_proxy = src.m_node_proxy; if ( m_allocators.allocator == src.m_allocators.allocator) { @@ -279,21 +259,18 @@ public: */ inline void insert(value_type const& value) { - BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); + BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_node_proxy.translate(value)), "Indexable is invalid"); try { detail::rtree::visitors::insert< value_type, value_type, - options_type, - translator_type, - box_type, - allocators_type, + node_proxy_type, typename options_type::insert_tag - > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + > insert_v(m_root, m_leafs_level, value, m_node_proxy); - detail::rtree::apply_visitor(insert_v, *m_root); + m_node_proxy.apply_visitor(insert_v, *m_root); ++m_values_count; } @@ -332,13 +309,10 @@ public: { detail::rtree::visitors::remove< value_type, - options_type, - translator_type, - box_type, - allocators_type - > remove_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + node_proxy_type + > remove_v(m_root, m_leafs_level, value, m_node_proxy); - detail::rtree::apply_visitor(remove_v, *m_root); + m_node_proxy.apply_visitor(remove_v, *m_root); --m_values_count; } @@ -381,10 +355,10 @@ public: template inline size_type query(Predicates const& pred, OutIter out_it) const { - detail::rtree::visitors::query - find_v(m_translator, pred, out_it); + detail::rtree::visitors::query + find_v(m_node_proxy, pred, out_it); - detail::rtree::apply_visitor(find_v, *m_root); + m_node_proxy.apply_visitor(find_v, *m_root); return find_v.found_count; } @@ -541,10 +515,10 @@ public: return result; } - detail::rtree::visitors::children_box - children_box_v(m_translator); + detail::rtree::visitors::children_box + children_box_v(m_node_proxy); - detail::rtree::apply_visitor(children_box_v, *m_root); + m_node_proxy.apply_visitor(children_box_v, *m_root); return children_box_v.result; } @@ -559,7 +533,7 @@ public: template inline void apply_visitor(Visitor & visitor) const { - detail::rtree::apply_visitor(visitor, *m_root); + m_node_proxy.apply_visitor(visitor, *m_root); } /*! @@ -570,7 +544,7 @@ public: */ inline translator_type const& translator() const { - return m_translator; + return m_node_proxy.m_translator; } /*! @@ -603,7 +577,7 @@ private: { assert(0 == m_root); - m_root = detail::rtree::create_node::apply(m_allocators); + m_root = m_node_proxy.template create_node(); m_values_count = 0; m_leafs_level = 0; } @@ -615,8 +589,11 @@ private: */ inline void destroy(rtree & t) { - detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); - detail::rtree::apply_visitor(del_v, *t.m_root); + detail::rtree::visitors::destroy< + value_type, + node_proxy_type + > del_v(t.m_root, t.m_node_proxy); + m_node_proxy.apply_visitor(del_v, *t.m_root); t.m_root = 0; t.m_values_count = 0; @@ -631,8 +608,11 @@ private: */ inline void copy(rtree const& src, rtree & dst) const { - detail::rtree::visitors::copy copy_v(dst.m_allocators); - detail::rtree::apply_visitor(copy_v, *src.m_root); + detail::rtree::visitors::copy< + value_type, + node_proxy_type + > copy_v(dst.m_node_proxy); + m_node_proxy.apply_visitor(copy_v, *src.m_root); dst.m_root = copy_v.result; dst.m_values_count = src.m_values_count; @@ -650,7 +630,7 @@ private: typedef detail::rtree::visitors::nearest_one< value_type, - translator_type, + node_proxy_type, point_type > result_type; @@ -658,16 +638,13 @@ private: detail::rtree::visitors::nearest< value_type, - options_type, - translator_type, - box_type, - allocators_type, + node_proxy_type, DistancesPredicates, Predicates, result_type - > nearest_v(m_parameters, m_translator, dpred, pred, result); + > nearest_v(m_node_proxy, dpred, pred, result); - detail::rtree::apply_visitor(nearest_v, *m_root); + m_node_proxy.apply_visitor(nearest_v, *m_root); return result.get(v); } @@ -683,7 +660,7 @@ private: typedef detail::rtree::visitors::nearest_k< value_type, - translator_type, + node_proxy_type, point_type > result_type; @@ -691,16 +668,13 @@ private: detail::rtree::visitors::nearest< value_type, - options_type, - translator_type, - box_type, - allocators_type, + node_proxy_type, DistancesPredicates, Predicates, result_type - > nearest_v(m_parameters, m_translator, dpred, pred, result); + > nearest_v(m_node_proxy, dpred, pred, result); - detail::rtree::apply_visitor(nearest_v, *m_root); + m_node_proxy.apply_visitor(nearest_v, *m_root); return result.get(out_it); } @@ -709,9 +683,7 @@ private: node *m_root; size_type m_leafs_level; - Parameters m_parameters; - translator_type m_translator; - allocators_type m_allocators; + node_proxy_type m_node_proxy; }; /*! From 75959b74269c6c54f24aed87c3b7645692bae8a2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Sep 2012 11:11:50 +0000 Subject: [PATCH 137/366] NodeProxy used in visitors instead of Parameters, Translator and Allocators. [SVN r80771] --- .../rtree/linear/redistribute_elements.hpp | 95 ++++----- .../extensions/index/rtree/node/node.hpp | 28 --- .../extensions/index/rtree/node_proxy.hpp | 62 +++++- .../rtree/quadratic/redistribute_elements.hpp | 67 +++--- .../index/rtree/rstar/choose_next_node.hpp | 31 ++- .../extensions/index/rtree/rstar/insert.hpp | 157 +++++++------- .../rtree/rstar/redistribute_elements.hpp | 200 +++++++++--------- .../geometry/extensions/index/rtree/rtree.hpp | 67 +++--- .../index/rtree/visitors/are_boxes_ok.hpp | 53 +++-- .../index/rtree/visitors/are_levels_ok.hpp | 40 ++-- .../index/rtree/visitors/children_box.hpp | 28 ++- .../extensions/index/rtree/visitors/copy.hpp | 27 ++- .../index/rtree/visitors/destroy.hpp | 27 ++- .../index/rtree/visitors/insert.hpp | 153 +++++++------- .../index/rtree/visitors/is_leaf.hpp | 16 +- .../index/rtree/visitors/nearest.hpp | 59 +++--- .../extensions/index/rtree/visitors/query.hpp | 37 ++-- .../index/rtree/visitors/remove.hpp | 66 +++--- test/rtree/test_rtree.hpp | 24 +-- 19 files changed, 652 insertions(+), 585 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 793f6c222..46f3a52c1 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -40,34 +40,33 @@ namespace linear { // from void find_normalized_separations(std::vector const& boxes, T& separation, unsigned int& first, unsigned int& second) const -template +template struct find_greatest_normalized_separation { typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; static inline void apply(Elements const& elements, - Parameters const& parameters, - Translator const& translator, + NodeProxy const& node_proxy, coordinate_type & separation, size_t & seed1, size_t & seed2) { - const size_t elements_count = parameters.get_max_elements() + 1; + const size_t elements_count = node_proxy.parameters().get_max_elements() + 1; BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected number of elements"); BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); // find the lowest low, highest high - coordinate_type lowest_low = index::get(rtree::element_indexable(elements[0], translator)); - coordinate_type highest_high = index::get(rtree::element_indexable(elements[0], translator)); + coordinate_type lowest_low = index::get(node_proxy.indexable(elements[0])); + coordinate_type highest_high = index::get(node_proxy.indexable(elements[0])); // and the lowest high coordinate_type lowest_high = highest_high; size_t lowest_high_index = 0; for ( size_t i = 1 ; i < elements_count ; ++i ) { - coordinate_type min_coord = index::get(rtree::element_indexable(elements[i], translator)); - coordinate_type max_coord = index::get(rtree::element_indexable(elements[i], translator)); + coordinate_type min_coord = index::get(node_proxy.indexable(elements[i])); + coordinate_type max_coord = index::get(node_proxy.indexable(elements[i])); if ( max_coord < lowest_high ) { @@ -84,10 +83,10 @@ struct find_greatest_normalized_separation // find the highest low size_t highest_low_index = lowest_high_index == 0 ? 1 : 0; - coordinate_type highest_low = index::get(rtree::element_indexable(elements[highest_low_index], translator)); + coordinate_type highest_low = index::get(node_proxy.indexable(elements[highest_low_index])); for ( size_t i = highest_low_index ; i < elements_count ; ++i ) { - coordinate_type min_coord = index::get(rtree::element_indexable(elements[i], translator)); + coordinate_type min_coord = index::get(node_proxy.indexable(elements[i])); if ( highest_low < min_coord && i != lowest_high_index ) { @@ -117,27 +116,26 @@ struct find_greatest_normalized_separation } }; -template +template struct pick_seeds_impl { BOOST_STATIC_ASSERT(0 < Dimension); typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; static inline void apply(Elements const& elements, - Parameters const& parameters, - Translator const& tr, + NodeProxy const& node_proxy, coordinate_type & separation, size_t & seed1, size_t & seed2) { - pick_seeds_impl::apply(elements, parameters, tr, separation, seed1, seed2); + pick_seeds_impl::apply(elements, node_proxy, separation, seed1, seed2); coordinate_type current_separation; size_t s1, s2; - find_greatest_normalized_separation::apply(elements, parameters, tr, current_separation, s1, s2); + find_greatest_normalized_separation::apply(elements, node_proxy, current_separation, s1, s2); // in the old implementation different operator was used: <= (y axis prefered) if ( separation < current_separation ) @@ -149,43 +147,41 @@ struct pick_seeds_impl } }; -template -struct pick_seeds_impl +template +struct pick_seeds_impl { typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; static inline void apply(Elements const& elements, - Parameters const& parameters, - Translator const& tr, + NodeProxy const& node_proxy, coordinate_type & separation, size_t & seed1, size_t & seed2) { - find_greatest_normalized_separation::apply(elements, parameters, tr, separation, seed1, seed2); + find_greatest_normalized_separation::apply(elements, node_proxy, separation, seed1, seed2); } }; // from void linear_pick_seeds(node_pointer const& n, unsigned int &seed1, unsigned int &seed2) const -template +template struct pick_seeds { typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; static const size_t dimension = index::traits::dimension::value; static inline void apply(Elements const& elements, - Parameters const& parameters, - Translator const& tr, + NodeProxy const& node_proxy, size_t & seed1, size_t & seed2) { coordinate_type separation = 0; - pick_seeds_impl::apply(elements, parameters, tr, separation, seed1, seed2); + pick_seeds_impl::apply(elements, node_proxy, separation, seed1, seed2); } }; @@ -193,32 +189,30 @@ struct pick_seeds // from void split_node(node_pointer const& n, node_pointer& n1, node_pointer& n2) const -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename Options::parameters_type parameters_type; - - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; template static inline void apply(Node & n, Node & second_node, - Box & box1, - Box & box2, - parameters_type const& parameters, - Translator const& translator) + box_type & box1, + box_type & box2, + NodeProxy const& node_proxy) { typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_content_result::type content_type; elements_type & elements1 = rtree::elements(n); elements_type & elements2 = rtree::elements(second_node); - const size_t elements1_count = parameters.get_max_elements() + 1; + const size_t elements1_count = node_proxy.parameters().get_max_elements() + 1; BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected number of elements"); @@ -228,7 +222,7 @@ struct redistribute_elements::apply(elements_copy, parameters, translator, seed1, seed2); + linear::pick_seeds::apply(elements_copy, node_proxy, seed1, seed2); // prepare nodes' elements containers elements1.clear(); @@ -239,8 +233,8 @@ struct redistribute_elements #include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { - -// elements box - -template -inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) -{ - BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box"); - - Box result; - - geometry::convert(element_indexable(*first, tr), result); - ++first; - - for ( ; first != last ; ++first ) - geometry::expand(result, element_indexable(*first, tr)); - - return result; -} - -}} // namespace detail::rtree - -}}} // namespace boost::geometry::index - #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node_proxy.hpp b/include/boost/geometry/extensions/index/rtree/node_proxy.hpp index 0b7410fcf..6662bb976 100644 --- a/include/boost/geometry/extensions/index/rtree/node_proxy.hpp +++ b/include/boost/geometry/extensions/index/rtree/node_proxy.hpp @@ -51,46 +51,86 @@ public: value_type, parameters_type, box_type, allocators_type, node_tag >::type leaf; - node_proxy(Parameters parameters, translator_type const& translator, Allocator allocator) + node_proxy(parameters_type const& parameters, translator_type const& translator, Allocator allocator) : m_parameters(parameters) , m_translator(translator) , m_allocators(allocator) {} template - node * create_node() + node * create() { return detail::rtree::create_node::apply(m_allocators); } template - void destroy_node(node * n) + void destroy(node * n) { return detail::rtree::destroy_node::apply(m_allocators, n); } - template - void apply_visitor(Visitor & visitor, node * n) const - { - detail::rtree::apply_visitor(visitor, *n); - } + // HMMMM - trzeba zwracac uwage na translator::return_type +// template +// typename element_indexable_type::type const& +// rtree::element_indexable(m_element, m_translator)); - indexable_type const& translate(value_type const& v) const + typename translator_type::result_type + indexable(value_type const& v) const { return m_translator(v); } + typename element_indexable_type< + typename internal_node::elements_type::value_type, + translator_type + >::type const& + indexable(typename internal_node::elements_type::value_type const& el) const + { + return element_indexable(el, m_translator); + } + + bool equals(value_type const& v1, value_type const& v2) const + { + return m_translator.equals(v1, v2); + } + + template + box_type elements_box(FwdIter first, FwdIter last) const + { + BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box"); + + box_type result; + + geometry::convert(element_indexable(*first, m_translator), result); + ++first; + + for ( ; first != last ; ++first ) + geometry::expand(result, element_indexable(*first, m_translator)); + + return result; + } + + parameters_type const& parameters() const + { + return m_parameters; + } + translator_type const& translator() const { return m_translator; } + allocator_type allocator() const + { + return m_allocators.allocator; + } + private: - Parameters m_parameters; + parameters_type m_parameters; translator_type m_translator; allocators_type m_allocators; }; -}}} // namespace boost::geometry::index::detail::rtree +}}}}} // namespace boost::geometry::index::detail::rtree #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_PROXY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 22f243eb3..4bd7d951e 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -28,22 +28,21 @@ namespace detail { namespace quadratic { -template +template struct pick_seeds { typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; - typedef Box box_type; + typedef typename NodeProxy::box_type box_type; typedef typename index::default_content_result::type content_type; static inline void apply(Elements const& elements, - Parameters const& parameters, - Translator const& tr, + NodeProxy const& node_proxy, size_t & seed1, size_t & seed2) { - const size_t elements_count = parameters.get_max_elements() + 1; + const size_t elements_count = node_proxy.parameters().get_max_elements() + 1; BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "wrong number of elements"); BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); @@ -55,8 +54,8 @@ struct pick_seeds { for ( size_t j = i + 1 ; j < elements_count ; ++j ) { - indexable_type const& ind1 = rtree::element_indexable(elements[i], tr); - indexable_type const& ind2 = rtree::element_indexable(elements[j], tr); + indexable_type const& ind1 = node_proxy.indexable(elements[i]); + indexable_type const& ind2 = node_proxy.indexable(elements[j]); box_type enlarged_box; geometry::convert(ind1, enlarged_box); @@ -77,33 +76,31 @@ struct pick_seeds } // namespace quadratic -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename Options::parameters_type parameters_type; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - typedef typename index::default_content_result::type content_type; + typedef typename index::default_content_result::type content_type; template static inline void apply(Node & n, Node & second_node, - Box & box1, - Box & box2, - parameters_type const& parameters, - Translator const& translator) + box_type & box1, + box_type & box2, + NodeProxy const& node_proxy) { typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; elements_type & elements1 = rtree::elements(n); elements_type & elements2 = rtree::elements(second_node); - const size_t elements1_count = parameters.get_max_elements() + 1; + const size_t elements1_count = node_proxy.parameters().get_max_elements() + 1; BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected elements number"); @@ -113,7 +110,7 @@ struct redistribute_elements::apply(elements_copy, parameters, translator, seed1, seed2); + quadratic::pick_seeds::apply(elements_copy, node_proxy, seed1, seed2); // prepare nodes' elements containers elements1.clear(); @@ -124,8 +121,8 @@ struct redistribute_elements static inline It pick_next(It first, It last, - Box const& box1, Box const& box2, + box_type const& box1, box_type const& box2, content_type const& content1, content_type const& content2, - Translator const& translator, + NodeProxy const& node_proxy, content_type & out_content_increase1, content_type & out_content_increase2) { typedef typename boost::iterator_value::type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + typedef typename rtree::element_indexable_type::type indexable_type; content_type greatest_content_incrase_diff = 0; It out_it = first; @@ -232,11 +229,11 @@ struct redistribute_elements -class choose_next_node +template +class choose_next_node { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; typedef typename rtree::elements_type::type children_type; typedef typename children_type::value_type child_type; - typedef typename Options::parameters_type parameters_type; - - typedef typename index::default_content_result::type content_type; + typedef typename index::default_content_result::type content_type; public: template static inline size_t apply(internal_node & n, Indexable const& indexable, - parameters_type const& parameters, + NodeProxy const& node_proxy, size_t node_relative_level) { children_type & children = rtree::elements(n); @@ -54,9 +53,9 @@ public: // children are leafs if ( node_relative_level <= 1 ) { - if ( 0 < parameters.get_overlap_cost_threshold() && - parameters.get_overlap_cost_threshold() < children.size() ) - return choose_by_nearly_minimum_overlap_cost(children, indexable, parameters.get_overlap_cost_threshold()); + if ( 0 < node_proxy.parameters().get_overlap_cost_threshold() && + node_proxy.parameters().get_overlap_cost_threshold() < children.size() ) + return choose_by_nearly_minimum_overlap_cost(children, indexable, node_proxy.parameters().get_overlap_cost_threshold()); else return choose_by_minimum_overlap_cost(children, indexable); } @@ -83,7 +82,7 @@ private: { child_type const& ch_i = children[i]; - Box box_exp(ch_i.first); + box_type box_exp(ch_i.first); // calculate expanded box of child node ch_i geometry::expand(box_exp, indexable); @@ -137,7 +136,7 @@ private: child_type const& ch_i = children[i]; // expanded child node's box - Box box_exp(ch_i.first); + box_type box_exp(ch_i.first); geometry::expand(box_exp, indexable); // areas difference @@ -164,7 +163,7 @@ private: typedef typename children_type::value_type child_type; child_type const& ch_i = children[child_index]; - Box box_exp(ch_i.first); + box_type box_exp(ch_i.first); // calculate expanded box of child node ch_i geometry::expand(box_exp, indexable); @@ -218,7 +217,7 @@ private: child_type const& ch_i = children[i]; // expanded child node's box - Box box_exp(ch_i.first); + box_type box_exp(ch_i.first); geometry::expand(box_exp, indexable); // areas difference diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 889d62aa2..2fabb8df7 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -21,34 +21,32 @@ namespace detail { namespace rstar { -template +template class remove_elements_to_reinsert { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - typedef typename Options::parameters_type parameters_type; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; template static inline void apply(typename rtree::elements_type::type & result_elements, Node & n, internal_node *parent, size_t current_child_index, - parameters_type const& parameters, - Translator const& translator) + NodeProxy const& node_proxy) { typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::value_type element_type; - typedef typename geometry::point_type::type point_type; + typedef typename geometry::point_type::type point_type; // TODO: awulkiew - change second point_type to the point type of the Indexable? typedef typename geometry::default_distance_result::type distance_type; elements_type & elements = rtree::elements(n); - const size_t elements_count = parameters.get_max_elements() + 1; - const size_t reinserted_elements_count = parameters.get_reinserted_elements(); + const size_t elements_count = node_proxy.parameters().get_max_elements() + 1; + const size_t reinserted_elements_count = node_proxy.parameters().get_reinserted_elements(); BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node"); BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected elements number"); @@ -67,8 +65,7 @@ public: for ( size_t i = 0 ; i < elements_count ; ++i ) { point_type element_center; - geometry::centroid( rtree::element_indexable(elements[i], translator), - element_center); + geometry::centroid( node_proxy.indexable(elements[i]), element_center); sorted_elements[i].first = geometry::comparable_distance(node_center, element_center); sorted_elements[i].second = elements[i]; } @@ -109,42 +106,42 @@ private: } }; -template +template struct level_insert_elements_type { typedef typename rtree::elements_type< - typename rtree::internal_node::type + typename NodeProxy::internal_node >::type type; }; -template -struct level_insert_elements_type<0, Value, Value, Options, Box, Allocators> +template +struct level_insert_elements_type<0, Value, Value, NodeProxy> { typedef typename rtree::elements_type< - typename rtree::leaf::type + typename NodeProxy::leaf >::type type; }; -template +template struct level_insert_base - : public detail::insert + : public detail::insert< + Element, + Value, + NodeProxy> { - typedef detail::insert base; + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename level_insert_elements_type::type elements_type; - typedef typename Options::parameters_type parameters_type; + typedef typename level_insert_elements_type::type elements_type; inline level_insert_base(node* & root, size_t & leafs_level, Element const& element, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level) - : base(root, leafs_level, element, parameters, translator, allocators, relative_level) + : base(root, leafs_level, element, node_proxy, relative_level) , result_relative_level(0) {} @@ -156,15 +153,15 @@ struct level_insert_base result_relative_level = base::m_leafs_level - base::m_current_level; // overflow - if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) + if ( base::m_node_proxy.parameters().get_max_elements() < rtree::elements(n).size() ) { // node isn't root node if ( base::m_parent ) { - rstar::remove_elements_to_reinsert::apply( + rstar::remove_elements_to_reinsert::apply( result_elements, n, base::m_parent, base::m_current_child_index, - base::m_parameters, base::m_translator); + base::m_node_proxy); } // node is root node else @@ -179,20 +176,20 @@ struct level_insert_base inline void handle_possible_split(Node &n) const { // overflow - if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) + if ( base::m_node_proxy.parameters().get_max_elements() < rtree::elements(n).size() ) { - base::split(n); + base::split(n); } } template inline void recalculate_aabb_if_necessary(Node &n) const { - if ( !result_elements.empty() && base::m_parent ) + if ( !result_elements.empty() && this->m_parent ) { // calulate node's new box rtree::elements(*base::m_parent)[base::m_current_child_index].first = - elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_translator); + base::m_node_proxy.elements_box(rtree::elements(n).begin(), rtree::elements(n).end()); } } @@ -200,25 +197,21 @@ struct level_insert_base elements_type result_elements; }; -template +template struct level_insert - : public level_insert_base + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename Options::parameters_type parameters_type; - inline level_insert(node* & root, size_t & leafs_level, Element const& element, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level) - : base(root, leafs_level, element, parameters, translator, allocators, relative_level) + : base(root, leafs_level, element, node_proxy, relative_level) {} inline void operator()(internal_node & n) @@ -269,25 +262,21 @@ struct level_insert } }; -template -struct level_insert - : public level_insert_base +template +struct level_insert + : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename Options::parameters_type parameters_type; - inline level_insert(node* & root, size_t & leafs_level, Value const& v, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level) - : base(root, leafs_level, v, parameters, translator, allocators, relative_level) + : base(root, leafs_level, v, node_proxy, relative_level) {} inline void operator()(internal_node & n) @@ -319,25 +308,21 @@ struct level_insert -struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> - : public level_insert_base<0, Value, Value, Options, Translator, Box, Allocators> +template +struct level_insert<0, Value, Value, NodeProxy> + : public level_insert_base<0, Value, Value, NodeProxy> { - typedef level_insert_base<0, Value, Value, Options, Translator, Box, Allocators> base; + typedef level_insert_base<0, Value, Value, NodeProxy> base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename Options::parameters_type parameters_type; - inline level_insert(node* & root, size_t & leafs_level, Value const& v, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level) - : base(root, leafs_level, v, parameters, translator, allocators, relative_level) + : base(root, leafs_level, v, node_proxy, relative_level) {} inline void operator()(internal_node & n) @@ -369,36 +354,39 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> } // namespace detail // R*-tree insert visitor -template -class insert - : public rtree::visitor::type +template +class insert + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + false + >::type , index::nonassignable { - typedef typename Options::parameters_type parameters_type; - - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; public: inline insert(node* & root, size_t & leafs_level, Element const& element, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level = 0) : m_root(root), m_leafs_level(leafs_level), m_element(element) - , m_parameters(parameters), m_translator(translator) - , m_relative_level(relative_level), m_allocators(allocators) + , m_node_proxy(node_proxy) + , m_relative_level(relative_level) {} inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( - m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); + detail::rstar::level_insert<0, Element, Value, NodeProxy> lins_v( + m_root, m_leafs_level, m_element, m_node_proxy, m_relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -412,8 +400,8 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( - m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); + detail::rstar::level_insert<0, Element, Value, NodeProxy> lins_v( + m_root, m_leafs_level, m_element, m_node_proxy, m_relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -431,8 +419,8 @@ private: for ( typename Elements::const_reverse_iterator it = elements.rbegin(); it != elements.rend(); ++it) { - detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( - m_root, m_leafs_level, *it, m_parameters, m_translator, m_allocators, relative_level); + detail::rstar::level_insert<1, element_type, Value, NodeProxy> lins_v( + m_root, m_leafs_level, *it, m_node_proxy, relative_level); rtree::apply_visitor(lins_v, *m_root); @@ -450,12 +438,9 @@ private: size_t & m_leafs_level; Element const& m_element; - parameters_type const& m_parameters; - Translator const& m_translator; + NodeProxy & m_node_proxy; size_t m_relative_level; - - Allocators m_allocators; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 0ebaf1d15..4c3854a38 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -29,66 +29,66 @@ namespace detail { namespace rstar { -template +template class element_axis_corner_less : index::nonassignable { public: - element_axis_corner_less(Translator const& tr) - : m_tr(tr) + element_axis_corner_less(NodeProxy const& node_proxy) + : m_node_proxy(node_proxy) {} bool operator()(Element const& e1, Element const& e2) const { - return index::get(rtree::element_indexable(e1, m_tr)) - < index::get(rtree::element_indexable(e2, m_tr)); + return index::get(m_node_proxy.indexable(e1)) + < index::get(m_node_proxy.indexable(e2)); } private: - Translator const& m_tr; + NodeProxy const& m_node_proxy; }; -template +template struct choose_split_axis_and_index_for_corner { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename NodeProxy::box_type box_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template + template static inline void apply(Elements const& elements, size_t & choosen_index, margin_type & sum_of_margins, content_type & smallest_overlap, content_type & smallest_content, - Parameters const& parameters, - Translator const& translator) + NodeProxy const& node_proxy) { typedef typename Elements::value_type element_type; - BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == parameters.get_max_elements() + 1, "wrong number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == node_proxy.parameters().get_max_elements() + 1, "wrong number of elements"); // copy elements Elements elements_copy = elements; // sort elements - element_axis_corner_less elements_less(translator); + element_axis_corner_less elements_less(node_proxy); std::sort(elements_copy.begin(), elements_copy.end(), elements_less); // init outputs - choosen_index = parameters.get_min_elements(); + choosen_index = node_proxy.parameters().get_min_elements(); sum_of_margins = 0; smallest_overlap = (std::numeric_limits::max)(); smallest_content = (std::numeric_limits::max)(); // calculate sum of margins for all distributions - size_t index_last = parameters.get_max_elements() - parameters.get_min_elements() + 2; - for ( size_t i = parameters.get_min_elements() ; i < index_last ; ++i ) + size_t index_last = node_proxy.parameters().get_max_elements() - node_proxy.parameters().get_min_elements() + 2; + for ( size_t i = node_proxy.parameters().get_min_elements() ; i < index_last ; ++i ) { // TODO - awulkiew: may be optimized - box of group 1 may be initialized with // box of min_elems number of elements and expanded for each iteration by another element - Box box1 = rtree::elements_box(elements_copy.begin(), elements_copy.begin() + i, translator); - Box box2 = rtree::elements_box(elements_copy.begin() + i, elements_copy.end(), translator); + box_type box1 = node_proxy.elements_box(elements_copy.begin(), elements_copy.begin() + i); + box_type box2 = node_proxy.elements_box(elements_copy.begin() + i, elements_copy.end()); sum_of_margins += index::margin(box1) + index::margin(box2); @@ -105,47 +105,47 @@ struct choose_split_axis_and_index_for_corner } }; -template +template struct choose_split_axis_and_index_for_axis { //BOOST_STATIC_ASSERT(0); }; -template -struct choose_split_axis_and_index_for_axis +template +struct choose_split_axis_and_index_for_axis { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename NodeProxy::box_type box_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template + template static inline void apply(Elements const& elements, size_t & choosen_corner, size_t & choosen_index, margin_type & sum_of_margins, content_type & smallest_overlap, content_type & smallest_content, - Parameters const& parameters, - Translator const& translator) + NodeProxy const& node_proxy) { size_t index1 = 0; margin_type som1 = 0; content_type ovl1 = (std::numeric_limits::max)(); content_type con1 = (std::numeric_limits::max)(); - choose_split_axis_and_index_for_corner:: + choose_split_axis_and_index_for_corner:: apply(elements, index1, som1, ovl1, con1, - parameters, translator); + node_proxy); size_t index2 = 0; margin_type som2 = 0; content_type ovl2 = (std::numeric_limits::max)(); content_type con2 = (std::numeric_limits::max)(); - choose_split_axis_and_index_for_corner:: + choose_split_axis_and_index_for_corner:: apply(elements, index2, som2, ovl2, con2, - parameters, translator); + node_proxy); sum_of_margins = som1 + som2; @@ -166,40 +166,41 @@ struct choose_split_axis_and_index_for_axis } }; -template -struct choose_split_axis_and_index_for_axis +template +struct choose_split_axis_and_index_for_axis { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename NodeProxy::box_type box_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template + template static inline void apply(Elements const& elements, size_t & choosen_corner, size_t & choosen_index, margin_type & sum_of_margins, content_type & smallest_overlap, content_type & smallest_content, - Parameters const& parameters, - Translator const& translator) + NodeProxy const& node_proxy) { - choose_split_axis_and_index_for_corner:: + choose_split_axis_and_index_for_corner:: apply(elements, choosen_index, sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); + node_proxy); choosen_corner = min_corner; } }; -template +template struct choose_split_axis_and_index { BOOST_STATIC_ASSERT(0 < Dimension); - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename NodeProxy::box_type box_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template + template static inline void apply(Elements const& elements, size_t & choosen_axis, size_t & choosen_corner, @@ -207,15 +208,17 @@ struct choose_split_axis_and_index margin_type & smallest_sum_of_margins, content_type & smallest_overlap, content_type & smallest_content, - Parameters const& parameters, - Translator const& translator) + NodeProxy const& node_proxy) { - typedef typename rtree::element_indexable_type::type element_indexable_type; + typedef typename rtree::element_indexable_type< + typename Elements::value_type, + typename NodeProxy::translator_type + >::type element_indexable_type; - choose_split_axis_and_index:: + choose_split_axis_and_index:: apply(elements, choosen_axis, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); + node_proxy); margin_type sum_of_margins = 0; @@ -226,11 +229,10 @@ struct choose_split_axis_and_index content_type content_val = (std::numeric_limits::max)(); choose_split_axis_and_index_for_axis< - Parameters, - Box, + NodeProxy, Dimension - 1, typename index::traits::tag::type - >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); + >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, node_proxy); if ( sum_of_margins < smallest_sum_of_margins ) { @@ -244,13 +246,14 @@ struct choose_split_axis_and_index } }; -template -struct choose_split_axis_and_index +template +struct choose_split_axis_and_index { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename NodeProxy::box_type box_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; - template + template static inline void apply(Elements const& elements, size_t & choosen_axis, size_t & choosen_corner, @@ -258,19 +261,20 @@ struct choose_split_axis_and_index margin_type & smallest_sum_of_margins, content_type & smallest_overlap, content_type & smallest_content, - Parameters const& parameters, - Translator const& translator) + NodeProxy const& node_proxy) { - typedef typename rtree::element_indexable_type::type element_indexable_type; + typedef typename rtree::element_indexable_type< + typename Elements::value_type, + typename NodeProxy::translator_type + >::type element_indexable_type; choosen_axis = 0; choose_split_axis_and_index_for_axis< - Parameters, - Box, + NodeProxy, 0, typename index::traits::tag::type - >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, parameters, translator); + >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, node_proxy); } }; @@ -279,19 +283,19 @@ struct partial_sort { BOOST_STATIC_ASSERT(0 < Dimension); - template - static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) + template + static inline void apply(Elements & elements, const size_t axis, const size_t index, NodeProxy const& node_proxy) { if ( axis < Dimension - 1 ) { - partial_sort::apply(elements, axis, index, tr); + partial_sort::apply(elements, axis, index, node_proxy); } else { BOOST_GEOMETRY_INDEX_ASSERT(axis == Dimension - 1, "unexpected axis value"); typedef typename Elements::value_type element_type; - element_axis_corner_less less(tr); + element_axis_corner_less less(node_proxy); std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); } } @@ -300,41 +304,39 @@ struct partial_sort template struct partial_sort { - template - static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) + template + static inline void apply(Elements & elements, const size_t axis, const size_t index, NodeProxy const& node_proxy) { BOOST_GEOMETRY_INDEX_ASSERT(axis == 0, "unexpected axis value"); typedef typename Elements::value_type element_type; - element_axis_corner_less less(tr); + element_axis_corner_less less(node_proxy); std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); } }; } // namespace rstar -template -struct redistribute_elements +template +struct redistribute_elements { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; - typedef typename Options::parameters_type parameters_type; + static const size_t dimension = index::traits::dimension::value; - static const size_t dimension = index::traits::dimension::value; - - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_margin_result::type margin_type; + typedef typename index::default_content_result::type content_type; template static inline void apply( Node & n, Node & second_node, - Box & box1, - Box & box2, - parameters_type const& parameters, - Translator const& translator) + box_type & box1, + box_type & box2, + NodeProxy & node_proxy) { typedef typename rtree::elements_type::type elements_type; @@ -343,37 +345,41 @@ struct redistribute_elements::max)(); content_type smallest_overlap = (std::numeric_limits::max)(); content_type smallest_content = (std::numeric_limits::max)(); - rstar::choose_split_axis_and_index::value>:: - apply(elements1, - split_axis, split_corner, split_index, - smallest_sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); + rstar::choose_split_axis_and_index< + NodeProxy, + index::traits::dimension::value + >::apply(elements1, + split_axis, split_corner, split_index, + smallest_sum_of_margins, smallest_overlap, smallest_content, + node_proxy); // TODO: awulkiew - get rid of following static_casts? - BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension::value, "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension::value, "unexpected value"); BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner), "unexpected value"); - BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= split_index && split_index <= parameters.get_max_elements() - parameters.get_min_elements() + 1, "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(node_proxy.parameters().get_min_elements() <= split_index && + split_index <= node_proxy.parameters().get_max_elements() - node_proxy.parameters().get_min_elements() + 1, + "unexpected value"); // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort if ( split_corner == static_cast(min_corner) ) - rstar::partial_sort::apply(elements1, split_axis, split_index, translator); + rstar::partial_sort::apply(elements1, split_axis, split_index, node_proxy); else - rstar::partial_sort::apply(elements1, split_axis, split_index, translator); + rstar::partial_sort::apply(elements1, split_axis, split_index, node_proxy); // copy elements to node 2 and remove from node 1 - elements2.resize(parameters.get_max_elements() + 1 - split_index); + elements2.resize(node_proxy.parameters().get_max_elements() + 1 - split_index); std::copy(elements1.begin() + split_index, elements1.end(), elements2.begin()); elements1.resize(split_index); // calculate boxes - box1 = rtree::elements_box(elements1.begin(), elements1.end(), translator); - box2 = rtree::elements_box(elements2.begin(), elements2.end(), translator); + box1 = node_proxy.elements_box(elements1.begin(), elements1.end()); + box2 = node_proxy.elements_box(elements2.begin(), elements2.end()); } }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index def510d47..eb4a48e26 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -78,16 +78,21 @@ class rtree { BOOST_COPYABLE_AND_MOVABLE(rtree) - typedef node_proxy node_proxy_type; - public: + typedef detail::rtree::node_proxy< + Value, Parameters, Translator, Allocator + > node_proxy_type; + typedef typename node_proxy_type::value_type value_type; typedef typename node_proxy_type::translator_type translator_type; typedef typename node_proxy_type::indexable_type indexable_type; typedef typename node_proxy_type::box_type box_type; typedef typename node_proxy_type::allocator_type allocator_type; - typedef typename node_proxy_type::size_type size_type size_type; + typedef typename node_proxy_type::size_type size_type; + + typedef typename node_proxy_type::node node; + typedef typename node_proxy_type::leaf leaf; /*! The constructor. @@ -157,7 +162,9 @@ public: The copy constructor. */ inline rtree(rtree const& src, Allocator const& allocator) - : m_node_proxy(src.m_parameters, src.m_translator, allocator) + : m_node_proxy(src.m_node_proxy.parameters(), + src.m_node_proxy.translator(), + allocator) { try { @@ -189,15 +196,17 @@ public: */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { - //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( this == &src ) return *this; if ( !this->empty() ) this->destroy(*this); - - m_node_proxy = src.m_node_proxy; + + //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment + m_node_proxy = node_proxy_type( + src.m_node_proxy.parameters(), + src.m_node_proxy.translator(), + m_node_proxy.allocator()); try { @@ -217,17 +226,19 @@ public: */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { - //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( this == &src ) return *this; if ( !this->empty() ) this->destroy(*this); - m_node_proxy = src.m_node_proxy; + //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment + m_node_proxy = node_proxy_type( + src.m_node_proxy.parameters(), + src.m_node_proxy.translator(), + m_node_proxy.allocator()); - if ( m_allocators.allocator == src.m_allocators.allocator) + if ( m_node_proxy.allocator() == src.m_node_proxy.allocator() ) { m_values_count = src.m_values_count; src.m_values_count = 0; @@ -259,7 +270,7 @@ public: */ inline void insert(value_type const& value) { - BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_node_proxy.translate(value)), "Indexable is invalid"); + BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_node_proxy.indexable(value)), "Indexable is invalid"); try { @@ -267,10 +278,10 @@ public: value_type, value_type, node_proxy_type, - typename options_type::insert_tag + typename node_proxy_type::options_type::insert_tag > insert_v(m_root, m_leafs_level, value, m_node_proxy); - m_node_proxy.apply_visitor(insert_v, *m_root); + detail::rtree::apply_visitor(insert_v, *m_root); ++m_values_count; } @@ -312,7 +323,7 @@ public: node_proxy_type > remove_v(m_root, m_leafs_level, value, m_node_proxy); - m_node_proxy.apply_visitor(remove_v, *m_root); + detail::rtree::apply_visitor(remove_v, *m_root); --m_values_count; } @@ -358,7 +369,7 @@ public: detail::rtree::visitors::query find_v(m_node_proxy, pred, out_it); - m_node_proxy.apply_visitor(find_v, *m_root); + detail::rtree::apply_visitor(find_v, *m_root); return find_v.found_count; } @@ -515,10 +526,10 @@ public: return result; } - detail::rtree::visitors::children_box + detail::rtree::visitors::children_box children_box_v(m_node_proxy); - m_node_proxy.apply_visitor(children_box_v, *m_root); + detail::rtree::apply_visitor(children_box_v, *m_root); return children_box_v.result; } @@ -533,18 +544,18 @@ public: template inline void apply_visitor(Visitor & visitor) const { - m_node_proxy.apply_visitor(visitor, *m_root); + detail::rtree::apply_visitor(visitor, *m_root); } /*! - Returns the translator object. + Returns the node proxy object. This function is not a part of the 'official' interface. - \return The translator object. + \return The node proxy object. */ - inline translator_type const& translator() const + inline node_proxy_type const& node_proxy() const { - return m_node_proxy.m_translator; + return m_node_proxy; } /*! @@ -593,7 +604,7 @@ private: value_type, node_proxy_type > del_v(t.m_root, t.m_node_proxy); - m_node_proxy.apply_visitor(del_v, *t.m_root); + detail::rtree::apply_visitor(del_v, *t.m_root); t.m_root = 0; t.m_values_count = 0; @@ -612,7 +623,7 @@ private: value_type, node_proxy_type > copy_v(dst.m_node_proxy); - m_node_proxy.apply_visitor(copy_v, *src.m_root); + detail::rtree::apply_visitor(copy_v, *src.m_root); dst.m_root = copy_v.result; dst.m_values_count = src.m_values_count; @@ -644,7 +655,7 @@ private: result_type > nearest_v(m_node_proxy, dpred, pred, result); - m_node_proxy.apply_visitor(nearest_v, *m_root); + detail::rtree::apply_visitor(nearest_v, *m_root); return result.get(v); } @@ -674,7 +685,7 @@ private: result_type > nearest_v(m_node_proxy, dpred, pred, result); - m_node_proxy.apply_visitor(nearest_v, *m_root); + detail::rtree::apply_visitor(nearest_v, *m_root); return result.get(out_it); } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 85aa5eb05..24710e2f7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -18,17 +18,25 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class are_boxes_ok - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + true + >::type , index::nonassignable { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; public: - inline are_boxes_ok(Translator const& tr) - : result(false), m_tr(tr), m_is_root(true) + inline are_boxes_ok(NodeProxy const& node_proxy) + : result(false), m_node_proxy(node_proxy), m_is_root(true) {} inline void operator()(internal_node const& n) @@ -42,7 +50,7 @@ public: return; } - Box box_bckup = m_box; + box_type box_bckup = m_box; bool is_root_bckup = m_is_root; m_is_root = false; @@ -61,7 +69,7 @@ public: m_box = box_bckup; m_is_root = is_root_bckup; - Box box_exp; + box_type box_exp; geometry::convert(elements.front().first, box_exp); for( typename elements_type::const_iterator it = elements.begin() + 1; it != elements.end() ; ++it) @@ -86,12 +94,12 @@ public: return; } - Box box_exp; - geometry::convert(m_tr(elements.front()), box_exp); + box_type box_exp; + geometry::convert(m_node_proxy.indexable(elements.front()), box_exp); for(typename elements_type::const_iterator it = elements.begin() + 1; it != elements.end() ; ++it) { - geometry::expand(box_exp, m_tr(*it)); + geometry::expand(box_exp, m_node_proxy.indexable(*it)); } result = geometry::equals(box_exp, m_box); @@ -103,24 +111,25 @@ public: bool result; private: - Translator const& m_tr; - Box m_box; + NodeProxy const& m_node_proxy; + box_type m_box; bool m_is_root; }; }}} // namespace detail::rtree::visitors -template -bool are_boxes_ok(rtree const& tree) +template +bool are_boxes_ok(rtree const& tree) { - typedef rtree rt; detail::rtree::visitors::are_boxes_ok< - typename rt::value_type, - typename rt::options_type, - typename rt::translator_type, - typename rt::box_type, - typename rt::allocators_type - > v(tree.translator()); + Value, + detail::rtree::node_proxy< + Value, + Parameters, + Translator, + Allocator + > + > v(tree.node_proxy()); tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index eabbfaf02..721e9f7be 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -17,17 +17,25 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class are_levels_ok - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + true + >::type , index::nonassignable { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; public: - inline are_levels_ok(Translator const& tr) - : result(true), m_tr(tr), m_leafs_level((std::numeric_limits::max)()), m_current_level(0) + inline are_levels_ok() + : result(true), m_leafs_level((std::numeric_limits::max)()), m_current_level(0) {} inline void operator()(internal_node const& n) @@ -81,24 +89,24 @@ public: bool result; private: - Translator const& m_tr; size_t m_leafs_level; size_t m_current_level; }; }}} // namespace detail::rtree::visitors -template -bool are_levels_ok(rtree const& tree) +template +bool are_levels_ok(rtree const& tree) { - typedef rtree rt; detail::rtree::visitors::are_levels_ok< - typename rt::value_type, - typename rt::options_type, - typename rt::translator_type, - typename rt::box_type, - typename rt::allocators_type - > v(tree.translator()); + Value, + detail::rtree::node_proxy< + Value, + Parameters, + Translator, + Allocator + > + > v; tree.apply_visitor(v); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp index 860d5e9cc..b2aadaf31 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp @@ -17,17 +17,25 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class children_box - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + true + >::type , index::nonassignable { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; public: - inline children_box(Translator const& tr) - : m_tr(tr) + inline children_box(NodeProxy const& node_proxy) + : m_node_proxy(node_proxy) {} inline void operator()(internal_node const& n) @@ -35,7 +43,7 @@ public: typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - result = rtree::elements_box(elements.begin(), elements.end(), m_tr); + result = m_node_proxy.elements_box(elements.begin(), elements.end()); } inline void operator()(leaf const& n) @@ -43,13 +51,13 @@ public: typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); - result = rtree::elements_box(elements.begin(), elements.end(), m_tr); + result = m_node_proxy.elements_box(elements.begin(), elements.end()); } - Box result; + box_type result; private: - Translator const& m_tr; + NodeProxy const& m_node_proxy; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp index a2cda3647..92c05f908 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -17,24 +17,31 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class copy - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + false + >::type , boost::noncopyable { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; - explicit inline copy(Allocators & allocators) + explicit inline copy(NodeProxy & node_proxy) : result(0) - , m_allocators(allocators) + , m_node_proxy(node_proxy) {} inline void operator()(internal_node & n) { - node * new_node = rtree::create_node::apply(m_allocators); + node * new_node = m_node_proxy.template create(); typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); @@ -54,7 +61,7 @@ public: inline void operator()(leaf & l) { - node * new_node = rtree::create_node::apply(m_allocators); + node * new_node = m_node_proxy.template create(); typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(l); @@ -73,7 +80,7 @@ public: node * result; private: - Allocators & m_allocators; + NodeProxy & m_node_proxy; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 7be482930..28403e2a1 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -17,19 +17,26 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template +template class destroy - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + false + >::type , boost::noncopyable { public: - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; - inline destroy(node * root_node, Allocators & allocators) + inline destroy(node * root_node, NodeProxy & node_proxy) : m_current_node(root_node) - , m_allocators(allocators) + , m_node_proxy(node_proxy) {} inline void operator()(internal_node & n) @@ -48,19 +55,19 @@ public: rtree::apply_visitor(*this, *m_current_node); } - rtree::destroy_node::apply(m_allocators, node_to_destroy); + m_node_proxy.template destroy(node_to_destroy); } inline void operator()(leaf & l) { BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get(m_current_node), "invalid pointers"); - rtree::destroy_node::apply(m_allocators, m_current_node); + m_node_proxy.template destroy(m_current_node); } private: node * m_current_node; - Allocators & m_allocators; + NodeProxy & m_node_proxy; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 2ddb33327..ea708d7a9 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -22,26 +22,28 @@ namespace detail { namespace rtree { namespace visitors { namespace detail { // Default choose_next_node -template -struct choose_next_node; +template +class choose_next_node; -template -struct choose_next_node +template +class choose_next_node { - typedef typename Options::parameters_type parameters_type; + typedef typename NodeProxy::parameters_type parameters_type; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; typedef typename rtree::elements_type::type children_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::default_content_result::type content_type; +public: template static inline size_t apply(internal_node & n, Indexable const& indexable, - parameters_type const& /*parameters*/, + NodeProxy const& /*node_proxy*/, size_t /*node_relative_level*/) { children_type & children = rtree::elements(n); @@ -62,7 +64,7 @@ struct choose_next_node +template struct redistribute_elements { BOOST_MPL_ASSERT_MSG( @@ -98,7 +100,7 @@ struct redistribute_elements // ----------------------------------------------------------------------- // // Split algorithm -template +template class split { BOOST_MPL_ASSERT_MSG( @@ -108,42 +110,40 @@ class split }; // Default split algorithm -template -class split +template +class split { protected: - typedef typename Options::parameters_type parameters_type; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::box_type box_type; public: - typedef index::pushable_array, 1> nodes_container_type; + typedef index::pushable_array, 1> nodes_container_type; template static inline void apply(nodes_container_type & additional_nodes, Node & n, - Box & n_box, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators) + box_type & n_box, + NodeProxy & node_proxy) { // create additional node - node * second_node = rtree::create_node::apply(allocators); + node * second_node = node_proxy.template create(); Node & n2 = rtree::get(*second_node); // redistribute elements - Box box2; - redistribute_elements:: - apply(n, n2, n_box, box2, parameters, translator); + box_type box2; + redistribute_elements:: + apply(n, n2, n_box, box2, node_proxy); // check numbers of elements - BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n).size() && - rtree::elements(n).size() <= parameters.get_max_elements(), + BOOST_GEOMETRY_INDEX_ASSERT(node_proxy.parameters().get_min_elements() <= rtree::elements(n).size() && + rtree::elements(n).size() <= node_proxy.parameters().get_max_elements(), "unexpected number of elements"); - BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n2).size() && - rtree::elements(n2).size() <= parameters.get_max_elements(), + BOOST_GEOMETRY_INDEX_ASSERT(node_proxy.parameters().get_min_elements() <= rtree::elements(n2).size() && + rtree::elements(n2).size() <= node_proxy.parameters().get_max_elements(), "unexpected number of elements"); additional_nodes.push_back(std::make_pair(box2, second_node)); @@ -153,29 +153,34 @@ public: // ----------------------------------------------------------------------- // // Default insert visitor -template +template class insert - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + false + >::type , index::nonassignable { protected: - typedef typename Options::parameters_type parameters_type; + typedef typename NodeProxy::options_type options_type; + typedef typename NodeProxy::parameters_type parameters_type; + typedef typename NodeProxy::box_type box_type; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; inline insert(node* & root, size_t & leafs_level, Element const& element, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level = 0 ) : m_element(element) - , m_parameters(parameters) - , m_translator(translator) , m_relative_level(relative_level) , m_level(leafs_level - relative_level) , m_root_node(root) @@ -183,7 +188,7 @@ protected: , m_parent(0) , m_current_child_index(0) , m_current_level(0) - , m_allocators(allocators) + , m_node_proxy(node_proxy) { BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value"); @@ -196,13 +201,13 @@ protected: inline void traverse(Visitor & visitor, internal_node & n) { // choose next node - size_t choosen_node_index = detail::choose_next_node:: - apply(n, rtree::element_indexable(m_element, m_translator), m_parameters, m_leafs_level - m_current_level); + size_t choosen_node_index = detail::choose_next_node:: + apply(n, m_node_proxy.indexable(m_element), m_node_proxy, m_leafs_level - m_current_level); // expand the node to contain value geometry::expand( rtree::elements(n)[choosen_node_index].first, - rtree::element_indexable(m_element, m_translator)); + m_node_proxy.indexable(m_element)); // next traversing step traverse_apply_visitor(visitor, n, choosen_node_index); @@ -217,7 +222,7 @@ protected: "if node isn't the root current_child_index should be valid"); // handle overflow - if ( m_parameters.get_max_elements() < rtree::elements(n).size() ) + if ( m_node_proxy.parameters().get_max_elements() < rtree::elements(n).size() ) { split(n); } @@ -237,7 +242,7 @@ protected: ++m_current_level; // next traversing step - rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); + index::detail::rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // restore previous traverse inputs m_parent = parent_bckup; @@ -250,12 +255,12 @@ protected: template inline void split(Node & n) const { - typedef detail::split split_algo; + typedef detail::split split_algo; typename split_algo::nodes_container_type additional_nodes; - Box n_box; + box_type n_box; - split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); + split_algo::apply(additional_nodes, n, n_box, m_node_proxy); BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); @@ -282,7 +287,7 @@ protected: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); // create new root and add nodes - node * new_root = rtree::create_node::apply(m_allocators); + node * new_root = m_node_proxy.template create(); rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); @@ -295,8 +300,6 @@ protected: // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation Element const& m_element; - parameters_type const& m_parameters; - Translator const& m_translator; const size_t m_relative_level; const size_t m_level; @@ -308,36 +311,33 @@ protected: size_t m_current_child_index; size_t m_current_level; - Allocators & m_allocators; + NodeProxy & m_node_proxy; }; } // namespace detail // Insert visitor forward declaration -template -struct insert; +template +class insert; // Default insert visitor used for nodes elements -template -struct insert - : public detail::insert +template +class insert + : public detail::insert { - typedef detail::insert base; +public: + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename Options::parameters_type parameters_type; - inline insert(node* & root, size_t & leafs_level, Element const& element, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level = 0 ) - : base(root, leafs_level, element, parameters, translator, allocators, relative_level) + : base(root, leafs_level, element, node_proxy, relative_level) {} inline void operator()(internal_node & n) @@ -367,26 +367,23 @@ struct insert -struct insert - : public detail::insert +template +class insert + : public detail::insert { - typedef detail::insert base; +public: + typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; - typedef typename Options::parameters_type parameters_type; - inline insert(node* & root, size_t & leafs_level, Value const& value, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators, + NodeProxy & node_proxy, size_t relative_level = 0 ) - : base(root, leafs_level, value, parameters, translator, allocators, relative_level) + : base(root, leafs_level, value, node_proxy, relative_level) {} inline void operator()(internal_node & n) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp index 9fd479b4f..75bb9af1a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp @@ -17,11 +17,19 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct is_leaf : public rtree::visitor::type +template +struct is_leaf + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + true + >::type { - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; inline void operator()(internal_node const&) { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index c85bfaf74..ddcb70ce7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -24,13 +24,13 @@ namespace detail { namespace rtree { namespace visitors { // in store() or break store to 2 functions e.g. should_store() and store() // - well not with this algorithm of storing k-th neighbor -template +template struct nearest_one { public: typedef typename geometry::default_distance_result< Point, - typename translator::indexable_type::type + typename NodeProxy::indexable_type >::type distance_type; inline nearest_one() @@ -67,13 +67,13 @@ private: distance_type m_comp_dist; }; -template +template struct nearest_k { public: typedef typename geometry::default_distance_result< Point, - typename translator::indexable_type::type + typename NodeProxy::indexable_type >::type distance_type; inline explicit nearest_k(size_t k) @@ -112,7 +112,7 @@ public: inline distance_type comparable_distance() const { - return m_neighbors.size() < 0 + return m_neighbors.size() == 0 ? (std::numeric_limits::max)() : m_neighbors.front().first; } @@ -144,43 +144,50 @@ private: template < typename Value, - typename Options, - typename Translator, - typename Box, - typename Allocators, + typename NodeProxy, typename DistancesPredicates, typename Predicates, typename Result > class nearest - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + true + >::type , index::nonassignable { public: - typedef typename Options::parameters_type parameters_type; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; + typedef typename NodeProxy::box_type box_type; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; - - typedef index::detail::distances_calc node_distances_calc; + typedef index::detail::distances_calc node_distances_calc; typedef typename node_distances_calc::result_type node_distances_type; - typedef index::detail::distances_predicates_check node_distances_predicates_check; + typedef index::detail::distances_predicates_check node_distances_predicates_check; typedef index::detail::distances_calc< DistancesPredicates, - typename translator::indexable_type::type, + typename translator::indexable_type< + typename NodeProxy::translator_type + >::type, rtree::value_tag > value_distances_calc; typedef typename value_distances_calc::result_type value_distances_type; typedef index::detail::distances_predicates_check< DistancesPredicates, - typename translator::indexable_type::type, + typename translator::indexable_type< + typename NodeProxy::translator_type + >::type, 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) - : m_parameters(parameters), m_translator(translator) + inline nearest(NodeProxy const& node_proxy, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r) + : m_node_proxy(node_proxy) , m_dist_pred(dist_pred), m_pred(pred) , m_result(r) {} @@ -196,7 +203,7 @@ public: elements_type, std::pair >::type active_branch_list; - active_branch_list.reserve(m_parameters.get_max_elements()); + active_branch_list.reserve(m_node_proxy.parameters().get_max_elements()); elements_type const& elements = rtree::elements(n); @@ -261,10 +268,10 @@ public: it != elements.end(); ++it) { // if value meets predicates - if ( index::predicates_check(m_pred, *it, m_translator(*it)) ) + if ( index::predicates_check(m_pred, *it, m_node_proxy.indexable(*it)) ) { // calculate values distance for distance predicate - value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_translator(*it)); + value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_node_proxy.indexable(*it)); // TODO: awulkiew - consider at first calculating point relation distance only, // comparing it with m_result.comparable_distance if it's valid, @@ -321,8 +328,8 @@ private: ::template get(d); } - parameters_type const& m_parameters; - Translator const& m_translator; + NodeProxy const& m_node_proxy; + DistancesPredicates const& m_dist_pred; Predicates const& m_pred; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp index b7aa9643d..b5f05892f 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -17,17 +17,28 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -template -struct query - : public rtree::visitor::type +template +class query + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + true + >::type , index::nonassignable { - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; - inline query(Translator const& t, Predicates const& p, OutIter out_it) - : tr(t), pred(p), out_iter(out_it), found_count(0) +public: + inline query(NodeProxy const& node_proxy, Predicates const& predicates, OutIter out_it) + : out_iter(out_it) + , found_count(0) + , m_node_proxy(node_proxy) + , m_predicates(predicates) {} inline void operator()(internal_node const& n) @@ -41,7 +52,7 @@ struct query { // if node meets predicates // 0 - dummy value - if ( index::predicates_check(pred, 0, it->first) ) + if ( index::predicates_check(m_predicates, 0, m_node_proxy.indexable(*it)) ) rtree::apply_visitor(*this, *it->second); } } @@ -56,7 +67,7 @@ struct query it != elements.end(); ++it) { // if value meets predicates - if ( index::predicates_check(pred, *it, tr(*it)) ) + if ( index::predicates_check(m_predicates, *it, m_node_proxy.indexable(*it)) ) { out_iter = *it; ++out_iter; @@ -66,10 +77,12 @@ struct query } } - Translator const& tr; - Predicates const& pred; OutIter out_iter; size_t found_count; + +private: + NodeProxy const& m_node_proxy; + Predicates const& m_predicates; }; }}} // namespace detail::rtree::visitors diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 0c584f077..815a8a9f3 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -22,28 +22,33 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { // Default remove algorithm -template +template class remove - : public rtree::visitor::type + : public rtree::visitor< + Value, + typename NodeProxy::parameters_type, + typename NodeProxy::box_type, + typename NodeProxy::allocators_type, + typename NodeProxy::node_tag, + false + >::type , index::nonassignable { - typedef typename Options::parameters_type parameters_type; + typedef typename NodeProxy::options_type options_type; + typedef typename NodeProxy::parameters_type parameters_type; + typedef typename NodeProxy::box_type box_type; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename NodeProxy::node node; + typedef typename NodeProxy::internal_node internal_node; + typedef typename NodeProxy::leaf leaf; public: inline remove(node* & root, size_t & leafs_level, Value const& value, - parameters_type const& parameters, - Translator const& translator, - Allocators & allocators) + NodeProxy & node_proxy) : m_value(value) - , m_parameters(parameters) - , m_translator(translator) - , m_allocators(allocators) + , m_node_proxy(node_proxy) , m_root_node(root) , m_leafs_level(leafs_level) , m_is_value_removed(false) @@ -65,7 +70,7 @@ public: size_t child_node_index = 0; for ( ; child_node_index < children.size() ; ++child_node_index ) { - if ( geometry::covered_by(m_translator(m_value), children[child_node_index].first) ) + if ( geometry::covered_by(m_node_proxy.indexable(m_value), children[child_node_index].first) ) { // next traversing step traverse_apply_visitor(n, child_node_index); @@ -92,7 +97,7 @@ public: elements.erase(underfl_el_it); // calc underflow - m_is_underflow = elements.size() < m_parameters.get_min_elements(); + m_is_underflow = elements.size() < m_node_proxy.parameters().get_min_elements(); } // n is not root - adjust aabb @@ -101,10 +106,10 @@ public: // underflow state should be ok here // note that there may be less than min_elems elements in root // so this condition should be checked only here - BOOST_GEOMETRY_INDEX_ASSERT((elements.size() < m_parameters.get_min_elements()) == m_is_underflow, "unexpected state"); + BOOST_GEOMETRY_INDEX_ASSERT((elements.size() < m_node_proxy.parameters().get_min_elements()) == m_is_underflow, "unexpected state"); rtree::elements(*m_parent)[m_current_child_index].first - = rtree::elements_box(elements.begin(), elements.end(), m_translator); + = m_node_proxy.elements_box(elements.begin(), elements.end()); } // n is root node else @@ -117,19 +122,19 @@ public: for ( typename std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); it != m_underflowed_nodes.rend() ; ++it ) { - is_leaf ilv; + is_leaf ilv; rtree::apply_visitor(ilv, *it->second); if ( ilv.result ) { reinsert_elements(rtree::get(*it->second), it->first); - rtree::destroy_node::apply(m_allocators, it->second); + m_node_proxy.template destroy(it->second); } else { reinsert_elements(rtree::get(*it->second), it->first); - rtree::destroy_node::apply(m_allocators, it->second); + m_node_proxy.template destroy(it->second); } } @@ -140,7 +145,7 @@ public: m_root_node = rtree::elements(n)[0].second; --m_leafs_level; - rtree::destroy_node::apply(m_allocators, root_to_destroy); + m_node_proxy.template destroy(root_to_destroy); } } } @@ -154,7 +159,7 @@ public: // find value and remove it for ( typename elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it ) { - if ( m_translator.equals(*it, m_value) ) + if ( m_node_proxy.equals(*it, m_value) ) { elements.erase(it); m_is_value_removed = true; @@ -166,13 +171,13 @@ public: if ( m_is_value_removed ) { // calc underflow - m_is_underflow = elements.size() < m_parameters.get_min_elements(); + m_is_underflow = elements.size() < m_node_proxy.parameters().get_min_elements(); // n is not root - adjust aabb if ( 0 != m_parent ) { rtree::elements(*m_parent)[m_current_child_index].first - = rtree::elements_box(elements.begin(), elements.end(), m_translator); + = m_node_proxy.elements_box(elements.begin(), elements.end()); } } } @@ -209,18 +214,13 @@ private: visitors::insert< typename elements_type::value_type, Value, - Options, - Translator, - Box, - Allocators, - typename Options::insert_tag + NodeProxy, + typename NodeProxy::options_type::insert_tag > insert_v( m_root_node, m_leafs_level, *it, - m_parameters, - m_translator, - m_allocators, + m_node_proxy, node_relative_level - 1); rtree::apply_visitor(insert_v, *m_root_node); @@ -228,9 +228,7 @@ private: } Value const& m_value; - parameters_type const& m_parameters; - Translator const& m_translator; - Allocators & m_allocators; + NodeProxy & m_node_proxy; node* & m_root_node; size_t & m_leafs_level; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 4d4a01965..c1c16d9ba 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -183,7 +183,7 @@ template Iter test_find(Rtree const& rtree, Iter first, Iter last, Value const& value) { for ( ; first != last ; ++first ) - if ( rtree.translator().equals(value, *first) ) + if ( rtree.node_proxy().equals(value, *first) ) return first; return first; } @@ -215,7 +215,7 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran typename Range2::const_iterator it2 = expected_output.begin(); for ( ; it1 != output.end() && it2 != expected_output.end() ; ++it1, ++it2 ) { - if ( !rtree.translator().equals(*it1, *it2) ) + if ( !rtree.node_proxy().equals(*it1, *it2) ) { BOOST_CHECK(false && "rtree.translator().equals(*it1, *it2)"); break; @@ -255,7 +255,7 @@ void test_intersects_and_disjoint(bgi::rtree const& tree, std::vect std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::intersects(tree.translator()(v), qbox) ) + if ( bg::intersects(tree.node_proxy().indexable(v), qbox) ) expected_output.push_back(v); test_query(tree, qbox, expected_output); @@ -271,7 +271,7 @@ void test_covered_by(bgi::rtree const& tree, std::vector con std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::covered_by(tree.translator()(v), qbox) ) + if ( bg::covered_by(tree.node_proxy().indexable(v), qbox) ) expected_output.push_back(v); test_query(tree, bgi::covered_by(qbox), expected_output); @@ -286,7 +286,7 @@ struct test_overlap_impl std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::overlaps(tree.translator()(v), qbox) ) + if ( bg::overlaps(tree.node_proxy().indexable(v), qbox) ) expected_output.push_back(v); test_query(tree, bgi::overlaps(qbox), expected_output); @@ -354,7 +354,7 @@ void test_within(bgi::rtree const& tree, std::vector const& std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::within(tree.translator()(v), qbox) ) + if ( bg::within(tree.node_proxy().indexable(v), qbox) ) expected_output.push_back(v); test_query(tree, bgi::within(qbox), expected_output); @@ -373,7 +373,7 @@ void test_nearest(Rtree const& rtree, std::vector const& input, Point con Value expected_output; BOOST_FOREACH(Value const& v, input) { - D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::comparable_distance_near(pt, rtree.node_proxy().indexable(v)); if ( d < smallest_d ) { smallest_d = d; @@ -391,10 +391,10 @@ void test_nearest(Rtree const& rtree, std::vector const& input, Point con // TODO - perform explicit check here? // should all objects which are closest be checked and should exactly the same be found? - if ( !rtree.translator().equals(output, expected_output) ) + if ( !rtree.node_proxy().equals(output, expected_output) ) { - D d1 = bgi::comparable_distance_near(pt, rtree.translator()(output)); - D d2 = bgi::comparable_distance_near(pt, rtree.translator()(expected_output)); + D d1 = bgi::comparable_distance_near(pt, rtree.node_proxy().indexable(output)); + D d2 = bgi::comparable_distance_near(pt, rtree.node_proxy().indexable(expected_output)); BOOST_CHECK(d1 == d2); } } @@ -437,7 +437,7 @@ void test_nearest_k(Rtree const& rtree, std::vector const& input, Point c // calculate test output - k closest values pairs BOOST_FOREACH(Value const& v, input) { - D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::comparable_distance_near(pt, rtree.node_proxy().indexable(v)); if ( test_output.size() < k ) test_output.push_back(std::make_pair(d, v)); @@ -473,7 +473,7 @@ void test_nearest_k(Rtree const& rtree, std::vector const& input, Point c if ( test_find(rtree, expected_output.begin(), expected_output.end(), v) == expected_output.end() ) { - D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::comparable_distance_near(pt, rtree.node_proxy().indexable(v)); BOOST_CHECK(d == biggest_d); } } From eb7ba34800dd04cff9c3268abb93e059b6a2cc69 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Sep 2012 11:40:09 +0000 Subject: [PATCH 138/366] NodeProxy create() template member replaced by template function. [SVN r80774] --- .../extensions/index/rtree/node_proxy.hpp | 40 +++++++++++++------ .../geometry/extensions/index/rtree/rtree.hpp | 2 +- .../extensions/index/rtree/visitors/copy.hpp | 4 +- .../index/rtree/visitors/destroy.hpp | 4 +- .../index/rtree/visitors/insert.hpp | 4 +- .../index/rtree/visitors/remove.hpp | 6 +-- 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node_proxy.hpp b/include/boost/geometry/extensions/index/rtree/node_proxy.hpp index 6662bb976..ab5940f84 100644 --- a/include/boost/geometry/extensions/index/rtree/node_proxy.hpp +++ b/include/boost/geometry/extensions/index/rtree/node_proxy.hpp @@ -57,18 +57,6 @@ public: , m_allocators(allocator) {} - template - node * create() - { - return detail::rtree::create_node::apply(m_allocators); - } - - template - void destroy(node * n) - { - return detail::rtree::destroy_node::apply(m_allocators, n); - } - // HMMMM - trzeba zwracac uwage na translator::return_type // template // typename element_indexable_type::type const& @@ -120,7 +108,12 @@ public: return m_translator; } - allocator_type allocator() const + allocators_type & allocators() + { + return m_allocators; + } + + allocator_type & allocator() { return m_allocators.allocator; } @@ -131,6 +124,27 @@ private: allocators_type m_allocators; }; +template +typename node_proxy::node * + create(node_proxy & np) +{ + return detail::rtree::create_node< + typename node_proxy::allocators_type, + Node + >::apply(np.allocators()); +} + +template +void destroy( + typename node_proxy::node * n, + node_proxy & np) +{ + return detail::rtree::destroy_node< + typename node_proxy::allocators_type, + Node + >::apply(np.allocators(), n); +} + }}}}} // namespace boost::geometry::index::detail::rtree #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_PROXY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index eb4a48e26..211a0c5ea 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -588,7 +588,7 @@ private: { assert(0 == m_root); - m_root = m_node_proxy.template create_node(); + m_root = detail::rtree::create(m_node_proxy); m_values_count = 0; m_leafs_level = 0; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp index 92c05f908..8a59dc78a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -41,7 +41,7 @@ public: inline void operator()(internal_node & n) { - node * new_node = m_node_proxy.template create(); + node * new_node = rtree::create(m_node_proxy); typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); @@ -61,7 +61,7 @@ public: inline void operator()(leaf & l) { - node * new_node = m_node_proxy.template create(); + node * new_node = rtree::create(m_node_proxy); typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(l); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 28403e2a1..ed48747d9 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -55,14 +55,14 @@ public: rtree::apply_visitor(*this, *m_current_node); } - m_node_proxy.template destroy(node_to_destroy); + rtree::destroy(node_to_destroy, m_node_proxy); } inline void operator()(leaf & l) { BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get(m_current_node), "invalid pointers"); - m_node_proxy.template destroy(m_current_node); + rtree::destroy(m_current_node, m_node_proxy); } private: diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index ea708d7a9..6410dfee3 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -130,7 +130,7 @@ public: NodeProxy & node_proxy) { // create additional node - node * second_node = node_proxy.template create(); + node * second_node = rtree::create(node_proxy); Node & n2 = rtree::get(*second_node); // redistribute elements @@ -287,7 +287,7 @@ protected: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); // create new root and add nodes - node * new_root = m_node_proxy.template create(); + node * new_root = rtree::create(m_node_proxy); rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 815a8a9f3..a825da553 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -128,13 +128,13 @@ public: { reinsert_elements(rtree::get(*it->second), it->first); - m_node_proxy.template destroy(it->second); + index::detail::rtree::destroy(it->second, m_node_proxy); } else { reinsert_elements(rtree::get(*it->second), it->first); - m_node_proxy.template destroy(it->second); + rtree::destroy(it->second, m_node_proxy); } } @@ -145,7 +145,7 @@ public: m_root_node = rtree::elements(n)[0].second; --m_leafs_level; - m_node_proxy.template destroy(root_to_destroy); + rtree::destroy(root_to_destroy, m_node_proxy); } } } From 136e2fc742e49cdc39428710897cabe2a9e8048c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Sep 2012 12:12:34 +0000 Subject: [PATCH 139/366] dynamic_visitor added and nodes tags changed. [SVN r80779] --- .../extensions/index/rtree/node/concept.hpp | 85 ++++++++++ .../index/rtree/node/dynamic_visitor.hpp | 70 ++++++++ .../extensions/index/rtree/node/node.hpp | 10 +- ...ode_default.hpp => node_d_mem_dynamic.hpp} | 152 ++++++------------ ...fault_static.hpp => node_d_mem_static.hpp} | 75 ++++++--- ...ult_variant.hpp => node_s_mem_dynamic.hpp} | 34 ++-- ...atic_variant.hpp => node_s_mem_static.hpp} | 56 +++---- .../extensions/index/rtree/options.hpp | 22 +-- .../geometry/extensions/index/rtree/rtree.hpp | 2 +- 9 files changed, 306 insertions(+), 200 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node/concept.hpp create mode 100644 include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp rename include/boost/geometry/extensions/index/rtree/node/{node_default.hpp => node_d_mem_dynamic.hpp} (60%) rename include/boost/geometry/extensions/index/rtree/node/{node_default_static.hpp => node_d_mem_static.hpp} (51%) rename include/boost/geometry/extensions/index/rtree/node/{node_default_variant.hpp => node_s_mem_dynamic.hpp} (88%) rename include/boost/geometry/extensions/index/rtree/node/{node_default_static_variant.hpp => node_s_mem_static.hpp} (69%) diff --git a/include/boost/geometry/extensions/index/rtree/node/concept.hpp b/include/boost/geometry/extensions/index/rtree/node/concept.hpp new file mode 100644 index 000000000..55238ddb0 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/concept.hpp @@ -0,0 +1,85 @@ +// Boost.Geometry Index +// +// R-tree node concept +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +struct node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (node)); +}; + +template +struct internal_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (internal_node)); +}; + +template +struct leaf +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (leaf)); +}; + +template +struct visitor +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (visitor)); +}; + +template +struct allocators +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE, + (allocators)); +}; + +template +struct create_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, + (create_node)); +}; + +template +struct destroy_node +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, + (destroy_node)); +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_CONCEPT_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp b/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp new file mode 100644 index 000000000..0514bc907 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp @@ -0,0 +1,70 @@ +// Boost.Geometry Index +// +// R-tree nodes dynamic visitor and nodes base type +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +// visitor forward declaration +template +struct dynamic_visitor; + +// node + +template +struct dynamic_node +{ + virtual ~dynamic_node() {} + virtual void apply_visitor(dynamic_visitor &) = 0; + virtual void apply_visitor(dynamic_visitor &) const = 0; +}; + +// nodes variants forward declarations + +template +struct dynamic_internal_node; + +template +struct dynamic_leaf; + +// visitor + +template +struct dynamic_visitor +{ + typedef dynamic_internal_node internal_node; + typedef dynamic_leaf leaf; + + virtual ~dynamic_visitor() {} + + virtual void operator()(internal_node const&) = 0; + virtual void operator()(leaf const&) = 0; +}; + +template +struct dynamic_visitor +{ + typedef dynamic_internal_node internal_node; + typedef dynamic_leaf leaf; + + virtual ~dynamic_visitor() {} + + virtual void operator()(internal_node &) = 0; + virtual void operator()(leaf &) = 0; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_DYNAMIC_VISITOR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 5b25b003d..bc4071d07 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -11,11 +11,13 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP -#include -#include +#include -#include -#include +#include +#include + +#include +#include #include diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp similarity index 60% rename from include/boost/geometry/extensions/index/rtree/node/node_default.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index d2ca25d81..54790364c 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -13,128 +13,92 @@ #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { -// visitor forward declaration -template -struct visitor_poly; - -// nodes types - -template -struct node_poly -{ - virtual ~node_poly() {} - virtual void apply_visitor(visitor_poly &) = 0; - virtual void apply_visitor(visitor_poly &) const = 0; -}; - -template -struct internal_node_poly : public node_poly +template +struct dynamic_internal_node + : public dynamic_node { typedef std::vector< - std::pair *>, + std::pair *>, typename Allocators::internal_node_elements_allocator_type > elements_type; - inline internal_node_poly(typename Allocators::internal_node_elements_allocator_type & al) + inline dynamic_internal_node(typename Allocators::internal_node_elements_allocator_type & al) : elements(al) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; -template -struct leaf_poly : public node_poly +template +struct dynamic_leaf + : public dynamic_node { typedef std::vector< Value, typename Allocators::leaf_elements_allocator_type > elements_type; - inline leaf_poly(typename Allocators::leaf_elements_allocator_type & al) + inline dynamic_leaf(typename Allocators::leaf_elements_allocator_type & al) : elements(al) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; // nodes traits -template -struct node +template +struct node { - typedef node_poly type; + typedef dynamic_node type; }; -template -struct internal_node +template +struct internal_node { - typedef internal_node_poly type; + typedef dynamic_internal_node type; }; -template -struct leaf +template +struct leaf { - typedef leaf_poly type; + typedef dynamic_leaf type; }; // nodes conversion template -inline Derived & get(node_poly & n) +inline Derived & get(dynamic_node & n) { assert(dynamic_cast(&n)); return static_cast(n); } template -inline Derived * get(node_poly * n) +inline Derived * get(dynamic_node * n) { assert(dynamic_cast(n)); return static_cast(n); } -// visitor - -template -struct visitor_poly -{ - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; - - virtual ~visitor_poly() {} - - virtual void operator()(internal_node const&) = 0; - virtual void operator()(leaf const&) = 0; -}; - -template -struct visitor_poly -{ - typedef typename internal_node::type internal_node; - typedef typename leaf::type leaf; - - virtual ~visitor_poly() {} - - virtual void operator()(internal_node &) = 0; - virtual void operator()(leaf &) = 0; -}; - // visitor traits -template -struct visitor +template +struct visitor { - typedef visitor_poly type; + typedef dynamic_visitor type; }; template @@ -153,7 +117,7 @@ struct element_indexable_type template struct element_indexable_type< - std::pair *>, + std::pair *>, Translator > { @@ -172,7 +136,7 @@ element_indexable(Value const& el, Translator const& tr) template inline Box const& element_indexable( - std::pair< Box, node_poly *> const& el, + std::pair< Box, dynamic_node *> const& el, Translator const&) { return el.first; @@ -209,29 +173,29 @@ struct container_from_elements_type // allocators -template -struct allocators_poly +template +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename internal_node::type + typename internal_node::type >::other internal_node_allocator_type; typedef typename allocator_type::template rebind< - typename leaf::type + typename leaf::type >::other leaf_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< Value >::other leaf_elements_allocator_type; - inline explicit allocators_poly(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) @@ -246,14 +210,6 @@ struct allocators_poly leaf_elements_allocator_type leaf_elements_allocator; }; -// allocators - -template -struct allocators -{ - typedef allocators_poly type; -}; - // create_node_impl template @@ -297,26 +253,17 @@ struct destroy_node_poly // create_node -template -struct create_node -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, - (create_node)); -}; - template struct create_node< Allocators, - internal_node_poly + dynamic_internal_node > { static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - internal_node_poly + dynamic_internal_node >::template apply< typename node::type >(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); @@ -326,14 +273,14 @@ struct create_node< template struct create_node< Allocators, - leaf_poly + dynamic_leaf > { static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - leaf_poly + dynamic_leaf >::template apply< typename node::type >(allocators.leaf_allocator, allocators.leaf_elements_allocator); @@ -342,25 +289,16 @@ struct create_node< // destroy_node -template -struct destroy_node -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_NODE_TYPE, - (destroy_node)); -}; - template struct destroy_node< Allocators, - internal_node_poly + dynamic_internal_node > { static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_poly< - internal_node_poly + dynamic_internal_node >::apply(allocators.internal_node_allocator, n); } }; @@ -368,13 +306,13 @@ struct destroy_node< template struct destroy_node< Allocators, - leaf_poly + dynamic_leaf > { static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_poly< - leaf_poly + dynamic_leaf >::apply(allocators.leaf_allocator, n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp similarity index 51% rename from include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp index 6c4f8563c..820d88ddf 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP +#include #include namespace boost { namespace geometry { namespace index { @@ -18,41 +19,67 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { template -struct internal_node_poly - : public node_poly +struct dynamic_internal_node + : public dynamic_node { typedef index::pushable_array< std::pair< Box, - node_poly * + dynamic_node * >, Parameters::max_elements + 1 > elements_type; template - inline internal_node_poly(Dummy) {} + inline dynamic_internal_node(Dummy) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; template -struct leaf_poly - : public node_poly +struct dynamic_leaf + : public dynamic_node { typedef index::pushable_array elements_type; template - inline leaf_poly(Dummy) {} + inline dynamic_leaf(Dummy) {} - void apply_visitor(visitor_poly & v) { v(*this); } - void apply_visitor(visitor_poly & v) const { v(*this); } + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } elements_type elements; }; +// nodes traits + +template +struct node +{ + typedef dynamic_node type; +}; + +template +struct internal_node +{ + typedef dynamic_internal_node type; +}; + +template +struct leaf +{ + typedef dynamic_leaf type; +}; + +template +struct visitor +{ + typedef dynamic_visitor type; +}; + // elements derived type template struct container_from_elements_type, NewValue> @@ -60,23 +87,23 @@ struct container_from_elements_type, NewValue typedef index::pushable_array type; }; -// allocators_poly +// allocators template -struct allocators_poly +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename internal_node::type + typename internal_node::type >::other internal_node_allocator_type; typedef typename allocator_type::template rebind< - typename leaf::type + typename leaf::type >::other leaf_allocator_type; - inline explicit allocators_poly(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) @@ -92,16 +119,16 @@ struct allocators_poly struct create_node< Allocators, - internal_node_poly + dynamic_internal_node > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - internal_node_poly + dynamic_internal_node >::template apply< - typename node::type + typename node::type >(allocators.internal_node_allocator, allocators.internal_node_allocator); } }; @@ -109,16 +136,16 @@ struct create_node< template struct create_node< Allocators, - leaf_poly + dynamic_leaf > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_poly< - leaf_poly + dynamic_leaf >::template apply< - typename node::type + typename node::type >(allocators.leaf_allocator, allocators.leaf_allocator); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp similarity index 88% rename from include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp index 51e08d1f8..7ba08aabc 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp @@ -56,24 +56,24 @@ struct leaf_variant // nodes traits template -struct node +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; template -struct internal_node +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; template -struct leaf +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // nodes conversion @@ -103,7 +103,7 @@ inline V * get( // visitor traits template -struct visitor +struct visitor { typedef static_visitor<> type; }; @@ -163,25 +163,25 @@ element_indexable(std::pair< // allocators -template -struct allocators_variant +template +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename node::type + typename node::type >::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair::type *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< Value >::other leaf_elements_allocator_type; - inline explicit allocators_variant(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , node_allocator(allocator) , internal_node_elements_allocator(allocator) @@ -194,14 +194,6 @@ struct allocators_variant leaf_elements_allocator_type leaf_elements_allocator; }; -// allocators - -template -struct allocators -{ - typedef allocators_variant type; -}; - // create_node_variant template diff --git a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp similarity index 69% rename from include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp rename to include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp index 2a97c255c..78e63b62e 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_default_static_variant.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp @@ -21,12 +21,12 @@ namespace detail { namespace rtree { // nodes default types template -struct internal_node_variant +struct internal_node_variant { typedef index::pushable_array< std::pair< Box, - typename node::type * + typename node::type * >, Parameters::max_elements + 1 > elements_type; @@ -38,7 +38,7 @@ struct internal_node_variant -struct leaf_variant +struct leaf_variant { typedef index::pushable_array elements_type; @@ -51,55 +51,55 @@ struct leaf_variant -struct node +struct node { typedef boost::variant< - leaf_variant, - internal_node_variant + leaf_variant, + internal_node_variant > type; }; template -struct internal_node +struct internal_node { - typedef internal_node_variant type; + typedef internal_node_variant type; }; template -struct leaf +struct leaf { - typedef leaf_variant type; + typedef leaf_variant type; }; // visitor traits template -struct visitor +struct visitor { typedef static_visitor<> type; }; -// allocators_variant +// allocators template -struct allocators_variant +struct allocators { typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::template rebind< - typename node::type + typename node::type >::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair::type *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< Value >::other leaf_elements_allocator_type; - inline explicit allocators_variant(Allocator alloc) + inline explicit allocators(Allocator alloc) : allocator(alloc) , node_allocator(allocator) {} @@ -108,29 +108,21 @@ struct allocators_variant -struct allocators -{ - typedef allocators_variant type; -}; - // create_node template struct create_node< Allocators, - internal_node_variant + internal_node_variant > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - internal_node_variant + internal_node_variant >::template apply< - typename node::type + typename node::type >(allocators.node_allocator, allocators.node_allocator); } }; @@ -138,16 +130,16 @@ struct create_node< template struct create_node< Allocators, - leaf_variant + leaf_variant > { - static inline typename node::type * + static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - leaf_variant + leaf_variant >::template apply< - typename node::type + typename node::type >(allocators.node_allocator, allocators.node_allocator); } }; diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 52300faf9..87d26a02f 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -33,10 +33,10 @@ struct quadratic_tag {}; struct rstar_tag {}; // NodeTag -struct node_default_tag {}; -struct node_default_variant_tag {}; -struct node_default_static_tag {}; -struct node_default_static_variant_tag {}; +struct node_d_mem_dynamic_tag {}; +struct node_d_mem_static_tag {}; +struct node_s_mem_dynamic_tag {}; +struct node_s_mem_static_tag {}; // TODO: awulkiew - implement those: //if ( m_min_elems_per_node < 1 ) @@ -216,7 +216,7 @@ struct options_type< linear > choose_by_content_diff_tag, split_default_tag, linear_tag, - node_default_static_tag + node_d_mem_static_tag > type; }; @@ -229,7 +229,7 @@ struct options_type< quadratic > choose_by_content_diff_tag, split_default_tag, quadratic_tag, - node_default_static_tag + node_d_mem_static_tag > type; }; @@ -242,7 +242,7 @@ struct options_type< rstar type; }; @@ -255,7 +255,7 @@ struct options_type< rstar type; //}; @@ -268,7 +268,7 @@ struct options_type< runtime::linear > choose_by_content_diff_tag, split_default_tag, linear_tag, - node_default_tag + node_d_mem_dynamic_tag > type; }; @@ -281,7 +281,7 @@ struct options_type< runtime::quadratic > choose_by_content_diff_tag, split_default_tag, quadratic_tag, - node_default_tag + node_d_mem_dynamic_tag > type; }; @@ -294,7 +294,7 @@ struct options_type< runtime::rstar > choose_by_overlap_diff_tag, split_default_tag, rstar_tag, - node_default_tag + node_d_mem_dynamic_tag > type; }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 10b3272b2..1aa17f3e8 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -86,7 +86,7 @@ public: typedef typename options_type::node_tag node_tag; typedef Allocator allocator_type; - typedef typename detail::rtree::allocators::type allocators_type; + typedef detail::rtree::allocators allocators_type; typedef typename allocators_type::size_type size_type; typedef typename detail::rtree::node::type node; From 80bfe0ae0167ca887ddcae7bb1d4e77146197894 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Sep 2012 12:54:25 +0000 Subject: [PATCH 140/366] code related to nodes visitation moved to XXX_visitor.hpp [SVN r80782] --- .../index/rtree/node/dynamic_visitor.hpp | 24 +++++ .../extensions/index/rtree/node/node.hpp | 4 +- .../index/rtree/node/node_d_mem_dynamic.hpp | 22 ----- .../index/rtree/node/node_s_mem_dynamic.hpp | 87 +++++-------------- .../index/rtree/node/node_s_mem_static.hpp | 29 ++++--- .../index/rtree/node/static_visitor.hpp | 76 ++++++++++++++++ 6 files changed, 139 insertions(+), 103 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp 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 0514bc907..7058057e4 100644 --- a/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp @@ -63,6 +63,30 @@ struct dynamic_visitor virtual void operator()(leaf &) = 0; }; +// nodes conversion + +template +inline Derived & get(dynamic_node & n) +{ + assert(dynamic_cast(&n)); + return static_cast(n); +} + +template +inline Derived * get(dynamic_node * n) +{ + assert(dynamic_cast(n)); + return static_cast(n); +} + +// apply visitor + +template +inline void apply_visitor(Visitor &v, Visitable & n) +{ + n.apply_visitor(v); +} + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index bc4071d07..d3ce1aca3 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -14,9 +14,9 @@ #include #include -#include - #include + +#include #include #include diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index 54790364c..4f530a555 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -77,22 +77,6 @@ struct leaf typedef dynamic_leaf type; }; -// nodes conversion - -template -inline Derived & get(dynamic_node & n) -{ - assert(dynamic_cast(&n)); - return static_cast(n); -} - -template -inline Derived * get(dynamic_node * n) -{ - assert(dynamic_cast(n)); - return static_cast(n); -} - // visitor traits template @@ -101,12 +85,6 @@ struct visitor type; }; -template -inline void apply_visitor(Visitor &v, Visitable & n) -{ - n.apply_visitor(v); -} - // element's indexable type template diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp index 7ba08aabc..4b492c072 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp @@ -12,7 +12,8 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP #include -#include + +#include namespace boost { namespace geometry { namespace index { @@ -21,7 +22,7 @@ namespace detail { namespace rtree { // nodes default types template -struct internal_node_variant +struct static_internal_node { typedef std::vector< std::pair< @@ -31,7 +32,7 @@ struct internal_node_variant typename Allocators::internal_node_elements_allocator_type > elements_type; - inline internal_node_variant(typename Allocators::internal_node_elements_allocator_type & al) + inline static_internal_node(typename Allocators::internal_node_elements_allocator_type & al) : elements(al) {} @@ -39,14 +40,14 @@ struct internal_node_variant }; template -struct leaf_variant +struct static_leaf { typedef std::vector< Value, typename Allocators::leaf_elements_allocator_type > elements_type; - inline leaf_variant(typename Allocators::leaf_elements_allocator_type & al) + inline static_leaf(typename Allocators::leaf_elements_allocator_type & al) : elements(al) {} @@ -59,47 +60,23 @@ template { typedef boost::variant< - leaf_variant, - internal_node_variant + static_leaf, + static_internal_node > type; }; template struct internal_node { - typedef internal_node_variant type; + typedef static_internal_node type; }; template struct leaf { - typedef leaf_variant type; + typedef static_leaf type; }; -// nodes conversion - -template -inline V & get( - boost::variant< - leaf_variant, - internal_node_variant - > &v -) -{ - return boost::get(v); -} - -template -inline V * get( - boost::variant< - leaf_variant, - internal_node_variant - > *v -) -{ - return boost::get(v); -} - // visitor traits template @@ -108,26 +85,6 @@ struct visitor type; }; -template -inline void apply_visitor(Visitor & v, - boost::variant< - leaf_variant, - internal_node_variant - > & n) -{ - boost::apply_visitor(v, n); -} - -template -inline void apply_visitor(Visitor & v, - boost::variant< - leaf_variant, - internal_node_variant - > const& n) -{ - boost::apply_visitor(v, n); -} - // element's indexable type template @@ -135,8 +92,8 @@ struct element_indexable_type< std::pair< Box, boost::variant< - leaf_variant, - internal_node_variant + static_leaf, + static_internal_node > * >, Translator @@ -152,8 +109,8 @@ inline Box const& element_indexable(std::pair< Box, boost::variant< - leaf_variant, - internal_node_variant + static_leaf, + static_internal_node > * > const& el, Translator const&) @@ -239,14 +196,14 @@ struct destroy_node_variant template struct create_node< Allocators, - internal_node_variant + static_internal_node > { static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - internal_node_variant + static_internal_node >::template apply< typename node::type >(allocators.node_allocator, allocators.internal_node_elements_allocator); @@ -256,14 +213,14 @@ struct create_node< template struct create_node< Allocators, - leaf_variant + static_leaf > { static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - leaf_variant + static_leaf >::template apply< typename node::type >(allocators.node_allocator, allocators.leaf_elements_allocator); @@ -275,13 +232,13 @@ struct create_node< template struct destroy_node< Allocators, - internal_node_variant + static_internal_node > { static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_variant< - internal_node_variant + static_internal_node >::apply(allocators.node_allocator, n); } }; @@ -289,13 +246,13 @@ struct destroy_node< template struct destroy_node< Allocators, - leaf_variant + static_leaf > { static inline void apply(Allocators & allocators, typename node::type * n) { destroy_node_variant< - leaf_variant + static_leaf >::apply(allocators.node_allocator, n); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp index 78e63b62e..89730b59c 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp @@ -11,8 +11,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#include -#include +#include + +#include namespace boost { namespace geometry { namespace index { @@ -21,7 +22,7 @@ namespace detail { namespace rtree { // nodes default types template -struct internal_node_variant +struct static_internal_node { typedef index::pushable_array< std::pair< @@ -32,18 +33,18 @@ struct internal_node_variant elements_type; template - inline internal_node_variant(Dummy) {} + inline static_internal_node(Dummy) {} elements_type elements; }; template -struct leaf_variant +struct static_leaf { typedef index::pushable_array elements_type; template - inline leaf_variant(Dummy) {} + inline static_leaf(Dummy) {} elements_type elements; }; @@ -54,21 +55,21 @@ template { typedef boost::variant< - leaf_variant, - internal_node_variant + static_leaf, + static_internal_node > type; }; template struct internal_node { - typedef internal_node_variant type; + typedef static_internal_node type; }; template struct leaf { - typedef leaf_variant type; + typedef static_leaf type; }; // visitor traits @@ -113,14 +114,14 @@ struct allocators template struct create_node< Allocators, - internal_node_variant + static_internal_node > { static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - internal_node_variant + static_internal_node >::template apply< typename node::type >(allocators.node_allocator, allocators.node_allocator); @@ -130,14 +131,14 @@ struct create_node< template struct create_node< Allocators, - leaf_variant + static_leaf > { static inline typename node::type * apply(Allocators & allocators) { return create_node_variant< - leaf_variant + static_leaf >::template apply< typename node::type >(allocators.node_allocator, allocators.node_allocator); diff --git a/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp b/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp new file mode 100644 index 000000000..70524f036 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp @@ -0,0 +1,76 @@ +// Boost.Geometry Index +// +// R-tree nodes static visitor related code +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +// nodes variants forward declarations + +template +struct static_internal_node; + +template +struct static_leaf; + +// nodes conversion + +template +inline V & get( + boost::variant< + static_leaf, + static_internal_node + > & v) +{ + return boost::get(v); +} + +template +inline V * get( + boost::variant< + static_leaf, + static_internal_node + > *v) +{ + return boost::get(v); +} + +// apply visitor + +template +inline void apply_visitor(Visitor & v, + boost::variant< + static_leaf, + static_internal_node + > & n) +{ + boost::apply_visitor(v, n); +} + +template +inline void apply_visitor(Visitor & v, + boost::variant< + static_leaf, + static_internal_node + > const& n) +{ + boost::apply_visitor(v, n); +} + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP From 4232b3992098b2bb3a00ea6ebf8c46dacd3a5907 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Sep 2012 17:29:00 +0000 Subject: [PATCH 141/366] removed not automatically deducable template parameters from methods templates (possible GCC compilation error). [SVN r80788] --- .../index/rtree/node/node_d_mem_dynamic.hpp | 30 +++++++++---------- .../index/rtree/node/node_d_mem_static.hpp | 16 +++++----- .../index/rtree/node/node_s_mem_dynamic.hpp | 14 ++++----- .../index/rtree/node/node_s_mem_static.hpp | 10 +++---- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index 4f530a555..a69b18ea7 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -190,11 +190,11 @@ struct allocators // create_node_impl -template -struct create_node_poly +template +struct create_dynamic_node { - template - static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems) + template + static inline BaseNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems) { Node * p = alloc_node.allocate(1); @@ -237,14 +237,13 @@ struct create_node< dynamic_internal_node > { - static inline typename node::type * + static inline dynamic_node * apply(Allocators & allocators) { - return create_node_poly< + return create_dynamic_node< + dynamic_node, dynamic_internal_node - >::template apply< - typename node::type - >(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); + >::apply(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); } }; @@ -254,14 +253,13 @@ struct create_node< dynamic_leaf > { - static inline typename node::type * + static inline dynamic_node * apply(Allocators & allocators) { - return create_node_poly< + return create_dynamic_node< + dynamic_node, dynamic_leaf - >::template apply< - typename node::type - >(allocators.leaf_allocator, allocators.leaf_elements_allocator); + >::template apply(allocators.leaf_allocator, allocators.leaf_elements_allocator); } }; @@ -273,7 +271,7 @@ struct destroy_node< dynamic_internal_node > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, dynamic_node * n) { destroy_node_poly< dynamic_internal_node @@ -287,7 +285,7 @@ struct destroy_node< dynamic_leaf > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, dynamic_node * n) { destroy_node_poly< dynamic_leaf diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp index 820d88ddf..35d087a15 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp @@ -122,14 +122,13 @@ struct create_node< dynamic_internal_node > { - static inline typename node::type * + static inline dynamic_node * apply(Allocators & allocators) { - return create_node_poly< + return create_dynamic_node< + dynamic_node, dynamic_internal_node - >::template apply< - typename node::type - >(allocators.internal_node_allocator, allocators.internal_node_allocator); + >::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator); } }; @@ -142,11 +141,10 @@ struct create_node< static inline typename node::type * apply(Allocators & allocators) { - return create_node_poly< + return create_dynamic_node< + dynamic_node, dynamic_leaf - >::template apply< - typename node::type - >(allocators.leaf_allocator, allocators.leaf_allocator); + >::template apply(allocators.leaf_allocator, allocators.leaf_allocator); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp index 4b492c072..5cb15aa0f 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp @@ -153,10 +153,10 @@ struct allocators // create_node_variant -template +template struct create_node_variant { - template + template static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems) { RetNode * p = alloc_node.allocate(1); @@ -203,10 +203,9 @@ struct create_node< apply(Allocators & allocators) { return create_node_variant< + typename node::type, static_internal_node - >::template apply< - typename node::type - >(allocators.node_allocator, allocators.internal_node_elements_allocator); + >::template apply(allocators.node_allocator, allocators.internal_node_elements_allocator); } }; @@ -220,10 +219,9 @@ struct create_node< apply(Allocators & allocators) { return create_node_variant< + typename node::type, static_leaf - >::template apply< - typename node::type - >(allocators.node_allocator, allocators.leaf_elements_allocator); + >::template apply(allocators.node_allocator, allocators.leaf_elements_allocator); } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp index 89730b59c..f76784f1a 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp @@ -121,10 +121,9 @@ struct create_node< apply(Allocators & allocators) { return create_node_variant< + typename node::type, static_internal_node - >::template apply< - typename node::type - >(allocators.node_allocator, allocators.node_allocator); + >::template apply(allocators.node_allocator, allocators.node_allocator); } }; @@ -138,10 +137,9 @@ struct create_node< apply(Allocators & allocators) { return create_node_variant< + typename node::type, static_leaf - >::template apply< - typename node::type - >(allocators.node_allocator, allocators.node_allocator); + >::template apply(allocators.node_allocator, allocators.node_allocator); } }; From 6e5c17a53f9b0ad861ee0f49a8c89d52b4a2f412 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Sep 2012 20:28:11 +0000 Subject: [PATCH 142/366] some names changed. [SVN r80794] --- .../index/rtree/node/node_d_mem_dynamic.hpp | 6 ++--- .../index/rtree/node/node_s_mem_dynamic.hpp | 24 +++++++++---------- .../index/rtree/node/node_s_mem_static.hpp | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index a69b18ea7..744d66eac 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -218,7 +218,7 @@ struct create_dynamic_node // destroy_node_impl template -struct destroy_node_poly +struct destroy_dynamic_node { template static inline void apply(AllocNode & alloc_node, BaseNode * n) @@ -273,7 +273,7 @@ struct destroy_node< { static inline void apply(Allocators & allocators, dynamic_node * n) { - destroy_node_poly< + destroy_dynamic_node< dynamic_internal_node >::apply(allocators.internal_node_allocator, n); } @@ -287,7 +287,7 @@ struct destroy_node< { static inline void apply(Allocators & allocators, dynamic_node * n) { - destroy_node_poly< + destroy_dynamic_node< dynamic_leaf >::apply(allocators.leaf_allocator, n); } diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp index 5cb15aa0f..8eb5d6b8e 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp @@ -153,20 +153,20 @@ struct allocators // create_node_variant -template -struct create_node_variant +template +struct create_static_node { template - static inline RetNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems) + static inline Variant * apply(AllocNode & alloc_node, AllocElems & alloc_elems) { - RetNode * p = alloc_node.allocate(1); + Variant * p = alloc_node.allocate(1); if ( 0 == p ) throw std::bad_alloc(); try { - alloc_node.construct(p, Node(alloc_elems)); + alloc_node.construct(p, Node(alloc_elems)); // implicit cast to Variant } catch(...) { @@ -181,10 +181,10 @@ struct create_node_variant // destroy_node_variant template -struct destroy_node_variant +struct destroy_static_node { - template - static inline void apply(AllocNode & alloc_node, BaseNode * n) + template + static inline void apply(AllocNode & alloc_node, Variant * n) { alloc_node.destroy(n); alloc_node.deallocate(n, 1); @@ -202,7 +202,7 @@ struct create_node< static inline typename node::type * apply(Allocators & allocators) { - return create_node_variant< + return create_static_node< typename node::type, static_internal_node >::template apply(allocators.node_allocator, allocators.internal_node_elements_allocator); @@ -218,7 +218,7 @@ struct create_node< static inline typename node::type * apply(Allocators & allocators) { - return create_node_variant< + return create_static_node< typename node::type, static_leaf >::template apply(allocators.node_allocator, allocators.leaf_elements_allocator); @@ -235,7 +235,7 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - destroy_node_variant< + destroy_static_node< static_internal_node >::apply(allocators.node_allocator, n); } @@ -249,7 +249,7 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename node::type * n) { - destroy_node_variant< + destroy_static_node< static_leaf >::apply(allocators.node_allocator, n); } diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp index f76784f1a..67e9b9ea9 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp @@ -120,7 +120,7 @@ struct create_node< static inline typename node::type * apply(Allocators & allocators) { - return create_node_variant< + return create_static_node< typename node::type, static_internal_node >::template apply(allocators.node_allocator, allocators.node_allocator); @@ -136,7 +136,7 @@ struct create_node< static inline typename node::type * apply(Allocators & allocators) { - return create_node_variant< + return create_static_node< typename node::type, static_leaf >::template apply(allocators.node_allocator, allocators.node_allocator); From 321143ef6f749c77a9fbb36df92271751466c083 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Sep 2012 23:14:09 +0000 Subject: [PATCH 143/366] cosmetic changes [SVN r80796] --- .../index/rtree/node/node_d_mem_dynamic.hpp | 2 +- .../geometry/extensions/index/rtree/rtree.hpp | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index 744d66eac..84d4c931b 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -166,7 +166,7 @@ struct allocators >::other leaf_allocator_type; typedef typename allocator_type::template rebind< - std::pair *> + std::pair::type *> >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 1aa17f3e8..d4c2db3bc 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -203,8 +203,6 @@ public: */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { - //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( this == &src ) return *this; @@ -213,6 +211,7 @@ public: m_parameters = src.m_parameters; m_translator = src.m_translator; + //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment //m_allocators = src.m_allocators; try @@ -233,8 +232,6 @@ public: */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { - //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( this == &src ) return *this; @@ -243,9 +240,10 @@ public: m_parameters = src.m_parameters; m_translator = src.m_translator; + //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment //m_allocators = src.m_allocators; - if ( m_allocators.allocator == src.m_allocators.allocator) + if ( m_allocators.allocator == src.m_allocators.allocator ) { m_values_count = src.m_values_count; src.m_values_count = 0; @@ -547,6 +545,16 @@ public: return children_box_v.result; } + /*! + Returns allocator used by the rtree. + + \return The allocator. + */ + allocator_type get_allocator() const + { + return m_allocators.allocator; + } + /*! Apply a visitor to the nodes structure in order to perform some operator. This function is not a part of the 'official' interface. However it makes From 460aac42a7d8269ed281a1654809b293656484d7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 3 Oct 2012 18:10:29 +0000 Subject: [PATCH 144/366] Data changing in traversing process moved to separate structure. [SVN r80827] --- .../extensions/index/rtree/rstar/insert.hpp | 44 ++++++---- .../index/rtree/visitors/insert.hpp | 85 +++++++++++++------ 2 files changed, 84 insertions(+), 45 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 889d62aa2..d36cec543 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -153,17 +153,17 @@ struct level_insert_base { BOOST_GEOMETRY_INDEX_ASSERT(result_elements.empty(), "reinsert should be handled only once for level"); - result_relative_level = base::m_leafs_level - base::m_current_level; + result_relative_level = base::m_leafs_level - base::m_traverse_data.current_level; // overflow if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) { // node isn't root node - if ( base::m_parent ) + if ( !base::m_traverse_data.current_is_root() ) { rstar::remove_elements_to_reinsert::apply( result_elements, n, - base::m_parent, base::m_current_child_index, + base::m_traverse_data.parent, base::m_traverse_data.current_child_index, base::m_parameters, base::m_translator); } // node is root node @@ -188,10 +188,10 @@ struct level_insert_base template inline void recalculate_aabb_if_necessary(Node &n) const { - if ( !result_elements.empty() && base::m_parent ) + if ( !result_elements.empty() && !base::m_traverse_data.current_is_root() ) { // calulate node's new box - rtree::elements(*base::m_parent)[base::m_current_child_index].first = + base::m_traverse_data.current_element().first = elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_translator); } } @@ -223,9 +223,9 @@ struct level_insert inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level"); - if ( base::m_current_level < base::m_level ) + if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step base::traverse(*this, n); @@ -235,7 +235,7 @@ struct level_insert { BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex"); - if ( base::m_current_level == base::m_level - 1 ) + if ( base::m_traverse_data.current_level == base::m_level - 1 ) { base::handle_possible_reinsert_or_split_of_root(n); } @@ -243,7 +243,7 @@ struct level_insert } else { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level"); // push new child node rtree::elements(n).push_back(base::m_element); @@ -292,15 +292,15 @@ struct level_insert::max)(), "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), + "unexpected level"); rtree::elements(n).push_back(base::m_element); @@ -342,8 +345,10 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, + "unexpected level"); // next traversing step base::traverse(*this, n); @@ -353,8 +358,11 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> inline void operator()(leaf & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == (std::numeric_limits::max)(), "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), + "unexpected level"); rtree::elements(n).push_back(base::m_element); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 2ddb33327..06d15f042 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -152,6 +152,45 @@ public: // ----------------------------------------------------------------------- // +template +struct insert_traverse_data +{ + typedef typename rtree::elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + + insert_traverse_data() + : parent(0), current_child_index(0), current_level(0) + {} + + void move_to_next_level(InternalNode * new_parent, size_t new_child_index) + { + parent = new_parent; + current_child_index = new_child_index; + ++current_level; + } + + bool current_is_root() const + { + return 0 == parent; + } + + elements_type & parent_elements() const + { + BOOST_GEOMETRY_INDEX_ASSERT(parent, "null pointer"); + return rtree::elements(*parent); + } + + element_type & current_element() const + { + BOOST_GEOMETRY_INDEX_ASSERT(parent, "null pointer"); + return rtree::elements(*parent)[current_child_index]; + } + + InternalNode * parent; + size_t current_child_index; + size_t current_level; +}; + // Default insert visitor template class insert @@ -180,9 +219,7 @@ protected: , m_level(leafs_level - relative_level) , m_root_node(root) , m_leafs_level(leafs_level) - , m_parent(0) - , m_current_child_index(0) - , m_current_level(0) + , m_traverse_data() , m_allocators(allocators) { BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); @@ -197,7 +234,7 @@ protected: { // choose next node size_t choosen_node_index = detail::choose_next_node:: - apply(n, rtree::element_indexable(m_element, m_translator), m_parameters, m_leafs_level - m_current_level); + apply(n, rtree::element_indexable(m_element, m_translator), m_parameters, m_leafs_level - m_traverse_data.current_level); // expand the node to contain value geometry::expand( @@ -213,7 +250,8 @@ protected: template inline void post_traverse(Node &n) { - BOOST_GEOMETRY_INDEX_ASSERT(0 == m_parent || &n == rtree::get(rtree::elements(*m_parent)[m_current_child_index].second), + BOOST_GEOMETRY_INDEX_ASSERT(m_traverse_data.current_is_root() || + &n == rtree::get(m_traverse_data.current_element().second), "if node isn't the root current_child_index should be valid"); // handle overflow @@ -227,22 +265,16 @@ protected: inline void traverse_apply_visitor(Visitor & visitor, internal_node &n, size_t choosen_node_index) { // save previous traverse inputs and set new ones - internal_node * parent_bckup = m_parent; - size_t current_child_index_bckup = m_current_child_index; - size_t current_level_bckup = m_current_level; + insert_traverse_data backup_traverse_data = m_traverse_data; // calculate new traverse inputs - m_parent = &n; - m_current_child_index = choosen_node_index; - ++m_current_level; + m_traverse_data.move_to_next_level(&n, choosen_node_index); // next traversing step rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // restore previous traverse inputs - m_parent = parent_bckup; - m_current_child_index = current_child_index_bckup; - m_current_level = current_level_bckup; + m_traverse_data = backup_traverse_data; } // TODO: consider - split result returned as OutIter is faster than reference to the container. Why? @@ -269,12 +301,12 @@ protected: // Implement template struct node_element_type or something like that // node is not the root - just add the new node - if ( m_parent != 0 ) + if ( !m_traverse_data.current_is_root() ) { // update old node's box - rtree::elements(*m_parent)[m_current_child_index].first = n_box; + m_traverse_data.current_element().first = n_box; // add new node to the parent's children - rtree::elements(*m_parent).push_back(additional_nodes[0]); + m_traverse_data.parent_elements().push_back(additional_nodes[0]); } // node is the root - add level else @@ -304,9 +336,7 @@ protected: size_t & m_leafs_level; // traversing input parameters - internal_node *m_parent; - size_t m_current_child_index; - size_t m_current_level; + insert_traverse_data m_traverse_data; Allocators & m_allocators; }; @@ -342,16 +372,16 @@ struct insert::max)(), "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), "unexpected level"); rtree::elements(n).push_back(base::m_element); From fa88da6b9914430a138f72f0b4ea8881c12aacd8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 3 Oct 2012 21:04:13 +0000 Subject: [PATCH 145/366] added quick speed test [SVN r80833] --- tests/additional_speed.cpp | 129 +++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 tests/additional_speed.cpp diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp new file mode 100644 index 000000000..4778dcb98 --- /dev/null +++ b/tests/additional_speed.cpp @@ -0,0 +1,129 @@ +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +int main() +{ + boost::timer tim; + + namespace bg = boost::geometry; + namespace bgi = bg::index; + + size_t values_count = 1000000; + size_t tests_count = 10; + size_t queries_count = 100000; + + std::vector< std::pair > coords; + + //randomize values + { + boost::mt19937 rng; + //rng.seed(static_cast(std::time(0))); + float max_val = static_cast(values_count / 2); + boost::uniform_real range(-max_val, max_val); + boost::variate_generator > rnd(rng, range); + + coords.reserve(values_count); + + std::cout << "randomizing data\n"; + for ( size_t i = 0 ; i < values_count ; ++i ) + { + coords.push_back(std::make_pair(rnd(), rnd())); + } + std::cout << "randomized\n"; + } + + //typedef bg::model::d2::point_xy P; + typedef bg::model::point P; + typedef bg::model::box

    B; + //typedef bgi::rtree > RT; + //typedef bgi::rtree RT; + typedef bgi::rtree > RT; + // typedef bgi::rtree RT; + //typedef bgi::rtree > RT; + //typedef bgi::rtree RT; + + for ( ;; ) + { + RT t; + //RT t(bgi::runtime::linear(32, 8)); + //RT t(bgi::runtime::quadratic(32, 8)); + //RT t(bgi::runtime::rstar(32, 8)); + + // inserting test + { + std::cout << "rtree inserting time test... (" + << values_count << ")\n"; + tim.restart(); + for (size_t i = 0 ; i < values_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + t.insert(b); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + } + + { + float x = coords[0].first; + float y = coords[0].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + t.remove(b); + } + + std::vector result; + result.reserve(100); + + // query test + { + std::cout << "query(B) searching time test... (" + << queries_count << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + result.clear(); + t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + + // searching test + { + std::cout << "nearest 5 searching time test... (" + << queries_count / 10 << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + result.clear(); + temp += t.nearest(P(x, y), 5, std::back_inserter(result)); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + } + + return 0; +} From a8356c2625974546ae3aed9d0cbab35d28bb375f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 3 Oct 2012 23:59:01 +0000 Subject: [PATCH 146/366] fixed some warnings and error, added nearest query test which don't find all values. [SVN r80838] --- .../index/rtree/visitors/insert.hpp | 13 +++--- .../index/rtree/visitors/nearest.hpp | 6 ++- test/rtree/test_rtree.hpp | 42 +++++++++++++++++++ 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 06d15f042..639e171e9 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -23,11 +23,12 @@ namespace detail { // Default choose_next_node template -struct choose_next_node; +class choose_next_node; template -struct choose_next_node +class choose_next_node { +public: typedef typename Options::parameters_type parameters_type; typedef typename rtree::node::type node; @@ -345,13 +346,14 @@ protected: // Insert visitor forward declaration template -struct insert; +class insert; // Default insert visitor used for nodes elements template -struct insert +class insert : public detail::insert { +public: typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; @@ -398,9 +400,10 @@ struct insert -struct insert +class insert : public detail::insert { +public: typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index c85bfaf74..f11d64f4b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -112,7 +112,11 @@ public: inline distance_type comparable_distance() const { - return m_neighbors.size() < 0 + // smallest distance is in the first neighbor only + // if there is at least m_count values found + // this is just for safety reasons since is_comparable_distance_valid() is checked earlier + // TODO - may be replaced by ASSERT + return m_neighbors.size() < m_count ? (std::numeric_limits::max)() : m_neighbors.front().first; } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 4d4a01965..72b0a1c7d 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -21,6 +21,32 @@ #include #include +// Set point's coordinates + +template +struct generate_outside_point +{}; + +template +struct generate_outside_point< bg::model::point > +{ + typedef bg::model::point P; + static P apply() + { + return P(13, 26); + } +}; + +template +struct generate_outside_point< bg::model::point > +{ + typedef bg::model::point P; + static P apply() + { + return P(13, 26, 13); + } +}; + // Values, input and rtree generation template @@ -480,6 +506,21 @@ void test_nearest_k(Rtree const& rtree, std::vector const& input, Point c } } +// rtree nearest not found + +template +void test_nearest_not_found(Rtree const& rtree, Point const& pt, CoordinateType max_distance_1, CoordinateType max_distance_k) +{ + typename Rtree::value_type output; + size_t n_res = rtree.nearest(bgi::max_bounded(pt, max_distance_1), output); + BOOST_CHECK(0 == n_res); + + std::vector output_v; + n_res = rtree.nearest(bgi::max_bounded(pt, max_distance_k), 5, std::back_inserter(output_v)); + BOOST_CHECK(output_v.size() == n_res); + BOOST_CHECK(n_res < 5); +} + // rtree copying and moving template @@ -580,6 +621,7 @@ void test_rtree_by_value(Parameters const& parameters) test_nearest(tree, input, pt); test_nearest_k(tree, input, pt, 10); + test_nearest_not_found(tree, generate_outside_point

    ::apply(), 1, 3); test_copy_assignment_move(tree, qbox); From 2eb4ed8cf7e565d1dac19acbc7773a242a59f7c0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 4 Oct 2012 00:02:43 +0000 Subject: [PATCH 147/366] moddified speed test [SVN r80839] --- tests/additional_speed.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 4778dcb98..7b2d338ff 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -1,5 +1,3 @@ -#include - #include #include @@ -23,7 +21,6 @@ int main() namespace bgi = bg::index; size_t values_count = 1000000; - size_t tests_count = 10; size_t queries_count = 100000; std::vector< std::pair > coords; @@ -107,6 +104,8 @@ int main() std::cout << "found: " << temp << "\n"; } + result.clear(); + // searching test { std::cout << "nearest 5 searching time test... (" From 0ab8fb772b3d01e13adf96f268673881d8aceff5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 4 Oct 2012 09:37:39 +0000 Subject: [PATCH 148/366] merged from index_dev. clang warnings and error in nearest_k fixed. added insert_traverse_data. added additional tests. [SVN r80841] --- .../extensions/index/rtree/rstar/insert.hpp | 44 +++--- .../index/rtree/visitors/insert.hpp | 98 +++++++++----- .../index/rtree/visitors/nearest.hpp | 6 +- test/rtree/test_rtree.hpp | 42 ++++++ tests/additional_speed.cpp | 128 ++++++++++++++++++ 5 files changed, 267 insertions(+), 51 deletions(-) create mode 100644 tests/additional_speed.cpp diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 889d62aa2..d36cec543 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -153,17 +153,17 @@ struct level_insert_base { BOOST_GEOMETRY_INDEX_ASSERT(result_elements.empty(), "reinsert should be handled only once for level"); - result_relative_level = base::m_leafs_level - base::m_current_level; + result_relative_level = base::m_leafs_level - base::m_traverse_data.current_level; // overflow if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) { // node isn't root node - if ( base::m_parent ) + if ( !base::m_traverse_data.current_is_root() ) { rstar::remove_elements_to_reinsert::apply( result_elements, n, - base::m_parent, base::m_current_child_index, + base::m_traverse_data.parent, base::m_traverse_data.current_child_index, base::m_parameters, base::m_translator); } // node is root node @@ -188,10 +188,10 @@ struct level_insert_base template inline void recalculate_aabb_if_necessary(Node &n) const { - if ( !result_elements.empty() && base::m_parent ) + if ( !result_elements.empty() && !base::m_traverse_data.current_is_root() ) { // calulate node's new box - rtree::elements(*base::m_parent)[base::m_current_child_index].first = + base::m_traverse_data.current_element().first = elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_translator); } } @@ -223,9 +223,9 @@ struct level_insert inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level"); - if ( base::m_current_level < base::m_level ) + if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step base::traverse(*this, n); @@ -235,7 +235,7 @@ struct level_insert { BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex"); - if ( base::m_current_level == base::m_level - 1 ) + if ( base::m_traverse_data.current_level == base::m_level - 1 ) { base::handle_possible_reinsert_or_split_of_root(n); } @@ -243,7 +243,7 @@ struct level_insert } else { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level"); // push new child node rtree::elements(n).push_back(base::m_element); @@ -292,15 +292,15 @@ struct level_insert::max)(), "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), + "unexpected level"); rtree::elements(n).push_back(base::m_element); @@ -342,8 +345,10 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, + "unexpected level"); // next traversing step base::traverse(*this, n); @@ -353,8 +358,11 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> inline void operator()(leaf & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == (std::numeric_limits::max)(), "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), + "unexpected level"); rtree::elements(n).push_back(base::m_element); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 2ddb33327..639e171e9 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -23,11 +23,12 @@ namespace detail { // Default choose_next_node template -struct choose_next_node; +class choose_next_node; template -struct choose_next_node +class choose_next_node { +public: typedef typename Options::parameters_type parameters_type; typedef typename rtree::node::type node; @@ -152,6 +153,45 @@ public: // ----------------------------------------------------------------------- // +template +struct insert_traverse_data +{ + typedef typename rtree::elements_type::type elements_type; + typedef typename elements_type::value_type element_type; + + insert_traverse_data() + : parent(0), current_child_index(0), current_level(0) + {} + + void move_to_next_level(InternalNode * new_parent, size_t new_child_index) + { + parent = new_parent; + current_child_index = new_child_index; + ++current_level; + } + + bool current_is_root() const + { + return 0 == parent; + } + + elements_type & parent_elements() const + { + BOOST_GEOMETRY_INDEX_ASSERT(parent, "null pointer"); + return rtree::elements(*parent); + } + + element_type & current_element() const + { + BOOST_GEOMETRY_INDEX_ASSERT(parent, "null pointer"); + return rtree::elements(*parent)[current_child_index]; + } + + InternalNode * parent; + size_t current_child_index; + size_t current_level; +}; + // Default insert visitor template class insert @@ -180,9 +220,7 @@ protected: , m_level(leafs_level - relative_level) , m_root_node(root) , m_leafs_level(leafs_level) - , m_parent(0) - , m_current_child_index(0) - , m_current_level(0) + , m_traverse_data() , m_allocators(allocators) { BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value"); @@ -197,7 +235,7 @@ protected: { // choose next node size_t choosen_node_index = detail::choose_next_node:: - apply(n, rtree::element_indexable(m_element, m_translator), m_parameters, m_leafs_level - m_current_level); + apply(n, rtree::element_indexable(m_element, m_translator), m_parameters, m_leafs_level - m_traverse_data.current_level); // expand the node to contain value geometry::expand( @@ -213,7 +251,8 @@ protected: template inline void post_traverse(Node &n) { - BOOST_GEOMETRY_INDEX_ASSERT(0 == m_parent || &n == rtree::get(rtree::elements(*m_parent)[m_current_child_index].second), + BOOST_GEOMETRY_INDEX_ASSERT(m_traverse_data.current_is_root() || + &n == rtree::get(m_traverse_data.current_element().second), "if node isn't the root current_child_index should be valid"); // handle overflow @@ -227,22 +266,16 @@ protected: inline void traverse_apply_visitor(Visitor & visitor, internal_node &n, size_t choosen_node_index) { // save previous traverse inputs and set new ones - internal_node * parent_bckup = m_parent; - size_t current_child_index_bckup = m_current_child_index; - size_t current_level_bckup = m_current_level; + insert_traverse_data backup_traverse_data = m_traverse_data; // calculate new traverse inputs - m_parent = &n; - m_current_child_index = choosen_node_index; - ++m_current_level; + m_traverse_data.move_to_next_level(&n, choosen_node_index); // next traversing step rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // restore previous traverse inputs - m_parent = parent_bckup; - m_current_child_index = current_child_index_bckup; - m_current_level = current_level_bckup; + m_traverse_data = backup_traverse_data; } // TODO: consider - split result returned as OutIter is faster than reference to the container. Why? @@ -269,12 +302,12 @@ protected: // Implement template struct node_element_type or something like that // node is not the root - just add the new node - if ( m_parent != 0 ) + if ( !m_traverse_data.current_is_root() ) { // update old node's box - rtree::elements(*m_parent)[m_current_child_index].first = n_box; + m_traverse_data.current_element().first = n_box; // add new node to the parent's children - rtree::elements(*m_parent).push_back(additional_nodes[0]); + m_traverse_data.parent_elements().push_back(additional_nodes[0]); } // node is the root - add level else @@ -304,9 +337,7 @@ protected: size_t & m_leafs_level; // traversing input parameters - internal_node *m_parent; - size_t m_current_child_index; - size_t m_current_level; + insert_traverse_data m_traverse_data; Allocators & m_allocators; }; @@ -315,13 +346,14 @@ protected: // Insert visitor forward declaration template -struct insert; +class insert; // Default insert visitor used for nodes elements template -struct insert +class insert : public detail::insert { +public: typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; @@ -342,16 +374,16 @@ struct insert -struct insert +class insert : public detail::insert { +public: typedef detail::insert base; typedef typename base::node node; typedef typename base::internal_node internal_node; @@ -391,8 +424,8 @@ struct insert::max)(), "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), "unexpected level"); rtree::elements(n).push_back(base::m_element); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp index c85bfaf74..f11d64f4b 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest.hpp @@ -112,7 +112,11 @@ public: inline distance_type comparable_distance() const { - return m_neighbors.size() < 0 + // smallest distance is in the first neighbor only + // if there is at least m_count values found + // this is just for safety reasons since is_comparable_distance_valid() is checked earlier + // TODO - may be replaced by ASSERT + return m_neighbors.size() < m_count ? (std::numeric_limits::max)() : m_neighbors.front().first; } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 4d4a01965..72b0a1c7d 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -21,6 +21,32 @@ #include #include +// Set point's coordinates + +template +struct generate_outside_point +{}; + +template +struct generate_outside_point< bg::model::point > +{ + typedef bg::model::point P; + static P apply() + { + return P(13, 26); + } +}; + +template +struct generate_outside_point< bg::model::point > +{ + typedef bg::model::point P; + static P apply() + { + return P(13, 26, 13); + } +}; + // Values, input and rtree generation template @@ -480,6 +506,21 @@ void test_nearest_k(Rtree const& rtree, std::vector const& input, Point c } } +// rtree nearest not found + +template +void test_nearest_not_found(Rtree const& rtree, Point const& pt, CoordinateType max_distance_1, CoordinateType max_distance_k) +{ + typename Rtree::value_type output; + size_t n_res = rtree.nearest(bgi::max_bounded(pt, max_distance_1), output); + BOOST_CHECK(0 == n_res); + + std::vector output_v; + n_res = rtree.nearest(bgi::max_bounded(pt, max_distance_k), 5, std::back_inserter(output_v)); + BOOST_CHECK(output_v.size() == n_res); + BOOST_CHECK(n_res < 5); +} + // rtree copying and moving template @@ -580,6 +621,7 @@ void test_rtree_by_value(Parameters const& parameters) test_nearest(tree, input, pt); test_nearest_k(tree, input, pt, 10); + test_nearest_not_found(tree, generate_outside_point

    ::apply(), 1, 3); test_copy_assignment_move(tree, qbox); diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp new file mode 100644 index 000000000..7b2d338ff --- /dev/null +++ b/tests/additional_speed.cpp @@ -0,0 +1,128 @@ +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +int main() +{ + boost::timer tim; + + namespace bg = boost::geometry; + namespace bgi = bg::index; + + size_t values_count = 1000000; + size_t queries_count = 100000; + + std::vector< std::pair > coords; + + //randomize values + { + boost::mt19937 rng; + //rng.seed(static_cast(std::time(0))); + float max_val = static_cast(values_count / 2); + boost::uniform_real range(-max_val, max_val); + boost::variate_generator > rnd(rng, range); + + coords.reserve(values_count); + + std::cout << "randomizing data\n"; + for ( size_t i = 0 ; i < values_count ; ++i ) + { + coords.push_back(std::make_pair(rnd(), rnd())); + } + std::cout << "randomized\n"; + } + + //typedef bg::model::d2::point_xy P; + typedef bg::model::point P; + typedef bg::model::box

    B; + //typedef bgi::rtree > RT; + //typedef bgi::rtree RT; + typedef bgi::rtree > RT; + // typedef bgi::rtree RT; + //typedef bgi::rtree > RT; + //typedef bgi::rtree RT; + + for ( ;; ) + { + RT t; + //RT t(bgi::runtime::linear(32, 8)); + //RT t(bgi::runtime::quadratic(32, 8)); + //RT t(bgi::runtime::rstar(32, 8)); + + // inserting test + { + std::cout << "rtree inserting time test... (" + << values_count << ")\n"; + tim.restart(); + for (size_t i = 0 ; i < values_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + t.insert(b); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + } + + { + float x = coords[0].first; + float y = coords[0].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + t.remove(b); + } + + std::vector result; + result.reserve(100); + + // query test + { + std::cout << "query(B) searching time test... (" + << queries_count << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + result.clear(); + t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + temp += result.size(); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + + result.clear(); + + // searching test + { + std::cout << "nearest 5 searching time test... (" + << queries_count / 10 << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + result.clear(); + temp += t.nearest(P(x, y), 5, std::back_inserter(result)); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } + } + + return 0; +} From b164ec22c4e1a32db08880906b6628d51e6dc4d7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 13 Oct 2012 23:26:25 +0000 Subject: [PATCH 149/366] Added exact_match parameter to are_boxes_ok() check. [SVN r80982] --- .../extensions/index/pushable_array.hpp | 2 +- .../index/rtree/visitors/are_boxes_ok.hpp | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index f1bd18e33..538a6f0f6 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -46,7 +46,7 @@ public: m_size = s; } - inline void reserve(size_type s) + inline void reserve(size_type /*s*/) { //BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); // do nothing diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 85aa5eb05..77fdb782a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -27,11 +27,11 @@ class are_boxes_ok typedef typename rtree::leaf::type leaf; public: - inline are_boxes_ok(Translator const& tr) - : result(false), m_tr(tr), m_is_root(true) + are_boxes_ok(Translator const& tr, bool exact_match) + : result(false), m_tr(tr), m_is_root(true), m_exact_match(exact_match) {} - inline void operator()(internal_node const& n) + void operator()(internal_node const& n) { typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); @@ -69,10 +69,13 @@ public: geometry::expand(box_exp, it->first); } - result = m_is_root || geometry::equals(box_exp, m_box); + if ( m_exact_match ) + result = m_is_root || geometry::equals(box_exp, m_box); + else + result = m_is_root || geometry::covered_by(box_exp, m_box); } - inline void operator()(leaf const& n) + void operator()(leaf const& n) { typedef typename rtree::elements_type::type elements_type; elements_type const& elements = rtree::elements(n); @@ -94,7 +97,10 @@ public: geometry::expand(box_exp, m_tr(*it)); } - result = geometry::equals(box_exp, m_box); + if ( m_exact_match ) + result = geometry::equals(box_exp, m_box); + else + result = geometry::covered_by(box_exp, m_box); } else result = true; @@ -106,12 +112,14 @@ private: Translator const& m_tr; Box m_box; bool m_is_root; + bool m_exact_match; }; }}} // namespace detail::rtree::visitors template -bool are_boxes_ok(rtree const& tree) +bool are_boxes_ok(rtree const& tree, + bool exact_match = true) { typedef rtree rt; detail::rtree::visitors::are_boxes_ok< @@ -120,7 +128,7 @@ bool are_boxes_ok(rtree const& tree) typename rt::translator_type, typename rt::box_type, typename rt::allocators_type - > v(tree.translator()); + > v(tree.translator(), exact_match); tree.apply_visitor(v); From 4dc16eb40d5a97602b2b82a6b062abd0783ae2da Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 10 Nov 2012 10:25:56 +0000 Subject: [PATCH 150/366] Exception-safety of the default insert and split algorithms improved. [SVN r81280] --- .../extensions/index/rtree/node/node.hpp | 10 +++ .../index/rtree/node/node_auto_ptr.hpp | 78 +++++++++++++++++++ .../index/rtree/visitors/insert.hpp | 66 +++++++++++----- 3 files changed, 136 insertions(+), 18 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index d3ce1aca3..a6611fa65 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -13,12 +13,22 @@ #include +// WARNING! +// The Node elements containing pointers to nodes, i.e. pair MUST NOT throw an exception +// in the copy constructor. Otherwise copying may be broken in push_back() of internal vectors. +// The result may be two copies of the same pointer in the vector. This may cause the attempt to destroy +// the same object two times. +// This means for example that Value's CoordinateType copy constructor MUST NOT throw an exception +// because Value's CoordinateType is used in Box type. + #include #include #include #include +#include + #include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp b/include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp new file mode 100644 index 000000000..fcb3e1492 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp @@ -0,0 +1,78 @@ +// Boost.Geometry Index +// +// R-tree node auto ptr +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_AUTO_PTR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_AUTO_PTR_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +class node_auto_ptr + : boost::noncopyable +{ + typedef typename rtree::node::type node; + +public: + node_auto_ptr(node * ptr, Allocators & allocators) + : m_ptr(ptr) + , m_allocators(allocators) + {} + + ~node_auto_ptr() + { + reset(); + } + + void reset(node * ptr = 0) + { + if ( m_ptr ) + { + detail::rtree::visitors::destroy del_v(m_ptr, m_allocators); + detail::rtree::apply_visitor(del_v, *m_ptr); + } + m_ptr = ptr; + } + + void release() + { + m_ptr = 0; + } + + node * get() const + { + return m_ptr; + } + + node & operator*() const + { + return *m_ptr; + } + + node * operator->() const + { + return m_ptr; + } + +private: + node * m_ptr; + Allocators & m_allocators; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_AUTO_PTR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 639e171e9..86089aa1c 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -119,6 +119,8 @@ protected: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; + typedef rtree::node_auto_ptr node_auto_ptr; + public: typedef index::pushable_array, 1> nodes_container_type; @@ -130,14 +132,23 @@ public: Translator const& translator, Allocators & allocators) { - // create additional node - node * second_node = rtree::create_node::apply(allocators); + // TODO - consider creating nodes always with sufficient memory allocated + + // create additional node, use auto ptr for automatic destruction on exception + node_auto_ptr second_node(rtree::create_node::apply(allocators), allocators); // MAY THROW + // create reference to the newly created node Node & n2 = rtree::get(*second_node); // redistribute elements Box box2; - redistribute_elements:: - apply(n, n2, n_box, box2, parameters, translator); + redistribute_elements< + Value, + Options, + Translator, + Box, + Allocators, + typename Options::redistribute_tag + >::apply(n, n2, n_box, box2, parameters, translator); // MAY THROW // check numbers of elements BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n).size() && @@ -147,7 +158,11 @@ public: rtree::elements(n2).size() <= parameters.get_max_elements(), "unexpected number of elements"); - additional_nodes.push_back(std::make_pair(box2, second_node)); + // return the list of newly created nodes (this algorithm returns one) + additional_nodes.push_back(std::make_pair(box2, second_node.get())); // MAY THROW + + // release the ptr + second_node.release(); } }; @@ -205,6 +220,8 @@ protected: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; + typedef rtree::node_auto_ptr node_auto_ptr; + inline insert(node* & root, size_t & leafs_level, Element const& element, @@ -258,7 +275,7 @@ protected: // handle overflow if ( m_parameters.get_max_elements() < rtree::elements(n).size() ) { - split(n); + split(n); // MAY THROW } } @@ -288,7 +305,7 @@ protected: typename split_algo::nodes_container_type additional_nodes; Box n_box; - split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); + split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); @@ -298,16 +315,19 @@ protected: // and container of additional elements (std::pairs or Values) // and translator + allocators // where node_elements_count + additional_elements > node_max_elements_count - // What with elements other than std::pair ??? + // What with elements other than std::pair ? // Implement template struct node_element_type or something like that + // for exception safety + node_auto_ptr additional_node_ptr(additional_nodes[0].second, m_allocators); + // node is not the root - just add the new node if ( !m_traverse_data.current_is_root() ) { // update old node's box m_traverse_data.current_element().first = n_box; - // add new node to the parent's children - m_traverse_data.parent_elements().push_back(additional_nodes[0]); + // add new node to parent's children + m_traverse_data.parent_elements().push_back(additional_nodes[0]); // MAY THROW } // node is the root - add level else @@ -315,14 +335,24 @@ protected: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); // create new root and add nodes - node * new_root = rtree::create_node::apply(m_allocators); + node_auto_ptr new_root(rtree::create_node::apply(m_allocators), m_allocators); // MAY THROW - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); - rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); + try { + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); // MAY THROW + rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); // MAY THROW + } catch (...) { + // clear new root to not delete in the ~node_auto_ptr() potentially stored old root node + rtree::elements(rtree::get(*new_root)).clear(); + throw; // RETHROW + } - m_root_node = new_root; + m_root_node = new_root.get(); ++m_leafs_level; + + new_root.release(); } + + additional_node_ptr.release(); } // TODO: awulkiew - implement dispatchable split::apply to enable additional nodes creation @@ -389,7 +419,7 @@ public: rtree::elements(n).push_back(base::m_element); } - base::post_traverse(n); + base::post_traverse(n); // MAY THROW } inline void operator()(leaf &) @@ -430,7 +460,7 @@ public: // next traversing step base::traverse(*this, n); - base::post_traverse(n); + base::post_traverse(n); // MAY THROW } inline void operator()(leaf & n) @@ -439,9 +469,9 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || base::m_level == (std::numeric_limits::max)(), "unexpected level"); - rtree::elements(n).push_back(base::m_element); + rtree::elements(n).push_back(base::m_element); // MAY THROW - base::post_traverse(n); + base::post_traverse(n); // MAY THROW } }; From d0084731255ded7c72d25fbc1bca341860cf48d6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 10 Nov 2012 13:29:07 +0000 Subject: [PATCH 151/366] mem leaks related to exceptions fixed in linear redistribute_elements. [SVN r81284] --- .../rtree/linear/redistribute_elements.hpp | 137 ++++++++++-------- .../extensions/index/rtree/node/node.hpp | 23 +++ .../rtree/quadratic/redistribute_elements.hpp | 3 +- .../rtree/rstar/redistribute_elements.hpp | 3 +- .../index/rtree/visitors/insert.hpp | 8 +- 5 files changed, 109 insertions(+), 65 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 793f6c222..5e28a2711 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -208,7 +208,8 @@ struct redistribute_elements::type elements_type; typedef typename elements_type::value_type element_type; @@ -223,7 +224,7 @@ struct redistribute_elements::apply(elements_copy, allocators); + + throw; // RETHROW + } } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index a6611fa65..30e5b48e0 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -53,6 +53,29 @@ inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) return result; } +// destroys stored subtrees if internal node's elements are passed +template +struct destroy_elements +{ + typedef typename Options::parameters_type parameters_type; + + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef rtree::node_auto_ptr node_auto_ptr; + + inline static void apply(typename internal_node::elements_type & elements, Allocators & allocators) + { + for ( size_t i = 0 ; i < elements.size() ; ++i ) + { + node_auto_ptr dummy(elements[i].second, allocators); + elements[i].second = 0; + } + } + + inline static void apply(typename leaf::elements_type &, Allocators &) {} +}; + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 22f243eb3..a179389e8 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -94,7 +94,8 @@ struct redistribute_elements::type elements_type; typedef typename elements_type::value_type element_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 0ebaf1d15..0520057a8 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -334,7 +334,8 @@ struct redistribute_elements::type elements_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 86089aa1c..22f93954a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -139,6 +139,12 @@ public: // create reference to the newly created node Node & n2 = rtree::get(*second_node); + // After throwing an exception by redistribute_elements both nodes may be empty. + // The tree won't be valid r-tree. + // The alternative is to create 2 (or more) additional nodes here and store backup info + // in the original node, but then, if exception was thrown, the node would have more than max + // elements which also is not allowed in the r-tree. + // redistribute elements Box box2; redistribute_elements< @@ -148,7 +154,7 @@ public: Box, Allocators, typename Options::redistribute_tag - >::apply(n, n2, n_box, box2, parameters, translator); // MAY THROW + >::apply(n, n2, n_box, box2, parameters, translator, allocators); // MAY THROW // check numbers of elements BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n).size() && From 25e10f253922b42d77c74b6bd5f5de9c19b3c655 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 12 Nov 2012 00:47:07 +0000 Subject: [PATCH 152/366] potential mem leaks fixed in inserting algorithms, exceptions tests added. [SVN r81301] --- .../rtree/linear/redistribute_elements.hpp | 23 +- .../extensions/index/rtree/node/node.hpp | 20 ++ .../index/rtree/node/node_d_mem_dynamic.hpp | 2 + .../index/rtree/node/node_s_mem_dynamic.hpp | 2 + .../rtree/quadratic/redistribute_elements.hpp | 170 +++++----- .../extensions/index/rtree/rstar/insert.hpp | 85 ++--- .../rtree/rstar/redistribute_elements.hpp | 72 +++-- .../geometry/extensions/index/rtree/rtree.hpp | 31 +- .../geometry/extensions/index/rtree/tags.hpp | 2 +- .../index/rtree/visitors/destroy.hpp | 3 +- .../index/rtree/visitors/insert.hpp | 19 +- test/rtree/Jamfile.v2 | 2 + test/rtree/rtree_exceptions.cpp | 51 +++ test/rtree/test_rtree_exceptions.hpp | 291 ++++++++++++++++++ 14 files changed, 600 insertions(+), 173 deletions(-) create mode 100644 test/rtree/rtree_exceptions.cpp create mode 100644 test/rtree/test_rtree_exceptions.hpp diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 5e28a2711..6f4b237a8 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -224,12 +224,16 @@ struct redistribute_elements::apply(elements_copy, parameters, translator, seed1, seed2); + linear::pick_seeds< + elements_type, + parameters_type, + Translator + >::apply(elements_copy, parameters, translator, seed1, seed2); // prepare nodes' elements containers elements1.clear(); @@ -238,8 +242,8 @@ struct redistribute_elements::apply(elements_copy, allocators); + //elements_copy.clear(); - throw; // RETHROW + throw; // RETHROW } } }; diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 30e5b48e0..850192e9f 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -53,6 +53,26 @@ inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) return result; } +// destroys subtree if the element is internal node's element +template +struct destroy_element +{ + typedef typename Options::parameters_type parameters_type; + + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + typedef rtree::node_auto_ptr node_auto_ptr; + + inline static void apply(typename internal_node::elements_type::value_type & element, Allocators & allocators) + { + node_auto_ptr dummy(element.second, allocators); + element.second = 0; + } + + inline static void apply(typename leaf::elements_type::value_type &, Allocators &) {} +}; + // destroys stored subtrees if internal node's elements are passed template struct destroy_elements diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index 84d4c931b..e66cef8c7 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -203,6 +203,8 @@ struct create_dynamic_node try { + // NOTE/TODO + // Here the whole node may be copied alloc_node.construct(p, Node(alloc_elems)); } catch(...) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp index 8eb5d6b8e..6f14beb80 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp @@ -166,6 +166,8 @@ struct create_static_node try { + // NOTE/TODO + // Here the whole node may be copied alloc_node.construct(p, Node(alloc_elems)); // implicit cast to Variant } catch(...) diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index a179389e8..b8fb0eb83 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -109,107 +109,127 @@ struct redistribute_elements::apply(elements_copy, parameters, translator, seed1, seed2); + quadratic::pick_seeds< + elements_type, + parameters_type, + Translator, + Box + >::apply(elements_copy, parameters, translator, seed1, seed2); // prepare nodes' elements containers elements1.clear(); BOOST_GEOMETRY_INDEX_ASSERT(elements2.empty(), "second node's elements container should be empty"); - // add seeds - elements1.push_back(elements_copy[seed1]); - elements2.push_back(elements_copy[seed2]); - - // calculate boxes - geometry::convert(rtree::element_indexable(elements_copy[seed1], translator), box1); - geometry::convert(rtree::element_indexable(elements_copy[seed2], translator), box2); - - // remove seeds - if (seed1 < seed2) + try { - elements_copy.erase(elements_copy.begin() + seed2); - elements_copy.erase(elements_copy.begin() + seed1); - } - else - { - elements_copy.erase(elements_copy.begin() + seed1); - elements_copy.erase(elements_copy.begin() + seed2); - } + // add seeds + elements1.push_back(elements_copy[seed1]); // MAY THROW + elements2.push_back(elements_copy[seed2]); // MAY THROW - // initialize areas - content_type content1 = index::content(box1); - content_type content2 = index::content(box2); + // calculate boxes + geometry::convert(rtree::element_indexable(elements_copy[seed1], translator), box1); + geometry::convert(rtree::element_indexable(elements_copy[seed2], translator), box2); - size_t remaining = elements_copy.size(); - - // redistribute the rest of the elements - while ( !elements_copy.empty() ) - { - typename elements_type::reverse_iterator el_it = elements_copy.rbegin(); - bool insert_into_group1 = false; - - size_t elements1_count = elements1.size(); - size_t elements2_count = elements2.size(); - - // if there is small number of elements left and the number of elements in node is lesser than min_elems - // just insert them to this node - if ( elements1_count + remaining <= parameters.get_min_elements() ) + // remove seeds + if (seed1 < seed2) { - insert_into_group1 = true; + elements_copy.erase(elements_copy.begin() + seed2); // MAY THROW + elements_copy.erase(elements_copy.begin() + seed1); // MAY THROW } - else if ( elements2_count + remaining <= parameters.get_min_elements() ) - { - insert_into_group1 = false; - } - // insert the best element else { - // find element with minimum groups areas increses differences - content_type content_increase1 = 0; - content_type content_increase2 = 0; - el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(), - box1, box2, content1, content2, translator, - content_increase1, content_increase2); + elements_copy.erase(elements_copy.begin() + seed1); // MAY THROW + elements_copy.erase(elements_copy.begin() + seed2); // MAY THROW + } - if ( content_increase1 < content_increase2 || - ( content_increase1 == content_increase2 && content1 < content2 ) || - ( content1 == content2 && elements1_count <= elements2_count ) ) + // initialize areas + content_type content1 = index::content(box1); + content_type content2 = index::content(box2); + + size_t remaining = elements_copy.size(); + + // redistribute the rest of the elements + while ( !elements_copy.empty() ) + { + typename elements_type::reverse_iterator el_it = elements_copy.rbegin(); + bool insert_into_group1 = false; + + size_t elements1_count = elements1.size(); + size_t elements2_count = elements2.size(); + + // if there is small number of elements left and the number of elements in node is lesser than min_elems + // just insert them to this node + if ( elements1_count + remaining <= parameters.get_min_elements() ) { insert_into_group1 = true; } - else + else if ( elements2_count + remaining <= parameters.get_min_elements() ) { insert_into_group1 = false; } + // insert the best element + else + { + // find element with minimum groups areas increses differences + content_type content_increase1 = 0; + content_type content_increase2 = 0; + el_it = pick_next(elements_copy.rbegin(), elements_copy.rend(), + box1, box2, content1, content2, translator, + content_increase1, content_increase2); + + if ( content_increase1 < content_increase2 || + ( content_increase1 == content_increase2 && content1 < content2 ) || + ( content1 == content2 && elements1_count <= elements2_count ) ) + { + insert_into_group1 = true; + } + else + { + insert_into_group1 = false; + } + } + + // move element to the choosen group + element_type const& elem = *el_it; + indexable_type const& indexable = rtree::element_indexable(elem, translator); + + if ( insert_into_group1 ) + { + elements1.push_back(elem); // MAY THROW + geometry::expand(box1, indexable); + content1 = index::content(box1); + } + else + { + elements2.push_back(elem); // MAY THROW + geometry::expand(box2, indexable); + content2 = index::content(box2); + } + + BOOST_GEOMETRY_INDEX_ASSERT(!elements_copy.empty(), "expected more elements"); + typename elements_type::iterator el_it_base = el_it.base(); + elements_copy.erase(--el_it_base); // MAY THROW + + BOOST_GEOMETRY_INDEX_ASSERT(0 < remaining, "expected more remaining elements"); + --remaining; } + } + catch(...) + { + //elements_copy.clear(); + elements1.clear(); + elements2.clear(); - // move element to the choosen group - element_type const& elem = *el_it; - indexable_type const& indexable = rtree::element_indexable(elem, translator); + rtree::destroy_elements::apply(elements_backup, allocators); + //elements_backup.clear(); - if ( insert_into_group1 ) - { - elements1.push_back(elem); - geometry::expand(box1, indexable); - content1 = index::content(box1); - } - else - { - elements2.push_back(elem); - geometry::expand(box2, indexable); - content2 = index::content(box2); - } - - BOOST_GEOMETRY_INDEX_ASSERT(!elements_copy.empty(), "expected more elements"); - typename elements_type::iterator el_it_base = el_it.base(); - elements_copy.erase(--el_it_base); - - BOOST_GEOMETRY_INDEX_ASSERT(0 < remaining, "expected more remaining elements"); - --remaining; + throw; // RETHROW } } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index d36cec543..1f78cb995 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -37,7 +37,8 @@ public: internal_node *parent, size_t current_child_index, parameters_type const& parameters, - Translator const& translator) + Translator const& translator, + Allocators & allocators) { typedef typename rtree::elements_type::type elements_type; typedef typename elements_type::value_type element_type; @@ -62,15 +63,14 @@ public: typename index::detail::rtree::container_from_elements_type< elements_type, std::pair - >::type sorted_elements(elements_count); - + >::type sorted_elements(elements_count); // MAY THROW + for ( size_t i = 0 ; i < elements_count ; ++i ) { point_type element_center; - geometry::centroid( rtree::element_indexable(elements[i], translator), - element_center); + geometry::centroid( rtree::element_indexable(elements[i], translator), element_center); sorted_elements[i].first = geometry::comparable_distance(node_center, element_center); - sorted_elements[i].second = elements[i]; + sorted_elements[i].second = elements[i]; // MAY THROW } // sort elements by distances from center @@ -78,17 +78,30 @@ public: sorted_elements.begin(), sorted_elements.begin() + reinserted_elements_count, sorted_elements.end(), - distances_dsc); + distances_dsc); // MAY THROW // copy elements which will be reinserted - result_elements.resize(reinserted_elements_count); + result_elements.resize(reinserted_elements_count); // MAY THROW for ( size_t i = 0 ; i < reinserted_elements_count ; ++i ) - result_elements[i] = sorted_elements[i].second; + result_elements[i] = sorted_elements[i].second; // MAY THROW - // copy remaining elements to the current node - elements.resize(elements_count - reinserted_elements_count); - for ( size_t i = reinserted_elements_count ; i < elements_count ; ++i ) - elements[i - reinserted_elements_count] = sorted_elements[i].second; + try + { + // copy remaining elements to the current node + size_t elements_new_count = elements_count - reinserted_elements_count; + elements.resize(elements_new_count); // MIGHT THROW + for ( size_t i = 0 ; i < elements_new_count ; ++i ) + elements[i] = sorted_elements[i + reinserted_elements_count].second; // MAY THROW + } + catch(...) + { + elements.clear(); + + for ( size_t i = 0 ; i < elements_count ; ++i ) + destroy_element::apply(sorted_elements[i].second, allocators); + + throw; // RETHROW + } } private: @@ -161,16 +174,18 @@ struct level_insert_base // node isn't root node if ( !base::m_traverse_data.current_is_root() ) { + // NOTE: exception-safety + // After an exception result_elements may contain garbage rstar::remove_elements_to_reinsert::apply( result_elements, n, base::m_traverse_data.parent, base::m_traverse_data.current_child_index, - base::m_parameters, base::m_translator); + base::m_parameters, base::m_translator, base::m_allocators); // MAY THROW } // node is root node else { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(base::m_root_node), "node should be the root node"); - base::split(n); + base::split(n); // MAY THROW } } } @@ -181,7 +196,7 @@ struct level_insert_base // overflow if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) { - base::split(n); + base::split(n); // MAY THROW } } @@ -228,7 +243,7 @@ struct level_insert if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step - base::traverse(*this, n); + base::traverse(*this, n); // MAY THROW // further insert if ( 0 < InsertIndex ) @@ -237,7 +252,7 @@ struct level_insert if ( base::m_traverse_data.current_level == base::m_level - 1 ) { - base::handle_possible_reinsert_or_split_of_root(n); + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW } } } @@ -246,17 +261,17 @@ struct level_insert BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level"); // push new child node - rtree::elements(n).push_back(base::m_element); + rtree::elements(n).push_back(base::m_element); // MAY THROW // first insert if ( 0 == InsertIndex ) { - base::handle_possible_reinsert_or_split_of_root(n); + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW } // not the first insert else { - base::handle_possible_split(n); + base::handle_possible_split(n); // MAY THROW } } @@ -296,13 +311,13 @@ struct level_insert::max)(), "unexpected level"); - rtree::elements(n).push_back(base::m_element); + rtree::elements(n).push_back(base::m_element); // MAY THROW - base::handle_possible_split(n); + base::handle_possible_split(n); // MAY THROW } }; @@ -351,7 +366,7 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> "unexpected level"); // next traversing step - base::traverse(*this, n); + base::traverse(*this, n); // MAY THROW base::recalculate_aabb_if_necessary(n); } @@ -364,11 +379,11 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> base::m_level == (std::numeric_limits::max)(), "unexpected level"); - rtree::elements(n).push_back(base::m_element); + rtree::elements(n).push_back(base::m_element); // MAY THROW - base::handle_possible_reinsert_or_split_of_root(n); - - base::recalculate_aabb_if_necessary(n); + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW + + base::recalculate_aabb_if_necessary(n); } }; @@ -408,11 +423,11 @@ public: detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); - rtree::apply_visitor(lins_v, *m_root); + rtree::apply_visitor(lins_v, *m_root); // MAY THROW if ( !lins_v.result_elements.empty() ) { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW } } @@ -423,7 +438,7 @@ public: detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); - rtree::apply_visitor(lins_v, *m_root); + rtree::apply_visitor(lins_v, *m_root); // MAY THROW // we're in the root, so root should be split and there should be no elements to reinsert assert(lins_v.result_elements.empty()); @@ -442,14 +457,14 @@ private: detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, *it, m_parameters, m_translator, m_allocators, relative_level); - rtree::apply_visitor(lins_v, *m_root); + rtree::apply_visitor(lins_v, *m_root); // MAY THROW assert(relative_level + 1 == lins_v.result_relative_level); // non-root relative level if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty()) { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW } } } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 0520057a8..469f1c702 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -68,11 +68,11 @@ struct choose_split_axis_and_index_for_corner BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == parameters.get_max_elements() + 1, "wrong number of elements"); // copy elements - Elements elements_copy = elements; + Elements elements_copy(elements); // MAY THROW // sort elements element_axis_corner_less elements_less(translator); - std::sort(elements_copy.begin(), elements_copy.end(), elements_less); + std::sort(elements_copy.begin(), elements_copy.end(), elements_less); // MAY THROW // init outputs choosen_index = parameters.get_min_elements(); @@ -135,7 +135,7 @@ struct choose_split_axis_and_index_for_axis choose_split_axis_and_index_for_corner:: apply(elements, index1, som1, ovl1, con1, - parameters, translator); + parameters, translator); // MAY THROW size_t index2 = 0; margin_type som2 = 0; @@ -145,7 +145,7 @@ struct choose_split_axis_and_index_for_axis choose_split_axis_and_index_for_corner:: apply(elements, index2, som2, ovl2, con2, - parameters, translator); + parameters, translator); // MAY THROW sum_of_margins = som1 + som2; @@ -185,7 +185,7 @@ struct choose_split_axis_and_index_for_axis:: apply(elements, choosen_index, sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); + parameters, translator); // MAY THROW choosen_corner = min_corner; } @@ -215,7 +215,7 @@ struct choose_split_axis_and_index choose_split_axis_and_index:: apply(elements, choosen_axis, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); + parameters, translator); // MAY THROW margin_type sum_of_margins = 0; @@ -230,7 +230,7 @@ struct choose_split_axis_and_index Box, Dimension - 1, typename index::traits::tag::type - >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); + >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); // MAY THROW if ( sum_of_margins < smallest_sum_of_margins ) { @@ -270,7 +270,7 @@ struct choose_split_axis_and_index Box, 0, typename index::traits::tag::type - >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, parameters, translator); + >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, parameters, translator); // MAY THROW } }; @@ -284,7 +284,7 @@ struct partial_sort { if ( axis < Dimension - 1 ) { - partial_sort::apply(elements, axis, index, tr); + partial_sort::apply(elements, axis, index, tr); // MAY THROW } else { @@ -292,7 +292,7 @@ struct partial_sort typedef typename Elements::value_type element_type; element_axis_corner_less less(tr); - std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW } } }; @@ -307,7 +307,7 @@ struct partial_sort typedef typename Elements::value_type element_type; element_axis_corner_less less(tr); - std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW } }; @@ -349,11 +349,14 @@ struct redistribute_elements::max)(); content_type smallest_content = (std::numeric_limits::max)(); - rstar::choose_split_axis_and_index::value>:: - apply(elements1, - split_axis, split_corner, split_index, - smallest_sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); + rstar::choose_split_axis_and_index< + typename Options::parameters_type, + Box, + index::traits::dimension::value + >::apply(elements1, + split_axis, split_corner, split_index, + smallest_sum_of_margins, smallest_overlap, smallest_content, + parameters, translator); // MAY THROW // TODO: awulkiew - get rid of following static_casts? @@ -361,20 +364,39 @@ struct redistribute_elements(min_corner) || split_corner == static_cast(max_corner), "unexpected value"); BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= split_index && split_index <= parameters.get_max_elements() - parameters.get_min_elements() + 1, "unexpected value"); + // copy original elements + elements_type elements_copy(elements1); // MAY THROW + // TODO: awulkiew - check if std::partial_sort produces the same result as std::sort if ( split_corner == static_cast(min_corner) ) - rstar::partial_sort::apply(elements1, split_axis, split_index, translator); + rstar::partial_sort + ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW else - rstar::partial_sort::apply(elements1, split_axis, split_index, translator); + rstar::partial_sort + ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW - // copy elements to node 2 and remove from node 1 - elements2.resize(parameters.get_max_elements() + 1 - split_index); - std::copy(elements1.begin() + split_index, elements1.end(), elements2.begin()); - elements1.resize(split_index); + try + { + // copy elements to nodes + elements1.resize(split_index); // MIGHT THROW + std::copy(elements_copy.begin(), elements_copy.begin() + split_index, elements1.begin()); // MAY THROW + elements2.resize(parameters.get_max_elements() + 1 - split_index); // MAY THROW + std::copy(elements_copy.begin() + split_index, elements_copy.end(), elements2.begin()); // MAY THROW - // calculate boxes - box1 = rtree::elements_box(elements1.begin(), elements1.end(), translator); - box2 = rtree::elements_box(elements2.begin(), elements2.end(), translator); + // calculate boxes + box1 = rtree::elements_box(elements1.begin(), elements1.end(), translator); + box2 = rtree::elements_box(elements2.begin(), elements2.end(), translator); + } + catch(...) + { + elements1.clear(); + elements2.clear(); + + rtree::destroy_elements::apply(elements_copy, allocators); + //elements_copy.clear(); + + throw; // RETHROW + } } }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d4c2db3bc..d21b74034 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -277,27 +277,20 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); - try - { - detail::rtree::visitors::insert< - value_type, - value_type, - options_type, - translator_type, - box_type, - allocators_type, - typename options_type::insert_tag - > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + detail::rtree::visitors::insert< + value_type, + value_type, + options_type, + translator_type, + box_type, + allocators_type, + typename options_type::insert_tag + > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); - detail::rtree::apply_visitor(insert_v, *m_root); + detail::rtree::apply_visitor(insert_v, *m_root); - ++m_values_count; - } - catch(...) - { - this->destroy(*this); - throw; - } + // If exception is thrown, m_values_count is invalid + ++m_values_count; } /*! diff --git a/include/boost/geometry/extensions/index/rtree/tags.hpp b/include/boost/geometry/extensions/index/rtree/tags.hpp index 7170755a2..5589be5b6 100644 --- a/include/boost/geometry/extensions/index/rtree/tags.hpp +++ b/include/boost/geometry/extensions/index/rtree/tags.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// Tags used by the R-tree implementation. +// Tags used by the R-tree predicates implementation. // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp index 7be482930..567e66d84 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp @@ -42,10 +42,11 @@ public: elements_type & elements = rtree::elements(n); for (typename elements_type::iterator it = elements.begin(); - it != elements.end(); ++it) + it != elements.end(); ++it) { m_current_node = it->second; rtree::apply_visitor(*this, *m_current_node); + it->second = 0; } rtree::destroy_node::apply(m_allocators, node_to_destroy); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 22f93954a..d3f929403 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -139,11 +139,14 @@ public: // create reference to the newly created node Node & n2 = rtree::get(*second_node); - // After throwing an exception by redistribute_elements both nodes may be empty. - // The tree won't be valid r-tree. + // NOTE: thread-safety + // After throwing an exception by redistribute_elements the original node may be not changed or + // both nodes may be empty. In both cases the tree won't be valid r-tree. // The alternative is to create 2 (or more) additional nodes here and store backup info - // in the original node, but then, if exception was thrown, the node would have more than max - // elements which also is not allowed in the r-tree. + // in the original node, then, if exception was thrown, the node would always have more than max + // elements. + // The alternative is to use moving semantics in the implementations of redistribute_elements, + // it will be possible to throw from boost::move() in the case of e.g. static size nodes. // redistribute elements Box box2; @@ -266,7 +269,7 @@ protected: rtree::element_indexable(m_element, m_translator)); // next traversing step - traverse_apply_visitor(visitor, n, choosen_node_index); + traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW } // TODO: awulkiew - change post_traverse name to handle_overflow or overflow_treatment? @@ -295,7 +298,7 @@ protected: m_traverse_data.move_to_next_level(&n, choosen_node_index); // next traversing step - rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); + rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW // restore previous traverse inputs m_traverse_data = backup_traverse_data; @@ -415,7 +418,7 @@ public: if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step - base::traverse(*this, n); + base::traverse(*this, n); // MAY THROW } else { @@ -464,7 +467,7 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, "unexpected level"); // next traversing step - base::traverse(*this, n); + base::traverse(*this, n); // MAY THROW base::post_traverse(n); // MAY THROW } diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index b4bca41d0..c424bcf21 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -37,5 +37,7 @@ test-suite boost-geometry-index-rtree [ run rtree3d_rstar_f.cpp ] [ run rtree3d_rstar_d.cpp ] [ run rtree3d_rstar_tt.cpp ] + + [ run rtree_exceptions.cpp ] ; diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp new file mode 100644 index 000000000..c388d04ba --- /dev/null +++ b/test/rtree/rtree_exceptions.cpp @@ -0,0 +1,51 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +// test value exceptions +template +void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) +{ + typedef std::pair, throwing_value> Value; + typedef bgi::rtree Tree; + typedef typename Tree::box_type B; + + for ( size_t i = 10 ; i < 100 ; i += 10 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls((std::numeric_limits::max)()); + + Tree tree(parameters); + std::vector input; + B qbox; + generate_input<2>::apply(input, qbox); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(0); + + BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_value_copy_exception ); + } +} + +int test_main(int, char* []) +{ + test_rtree_value_exceptions< bgi::linear<4, 2> >(); + test_rtree_value_exceptions(bgi::runtime::linear(4, 2)); + test_rtree_value_exceptions< bgi::quadratic<4, 2> >(); + test_rtree_value_exceptions(bgi::runtime::quadratic(4, 2)); + test_rtree_value_exceptions< bgi::rstar<4, 2> >(); + test_rtree_value_exceptions(bgi::runtime::rstar(4, 2)); + + return 0; +} diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp new file mode 100644 index 000000000..20e6fefbe --- /dev/null +++ b/test/rtree/test_rtree_exceptions.hpp @@ -0,0 +1,291 @@ +// Boost.Geometry Index +// +// R-tree nodes based on runtime-polymorphism, storing static-size containers +// test version throwing exceptions on creation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_EXCEPTIONS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_EXCEPTIONS_HPP + +#include + +#include +#include + +namespace boost { namespace geometry { namespace index { + +// options implementation (from options.hpp) + +struct node_throwing_d_mem_static_tag {}; + +template +struct linear_throwing : public linear {}; + +template +struct quadratic_throwing : public quadratic {}; + +template ::value> +struct rstar_throwing : public rstar {}; + +namespace detail { namespace rtree { + +template +struct options_type< linear_throwing > +{ + typedef options::rtree< + linear_throwing, + insert_default_tag, choose_by_content_diff_tag, split_default_tag, linear_tag, + node_throwing_d_mem_static_tag + > type; +}; + +template +struct options_type< quadratic_throwing > +{ + typedef options::rtree< + quadratic_throwing, + insert_default_tag, choose_by_content_diff_tag, split_default_tag, quadratic_tag, + node_throwing_d_mem_static_tag + > type; +}; + +template +struct options_type< rstar_throwing > +{ + typedef options::rtree< + rstar_throwing, + insert_reinsert_tag, choose_by_overlap_diff_tag, split_default_tag, rstar_tag, + node_throwing_d_mem_static_tag + > type; +}; + +}} // namespace detail::rtree + +// node implementation + +namespace detail { namespace rtree { + +template +struct dynamic_internal_node + : public dynamic_node +{ + typedef index::pushable_array< + std::pair< + Box, + dynamic_node * + >, + Parameters::max_elements + 1 + > elements_type; + + template + inline dynamic_internal_node(Dummy) {} + + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } + + elements_type elements; +}; + +template +struct dynamic_leaf + : public dynamic_node +{ + typedef index::pushable_array elements_type; + + template + inline dynamic_leaf(Dummy) {} + + void apply_visitor(dynamic_visitor & v) { v(*this); } + void apply_visitor(dynamic_visitor & v) const { v(*this); } + + elements_type elements; +}; + +// nodes traits + +template +struct node +{ + typedef dynamic_node type; +}; + +template +struct internal_node +{ + typedef dynamic_internal_node type; +}; + +template +struct leaf +{ + typedef dynamic_leaf type; +}; + +template +struct visitor +{ + typedef dynamic_visitor type; +}; + +// allocators + +template +struct allocators +{ + typedef Allocator allocator_type; + typedef typename allocator_type::size_type size_type; + + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other internal_node_allocator_type; + + typedef typename allocator_type::template rebind< + typename leaf::type + >::other leaf_allocator_type; + + inline explicit allocators(Allocator alloc) + : allocator(alloc) + , internal_node_allocator(allocator) + , leaf_allocator(allocator) + {} + + allocator_type allocator; + internal_node_allocator_type internal_node_allocator; + leaf_allocator_type leaf_allocator; +}; + +struct internal_node_bad_alloc : public std::exception +{ + const char * what() { return "internal node creation failed."; } +}; + +// create_node + +template +struct create_node< + Allocators, + dynamic_internal_node +> +{ + static inline dynamic_node * + apply(Allocators & allocators) + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw internal_node_bad_alloc(); + else + ++get_calls_counter_ref(); + + return create_dynamic_node< + dynamic_node, + dynamic_internal_node + >::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = 0; return mc; } +}; + +struct leaf_bad_alloc : public std::exception +{ + const char * what() { return "leaf node creation failed."; } +}; + +template +struct create_node< + Allocators, + dynamic_leaf +> +{ + static inline typename node::type * + apply(Allocators & allocators) + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw leaf_bad_alloc(); + else + ++get_calls_counter_ref(); + + return create_dynamic_node< + dynamic_node, + dynamic_leaf + >::template apply(allocators.leaf_allocator, allocators.leaf_allocator); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = 0; return mc; } +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +// value implementation + +struct throwing_value_copy_exception : public std::exception +{ + const char * what() { return "value copy failed."; } +}; + +struct throwing_value +{ + explicit throwing_value(int v = 0) + : value(v) + {} + + throwing_value(throwing_value const& v) + { + throw_if_required(); + + value = v.value; + } + + throwing_value & operator=(throwing_value const& v) + { + throw_if_required(); + + value = v.value; + return *this; + } + + void throw_if_required() + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw throwing_value_copy_exception(); + else + ++get_calls_counter_ref(); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = 0; return mc; } + + int value; +}; + +template +struct generate_value< std::pair, throwing_value> > +{ + typedef bg::model::point P; + typedef std::pair R; + static R apply(int x, int y) + { + return std::make_pair(P(x, y), throwing_value(x + y * 100)); + } +}; + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_EXCEPTIONS_HPP From 6a1f024055983972d0e6e4b9833638320d2661c6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 12 Nov 2012 01:07:59 +0000 Subject: [PATCH 153/366] exceptions test improved. [SVN r81302] --- .../geometry/extensions/index/rtree/rtree.hpp | 2 +- test/rtree/rtree_exceptions.cpp | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d21b74034..6fc686fd8 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -138,7 +138,7 @@ public: */ inline ~rtree() { - if ( !this->empty() ) + if ( m_root ) this->destroy(*this); } diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index c388d04ba..3e43c8c53 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -21,23 +21,27 @@ void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) typedef bgi::rtree Tree; typedef typename Tree::box_type B; - for ( size_t i = 10 ; i < 100 ; i += 10 ) + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls((std::numeric_limits::max)()); + std::vector input; + B qbox; + generate_input<2>::apply(input, qbox); + + for ( size_t i = 10 ; i < 100 ; i += 5 ) { throwing_value::reset_calls_counter(); - throwing_value::set_max_calls((std::numeric_limits::max)()); + throwing_value::set_max_calls(i); Tree tree(parameters); - std::vector input; - B qbox; - generate_input<2>::apply(input, qbox); - - throwing_value::reset_calls_counter(); - throwing_value::set_max_calls(0); - + BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_value_copy_exception ); } } +//#define _CRTDBG_MAP_ALLOC +//#include +//#include + int test_main(int, char* []) { test_rtree_value_exceptions< bgi::linear<4, 2> >(); @@ -47,5 +51,9 @@ int test_main(int, char* []) test_rtree_value_exceptions< bgi::rstar<4, 2> >(); test_rtree_value_exceptions(bgi::runtime::rstar(4, 2)); + //std::cout << "----------------------------------------\n"; + //_CrtDumpMemoryLeaks(); + //std::cin.get(); + return 0; } From fd19533cec66fda883fe18b726b5509a50702ee5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 12 Nov 2012 02:36:41 +0000 Subject: [PATCH 154/366] exceptions test compilation warnings fixed for clang [SVN r81304] --- test/rtree/rtree_exceptions.cpp | 8 -------- test/rtree/test_rtree_exceptions.hpp | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 3e43c8c53..35c6ef80c 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -38,10 +38,6 @@ void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) } } -//#define _CRTDBG_MAP_ALLOC -//#include -//#include - int test_main(int, char* []) { test_rtree_value_exceptions< bgi::linear<4, 2> >(); @@ -51,9 +47,5 @@ int test_main(int, char* []) test_rtree_value_exceptions< bgi::rstar<4, 2> >(); test_rtree_value_exceptions(bgi::runtime::rstar(4, 2)); - //std::cout << "----------------------------------------\n"; - //_CrtDumpMemoryLeaks(); - //std::cin.get(); - return 0; } diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 20e6fefbe..74c58c823 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -161,7 +161,7 @@ struct allocators @@ -235,7 +235,7 @@ struct create_node< struct throwing_value_copy_exception : public std::exception { - const char * what() { return "value copy failed."; } + const char * what() const throw() { return "value copy failed."; } }; struct throwing_value From b00198e311ed12024073fb0cbb3d82427fc2dafc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 13 Nov 2012 22:13:17 +0000 Subject: [PATCH 155/366] mem leaks related to exceptions in remove fixed [SVN r81325] --- .../extensions/index/pushable_array.hpp | 8 +- .../extensions/index/rtree/node/node.hpp | 19 +- .../rtree/quadratic/redistribute_elements.hpp | 16 +- .../extensions/index/rtree/rstar/insert.hpp | 375 +++++++++--------- .../index/rtree/visitors/insert.hpp | 52 ++- .../index/rtree/visitors/remove.hpp | 128 +++--- test/rtree/rtree_exceptions.cpp | 24 +- test/rtree/test_rtree_exceptions.hpp | 5 + 8 files changed, 369 insertions(+), 258 deletions(-) diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index 538a6f0f6..68b69dd00 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -138,7 +138,13 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); BOOST_GEOMETRY_INDEX_ASSERT(begin() <= it && it < end(), "iterator points on the element outside the container"); //std::copy(it + 1, end(), it); - *it = back(); + // TODO: leave this code or use copy? + // code below may work differently than one might think about erase() + if ( it != (begin() + (m_size - 1)) ) + { + // NOTE: without this condition assignment may call memcpy with the same 2 addresses + *it = back(); + } --m_size; } diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 850192e9f..24815bec6 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -93,7 +93,24 @@ struct destroy_elements } } - inline static void apply(typename leaf::elements_type &, Allocators &) {} + inline static void apply(typename leaf::elements_type &, Allocators &) + {} + + inline static void apply(typename internal_node::elements_type::iterator first, + typename internal_node::elements_type::iterator last, + Allocators & allocators) + { + for ( ; first != last ; ++first ) + { + node_auto_ptr dummy(first->second, allocators); + first->second = 0; + } + } + + inline static void apply(typename leaf::elements_type::iterator first, + typename leaf::elements_type::iterator last, + Allocators &) + {} }; }} // namespace detail::rtree diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index b8fb0eb83..b41ca6c61 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -90,11 +90,11 @@ struct redistribute_elements static inline void apply(Node & n, - Node & second_node, - Box & box1, - Box & box2, + Node & second_node, + Box & box1, + Box & box2, parameters_type const& parameters, - Translator const& translator, + Translator const& translator, Allocators & allocators) { typedef typename rtree::elements_type::type elements_type; @@ -102,11 +102,11 @@ struct redistribute_elements::type indexable_type; typedef typename index::traits::coordinate_type::type coordinate_type; - elements_type & elements1 = rtree::elements(n); - elements_type & elements2 = rtree::elements(second_node); - const size_t elements1_count = parameters.get_max_elements() + 1; + elements_type & elements1 = rtree::elements(n); + elements_type & elements2 = rtree::elements(second_node); + const size_t elements1_count = parameters.get_max_elements() + 1; - BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected elements number"); + BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected elements number"); // copy original elements elements_type elements_copy(elements1); // MAY THROW diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 1f78cb995..faa08f01d 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -29,15 +29,15 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename Options::parameters_type parameters_type; + typedef typename Options::parameters_type parameters_type; template static inline void apply(typename rtree::elements_type::type & result_elements, - Node & n, - internal_node *parent, - size_t current_child_index, + Node & n, + internal_node *parent, + size_t current_child_index, parameters_type const& parameters, - Translator const& translator, + Translator const& translator, Allocators & allocators) { typedef typename rtree::elements_type::type elements_type; @@ -46,13 +46,13 @@ public: // TODO: awulkiew - change second point_type to the point type of the Indexable? typedef typename geometry::default_distance_result::type distance_type; - elements_type & elements = rtree::elements(n); + elements_type & elements = rtree::elements(n); - const size_t elements_count = parameters.get_max_elements() + 1; - const size_t reinserted_elements_count = parameters.get_reinserted_elements(); + const size_t elements_count = parameters.get_max_elements() + 1; + const size_t reinserted_elements_count = parameters.get_reinserted_elements(); - BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node"); - BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected elements number"); + BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node"); + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected elements number"); BOOST_GEOMETRY_INDEX_ASSERT(0 < reinserted_elements_count, "wrong value of elements to reinsert"); // calculate current node's center @@ -63,14 +63,14 @@ public: typename index::detail::rtree::container_from_elements_type< elements_type, std::pair - >::type sorted_elements(elements_count); // MAY THROW + >::type sorted_elements(elements_count); // MAY THROW (V: alloc, copy, E: alloc) - for ( size_t i = 0 ; i < elements_count ; ++i ) + for ( size_t i = 0 ; i < elements_count ; ++i ) { point_type element_center; geometry::centroid( rtree::element_indexable(elements[i], translator), element_center); sorted_elements[i].first = geometry::comparable_distance(node_center, element_center); - sorted_elements[i].second = elements[i]; // MAY THROW + sorted_elements[i].second = elements[i]; // MAY THROW (V: copy) } // sort elements by distances from center @@ -78,20 +78,20 @@ public: sorted_elements.begin(), sorted_elements.begin() + reinserted_elements_count, sorted_elements.end(), - distances_dsc); // MAY THROW + distances_dsc); // MAY THROW (V: copy) // copy elements which will be reinserted - result_elements.resize(reinserted_elements_count); // MAY THROW + result_elements.resize(reinserted_elements_count); // MAY THROW (V: alloc, copy?, E: alloc) for ( size_t i = 0 ; i < reinserted_elements_count ; ++i ) - result_elements[i] = sorted_elements[i].second; // MAY THROW + result_elements[i] = sorted_elements[i].second; // MAY THROW (V: copy) try { // copy remaining elements to the current node size_t elements_new_count = elements_count - reinserted_elements_count; - elements.resize(elements_new_count); // MIGHT THROW + elements.resize(elements_new_count); // SHOULDN'T THROW (new_size <= old size) for ( size_t i = 0 ; i < elements_new_count ; ++i ) - elements[i] = sorted_elements[i + reinserted_elements_count].second; // MAY THROW + elements[i] = sorted_elements[i + reinserted_elements_count].second; // MAY THROW (V: copy) } catch(...) { @@ -100,7 +100,7 @@ public: for ( size_t i = 0 ; i < elements_count ; ++i ) destroy_element::apply(sorted_elements[i].second, allocators); - throw; // RETHROW + throw; // RETHROW } } @@ -125,101 +125,101 @@ private: template struct level_insert_elements_type { - typedef typename rtree::elements_type< - typename rtree::internal_node::type - >::type type; + typedef typename rtree::elements_type< + typename rtree::internal_node::type + >::type type; }; template struct level_insert_elements_type<0, Value, Value, Options, Box, Allocators> { - typedef typename rtree::elements_type< - typename rtree::leaf::type - >::type type; + typedef typename rtree::elements_type< + typename rtree::leaf::type + >::type type; }; template struct level_insert_base - : public detail::insert + : public detail::insert { - typedef detail::insert base; - typedef typename base::node node; - typedef typename base::internal_node internal_node; - typedef typename base::leaf leaf; + typedef detail::insert base; + typedef typename base::node node; + typedef typename base::internal_node internal_node; + typedef typename base::leaf leaf; - typedef typename level_insert_elements_type::type elements_type; - typedef typename Options::parameters_type parameters_type; + typedef typename level_insert_elements_type::type elements_type; + typedef typename Options::parameters_type parameters_type; - inline level_insert_base(node* & root, - size_t & leafs_level, - Element const& element, + inline level_insert_base(node* & root, + size_t & leafs_level, + Element const& element, parameters_type const& parameters, - Translator const& translator, + Translator const& translator, Allocators & allocators, - size_t relative_level) - : base(root, leafs_level, element, parameters, translator, allocators, relative_level) - , result_relative_level(0) - {} + size_t relative_level) + : base(root, leafs_level, element, parameters, translator, allocators, relative_level) + , result_relative_level(0) + {} - template - inline void handle_possible_reinsert_or_split_of_root(Node &n) - { - BOOST_GEOMETRY_INDEX_ASSERT(result_elements.empty(), "reinsert should be handled only once for level"); - - result_relative_level = base::m_leafs_level - base::m_traverse_data.current_level; + template + inline void handle_possible_reinsert_or_split_of_root(Node &n) + { + BOOST_GEOMETRY_INDEX_ASSERT(result_elements.empty(), "reinsert should be handled only once for level"); - // overflow - if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) - { - // node isn't root node - if ( !base::m_traverse_data.current_is_root() ) - { + result_relative_level = base::m_leafs_level - base::m_traverse_data.current_level; + + // overflow + if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) + { + // node isn't root node + if ( !base::m_traverse_data.current_is_root() ) + { // NOTE: exception-safety // After an exception result_elements may contain garbage - rstar::remove_elements_to_reinsert::apply( - result_elements, n, - base::m_traverse_data.parent, base::m_traverse_data.current_child_index, - base::m_parameters, base::m_translator, base::m_allocators); // MAY THROW - } - // node is root node - else - { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(base::m_root_node), "node should be the root node"); - base::split(n); // MAY THROW - } - } - } + rstar::remove_elements_to_reinsert::apply( + result_elements, n, + base::m_traverse_data.parent, base::m_traverse_data.current_child_index, + base::m_parameters, base::m_translator, base::m_allocators); // MAY THROW (V: alloc, copy, E: alloc) + } + // node is root node + else + { + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(base::m_root_node), "node should be the root node"); + base::split(n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + } + } + } - template - inline void handle_possible_split(Node &n) const - { - // overflow - if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) - { - base::split(n); // MAY THROW - } - } + template + inline void handle_possible_split(Node &n) const + { + // overflow + if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) + { + base::split(n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + } + } - template - inline void recalculate_aabb_if_necessary(Node &n) const - { - if ( !result_elements.empty() && !base::m_traverse_data.current_is_root() ) - { - // calulate node's new box - base::m_traverse_data.current_element().first = - elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_translator); - } - } + template + inline void recalculate_aabb_if_necessary(Node &n) const + { + if ( !result_elements.empty() && !base::m_traverse_data.current_is_root() ) + { + // calulate node's new box + base::m_traverse_data.current_element().first = + elements_box(rtree::elements(n).begin(), rtree::elements(n).end(), base::m_translator); + } + } - size_t result_relative_level; - elements_type result_elements; + size_t result_relative_level; + elements_type result_elements; }; template struct level_insert : public level_insert_base { - typedef level_insert_base base; + typedef level_insert_base base; typedef typename base::node node; typedef typename base::internal_node internal_node; typedef typename base::leaf leaf; @@ -238,12 +238,12 @@ struct level_insert inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, "unexpected level"); if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step - base::traverse(*this, n); // MAY THROW + base::traverse(*this, n); // MAY THROW (E: alloc, N: alloc) // further insert if ( 0 < InsertIndex ) @@ -252,26 +252,40 @@ struct level_insert if ( base::m_traverse_data.current_level == base::m_level - 1 ) { - base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, N: alloc) } } } else { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level"); - - // push new child node - rtree::elements(n).push_back(base::m_element); // MAY THROW + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level"); // first insert if ( 0 == InsertIndex ) { - base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW + try + { + // push new child node + rtree::elements(n).push_back(base::m_element); // MAY THROW (E: alloc) + } + catch(...) + { + // if the first insert fails here, the element won't be stored in the tree + rtree::visitors::destroy del_v(base::m_element.second, base::m_allocators); + rtree::apply_visitor(del_v, *base::m_element.second); + + throw; // RETHROW + } + + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, N: alloc) } // not the first insert else { - base::handle_possible_split(n); // MAY THROW + // push new child node + rtree::elements(n).push_back(base::m_element); // MAY THROW (E: alloc) + + base::handle_possible_split(n); // MAY THROW (E: alloc, N: alloc) } } @@ -307,17 +321,17 @@ struct level_insert::max)(), - "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), + "unexpected level"); - rtree::elements(n).push_back(base::m_element); // MAY THROW + rtree::elements(n).push_back(base::m_element); // MAY THROW (V: alloc, copy) - base::handle_possible_split(n); // MAY THROW + base::handle_possible_split(n); // MAY THROW (V: alloc, copy, N: alloc) } }; @@ -360,28 +374,28 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, - "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, - "unexpected level"); - + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, + "unexpected level"); + // next traversing step - base::traverse(*this, n); // MAY THROW + base::traverse(*this, n); // MAY THROW (V: alloc, copy, N: alloc) base::recalculate_aabb_if_necessary(n); } inline void operator()(leaf & n) { - BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, - "unexpected level"); - BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || - base::m_level == (std::numeric_limits::max)(), - "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level == base::m_leafs_level, + "unexpected level"); + BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || + base::m_level == (std::numeric_limits::max)(), + "unexpected level"); - rtree::elements(n).push_back(base::m_element); // MAY THROW + rtree::elements(n).push_back(base::m_element); // MAY THROW (V: alloc, copy) - base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (V: alloc, copy, N: alloc) base::recalculate_aabb_if_necessary(n); } @@ -392,91 +406,94 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> } // namespace detail // R*-tree insert visitor +// After passing the Element to insert visitor the Element is managed by the tree +// I.e. one should not delete the node passed to the insert visitor after exception is thrown +// because this visitor may delete it template class insert - : public rtree::visitor::type - , index::nonassignable + : public rtree::visitor::type + , index::nonassignable { typedef typename Options::parameters_type parameters_type; - typedef typename rtree::node::type node; - typedef typename rtree::internal_node::type internal_node; - typedef typename rtree::leaf::type leaf; + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; public: - inline insert(node* & root, - size_t & leafs_level, - Element const& element, + inline insert(node* & root, + size_t & leafs_level, + Element const& element, parameters_type const& parameters, - Translator const& translator, + Translator const& translator, Allocators & allocators, - size_t relative_level = 0) - : m_root(root), m_leafs_level(leafs_level), m_element(element) - , m_parameters(parameters), m_translator(translator) + size_t relative_level = 0) + : m_root(root), m_leafs_level(leafs_level), m_element(element) + , m_parameters(parameters), m_translator(translator) , m_relative_level(relative_level), m_allocators(allocators) - {} + {} - inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) - { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( - m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); + inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) + { + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - rtree::apply_visitor(lins_v, *m_root); // MAY THROW + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( + m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); - if ( !lins_v.result_elements.empty() ) - { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW - } - } + rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) - inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) - { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); + if ( !lins_v.result_elements.empty() ) + { + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + } + } - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( - m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); + inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) + { + BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - rtree::apply_visitor(lins_v, *m_root); // MAY THROW + detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( + m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); - // we're in the root, so root should be split and there should be no elements to reinsert - assert(lins_v.result_elements.empty()); - } + rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + + // we're in the root, so root should be split and there should be no elements to reinsert + assert(lins_v.result_elements.empty()); + } private: - template - inline void recursive_reinsert(Elements const& elements, size_t relative_level) - { - typedef typename Elements::value_type element_type; + template + inline void recursive_reinsert(Elements const& elements, size_t relative_level) + { + typedef typename Elements::value_type element_type; - // reinsert children starting from the minimum distance - for ( typename Elements::const_reverse_iterator it = elements.rbegin(); - it != elements.rend(); ++it) - { - detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( - m_root, m_leafs_level, *it, m_parameters, m_translator, m_allocators, relative_level); + // reinsert children starting from the minimum distance + for ( typename Elements::const_reverse_iterator it = elements.rbegin(); + it != elements.rend(); ++it) + { + detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( + m_root, m_leafs_level, *it, m_parameters, m_translator, m_allocators, relative_level); - rtree::apply_visitor(lins_v, *m_root); // MAY THROW + rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) - assert(relative_level + 1 == lins_v.result_relative_level); + assert(relative_level + 1 == lins_v.result_relative_level); - // non-root relative level - if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty()) - { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW - } - } - } + // non-root relative level + if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty()) + { + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + } + } + } - node* & m_root; - size_t & m_leafs_level; - Element const& m_element; + node* & m_root; + size_t & m_leafs_level; + Element const& m_element; parameters_type const& m_parameters; - Translator const& m_translator; + Translator const& m_translator; - size_t m_relative_level; + size_t m_relative_level; Allocators m_allocators; }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index d3f929403..9def4668a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -135,7 +135,7 @@ public: // TODO - consider creating nodes always with sufficient memory allocated // create additional node, use auto ptr for automatic destruction on exception - node_auto_ptr second_node(rtree::create_node::apply(allocators), allocators); // MAY THROW + node_auto_ptr second_node(rtree::create_node::apply(allocators), allocators); // MAY THROW (N: alloc) // create reference to the newly created node Node & n2 = rtree::get(*second_node); @@ -157,7 +157,7 @@ public: Box, Allocators, typename Options::redistribute_tag - >::apply(n, n2, n_box, box2, parameters, translator, allocators); // MAY THROW + >::apply(n, n2, n_box, box2, parameters, translator, allocators); // MAY THROW (V: alloc, copy, E: alloc) // check numbers of elements BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n).size() && @@ -269,7 +269,7 @@ protected: rtree::element_indexable(m_element, m_translator)); // next traversing step - traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW + traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) } // TODO: awulkiew - change post_traverse name to handle_overflow or overflow_treatment? @@ -284,7 +284,7 @@ protected: // handle overflow if ( m_parameters.get_max_elements() < rtree::elements(n).size() ) { - split(n); // MAY THROW + split(n); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) } } @@ -298,7 +298,7 @@ protected: m_traverse_data.move_to_next_level(&n, choosen_node_index); // next traversing step - rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW + rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) // restore previous traverse inputs m_traverse_data = backup_traverse_data; @@ -314,7 +314,7 @@ protected: typename split_algo::nodes_container_type additional_nodes; Box n_box; - split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW + split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); @@ -336,7 +336,7 @@ protected: // update old node's box m_traverse_data.current_element().first = n_box; // add new node to parent's children - m_traverse_data.parent_elements().push_back(additional_nodes[0]); // MAY THROW + m_traverse_data.parent_elements().push_back(additional_nodes[0]); // MAY THROW (V: alloc, copy, E: alloc) } // node is the root - add level else @@ -344,11 +344,11 @@ protected: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); // create new root and add nodes - node_auto_ptr new_root(rtree::create_node::apply(m_allocators), m_allocators); // MAY THROW + node_auto_ptr new_root(rtree::create_node::apply(m_allocators), m_allocators); // MAY THROW (N:alloc) try { - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); // MAY THROW - rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); // MAY THROW + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); // MAY THROW (E:alloc) + rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); // MAY THROW (E:alloc) } catch (...) { // clear new root to not delete in the ~node_auto_ptr() potentially stored old root node rtree::elements(rtree::get(*new_root)).clear(); @@ -388,6 +388,9 @@ template class insert : public detail::insert @@ -402,7 +405,7 @@ public: inline insert(node* & root, size_t & leafs_level, - Element const& element, + Element & element, parameters_type const& parameters, Translator const& translator, Allocators & allocators, @@ -418,17 +421,28 @@ public: if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step - base::traverse(*this, n); // MAY THROW + base::traverse(*this, n); // MAY THROW (E: alloc, N: alloc) } else { BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level"); - // push new child node - rtree::elements(n).push_back(base::m_element); + try + { + // push new child node + rtree::elements(n).push_back(base::m_element); // MAY THROW (E: alloc) + } + catch(...) + { + // if the insert fails here, the element won't be stored in the tree + rtree::visitors::destroy del_v(base::m_element.second, base::m_allocators); + rtree::apply_visitor(del_v, *base::m_element.second); + + throw; // RETHROW + } } - base::post_traverse(n); // MAY THROW + base::post_traverse(n); // MAY THROW (E: alloc, N: alloc) } inline void operator()(leaf &) @@ -467,9 +481,9 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, "unexpected level"); // next traversing step - base::traverse(*this, n); // MAY THROW + base::traverse(*this, n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) - base::post_traverse(n); // MAY THROW + base::post_traverse(n); // MAY THROW (E: alloc, N: alloc) } inline void operator()(leaf & n) @@ -478,9 +492,9 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || base::m_level == (std::numeric_limits::max)(), "unexpected level"); - rtree::elements(n).push_back(base::m_element); // MAY THROW + rtree::elements(n).push_back(base::m_element); // MAY THROW (V: alloc, copy) - base::post_traverse(n); // MAY THROW + base::post_traverse(n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) } }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 0c584f077..4fb867f9a 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -33,6 +33,8 @@ class remove typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; + typedef rtree::node_auto_ptr node_auto_ptr; + public: inline remove(node* & root, size_t & leafs_level, @@ -68,7 +70,7 @@ public: if ( geometry::covered_by(m_translator(m_value), children[child_node_index].first) ) { // next traversing step - traverse_apply_visitor(n, child_node_index); + traverse_apply_visitor(n, child_node_index); // MAY THROW if ( m_is_value_removed ) break; @@ -88,8 +90,9 @@ public: element_iterator underfl_el_it = elements.begin() + child_node_index; // move node to the container - store node's relative level as well - m_underflowed_nodes.push_back(std::make_pair(m_leafs_level - m_current_level, underfl_el_it->second)); - elements.erase(underfl_el_it); + m_underflowed_nodes.push_back(std::make_pair(m_leafs_level - m_current_level, underfl_el_it->second)); // MAY THROW (alloc) + + elements.erase(underfl_el_it); // SHOULDN'T THROW // calc underflow m_is_underflow = elements.size() < m_parameters.get_min_elements(); @@ -112,26 +115,8 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); BOOST_GEOMETRY_INDEX_ASSERT(m_is_value_removed, "value not found"); - // reinsert elements from removed nodes - // begin with levels closer to the root - for ( typename std::vector< std::pair >::reverse_iterator it = m_underflowed_nodes.rbegin(); - it != m_underflowed_nodes.rend() ; ++it ) - { - is_leaf ilv; - rtree::apply_visitor(ilv, *it->second); - if ( ilv.result ) - { - reinsert_elements(rtree::get(*it->second), it->first); - - rtree::destroy_node::apply(m_allocators, it->second); - } - else - { - reinsert_elements(rtree::get(*it->second), it->first); - - rtree::destroy_node::apply(m_allocators, it->second); - } - } + // reinsert elements from removed nodes (underflows) + reinsert_removed_nodes_elements(); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) // shorten the tree if ( rtree::elements(n).size() == 1 ) @@ -156,7 +141,7 @@ public: { if ( m_translator.equals(*it, m_value) ) { - elements.erase(it); + elements.erase(it); // MAY THROW (V: copy) m_is_value_removed = true; break; } @@ -178,6 +163,9 @@ public: } private: + + typedef std::vector< std::pair > UnderflowNodes; + inline void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) { // save previous traverse inputs and set new ones @@ -190,7 +178,7 @@ private: ++m_current_level; // next traversing step - rtree::apply_visitor(*this, *rtree::elements(n)[choosen_node_index].second); + rtree::apply_visitor(*this, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) // restore previous traverse inputs m_parent = parent_bckup; @@ -198,32 +186,78 @@ private: m_current_level = current_level_bckup; } + void reinsert_removed_nodes_elements() + { + typename UnderflowNodes::reverse_iterator it = m_underflowed_nodes.rbegin(); + + try + { + // reinsert elements from removed nodes + // begin with levels closer to the root + for ( ; it != m_underflowed_nodes.rend() ; ++it ) + { + is_leaf ilv; + rtree::apply_visitor(ilv, *it->second); + if ( ilv.result ) + { + reinsert_node_elements(rtree::get(*it->second), it->first); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + + rtree::destroy_node::apply(m_allocators, it->second); + } + else + { + reinsert_node_elements(rtree::get(*it->second), it->first); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + + rtree::destroy_node::apply(m_allocators, it->second); + } + } + + //m_underflowed_nodes.clear(); + } + catch(...) + { + // destroy current and remaining nodes + for ( ; it != m_underflowed_nodes.rend() ; ++it ) + { + node_auto_ptr dummy(it->second, m_allocators); + } + + //m_underflowed_nodes.clear(); + + throw; // RETHROW + } + } + template - void reinsert_elements(Node &n, size_t node_relative_level) + void reinsert_node_elements(Node &n, size_t node_relative_level) { typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); - for ( typename elements_type::iterator it = elements.begin(); - it != elements.end() ; ++it ) - { - visitors::insert< - typename elements_type::value_type, - Value, - Options, - Translator, - Box, - Allocators, - typename Options::insert_tag - > insert_v( - m_root_node, - m_leafs_level, - *it, - m_parameters, - m_translator, - m_allocators, - node_relative_level - 1); - rtree::apply_visitor(insert_v, *m_root_node); + typename elements_type::iterator it = elements.begin(); + try + { + for ( ; it != elements.end() ; ++it ) + { + visitors::insert< + typename elements_type::value_type, + Value, Options, Translator, Box, Allocators, + typename Options::insert_tag + > insert_v( + m_root_node, m_leafs_level, *it, + m_parameters, m_translator, m_allocators, + node_relative_level - 1); + + rtree::apply_visitor(insert_v, *m_root_node); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + } + } + catch(...) + { + ++it; + rtree::destroy_elements + ::apply(it, elements.end(), m_allocators); + elements.clear(); + throw; // RETHROW } } @@ -235,7 +269,7 @@ private: node* & m_root_node; size_t & m_leafs_level; bool m_is_value_removed; - std::vector< std::pair > m_underflowed_nodes; + UnderflowNodes m_underflowed_nodes; // traversing input parameters internal_node *m_parent; diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 35c6ef80c..de161045b 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -27,15 +27,33 @@ void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) B qbox; generate_input<2>::apply(input, qbox); - for ( size_t i = 10 ; i < 100 ; i += 5 ) + for ( size_t i = 0 ; i < 100 ; i += 5 ) { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + throwing_value::reset_calls_counter(); throwing_value::set_max_calls(i); - Tree tree(parameters); - BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_value_copy_exception ); } + + for ( size_t i = 0 ; i < 20 ; i += 2 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_value_copy_exception ); + } } int test_main(int, char* []) diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 74c58c823..a41e6587f 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -244,6 +244,11 @@ struct throwing_value : value(v) {} + bool operator==(throwing_value const& v) const + { + return value == v.value; + } + throwing_value(throwing_value const& v) { throw_if_required(); From 0ce013bdba7ca9e9f40f0494781d8aa039aa1df3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 14 Nov 2012 14:37:09 +0000 Subject: [PATCH 156/366] mem leaks related exceptions in rtree copying fixed [SVN r81340] --- .../extensions/index/rtree/node/node.hpp | 38 +++ .../geometry/extensions/index/rtree/rtree.hpp | 227 +++++++++++------- .../extensions/index/rtree/visitors/copy.hpp | 20 +- test/rtree/rtree_exceptions.cpp | 31 +++ 4 files changed, 223 insertions(+), 93 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 24815bec6..f01cbce03 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -31,6 +31,8 @@ #include +#include + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -113,6 +115,42 @@ struct destroy_elements {} }; +// clears node, deletes all subtrees stored in node +template +struct clear_node +{ + typedef typename Options::parameters_type parameters_type; + + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + inline static void apply(node & node, Allocators & allocators) + { + rtree::visitors::is_leaf ilv; + rtree::apply_visitor(ilv, node); + if ( ilv.result ) + { + apply(rtree::get(node), allocators); + } + else + { + apply(rtree::get(node), allocators); + } + } + + inline static void apply(internal_node & internal_node, Allocators & allocators) + { + destroy_elements::apply(rtree::elements(internal_node), allocators); + rtree::elements(internal_node).clear(); + } + + inline static void apply(leaf & leaf, Allocators &) + { + rtree::elements(leaf).clear(); + } +}; + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 6fc686fd8..74161e51c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -96,6 +96,8 @@ public: /*! The constructor. + \note Exception-safety: strong + \param parameters The parameters object. \param translator The translator object. \param allocator The allocator object. @@ -114,6 +116,8 @@ public: /*! The constructor. + \note Exception-safety: strong + \param first The beginning of the range of Values. \param last The end of the range of Values. \param parameters The parameters object. @@ -130,60 +134,64 @@ public: , m_allocators(allocator) { this->create(); - this->insert(first, last); + + try + { + this->insert(first, last); + } + catch(...) + { + this->destroy(*this); + throw; + } } /*! The destructor. + + \note Exception-safety: strong */ inline ~rtree() { +// TODO: after moving assignment, rvalue will have root == 0 if ( m_root ) this->destroy(*this); } /*! The copy constructor. + + \note Exception-safety: strong */ inline rtree(rtree const& src) - : m_parameters(src.m_parameters) + : m_root(0) + , m_parameters(src.m_parameters) , m_translator(src.m_translator) , m_allocators(src.m_allocators) { //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() - try - { - this->copy(src, *this); - } - catch(...) - { - this->destroy(*this); - throw; - } + this->copy(src, *this, m_allocators); } /*! The copy constructor. + + \note Exception-safety: strong */ inline rtree(rtree const& src, Allocator const& allocator) - : m_parameters(src.m_parameters) + : m_root(0) + , m_parameters(src.m_parameters) , m_translator(src.m_translator) , m_allocators(allocator) { - try - { - this->copy(src, *this); - } - catch(...) - { - this->destroy(*this); - throw; - } + this->copy(src, *this, m_allocators); } /*! The moving constructor. + + \note Exception-safety: strong */ inline rtree(BOOST_RV_REF(rtree) src) : m_values_count(src.m_values_count) @@ -196,73 +204,60 @@ public: src.m_values_count = 0; src.m_root = 0; src.m_leafs_level = 0; +// TODO: after moving, rvalue will have root == 0 +// This would leave the tree unusable +// Write the test } /*! The assignment operator. + + \note Exception-safety: strong */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { if ( this == &src ) return *this; - if ( !this->empty() ) - this->destroy(*this); - - m_parameters = src.m_parameters; - m_translator = src.m_translator; //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - //m_allocators = src.m_allocators; - try - { - this->copy(src, *this); - } - catch(...) - { - this->destroy(*this); - throw; - } + this->copy(src, *this, m_allocators); return *this; } /*! The moving assignment. + + \note Exception-safety: strong */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { if ( this == &src ) return *this; - if ( !this->empty() ) - this->destroy(*this); - - m_parameters = src.m_parameters; - m_translator = src.m_translator; //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - //m_allocators = src.m_allocators; if ( m_allocators.allocator == src.m_allocators.allocator ) { + m_parameters = src.m_parameters; + m_translator = src.m_translator; + //m_allocators = src.m_allocators; + m_values_count = src.m_values_count; src.m_values_count = 0; m_root = src.m_root; src.m_root = 0; m_leafs_level = src.m_leafs_level; src.m_leafs_level = 0; + +// TODO: after moving, rvalue will have root == 0 +// This would leave the tree unusable +// Write the test } else { - try - { - this->copy(src, *this); - } - catch(...) - { - this->destroy(*this); - throw; - } + this->copy(src, *this, m_allocators); } return *this; @@ -271,6 +266,8 @@ public: /*! Insert a value to the index. + \note Exception-safety: basic + \param value The value which will be stored in the container. */ inline void insert(value_type const& value) @@ -279,23 +276,26 @@ public: detail::rtree::visitors::insert< value_type, - value_type, - options_type, - translator_type, - box_type, - allocators_type, + value_type, options_type, translator_type, box_type, allocators_type, typename options_type::insert_tag > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); detail::rtree::apply_visitor(insert_v, *m_root); - // If exception is thrown, m_values_count is invalid +// TODO +// Think about this: If exception is thrown, may the root be removed? +// Or it is just cleared? + +// TODO +// If exception is thrown, m_values_count may be invalid ++m_values_count; } /*! Insert a range of values to the index. + \note Exception-safety: basic + \param first The beginning of the range of values. \param last The end of the range of values. */ @@ -309,6 +309,8 @@ public: /*! Remove the value from the container. + \note Exception-safety: basic + \param value The value which will be removed from the container. */ inline void remove(value_type const& value) @@ -317,30 +319,26 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there are no elements in the rtree"); - try - { - detail::rtree::visitors::remove< - value_type, - options_type, - translator_type, - box_type, - allocators_type - > remove_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + detail::rtree::visitors::remove< + value_type, options_type, translator_type, box_type, allocators_type + > remove_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); - detail::rtree::apply_visitor(remove_v, *m_root); + detail::rtree::apply_visitor(remove_v, *m_root); - --m_values_count; - } - catch(...) - { - this->destroy(*this); - throw; - } +// TODO +// Think about this: If exception is thrown, may the root be removed? +// Or it is just cleared? + +// TODO +// If exception is thrown, m_values_count may be invalid + --m_values_count; } /*! Remove the range of values from the container. + \note Exception-safety: basic + \param first The beginning of the range of values. \param last The end of the range of values. */ @@ -354,6 +352,8 @@ public: /*! Find values meeting spatial predicates, e.g. intersecting some box. + \note Exception-safety: strong + \param pred The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), @@ -381,6 +381,8 @@ public: /*! Find one value meeting distances predicates, e.g. nearest to some point. + \note Exception-safety: strong + \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), @@ -405,6 +407,8 @@ public: Find one value meeting distances predicates and spatial predicates, e.g. nearest to some point and intersecting some box. + \note Exception-safety: strong + \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), @@ -434,6 +438,8 @@ public: /*! Find k values meeting distances predicates, e.g. k nearest values to some point. + \note Exception-safety: strong + \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), @@ -458,6 +464,8 @@ public: Find k values meeting distances predicates and spatial predicates, e.g. k nearest values to some point and intersecting some box. + \note Exception-safety: strong + \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), @@ -488,6 +496,8 @@ public: /*! Returns the number of stored values. + \note Exception-safety: nothrow + \return The number of stored values. */ inline size_type size() const @@ -498,6 +508,8 @@ public: /*! Query if the container is empty. + \note Exception-safety: nothrow + \return true if the container is empty. */ inline bool empty() const @@ -507,17 +519,20 @@ public: /*! Removes all values stored in the container. + + \note Exception-safety: nothrow. */ inline void clear() { - this->destroy(*this); - this->create(); + this->destroy(*this, false); } /*! Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned. + \note Exception-safety: nothrow. + \return The box containing all values stored in the container or an invalid box if there are no values in the container. */ @@ -541,6 +556,8 @@ public: /*! Returns allocator used by the rtree. + \note Exception-safety: nothrow if allocator copy can't throw. + \return The allocator. */ allocator_type get_allocator() const @@ -553,6 +570,8 @@ public: This function is not a part of the 'official' interface. However it makes possible to e.g. draw the tree structure. + \note Exception-safety: the same as visitor. + \param visitor The visitor object. */ template @@ -565,6 +584,8 @@ public: Returns the translator object. This function is not a part of the 'official' interface. + \note Exception-safety: nothrow. + \return The translator object. */ inline translator_type const& translator() const @@ -574,7 +595,9 @@ public: /*! Returns the number of stored objects. Same as size() - This function is not a part of the 'official' interface. + This function is not a part of the 'official' interface. + + \note Exception-safety: nothrow. \return The number of stored objects. */ @@ -585,7 +608,9 @@ public: /*! Returns the depth of the R-tree. - This function is not a part of the 'official' interface. + This function is not a part of the 'official' interface. + + \note Exception-safety: nothrow. \return The depth of the R-tree. */ @@ -597,12 +622,14 @@ public: private: /*! Create an empty R-tree i.e. new empty root node and clear other attributes. + + \note Exception-safety: strong. */ inline void create() { - assert(0 == m_root); + BOOST_GEOMETRY_INDEX_ASSERT(0 == m_root, "the tree is already created"); - m_root = detail::rtree::create_node::apply(m_allocators); + m_root = detail::rtree::create_node::apply(m_allocators); // MAY THROW (N: alloc) m_values_count = 0; m_leafs_level = 0; } @@ -610,12 +637,23 @@ private: /*! Destroy the R-tree i.e. all nodes and clear attributes. + \note Exception-safety: nothrow. + \param t The container which is going to be destroyed. */ - inline void destroy(rtree & t) + inline void destroy(rtree & t, bool destroy_root = true) { - detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); - detail::rtree::apply_visitor(del_v, *t.m_root); + BOOST_GEOMETRY_INDEX_ASSERT(t.m_root, "can't destroy empty tree"); + + if ( destroy_root ) + { + detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); + detail::rtree::apply_visitor(del_v, *t.m_root); + } + else + { + detail::rtree::clear_node::apply(*t.m_root, t.m_allocators); + } t.m_root = 0; t.m_values_count = 0; @@ -625,13 +663,26 @@ private: /*! Copy the R-tree i.e. whole nodes structure, values and other attributes. + \note Exception-safety: strong. + \param src The source R-tree. \param dst The destination R-tree. */ - inline void copy(rtree const& src, rtree & dst) const + inline void copy(rtree const& src, rtree & dst, allocators_type & allocators) const { - detail::rtree::visitors::copy copy_v(dst.m_allocators); - detail::rtree::apply_visitor(copy_v, *src.m_root); + 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) + + if ( dst.m_root ) + { + detail::rtree::visitors::destroy del_v(dst.m_root, dst.m_allocators); + detail::rtree::apply_visitor(del_v, *dst.m_root); + dst.m_root = 0; + } + + dst.m_parameters = src.m_parameters; + dst.m_translator = src.m_translator; + dst.m_allocators = allocators; dst.m_root = copy_v.result; dst.m_values_count = src.m_values_count; @@ -640,6 +691,8 @@ private: /*! Find one value meeting distances and spatial predicates. + + \note Exception-safety: strong. */ template inline size_type nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -673,6 +726,8 @@ private: /*! Find k values meeting distances and spatial predicates. + + \note Exception-safety: strong. */ template inline size_type nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp index a2cda3647..484c99ec8 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -27,6 +27,8 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; + typedef rtree::node_auto_ptr node_auto_ptr; + explicit inline copy(Allocators & allocators) : result(0) , m_allocators(allocators) @@ -34,7 +36,8 @@ public: inline void operator()(internal_node & n) { - node * new_node = rtree::create_node::apply(m_allocators); + node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW (N: alloc) + node_auto_ptr new_node(raw_new_node, m_allocators); typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); @@ -46,16 +49,18 @@ public: { rtree::apply_visitor(*this, *it->second); - elements_dst.push_back( std::make_pair(it->first, result) ); + elements_dst.push_back( std::make_pair(it->first, result) ); // MAY THROW (E: alloc) } - result = new_node; + result = new_node.get(); + new_node.release(); } inline void operator()(leaf & l) { - node * new_node = rtree::create_node::apply(m_allocators); - + node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW (N: alloc) + node_auto_ptr new_node(raw_new_node, m_allocators); + typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(l); @@ -64,10 +69,11 @@ public: for (typename elements_type::iterator it = elements.begin(); it != elements.end(); ++it) { - elements_dst.push_back(*it); + elements_dst.push_back(*it); // MAY THROW (V: alloc, copy) } - result = new_node; + result = new_node.get(); + new_node.release(); } node * result; diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index de161045b..6ba313af7 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -54,6 +54,37 @@ void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_value_copy_exception ); } + + for ( size_t i = 0 ; i < 20 ; i += 2 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW( Tree tree2(tree), throwing_value_copy_exception ); + } + + for ( size_t i = 0 ; i < 20 ; i += 2 ) + { + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(10000); + + Tree tree(parameters); + Tree tree2(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls(i); + + BOOST_CHECK_THROW(tree2 = tree, throwing_value_copy_exception ); + } } int test_main(int, char* []) From 118ec2fbf67f7660470df9bed3587fc9240a5927 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 14 Nov 2012 17:12:23 +0000 Subject: [PATCH 157/366] Error related to the state of the rval after moving fixed. The root being NULL is valid state. Root is created lazily, if needed. This means that default constructor won't throw as well as moving operations. [SVN r81345] --- .../geometry/extensions/index/rtree/rtree.hpp | 167 ++++++++++-------- 1 file changed, 96 insertions(+), 71 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 74161e51c..355fae991 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -96,7 +96,7 @@ public: /*! The constructor. - \note Exception-safety: strong + \note Exception-safety: nothrow \param parameters The parameters object. \param translator The translator object. @@ -109,14 +109,12 @@ public: , m_parameters(parameters) , m_translator(translator) , m_allocators(allocator) - { - this->create(); - } + {} /*! The constructor. - \note Exception-safety: strong + \note Exception-safety: basic \param first The beginning of the range of Values. \param last The end of the range of Values. @@ -133,15 +131,13 @@ public: , m_translator(translator) , m_allocators(allocator) { - this->create(); - try { this->insert(first, last); } catch(...) { - this->destroy(*this); + this->raw_destroy(*this, true); throw; } } @@ -149,13 +145,11 @@ public: /*! The destructor. - \note Exception-safety: strong + \note Exception-safety: nothrow */ inline ~rtree() { -// TODO: after moving assignment, rvalue will have root == 0 - if ( m_root ) - this->destroy(*this); + this->raw_destroy(*this, true); } /*! @@ -171,7 +165,7 @@ public: { //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() - this->copy(src, *this, m_allocators); + this->raw_copy(src, *this, m_allocators); } /*! @@ -185,13 +179,13 @@ public: , m_translator(src.m_translator) , m_allocators(allocator) { - this->copy(src, *this, m_allocators); + this->raw_copy(src, *this, m_allocators); } /*! The moving constructor. - \note Exception-safety: strong + \note Exception-safety: nothrow */ inline rtree(BOOST_RV_REF(rtree) src) : m_values_count(src.m_values_count) @@ -204,9 +198,6 @@ public: src.m_values_count = 0; src.m_root = 0; src.m_leafs_level = 0; -// TODO: after moving, rvalue will have root == 0 -// This would leave the tree unusable -// Write the test } /*! @@ -221,7 +212,7 @@ public: //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - this->copy(src, *this, m_allocators); + this->raw_copy(src, *this, m_allocators); return *this; } @@ -229,7 +220,7 @@ public: /*! The moving assignment. - \note Exception-safety: strong + \note Exception-safety: nothrow (if allocators are equal), strong (if allocators aren't equal) */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -250,14 +241,10 @@ public: src.m_root = 0; m_leafs_level = src.m_leafs_level; src.m_leafs_level = 0; - -// TODO: after moving, rvalue will have root == 0 -// This would leave the tree unusable -// Write the test } else { - this->copy(src, *this, m_allocators); + this->raw_copy(src, *this, m_allocators); } return *this; @@ -272,23 +259,10 @@ public: */ inline void insert(value_type const& value) { - BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); + if ( !m_root ) + this->raw_create(); - detail::rtree::visitors::insert< - value_type, - value_type, options_type, translator_type, box_type, allocators_type, - typename options_type::insert_tag - > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); - - detail::rtree::apply_visitor(insert_v, *m_root); - -// TODO -// Think about this: If exception is thrown, may the root be removed? -// Or it is just cleared? - -// TODO -// If exception is thrown, m_values_count may be invalid - ++m_values_count; + this->raw_insert(value); } /*! @@ -302,8 +276,11 @@ public: template inline void insert(Iterator first, Iterator last) { + if ( !m_root ) + this->raw_create(); + for ( ; first != last ; ++first ) - this->insert(*first); + this->raw_insert(*first); } /*! @@ -315,23 +292,10 @@ public: */ inline void remove(value_type const& value) { - // TODO: awulkiew - assert for correct value (indexable) ? + if ( !m_root ) + return; - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there are no elements in the rtree"); - - detail::rtree::visitors::remove< - value_type, options_type, translator_type, box_type, allocators_type - > remove_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); - - detail::rtree::apply_visitor(remove_v, *m_root); - -// TODO -// Think about this: If exception is thrown, may the root be removed? -// Or it is just cleared? - -// TODO -// If exception is thrown, m_values_count may be invalid - --m_values_count; + this->raw_remove(value); } /*! @@ -345,8 +309,11 @@ public: template inline void remove(Iterator first, Iterator last) { + if ( !m_root ) + return; + for ( ; first != last ; ++first ) - this->remove(*first); + this->raw_remove(*first); } /*! @@ -400,7 +367,7 @@ public: template inline size_type nearest(DistancesPredicates const& dpred, value_type & v) const { - return nearest_one(dpred, detail::empty(), v); + return raw_nearest_one(dpred, detail::empty(), v); } /*! @@ -432,7 +399,7 @@ public: template inline size_type nearest(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { - return nearest_one(dpred, pred, v); + return raw_nearest_one(dpred, pred, v); } /*! @@ -457,7 +424,7 @@ public: template inline size_type nearest(DistancesPredicates const& dpred, size_t k, OutIter out_it) const { - return nearest_k(dpred, k, detail::empty(), out_it); + return raw_nearest_k(dpred, k, detail::empty(), out_it); } /*! @@ -490,7 +457,7 @@ public: template inline size_type nearest(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { - return nearest_k(dpred, k, pred, out_it); + return raw_nearest_k(dpred, k, pred, out_it); } /*! @@ -524,7 +491,7 @@ public: */ inline void clear() { - this->destroy(*this, false); + this->raw_destroy(*this, false); } /*! @@ -590,7 +557,7 @@ public: */ inline translator_type const& translator() const { - return m_translator; + return m_translator; } /*! @@ -620,12 +587,69 @@ public: } private: + /*! + Insert a value to the index. Root node must exist. + + \note Exception-safety: basic + + \param value The value which will be stored in the container. + */ + inline void raw_insert(value_type const& value) + { + BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); + BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); + + detail::rtree::visitors::insert< + value_type, + value_type, options_type, translator_type, box_type, allocators_type, + typename options_type::insert_tag + > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + + detail::rtree::apply_visitor(insert_v, *m_root); + +// TODO +// Think about this: If exception is thrown, may the root be removed? +// Or it is just cleared? + +// TODO +// If exception is thrown, m_values_count may be invalid + ++m_values_count; + } + + /*! + Remove the value from the container. + + \note Exception-safety: basic + + \param value The value which will be removed from the container. + */ + inline void raw_remove(value_type const& value) + { + // TODO: awulkiew - assert for correct value (indexable) ? + BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there are no elements in the rtree"); + + detail::rtree::visitors::remove< + value_type, options_type, translator_type, box_type, allocators_type + > remove_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + + detail::rtree::apply_visitor(remove_v, *m_root); + +// TODO +// Think about this: If exception is thrown, may the root be removed? +// Or it is just cleared? + +// TODO +// If exception is thrown, m_values_count may be invalid + --m_values_count; + } + /*! Create an empty R-tree i.e. new empty root node and clear other attributes. \note Exception-safety: strong. */ - inline void create() + inline void raw_create() { BOOST_GEOMETRY_INDEX_ASSERT(0 == m_root, "the tree is already created"); @@ -641,9 +665,10 @@ private: \param t The container which is going to be destroyed. */ - inline void destroy(rtree & t, bool destroy_root = true) + inline void raw_destroy(rtree & t, bool destroy_root = true) { - BOOST_GEOMETRY_INDEX_ASSERT(t.m_root, "can't destroy empty tree"); + if ( !t.m_root ) + return; if ( destroy_root ) { @@ -668,7 +693,7 @@ private: \param src The source R-tree. \param dst The destination R-tree. */ - inline void copy(rtree const& src, rtree & dst, allocators_type & allocators) const + inline void raw_copy(rtree const& src, rtree & dst, allocators_type & allocators) 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) @@ -695,7 +720,7 @@ private: \note Exception-safety: strong. */ template - inline size_type nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const + inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; @@ -730,7 +755,7 @@ private: \note Exception-safety: strong. */ template - inline size_type nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const + inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { typedef typename detail::point_relation::type point_relation; typedef typename detail::relation::value_type point_type; From 593ab6d9fbcd331892a5f380ebd1b216e23d45cf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 14 Nov 2012 21:59:37 +0000 Subject: [PATCH 158/366] Names changed query to spatial_query, nearest to nearest_query, query_filtered to adaptors::spatial_queried, nearest_filtered to adaptors::nearest_queried. [SVN r81349] --- doc/src/examples/rtree/quick_start.cpp | 8 +-- .../index/filters/nearest_filter.hpp | 37 +++++++---- .../extensions/index/filters/query_filter.hpp | 28 +++++---- .../extensions/index/rtree/filters.hpp | 16 +++-- .../extensions/index/rtree/rstar/insert.hpp | 2 +- .../geometry/extensions/index/rtree/rtree.hpp | 34 +++++----- .../extensions/index/rtree/visitors/query.hpp | 2 + test/rtree/test_rtree.hpp | 62 ++++++++++--------- 8 files changed, 109 insertions(+), 80 deletions(-) diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index 25523f8b4..99f9fdd39 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -42,15 +42,15 @@ int main(void) rtree.insert(std::make_pair(b, 0)); //] - //[rtree_quickstart_query + //[rtree_quickstart_spatial_query // find values intersecting a box std::vector result; - rtree.query(b, std::back_inserter(result)); + rtree.spatial_query(b, std::back_inserter(result)); //] - //[rtree_quickstart_nearest + //[rtree_quickstart_nearest_query // find 5 nearest values to a point - rtree.nearest(point(0, 0), 5, std::back_inserter(result)); + rtree.nearest_query(point(0, 0), 5, std::back_inserter(result)); //] return 0; diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp index 49afbb18a..8e1ecb1f1 100644 --- a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/nearest_filter.hpp @@ -13,19 +13,21 @@ namespace boost { namespace geometry { namespace index { +namespace adaptors { + template -class nearest_filter +class nearest_query_range { BOOST_MPL_ASSERT_MSG( (false), NOT_IMPLEMENTED_FOR_THIS_INDEX, - (nearest_filter)); + (nearest_query_range)); typedef int* iterator; typedef const int* const_iterator; template - inline nearest_filter( + inline nearest_query_range( Index const&, DistancesPredicates const&, size_t, @@ -44,9 +46,9 @@ namespace detail { // TODO: awulkiew - consider removing references from predicates template -struct nearest_filtered +struct nearest_query { - inline nearest_filtered( + inline nearest_query( DistancesPredicates const& dpred, size_t k, Predicates const& pred @@ -64,21 +66,34 @@ struct nearest_filtered } // namespace detail template -detail::nearest_filtered nearest_filtered( +detail::nearest_query +nearest_queried( DistancesPredicates const& dpred, size_t k, - Predicates const& pred = detail::empty()) + Predicates const& pred) { - return detail::nearest_filtered(dpred, k, pred); + return detail::nearest_query(dpred, k, pred); } +template +detail::nearest_query +nearest_queried( + DistancesPredicates const& dpred, + size_t k) +{ + return detail::nearest_query(dpred, k, index::detail::empty()); +} + +} // namespace adaptors + template -index::nearest_filter +index::adaptors::nearest_query_range operator|( Index const& si, - detail::nearest_filtered const& f) + index::adaptors::detail::nearest_query const& f) { - return index::nearest_filter(si, f.distances_predicates, f.count, f.predicates); + return index::adaptors::nearest_query_range( + si, f.distances_predicates, f.count, f.predicates); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/filters/query_filter.hpp b/include/boost/geometry/extensions/index/filters/query_filter.hpp index 025cfa069..4d30b4ea9 100644 --- a/include/boost/geometry/extensions/index/filters/query_filter.hpp +++ b/include/boost/geometry/extensions/index/filters/query_filter.hpp @@ -13,22 +13,23 @@ namespace boost { namespace geometry { namespace index { +namespace adaptors { + template -class query_filter +class spatial_query_range { BOOST_MPL_ASSERT_MSG( (false), NOT_IMPLEMENTED_FOR_THIS_INDEX, - (query_filter)); + (spatial_query_range)); typedef int* iterator; typedef const int* const_iterator; template - inline query_filter( + inline spatial_query_range( Index const&, - Predicates const& - ) + Predicates const&) {} inline iterator begin() { return 0; } @@ -42,9 +43,9 @@ namespace detail { // TODO: awulkiew - consider removing reference from predicates template -struct query_filtered +struct spatial_query { - inline explicit query_filtered(Predicates const& pred) + inline explicit spatial_query(Predicates const& pred) : predicates(pred) {} @@ -54,18 +55,21 @@ struct query_filtered } // namespace detail template -detail::query_filtered query_filtered(Predicates const& pred) +detail::spatial_query +spatial_queried(Predicates const& pred) { - return detail::query_filtered(pred); + return detail::spatial_query(pred); } +} // namespace adaptors + template -index::query_filter +index::adaptors::spatial_query_range operator|( Index const& si, - index::detail::query_filtered const& f) + index::adaptors::detail::spatial_query const& f) { - return index::query_filter(si, f.predicates); + return index::adaptors::spatial_query_range(si, f.predicates); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/filters.hpp index 6cda2401d..44f56dd2f 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/filters.hpp @@ -22,8 +22,10 @@ namespace boost { namespace geometry { namespace index { template class rtree; +namespace adaptors { + template -class query_filter< index::rtree > +class spatial_query_range< index::rtree > { public: typedef std::vector result_type; @@ -31,12 +33,12 @@ public: typedef typename result_type::const_iterator const_iterator; template - inline query_filter( + inline spatial_query_range( index::rtree const& rtree, Predicates const& pred ) { - rtree.query(pred, std::back_inserter(m_result)); + rtree.spatial_query(pred, std::back_inserter(m_result)); } inline iterator begin() { return m_result.begin(); } @@ -49,7 +51,7 @@ private: }; template -class nearest_filter< index::rtree > +class nearest_query_range< index::rtree > { public: typedef std::vector result_type; @@ -57,14 +59,14 @@ public: typedef typename result_type::const_iterator const_iterator; template - inline nearest_filter( + inline nearest_query_range( index::rtree const& rtree, DistancesPredicates const& dpred, size_t k, Predicates const& pred ) { - rtree.nearest(dpred, k, pred, std::back_inserter(m_result)); + rtree.nearest_query(dpred, k, pred, std::back_inserter(m_result)); } inline iterator begin() { return m_result.begin(); } @@ -76,6 +78,8 @@ private: result_type m_result; }; +} // namespace adaptors + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index faa08f01d..1368689f8 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -34,7 +34,7 @@ public: template static inline void apply(typename rtree::elements_type::type & result_elements, Node & n, - internal_node *parent, + internal_node *parent, size_t current_child_index, parameters_type const& parameters, Translator const& translator, diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 355fae991..0943f519c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -45,6 +45,8 @@ #include //#include +// TODO change the name to bounding_tree + namespace boost { namespace geometry { namespace index { /*! @@ -335,7 +337,7 @@ public: \return The number of values found. */ template - inline size_type query(Predicates const& pred, OutIter out_it) const + inline size_type spatial_query(Predicates const& pred, OutIter out_it) const { detail::rtree::visitors::query find_v(m_translator, pred, out_it); @@ -365,7 +367,7 @@ public: \return The number of values found. */ template - inline size_type nearest(DistancesPredicates const& dpred, value_type & v) const + inline size_type nearest_query(DistancesPredicates const& dpred, value_type & v) const { return raw_nearest_one(dpred, detail::empty(), v); } @@ -397,7 +399,7 @@ public: \return The number of values found. */ template - inline size_type nearest(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const + inline size_type nearest_query(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const { return raw_nearest_one(dpred, pred, v); } @@ -422,7 +424,7 @@ public: \return The number of values found. */ template - inline size_type nearest(DistancesPredicates const& dpred, size_t k, OutIter out_it) const + inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, OutIter out_it) const { return raw_nearest_k(dpred, k, detail::empty(), out_it); } @@ -455,7 +457,7 @@ public: \return The number of values found. */ template - inline size_type nearest(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const + inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const { return raw_nearest_k(dpred, k, pred, out_it); } @@ -853,9 +855,9 @@ Find values meeting spatial predicates. \return The number of found values. */ template -inline size_t query(rtree const& tree, Predicates const& pred, OutIter out_it) +inline size_t spatial_query(rtree const& tree, Predicates const& pred, OutIter out_it) { - return tree.query(pred, out_it); + return tree.spatial_query(pred, out_it); } /*! @@ -868,9 +870,9 @@ Find the value meeting distances predicates. \return The number of found values. */ template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Value & v) +inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, Value & v) { - return tree.nearest(dpred, v); + return tree.nearest_query(dpred, v); } /*! @@ -884,9 +886,9 @@ Find the value meeting distances and spatial predicates. \return The number of found values. */ template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v) +inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v) { - return tree.nearest(dpred, pred, v); + return tree.nearest_query(dpred, pred, v); } /*! @@ -900,9 +902,9 @@ Find k values meeting distances predicates. \return The number of found values. */ template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, OutIter out_it) +inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, size_t k, OutIter out_it) { - return tree.nearest(dpred, k, out_it); + return tree.nearest_query(dpred, k, out_it); } /*! @@ -917,9 +919,9 @@ Find k values meeting distances and spatial predicates. \return The number of found values. */ template -inline size_t nearest(rtree const& tree, DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) +inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) { - return tree.nearest(dpred, k, pred, out_it); + return tree.nearest_query(dpred, k, pred, out_it); } /*! diff --git a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp index b7aa9643d..689e525aa 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/query.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_QUERY_HPP +#include + #include namespace boost { namespace geometry { namespace index { diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 72b0a1c7d..7b68cfb31 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -253,24 +253,24 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran // spatial query template -void test_query(Rtree & rtree, Predicates const& pred, std::vector const& expected_output) +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) ); std::vector output; - size_t n = rtree.query(pred, std::back_inserter(output)); + size_t n = rtree.spatial_query(pred, std::back_inserter(output)); BOOST_CHECK( expected_output.size() == n ); test_compare_outputs(rtree, output, expected_output); std::vector output2; - size_t n2 = query(rtree, pred, std::back_inserter(output2)); + size_t n2 = spatial_query(rtree, pred, std::back_inserter(output2)); BOOST_CHECK( n == n2 ); test_exactly_the_same_outputs(rtree, output, output2); - test_exactly_the_same_outputs(rtree, output, rtree | bgi::query_filtered(pred)); + test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::spatial_queried(pred)); } // rtree specific queries tests @@ -284,11 +284,11 @@ void test_intersects_and_disjoint(bgi::rtree const& tree, std::vect if ( bg::intersects(tree.translator()(v), qbox) ) expected_output.push_back(v); - test_query(tree, qbox, expected_output); - test_query(tree, bgi::intersects(qbox), expected_output); - test_query(tree, !bgi::not_intersects(qbox), expected_output); - test_query(tree, !bgi::disjoint(qbox), expected_output); - test_query(tree, bgi::not_disjoint(qbox), expected_output); + test_spatial_query(tree, qbox, expected_output); + test_spatial_query(tree, bgi::intersects(qbox), expected_output); + test_spatial_query(tree, !bgi::not_intersects(qbox), expected_output); + test_spatial_query(tree, !bgi::disjoint(qbox), expected_output); + test_spatial_query(tree, bgi::not_disjoint(qbox), expected_output); } template @@ -300,7 +300,7 @@ void test_covered_by(bgi::rtree const& tree, std::vector con if ( bg::covered_by(tree.translator()(v), qbox) ) expected_output.push_back(v); - test_query(tree, bgi::covered_by(qbox), expected_output); + test_spatial_query(tree, bgi::covered_by(qbox), expected_output); } template @@ -315,7 +315,7 @@ struct test_overlap_impl if ( bg::overlaps(tree.translator()(v), qbox) ) expected_output.push_back(v); - test_query(tree, bgi::overlaps(qbox), expected_output); + test_spatial_query(tree, bgi::overlaps(qbox), expected_output); } }; @@ -357,7 +357,7 @@ void test_overlaps(bgi::rtree const& tree, std::vector const // if ( bg::touches(tree.translator()(v), qbox) ) // expected_output.push_back(v); // -// test_query(tree, bgi::touches(qbox), expected_output); +// test_spatial_query(tree, bgi::touches(qbox), expected_output); // } //}; // @@ -383,13 +383,13 @@ void test_within(bgi::rtree const& tree, std::vector const& if ( bg::within(tree.translator()(v), qbox) ) expected_output.push_back(v); - test_query(tree, bgi::within(qbox), expected_output); + test_spatial_query(tree, bgi::within(qbox), expected_output); } // rtree nearest queries template -void test_nearest(Rtree const& rtree, std::vector const& input, Point const& pt) +void test_nearest_query(Rtree const& rtree, std::vector const& input, Point const& pt) { // TODO: Nearest object may not be the same as found by the rtree if distances are equal // Should all objects with the same closest distance be picked? @@ -409,7 +409,7 @@ void test_nearest(Rtree const& rtree, std::vector const& input, Point con size_t n = ( (std::numeric_limits::max)() == smallest_d ) ? 0 : 1; Value output; - size_t n_res = rtree.nearest(pt, output); + size_t n_res = rtree.nearest_query(pt, output); BOOST_CHECK(n == n_res); if ( n == n_res && 0 < n ) @@ -451,7 +451,7 @@ struct TestNearestKTransform }; template -void test_nearest_k(Rtree const& rtree, std::vector const& input, Point const& pt, size_t k) +void test_nearest_query_k(Rtree const& rtree, std::vector const& input, Point const& pt, size_t k) { // TODO: Nearest object may not be the same as found by the rtree if distances are equal // All objects with the same closest distance should be picked @@ -485,7 +485,7 @@ void test_nearest_k(Rtree const& rtree, std::vector const& input, Point c // calculate output using rtree std::vector output; - rtree.nearest(pt, k, std::back_inserter(output)); + rtree.nearest_query(pt, k, std::back_inserter(output)); // check output bool are_sizes_ok = (expected_output.size() == output.size()); @@ -504,19 +504,21 @@ void test_nearest_k(Rtree const& rtree, std::vector const& input, Point c } } } + + test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::nearest_queried(pt, k)); } // rtree nearest not found template -void test_nearest_not_found(Rtree const& rtree, Point const& pt, CoordinateType max_distance_1, CoordinateType max_distance_k) +void test_nearest_query_not_found(Rtree const& rtree, Point const& pt, CoordinateType max_distance_1, CoordinateType max_distance_k) { typename Rtree::value_type output; - size_t n_res = rtree.nearest(bgi::max_bounded(pt, max_distance_1), output); + size_t n_res = rtree.nearest_query(bgi::max_bounded(pt, max_distance_1), output); BOOST_CHECK(0 == n_res); std::vector output_v; - n_res = rtree.nearest(bgi::max_bounded(pt, max_distance_k), 5, std::back_inserter(output_v)); + n_res = rtree.nearest_query(bgi::max_bounded(pt, max_distance_k), 5, std::back_inserter(output_v)); BOOST_CHECK(output_v.size() == n_res); BOOST_CHECK(n_res < 5); } @@ -531,7 +533,7 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q BOOST_CHECK(s); std::vector expected_output; - tree.query(qbox, std::back_inserter(expected_output)); + tree.spatial_query(qbox, std::back_inserter(expected_output)); // copy constructor bgi::rtree t1(tree); @@ -539,7 +541,7 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q BOOST_CHECK(tree.size() == t1.size()); std::vector output; - t1.query(qbox, std::back_inserter(output)); + t1.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); // copying assignment operator @@ -548,7 +550,7 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q BOOST_CHECK(tree.size() == t1.size()); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); // moving constructor @@ -558,7 +560,7 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q BOOST_CHECK(t1.size() == 0); output.clear(); - t2.query(qbox, std::back_inserter(output)); + t2.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t2, output, expected_output); // moving assignment operator @@ -568,7 +570,7 @@ void test_copy_assignment_move(bgi::rtree const& tree, Box const& q BOOST_CHECK(t2.size() == 0); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); } @@ -580,7 +582,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) size_t prev_size = tree.size(); std::vector output; - tree.query(qbox, std::back_inserter(output)); + tree.spatial_query(qbox, std::back_inserter(output)); BOOST_CHECK(0 < output.size()); @@ -589,7 +591,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) BOOST_CHECK(tree.size() == prev_size - output.size()); output.clear(); - tree.query(qbox, std::back_inserter(output)); + tree.spatial_query(qbox, std::back_inserter(output)); BOOST_CHECK(0 == output.size()); } @@ -619,9 +621,9 @@ void test_rtree_by_value(Parameters const& parameters) P pt; bg::centroid(qbox, pt); - test_nearest(tree, input, pt); - test_nearest_k(tree, input, pt, 10); - test_nearest_not_found(tree, generate_outside_point

    ::apply(), 1, 3); + test_nearest_query(tree, input, pt); + 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); From 6b456b1fc76775895b6472c81067f0b5d8797d34 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 14 Nov 2012 23:35:14 +0000 Subject: [PATCH 159/366] remove() don't return if there is no root, assertion check is done in raw_remove(). Docs updated. [SVN r81350] --- doc/html/geometry_index/r_tree.html | 18 +- .../r_tree/creation_and_modification.html | 225 +++++++++++++ .../r_tree/exception_safety.html | 297 ++++++++++++++++++ .../r_tree/nearest_neighbours_queries.html | 39 +-- .../r_tree/rtree_quickstart.html | 14 +- .../r_tree/spatial_queries.html | 28 +- doc/html/index.html | 6 +- doc/rtree.qbk | 5 +- doc/rtree/creation.qbk | 44 ++- doc/rtree/exception_safety.qbk | 40 +++ doc/rtree/{nearest.qbk => nearest_query.qbk} | 34 +- doc/rtree/quickstart.qbk | 6 +- doc/rtree/{query.qbk => spatial_query.qbk} | 22 +- .../geometry/extensions/index/rtree/rtree.hpp | 8 +- 14 files changed, 690 insertions(+), 96 deletions(-) create mode 100644 doc/html/geometry_index/r_tree/creation_and_modification.html create mode 100644 doc/html/geometry_index/r_tree/exception_safety.html create mode 100644 doc/rtree/exception_safety.qbk rename doc/rtree/{nearest.qbk => nearest_query.qbk} (65%) rename doc/rtree/{query.qbk => spatial_query.qbk} (82%) diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index a59abe3bf..610c173c3 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -29,15 +29,20 @@

    diff --git a/doc/html/geometry_index/r_tree/creation_and_modification.html b/doc/html/geometry_index/r_tree/creation_and_modification.html new file mode 100644 index 000000000..50c29f984 --- /dev/null +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -0,0 +1,225 @@ + + + +Creation and modification + + + + + + + + +
    + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + + +
    + +

    + R-tree has 4 parameters: +

    +
    rtree<Value, Parameters, Translator, Allocator>
    +
    +
      +
    • + Value - type of object which will be stored in the container. +
    • +
    • + Parameters - compile-time + parameters, e.g. inserting/splitting algorithm with min and max nodes' + elements numbers. +
    • +
    • + Translator - type of object translating Value objects to Indexable + objects (Point + or Box) + which R-tree can handle. +
    • +
    • + Allocator - the allocator. +
    • +
    +
    +
    + +

    + R-tree may store Values of any type as long the Translator + is passed as parameter. It knows how to interpret those Values + and extract an object understandable by the R-tree. Those objects are called + 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. +

    +
      +
    • + Indexable = Point + | Box +
    • +
    • + BasicValue = + Indexable | + std::pair<Indexable, T> | std::pair<T, Indexable> +
    • +
    • + Value = BasicValue + | BasicValue* | Iterator<BasicValue> + | SmartPtr<BasicValue> +
    • +
    +

    + Examples of Value types: +

    +
    geometry::model::point<...>
    +geometry::model::point_xy<...>
    +geometry::model::box<...>
    +std::pair<geometry::model::box<...>, size_t>
    +
    +
    +
    + +

    + Values may be inserted to the R-tree in many various ways. + Final internal structure of the R-tree depends on algorithms used in the + insertion process. The most important is nodes' splitting algorithm. Currently, + three well-known types of R-trees may be created. +

    +

    + Linear - classic R-tree using splitting algorithm of linear complexity +

    +
    index::rtree< Value, index::linear<32, 8> > rt;
    +
    +

    + Quadratic - classic R-tree using splitting algorithm of quadratic complexity +

    +
    index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +

    + R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions +

    +
    index::rtree< Value, index::rstar<32, 8> > rt;
    +
    +
    +
    + +

    + By default splitting algorithm parameters are passed to the R-tree in compile + time. To use run-time versions of the R-tree one may pass parameters defined + in index::runtime namespace. +

    +
    // linear
    +index::rtree<Value, index::runtime::linear> rt(index::runtime::linear(32, 8));
    +// quadratic
    +index::rtree<Value, index::runtime::quadratic> rt(index::runtime::quadratic(32, 8));
    +// rstar
    +index::rtree<Value, index::runtime::rstar> rt(index::runtime::rstar(32, 8));
    +
    +
    +
    + +

    + The R-tree is copyable and movable container. Move semantics is implemented + using Boost.Move library which also supports compilers not supporting rvalue + references. +

    +
    index::rtree< Value, index::quadratic<32, 8> > rt1;
    +// copy constructor
    +index::rtree< Value, index::quadratic<32, 8> > rt2;
    +// copy assignment
    +rt2 = r1;
    +// move constructor
    +index::rtree< Value, index::quadratic<32, 8> > rt3(boost::move(rt1));
    +// move assignment
    +rt3 = boost::move(rt2);
    +
    +
    +
    + +

    + Following code creates an R-tree using quadratic algorithm. +

    +
    using namespace boost::geometry;
    +typedef std::pair<Box, int> Value;
    +index::rtree< Value, index::quadratic<32, 8> > rt;
    +
    +

    + To insert or remove Value's by method calls one may use the following code. +

    +
    Value v = std::make_pair(Box(...), 0);
    +rt.insert(v);
    +rt.remove(v);
    +
    +

    + To insert or remove Value's by function calls one may use the following + code. +

    +
    Value v = std::make_pair(Box(...), 0);
    +index::insert(rt, v);
    +index::remove(rt, v);
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html new file mode 100644 index 000000000..0f98c1133 --- /dev/null +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -0,0 +1,297 @@ + + + +Exception safety + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHome +
    +
    + +

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

    +
      +
    • + Nonthrowing copy constructor of the CoordinateType + used in the Indexable, +
    • +
    • + Nonthrowing destructor of the Value. +
    • +
    +
    ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Operation +

    +
    +

    + exception-safety +

    +
    +

    + rtree() +

    +
    +

    + nothrow +

    +
    +

    + rtree(first, + last) +

    +
    +

    + strong +

    +
    +

    + ~rtree() +

    +
    +

    + nothrow +

    +
    +

    + rtree(rtree const&) +

    +
    +

    + strong +

    +
    +

    + operator=(rtree const&) +

    +
    +

    + strong +

    +
    +

    + rtree(rtree &&) +

    +
    +

    + nothrow +

    +
    +

    + operator=(rtree &&) +

    +
    +

    + nothrow or strong + [a] +

    +
    +

    + insert(Value) +

    +
    +

    + basic +

    +
    +

    + insert(first, + last) +

    +
    +

    + basic +

    +
    +

    + remove(Value) +

    +
    +

    + basic +

    +
    +

    + remove(first, + last) +

    +
    +

    + basic +

    +
    +

    + spatial_query(...) +

    +
    +

    + strong +

    +
    +

    + nearest_query(...) +

    +
    +

    + strong +

    +
    +

    + size() +

    +
    +

    + nothrow +

    +
    +

    + empty() +

    +
    +

    + nothrow +

    +
    +

    + clear() +

    +
    +

    + nothrow +

    +
    +

    + box() +

    +
    +

    + nothrow +

    +
    +

    + get_allocator() +

    +
    +

    + nothrow +

    +

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

    +
    + + + +
    +
    +
    +PrevUpHome +
    + + 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 edbd07a1b..6a2482203 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -7,6 +7,7 @@ + @@ -19,7 +20,7 @@

    -PrevUpHome +PrevUpHomeNext

    @@ -52,20 +53,20 @@

    std::vector<Value> returned_values;
     Point pt(...);
    -rt.nearest(pt, k, std::back_inserter(returned_values));
    +rt.nearest_query(pt, k, std::back_inserter(returned_values));
     

    Function call

    std::vector<Value> returned_values;
     Point pt(...);
    -index::nearest(rt, pt, k, std::back_inserter(returned_values));
    +index::nearest_query(rt, pt, k, std::back_inserter(returned_values));
     

    Use of operator |

    Point pt(...);
    -BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k))
    +BOOST_FOREACH(Value & v, rt | index::adaptors::nearest_queried(pt, k))
       ; // do something with v
     

    @@ -84,14 +85,14 @@

    Value returned_value;
     Point pt(...);
    -size_t n = rt.nearest(pt, returned_value);
    +size_t n = rt.nearest_query(pt, returned_value);
     

    Function call

    Value Value returned_value;
     Point pt(...);
    -size_t n = index::nearest(rt, pt, returned_value);
    +size_t n = index::nearest_query(rt, pt, returned_value);
     
    @@ -109,19 +110,19 @@ Point pt(...); /* default - without bounds */ -index::nearest(rt, pt, k, std::back_inserter(returned_values)); +index::nearest_query(rt, pt, k, std::back_inserter(returned_values)); /* same as default */ -index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); /* distance must be greater than or equal to 10 */ -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); /* distance must be lesser than or equal to 500 */ -index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); /* distance must be between 10 and 500 */ -index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values));

    Furthermore, it's possible to define if the closest, furthest or centroidal @@ -133,19 +134,19 @@ /* default - distance between Indexable's closest point and a query point must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); /* same as default - distance between Indexable's closest point and a query point must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's furthest point and a query point must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's centroid and a query point must be greater than 10 */ -index::nearest(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values)); +index::nearest_query(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values));

    @@ -163,11 +164,11 @@ must be greater than 10 */ Point pt(...); Box b(...); -size_t n1 = rt.nearest(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); +size_t n1 = rt.nearest_query(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); -size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); +size_t n2 = index::nearest_query(rt, pt, k, index::within(b), std::back_inserter(returned_values)); -BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b))) +BOOST_FOREACH(Value & v, rt | index::adaptors::nearest_queried(pt, k, index::covered_by(b))) ; // do something with v
    @@ -182,7 +183,7 @@ must be greater than 10 */

    -PrevUpHome +PrevUpHomeNext
    diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 01d21143e..34499d5f8 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext

    @@ -86,14 +86,14 @@

    - There are various types of queries that may be performed, they can be even - combined together in one call. For simplicity, default one is used. + 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.

    // find values intersecting a box
     std::vector<value> result;
    -rtree.query(b, std::back_inserter(result));
    +rtree.spatial_query(b, std::back_inserter(result));
     

    @@ -103,7 +103,7 @@

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

    @@ -126,7 +126,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index 479186902..0262793d6 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext

    @@ -46,20 +46,20 @@

    std::vector<Value> returned_values;
     Box box_region(...);
    -rt.query(box_region, std::back_inserter(returned_values));
    +rt.spatial_query(box_region, std::back_inserter(returned_values));
     

    Function call

    std::vector<Value> returned_values;
     Box box_region(...);
    -index::query(rt, box_region, std::back_inserter(returned_values));
    +index::spatial_query(rt, box_region, std::back_inserter(returned_values));
     

    Use of pipe operator generating a range

    Box box_region(...);
    -BOOST_FOREACH(Value & v, rt | index::query_filtered(box_region))
    +BOOST_FOREACH(Value & v, rt | index::adaptors::spatial_queried(box_region))
       ; // do something with v
     

    @@ -75,7 +75,7 @@ algorithms.

    rt.query(box, std::back_inserter(result)); // default case - intersects
    -rt.query(index::intersects(box), std::back_inserter(result)); // same as default
    +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));
    @@ -84,23 +84,21 @@
     

    All predicates may be negated, e.g.:

    -
    rt.query(index::not_intersects(box), std::back_inserter(result));
    -// or
    -rt.query(!index::intersects(box), std::back_inserter(result));
    +
    rt.spatial_query(!index::intersects(box), std::back_inserter(result));
     // the same as
    -rt.query(index::disjoint(box), std::back_inserter(result));
    +rt.spatial_query(index::disjoint(box), std::back_inserter(result));
     

    It's possible to use some number of predicates by passing std::pair<Pred1, Pred2>

    -
    rt.query(
    +
    rt.spatial_query(
       std::make_pair(index::intersects(box1), !index::within(box2))
       , std::back_inserter(result));
     

    or boost::tuple<Pred1, Pred2, Pred3, ...>

    -
    rt.query(
    +
    rt.spatial_query(
       boost::make_tuple(
         index::intersects(box1), !index::within(box2), index::overlaps(box3))
       , std::back_inserter(result));
    @@ -116,9 +114,9 @@
     
     // ...
     
    -rt.query(
    +rt.spatial_query(
       boost::make_pair(index::intersects(box), index::value(fun))
    -  , std::back_inserter(result));
    +, std::back_inserter(result));
     
    @@ -132,7 +130,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/index.html b/doc/html/index.html index dfa4be92f..431d6ce79 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -45,16 +45,18 @@
    Introduction
    Quick Start
    -
    R-tree creation
    +
    Creation + and modification
    Spatial queries
    Nearest neighbours queries
    +
    Exception safety
    - +

    Last revised: September 04, 2012 at 18:00:33 GMT

    Last revised: November 14, 2012 at 23:30:31 GMT


    diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 07b5274c1..4fe958312 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -13,7 +13,8 @@ [include rtree/introduction.qbk] [include rtree/quickstart.qbk] [include rtree/creation.qbk] -[include rtree/query.qbk] -[include rtree/nearest.qbk] +[include rtree/spatial_query.qbk] +[include rtree/nearest_query.qbk] +[include rtree/exception_safety.qbk] [endsect] diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 73d614090..c83f23de8 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -8,19 +8,19 @@ http://www.boost.org/LICENSE_1_0.txt) =============================================================================/] -[section R-tree creation] +[section Creation and modification] -[section R-tree template parameters] +[section Template parameters] __rtree__ has 4 parameters: rtree -* `Value` - type of object which will be stored in the container. +* `__value__` - type of object which will be stored in the container. * `Parameters` - compile-time parameters, e.g. inserting/splitting algorithm with min and max nodes' elements numbers. -* `Translator` - type of object translating `Value` objects to - `Indexable` objects (`__point__` or `__box__`) which __rtree__ can handle. +* `__translator__` - type of object translating `Value` objects to + `__indexable__` objects (`__point__` or `__box__`) which __rtree__ can handle. * `Allocator` - the allocator. [endsect] @@ -68,6 +68,38 @@ R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions [endsect] +[section Inserting and splitting algorithms (run-time)] + +By default splitting algorithm parameters are passed to the __rtree__ in compile time. +To use run-time versions of the __rtree__ one may pass parameters defined in index::runtime +namespace. + + // linear + index::rtree<__value__, index::runtime::linear> rt(index::runtime::linear(32, 8)); + // quadratic + index::rtree<__value__, index::runtime::quadratic> rt(index::runtime::quadratic(32, 8)); + // rstar + index::rtree<__value__, index::runtime::rstar> rt(index::runtime::rstar(32, 8)); + +[endsect] + +[section Copying and moving] + +The __rtree__ is copyable and movable container. Move semantics is implemented using Boost.Move library +which also supports compilers not supporting rvalue references. + + index::rtree< __value__, index::quadratic<32, 8> > rt1; + // copy constructor + index::rtree< __value__, index::quadratic<32, 8> > rt2; + // copy assignment + rt2 = r1; + // move constructor + index::rtree< __value__, index::quadratic<32, 8> > rt3(boost::move(rt1)); + // move assignment + rt3 = boost::move(rt2); + +[endsect] + [section Inserting and removing Values] Following code creates an __rtree__ using quadratic algorithm. @@ -92,4 +124,4 @@ code. [endsect] -[endsect] [/ R-tree creation /] +[endsect] [/ Creation and modification /] diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk new file mode 100644 index 000000000..279eb9044 --- /dev/null +++ b/doc/rtree/exception_safety.qbk @@ -0,0 +1,40 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section Exception safety] + +In order to be exception-safe the __rtree__ requires: + +* Nonthrowing copy constructor of the `CoordinateType` used in the `__indexable__`, +* Nonthrowing destructor of the `__value__`. + +[table +[[Operation] [exception-safety]] +[[`rtree()`] [ /nothrow/ ]] +[[`rtree(first, last)`] [ *strong* ]] +[[`~rtree()`] [ /nothrow/ ]] +[[`rtree(rtree const&)`] [ *strong* ]] +[[`operator=(rtree const&)`] [ *strong* ]] +[[`rtree(rtree &&)`] [ /nothrow/ ]] +[[`operator=(rtree &&)`] [ /nothrow/ or *strong* [footnote /nothrow/ - if allocators are equal, *strong* - if allocators aren't equal ]]] +[[`insert(__value__)`] [ basic ]] +[[`insert(first, last)`] [ basic ]] +[[`remove(__value__)`] [ basic ]] +[[`remove(first, last)`] [ basic ]] +[[`spatial_query(...)`] [ *strong* ]] +[[`nearest_query(...)`] [ *strong* ]] +[[`size()`] [ /nothrow/ ]] +[[`empty()`] [ /nothrow/ ]] +[[`clear()`] [ /nothrow/ ]] +[[`box()`] [ /nothrow/ ]] +[[`get_allocator()`] [ /nothrow/ ]] +] + +[endsect] [/Exception safety/] diff --git a/doc/rtree/nearest.qbk b/doc/rtree/nearest_query.qbk similarity index 65% rename from doc/rtree/nearest.qbk rename to doc/rtree/nearest_query.qbk index 8b157b1de..d5eb85748 100644 --- a/doc/rtree/nearest.qbk +++ b/doc/rtree/nearest_query.qbk @@ -20,18 +20,18 @@ Method call std::vector<__value__> returned_values; __point__ pt(...); - rt.nearest(pt, k, std::back_inserter(returned_values)); + rt.nearest_query(pt, k, std::back_inserter(returned_values)); Function call std::vector<__value__> returned_values; __point__ pt(...); - index::nearest(rt, pt, k, std::back_inserter(returned_values)); + index::nearest_query(rt, pt, k, std::back_inserter(returned_values)); Use of `operator |` __point__ pt(...); - BOOST_FOREACH(__value__ & v, rt | index::nearest_filtered(pt, k)) + BOOST_FOREACH(__value__ & v, rt | index::adaptors::nearest_queried(pt, k)) ; // do something with v [endsect] @@ -46,13 +46,13 @@ Method call __value__ returned_value; __point__ pt(...); - size_t n = rt.nearest(pt, returned_value); + size_t n = rt.nearest_query(pt, returned_value); Function call __value__ Value returned_value; __point__ pt(...); - size_t n = index::nearest(rt, pt, returned_value); + size_t n = index::nearest_query(rt, pt, returned_value); [endsect] @@ -66,19 +66,19 @@ may be defined as follows. __point__ pt(...); /* default - without bounds */ - index::nearest(rt, pt, k, std::back_inserter(returned_values)); + index::nearest_query(rt, pt, k, std::back_inserter(returned_values)); /* same as default */ - index::nearest(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); /* distance must be greater than or equal to 10 */ - index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); /* distance must be lesser than or equal to 500 */ - index::nearest(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); /* distance must be between 10 and 500 */ - index::nearest(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); Furthermore, it's possible to define if the closest, furthest or centroidal point of the non-point `__indexable__` should be taken into account in the routine calculating distance. @@ -88,19 +88,19 @@ non-point `__indexable__` should be taken into account in the routine calculatin /* default - distance between Indexable's closest point and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); /* same as default - distance between Indexable's closest point and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's furthest point and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); /* distance between Indexable's centroid and a query point must be greater than 10 */ - index::nearest(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values)); + index::nearest_query(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values)); [endsect] @@ -114,11 +114,11 @@ It is possible to use spatial predicates described before in nearest neighbours __point__ pt(...); __box__ b(...); - size_t n1 = rt.nearest(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); + size_t n1 = rt.nearest_query(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); - size_t n2 = index::nearest(rt, pt, k, index::within(b), std::back_inserter(returned_values)); + size_t n2 = index::nearest_query(rt, pt, k, index::within(b), std::back_inserter(returned_values)); - BOOST_FOREACH(Value & v, rt | index::nearest_filtered(pt, k, index::covered_by(b))) + BOOST_FOREACH(Value & v, rt | index::adaptors::nearest_queried(pt, k, index::covered_by(b))) ; // do something with v [endsect] diff --git a/doc/rtree/quickstart.qbk b/doc/rtree/quickstart.qbk index 2bbb5dda2..822aa43d7 100644 --- a/doc/rtree/quickstart.qbk +++ b/doc/rtree/quickstart.qbk @@ -31,14 +31,14 @@ Inserting values into the R-tree may be done by calling insert() method. [rtree_quickstart_insert] -There are various types of queries that may be performed, they can be even combined together +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. -[rtree_quickstart_query] +[rtree_quickstart_spatial_query] Default k-nearest neighbors query may be performed as follows. -[rtree_quickstart_nearest] +[rtree_quickstart_nearest_query] [h3 More] More information about the R-tree implementation, other algorithms and queries may be found in diff --git a/doc/rtree/query.qbk b/doc/rtree/spatial_query.qbk similarity index 82% rename from doc/rtree/query.qbk rename to doc/rtree/spatial_query.qbk index 65d687f7f..dbd7cd55a 100644 --- a/doc/rtree/query.qbk +++ b/doc/rtree/spatial_query.qbk @@ -19,18 +19,18 @@ Method call std::vector<__value__> returned_values; __box__ box_region(...); - rt.query(box_region, std::back_inserter(returned_values)); + rt.spatial_query(box_region, std::back_inserter(returned_values)); Function call std::vector<__value__> returned_values; __box__ box_region(...); - index::query(rt, box_region, std::back_inserter(returned_values)); + index::spatial_query(rt, box_region, std::back_inserter(returned_values)); Use of pipe operator generating a range __box__ box_region(...); - BOOST_FOREACH(__value__ & v, rt | index::query_filtered(box_region)) + BOOST_FOREACH(__value__ & v, rt | index::adaptors::spatial_queried(box_region)) ; // do something with v [endsect] @@ -40,7 +40,7 @@ It is possible to define other relations between queried `__value__`s and region 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)); // same as default + 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)); @@ -48,21 +48,19 @@ of interest. Names of predicates corresponds to names of __boost_geometry__ algo All predicates may be negated, e.g.: - rt.query(index::not_intersects(box), std::back_inserter(result)); - // or - rt.query(!index::intersects(box), std::back_inserter(result)); + rt.spatial_query(!index::intersects(box), std::back_inserter(result)); // the same as - rt.query(index::disjoint(box), std::back_inserter(result)); + rt.spatial_query(index::disjoint(box), std::back_inserter(result)); It's possible to use some number of predicates by passing `std::pair` - rt.query( + rt.spatial_query( std::make_pair(index::intersects(box1), !index::within(box2)) , std::back_inserter(result)); or `boost::tuple` - rt.query( + rt.spatial_query( boost::make_tuple( index::intersects(box1), !index::within(box2), index::overlaps(box3)) , std::back_inserter(result)); @@ -77,9 +75,9 @@ which checks if `__value__` should be returned by the query. // ... - rt.query( + rt.spatial_query( boost::make_pair(index::intersects(box), index::value(fun)) - , std::back_inserter(result)); + , std::back_inserter(result)); [endsect] diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 0943f519c..d216cdade 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -116,7 +116,7 @@ public: /*! The constructor. - \note Exception-safety: basic + \note Exception-safety: strong \param first The beginning of the range of Values. \param last The end of the range of Values. @@ -294,9 +294,6 @@ public: */ inline void remove(value_type const& value) { - if ( !m_root ) - return; - this->raw_remove(value); } @@ -311,9 +308,6 @@ public: template inline void remove(Iterator first, Iterator last) { - if ( !m_root ) - return; - for ( ; first != last ; ++first ) this->raw_remove(*first); } From 00c54279b4ae7e8dd404aa17b92487daca554244 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 14 Nov 2012 23:55:53 +0000 Subject: [PATCH 160/366] std::vector MS implementation memory leak workaround added. [SVN r81351] --- .../boost/geometry/extensions/index/rtree/rstar/insert.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 1368689f8..21be5b849 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -63,7 +63,9 @@ public: typename index::detail::rtree::container_from_elements_type< elements_type, std::pair - >::type sorted_elements(elements_count); // MAY THROW (V: alloc, copy, E: alloc) + >::type sorted_elements; + // If constructor is used instead of resize() MS implementation leaks here + sorted_elements.resize(elements_count); // MAY THROW (V: alloc, copy, E: alloc) for ( size_t i = 0 ; i < elements_count ; ++i ) { From ebb55d2ae90f90236f8f82723910980b54790cde Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 15 Nov 2012 00:52:13 +0000 Subject: [PATCH 161/366] names fixed in speed test. [SVN r81352] --- tests/additional_speed.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 7b2d338ff..15944c64a 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -97,7 +97,7 @@ int main() float x = coords[i].first; float y = coords[i].second; result.clear(); - t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.spatial_query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -117,7 +117,7 @@ int main() float x = coords[i].first + 100; float y = coords[i].second + 100; result.clear(); - temp += t.nearest(P(x, y), 5, std::back_inserter(result)); + temp += t.nearest_query(P(x, y), 5, std::back_inserter(result)); } std::cout << "time: " << tim.elapsed() << "s\n"; std::cout << "found: " << temp << "\n"; From 04cf9fbc3919faedc0dd73039222ff7541426542 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 15 Nov 2012 11:23:36 +0000 Subject: [PATCH 162/366] A cosmetic change in raw_destroy(). Some of the rtree member types and methods made private unless BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE is defined. [SVN r81355] --- .../geometry/extensions/index/rtree/rtree.hpp | 77 ++++++++++++------- .../index/rtree/visitors/are_boxes_ok.hpp | 7 +- .../index/rtree/visitors/are_levels_ok.hpp | 7 +- test/geometry_index_test_common.hpp | 1 + 4 files changed, 57 insertions(+), 35 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d216cdade..91015566b 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -80,21 +80,26 @@ class rtree public: typedef Value value_type; + typedef Parameters parameters_type; typedef Translator translator_type; + typedef Allocator allocator_type; + typedef typename allocator_type::size_type size_type; + typedef typename translator::indexable_type::type indexable_type; typedef typename index::default_box_type::type box_type; +#if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) +private: +#endif typedef typename detail::rtree::options_type::type options_type; typedef typename options_type::node_tag node_tag; - - typedef Allocator allocator_type; typedef detail::rtree::allocators allocators_type; - typedef typename allocators_type::size_type size_type; typedef typename detail::rtree::node::type node; typedef typename detail::rtree::internal_node::type internal_node; typedef typename detail::rtree::leaf::type leaf; +public: /*! The constructor. @@ -516,6 +521,30 @@ public: return children_box_v.result; } + /*! + Returns parameters. + + \note Exception-safety: nothrow. + + \return The parameters object. + */ + inline parameters_type const& parameters() const + { + return m_parameters; + } + + /*! + Returns the translator object. + + \note Exception-safety: nothrow. + + \return The translator object. + */ + inline translator_type const& translator() const + { + return m_translator; + } + /*! Returns allocator used by the rtree. @@ -528,10 +557,13 @@ public: return m_allocators.allocator; } +#if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) +private: +#endif /*! Apply a visitor to the nodes structure in order to perform some operator. This function is not a part of the 'official' interface. However it makes - possible to e.g. draw the tree structure. + possible e.g. to pass a visitor drawing the tree structure. \note Exception-safety: the same as visitor. @@ -543,19 +575,6 @@ public: detail::rtree::apply_visitor(visitor, *m_root); } - /*! - Returns the translator object. - This function is not a part of the 'official' interface. - - \note Exception-safety: nothrow. - - \return The translator object. - */ - inline translator_type const& translator() const - { - return m_translator; - } - /*! Returns the number of stored objects. Same as size() This function is not a part of the 'official' interface. @@ -663,20 +682,20 @@ private: */ inline void raw_destroy(rtree & t, bool destroy_root = true) { - if ( !t.m_root ) - return; - - if ( destroy_root ) + if ( t.m_root ) { - detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); - detail::rtree::apply_visitor(del_v, *t.m_root); - } - else - { - detail::rtree::clear_node::apply(*t.m_root, t.m_allocators); - } + if ( destroy_root ) + { + detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); + detail::rtree::apply_visitor(del_v, *t.m_root); + } + else + { + detail::rtree::clear_node::apply(*t.m_root, t.m_allocators); + } - t.m_root = 0; + t.m_root = 0; + } t.m_values_count = 0; t.m_leafs_level = 0; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 77fdb782a..9f8ac5dcc 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -117,11 +117,12 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_boxes_ok(rtree const& tree, +template +bool are_boxes_ok(rtree const& tree, bool exact_match = true) { - typedef rtree rt; + typedef rtree rt; + detail::rtree::visitors::are_boxes_ok< typename rt::value_type, typename rt::options_type, diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index eabbfaf02..e7999adc5 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -88,10 +88,11 @@ private: }}} // namespace detail::rtree::visitors -template -bool are_levels_ok(rtree const& tree) +template +bool are_levels_ok(rtree const& tree) { - typedef rtree rt; + typedef rtree rt; + detail::rtree::visitors::are_levels_ok< typename rt::value_type, typename rt::options_type, diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp index 0f21bdc20..35e623d86 100644 --- a/test/geometry_index_test_common.hpp +++ b/test/geometry_index_test_common.hpp @@ -11,6 +11,7 @@ #define GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP #include +#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE #include #include From ff1ccbdf2900f251f59bfaf101ae84261815714f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 16 Nov 2012 12:43:34 +0000 Subject: [PATCH 163/366] Translator copy ctor exception handled. Exception-safety docs moddified. [SVN r81365] --- 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 | 89 +++++++++++++++++-- .../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 | 16 +++- .../geometry/extensions/index/rtree/rtree.hpp | 75 +++++++++------- 11 files changed, 148 insertions(+), 56 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 0f98c1133..c0ec24646 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 copy constructor of the CoordinateType used in the Indexable, @@ -63,7 +63,8 @@

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

    + +

    rtree(rtree const&) @@ -117,6 +124,12 @@

    + +

    rtree(rtree &&) @@ -124,7 +137,8 @@

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

    nothrow or strong - [a] + [c]

    + +

    insert(Value) @@ -192,6 +212,12 @@

    + +

    spatial_query(...) @@ -216,6 +242,12 @@

    + +

    size() @@ -275,10 +307,51 @@

    +

    + parameters() +

    +
    +

    + nothrow +

    +
    +

    + translator() +

    +
    +

    + nothrow +

    +

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

    +

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

    +

    [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 +

    +
    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 0262793d6..065642608 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 431d6ce79..ae3cf7c80 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 14, 2012 at 23:30:31 GMT

    Last revised: November 16, 2012 at 12:39:01 GMT


    diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index 279eb9044..fe1f3b91a 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -17,24 +17,34 @@ In order to be exception-safe the __rtree__ requires: [table [[Operation] [exception-safety]] -[[`rtree()`] [ /nothrow/ ]] +[[`rtree()`] [ /nothrow (default)/ or *strong* +[footnote /nothrow/ - if `Translator` has nonthrowing copy constructor (default), *strong* - if `Translator` has throwing copy constructor]]] [[`rtree(first, last)`] [ *strong* ]] [[`~rtree()`] [ /nothrow/ ]] +[[][]] [[`rtree(rtree const&)`] [ *strong* ]] [[`operator=(rtree const&)`] [ *strong* ]] -[[`rtree(rtree &&)`] [ /nothrow/ ]] -[[`operator=(rtree &&)`] [ /nothrow/ or *strong* [footnote /nothrow/ - if allocators are equal, *strong* - if allocators aren't equal ]]] +[[][]] +[[`rtree(rtree &&)`] [ /nothrow (default)/ or *strong* +[footnote /nothrow/ - if `Translator` has nonthrowing copy constructor (default), *strong* - if `Translator` has throwing copy constructor]]] +[[`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]]] +[[][]] [[`insert(__value__)`] [ basic ]] [[`insert(first, last)`] [ basic ]] [[`remove(__value__)`] [ basic ]] [[`remove(first, last)`] [ basic ]] +[[][]] [[`spatial_query(...)`] [ *strong* ]] [[`nearest_query(...)`] [ *strong* ]] +[[][]] [[`size()`] [ /nothrow/ ]] [[`empty()`] [ /nothrow/ ]] [[`clear()`] [ /nothrow/ ]] [[`box()`] [ /nothrow/ ]] [[`get_allocator()`] [ /nothrow/ ]] +[[`parameters()`] [ /nothrow/ ]] +[[`translator()`] [ /nothrow/ ]] ] [endsect] [/Exception safety/] diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 91015566b..b8a93e95c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -103,19 +103,20 @@ public: /*! The constructor. - \note Exception-safety: nothrow + \note Exception-safety: nothrow (if translator has nonthrowing copy ctor), + strong (if translator has throwing copy ctor) \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_values_count(0) - , m_root(0) - , m_leafs_level(0) + : m_translator(translator) // MAY THROW (copy) , m_parameters(parameters) - , m_translator(translator) , m_allocators(allocator) + , m_values_count(0) + , m_leafs_level(0) + , m_root(0) {} /*! @@ -131,12 +132,12 @@ public: */ template inline rtree(Iterator first, Iterator last, Parameters parameters = Parameters(), translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) - : m_values_count(0) - , m_root(0) - , m_leafs_level(0) + : m_translator(translator) // MAY THROW (copy) , m_parameters(parameters) - , m_translator(translator) , m_allocators(allocator) + , m_values_count(0) + , m_leafs_level(0) + , m_root(0) { try { @@ -165,10 +166,12 @@ public: \note Exception-safety: strong */ inline rtree(rtree const& src) - : m_root(0) + : m_translator(src.m_translator) // MAY THROW (copy) , m_parameters(src.m_parameters) - , m_translator(src.m_translator) , m_allocators(src.m_allocators) + , m_values_count(0) + , m_leafs_level(0) + , m_root(0) { //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() @@ -181,10 +184,12 @@ public: \note Exception-safety: strong */ inline rtree(rtree const& src, Allocator const& allocator) - : m_root(0) + : m_translator(src.m_translator) // MAY THROW (copy) , m_parameters(src.m_parameters) - , m_translator(src.m_translator) , m_allocators(allocator) + , m_values_count(0) + , m_leafs_level(0) + , m_root(0) { this->raw_copy(src, *this, m_allocators); } @@ -192,19 +197,20 @@ public: /*! The moving constructor. - \note Exception-safety: nothrow + \note Exception-safety: nothrow (if translator has nonthrowing copy ctor), + strong (if translator has throwing copy ctor) */ inline rtree(BOOST_RV_REF(rtree) src) - : m_values_count(src.m_values_count) - , m_root(src.m_root) - , m_leafs_level(src.m_leafs_level) + : m_translator(src.m_translator) // MAY THROW (copy) , m_parameters(src.m_parameters) - , m_translator(src.m_translator) , m_allocators(src.m_allocators) + , m_values_count(src.m_values_count) + , m_leafs_level(src.m_leafs_level) + , m_root(src.m_root) { src.m_values_count = 0; - src.m_root = 0; src.m_leafs_level = 0; + src.m_root = 0; } /*! @@ -227,7 +233,8 @@ public: /*! The moving assignment. - \note Exception-safety: nothrow (if allocators are equal), strong (if allocators aren't equal) + \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) */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -238,16 +245,17 @@ public: if ( m_allocators.allocator == src.m_allocators.allocator ) { + m_translator = src.m_translator; // MAY THROW (copy) m_parameters = src.m_parameters; - m_translator = src.m_translator; //m_allocators = src.m_allocators; m_values_count = src.m_values_count; - src.m_values_count = 0; - m_root = src.m_root; - src.m_root = 0; m_leafs_level = src.m_leafs_level; + m_root = src.m_root; + + src.m_values_count = 0; src.m_leafs_level = 0; + src.m_root = 0; } else { @@ -548,7 +556,7 @@ public: /*! Returns allocator used by the rtree. - \note Exception-safety: nothrow if allocator copy can't throw. + \note Exception-safety: nothrow \return The allocator. */ @@ -565,7 +573,7 @@ private: This function is not a part of the 'official' interface. However it makes possible e.g. to pass a visitor drawing the tree structure. - \note Exception-safety: the same as visitor. + \note Exception-safety: the same as Visitor::operator(). \param visitor The visitor object. */ @@ -579,7 +587,7 @@ private: Returns the number of stored objects. Same as size() This function is not a part of the 'official' interface. - \note Exception-safety: nothrow. + \note Exception-safety: nothrow \return The number of stored objects. */ @@ -720,8 +728,9 @@ private: dst.m_root = 0; } - dst.m_parameters = src.m_parameters; dst.m_translator = src.m_translator; + + dst.m_parameters = src.m_parameters; dst.m_allocators = allocators; dst.m_root = copy_v.result; @@ -799,13 +808,13 @@ private: return result.get(out_it); } - size_type m_values_count; - node *m_root; - size_type m_leafs_level; - - Parameters m_parameters; translator_type m_translator; + Parameters m_parameters; allocators_type m_allocators; + + size_type m_values_count; + size_type m_leafs_level; + node * m_root; }; /*! From e2beb3cf2f19e0836b7aed686cbf500c53e48f5f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 20 Nov 2012 13:45:48 +0000 Subject: [PATCH 164/366] Safety issue fixed in pushable_array. Filenames related to filters(old name) changed to adaptors. [SVN r81436] --- .../nearest_query.hpp} | 8 ++++---- .../query_filter.hpp => adaptors/spatial_query.hpp} | 8 ++++---- .../geometry/extensions/index/pushable_array.hpp | 3 ++- .../index/rtree/{filters.hpp => adaptors.hpp} | 12 ++++++------ .../boost/geometry/extensions/index/rtree/rtree.hpp | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) rename include/boost/geometry/extensions/index/{filters/nearest_filter.hpp => adaptors/nearest_query.hpp} (91%) rename include/boost/geometry/extensions/index/{filters/query_filter.hpp => adaptors/spatial_query.hpp} (88%) rename include/boost/geometry/extensions/index/rtree/{filters.hpp => adaptors.hpp} (87%) diff --git a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp b/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp similarity index 91% rename from include/boost/geometry/extensions/index/filters/nearest_filter.hpp rename to include/boost/geometry/extensions/index/adaptors/nearest_query.hpp index 8e1ecb1f1..f9c6a046f 100644 --- a/include/boost/geometry/extensions/index/filters/nearest_filter.hpp +++ b/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// Nearest neighbour filter implementation +// Nearest neighbour query range adaptor // // 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_FILTERS_NEAREST_FILTER_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP namespace boost { namespace geometry { namespace index { @@ -98,4 +98,4 @@ operator|( }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_NEAREST_FILTER_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/filters/query_filter.hpp b/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp similarity index 88% rename from include/boost/geometry/extensions/index/filters/query_filter.hpp rename to include/boost/geometry/extensions/index/adaptors/spatial_query.hpp index 4d30b4ea9..8b9d12262 100644 --- a/include/boost/geometry/extensions/index/filters/query_filter.hpp +++ b/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// Query filter implementation +// Spatial query range adaptor // // 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_FILTERS_QUERY_FILTER_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_QUERY_FILTER_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP namespace boost { namespace geometry { namespace index { @@ -74,4 +74,4 @@ operator|( }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_FILTERS_QUERY_FILTER_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index 68b69dd00..14570afdf 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -151,7 +151,8 @@ public: inline void push_back(Element const& v) { BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container"); - m_array[m_size++] = v; + m_array[m_size] = v; + ++m_size; } inline void pop_back() diff --git a/include/boost/geometry/extensions/index/rtree/filters.hpp b/include/boost/geometry/extensions/index/rtree/adaptors.hpp similarity index 87% rename from include/boost/geometry/extensions/index/rtree/filters.hpp rename to include/boost/geometry/extensions/index/rtree/adaptors.hpp index 44f56dd2f..85b14d670 100644 --- a/include/boost/geometry/extensions/index/rtree/filters.hpp +++ b/include/boost/geometry/extensions/index/rtree/adaptors.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// R-tree queries filters implementation +// R-tree queries range adaptors // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // @@ -8,14 +8,14 @@ // 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_FILTERS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ADAPTORS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ADAPTORS_HPP #include #include -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -82,4 +82,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_FILTERS_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ADAPTORS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index b8a93e95c..8020cdaf5 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include From 7ed71e5324948bc79ea1e73ede06a2d46b275d06 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 20 Nov 2012 17:00:41 +0000 Subject: [PATCH 165/366] Fixed memleak for CoordinateType/BoundingObject which have throwing copy constructor for R*tree. Added comments regarding exception-safety. [SVN r81438] --- .../extensions/index/nonassignable.hpp | 2 +- .../extensions/index/pushable_array.hpp | 2 + .../rtree/linear/redistribute_elements.hpp | 16 +++---- .../rtree/quadratic/redistribute_elements.hpp | 24 +++++----- .../rtree/rstar/redistribute_elements.hpp | 44 ++++++++++--------- .../index/rtree/visitors/insert.hpp | 42 +++++++++--------- 6 files changed, 68 insertions(+), 62 deletions(-) diff --git a/include/boost/geometry/extensions/index/nonassignable.hpp b/include/boost/geometry/extensions/index/nonassignable.hpp index c6ee9ebeb..810cfd111 100644 --- a/include/boost/geometry/extensions/index/nonassignable.hpp +++ b/include/boost/geometry/extensions/index/nonassignable.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// Spatial query predicates +// Nonassignable base class. // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index 14570afdf..d01a82b81 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -133,6 +133,8 @@ public: m_size = 0; } + // IMPORTANT! + // The sequence of elements is NOT preserved inline void erase(iterator it) { BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 6f4b237a8..910b77a39 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -224,7 +224,7 @@ struct redistribute_elements::apply(elements_copy, allocators); //elements_copy.clear(); - throw; // RETHROW + throw; // RETHROW, BASIC } } }; diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index b41ca6c61..97e5917ef 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -109,8 +109,8 @@ struct redistribute_elements::apply(elements_backup, allocators); //elements_backup.clear(); - throw; // RETHROW + throw; // RETHROW, BASIC } } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 469f1c702..7a81aa9f7 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -68,11 +68,11 @@ struct choose_split_axis_and_index_for_corner BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == parameters.get_max_elements() + 1, "wrong number of elements"); // copy elements - Elements elements_copy(elements); // MAY THROW + Elements elements_copy(elements); // MAY THROW, STRONG (alloc, copy) // sort elements element_axis_corner_less elements_less(translator); - std::sort(elements_copy.begin(), elements_copy.end(), elements_less); // MAY THROW + std::sort(elements_copy.begin(), elements_copy.end(), elements_less); // MAY THROW, BASIC (copy) // init outputs choosen_index = parameters.get_min_elements(); @@ -135,7 +135,7 @@ struct choose_split_axis_and_index_for_axis choose_split_axis_and_index_for_corner:: apply(elements, index1, som1, ovl1, con1, - parameters, translator); // MAY THROW + parameters, translator); // MAY THROW, STRONG size_t index2 = 0; margin_type som2 = 0; @@ -145,7 +145,7 @@ struct choose_split_axis_and_index_for_axis choose_split_axis_and_index_for_corner:: apply(elements, index2, som2, ovl2, con2, - parameters, translator); // MAY THROW + parameters, translator); // MAY THROW, STRONG sum_of_margins = som1 + som2; @@ -185,7 +185,7 @@ struct choose_split_axis_and_index_for_axis:: apply(elements, choosen_index, sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); // MAY THROW + parameters, translator); // MAY THROW, STRONG choosen_corner = min_corner; } @@ -215,7 +215,7 @@ struct choose_split_axis_and_index choose_split_axis_and_index:: apply(elements, choosen_axis, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); // MAY THROW + parameters, translator); // MAY THROW, STRONG margin_type sum_of_margins = 0; @@ -230,7 +230,7 @@ struct choose_split_axis_and_index Box, Dimension - 1, typename index::traits::tag::type - >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); // MAY THROW + >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); // MAY THROW, STRONG if ( sum_of_margins < smallest_sum_of_margins ) { @@ -284,7 +284,7 @@ struct partial_sort { if ( axis < Dimension - 1 ) { - partial_sort::apply(elements, axis, index, tr); // MAY THROW + partial_sort::apply(elements, axis, index, tr); // MAY THROW, BASIC (copy) } else { @@ -292,7 +292,7 @@ struct partial_sort typedef typename Elements::value_type element_type; element_axis_corner_less less(tr); - std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW, BASIC (copy) } } }; @@ -307,7 +307,7 @@ struct partial_sort typedef typename Elements::value_type element_type; element_axis_corner_less less(tr); - std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW + std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less); // MAY THROW, BASIC (copy) } }; @@ -356,7 +356,7 @@ struct redistribute_elements::apply(elements1, split_axis, split_corner, split_index, smallest_sum_of_margins, smallest_overlap, smallest_content, - parameters, translator); // MAY THROW + parameters, translator); // MAY THROW, STRONG // TODO: awulkiew - get rid of following static_casts? @@ -365,23 +365,24 @@ struct redistribute_elements(min_corner) ) rstar::partial_sort - ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW + ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW, BASIC (copy) else rstar::partial_sort - ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW + ::apply(elements_copy, split_axis, split_index, translator); // MAY THROW, BASIC (copy) try { // copy elements to nodes - elements1.resize(split_index); // MIGHT THROW - std::copy(elements_copy.begin(), elements_copy.begin() + split_index, elements1.begin()); // MAY THROW - elements2.resize(parameters.get_max_elements() + 1 - split_index); // MAY THROW - std::copy(elements_copy.begin() + split_index, elements_copy.end(), elements2.begin()); // MAY THROW + elements1.resize(split_index); // SHOULDN'T THROW + std::copy(elements_copy.begin(), elements_copy.begin() + split_index, elements1.begin()); // MAY THROW, BASIC + elements2.resize(parameters.get_max_elements() + 1 - split_index); // MAY THROW, STRONG + std::copy(elements_copy.begin() + split_index, elements_copy.end(), elements2.begin()); // MAY THROW, BASIC // calculate boxes box1 = rtree::elements_box(elements1.begin(), elements1.end(), translator); @@ -389,13 +390,14 @@ struct redistribute_elements::apply(elements_copy, allocators); - //elements_copy.clear(); + rtree::destroy_elements::apply(elements_backup, allocators); + //elements_backup.clear(); - throw; // RETHROW + throw; // RETHROW, BASIC } } }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 9def4668a..36e051535 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -157,7 +157,7 @@ public: Box, Allocators, typename Options::redistribute_tag - >::apply(n, n2, n_box, box2, parameters, translator, allocators); // MAY THROW (V: alloc, copy, E: alloc) + >::apply(n, n2, n_box, box2, parameters, translator, allocators); // MAY THROW (V, E: alloc, copy, copy) // check numbers of elements BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= rtree::elements(n).size() && @@ -168,7 +168,7 @@ public: "unexpected number of elements"); // return the list of newly created nodes (this algorithm returns one) - additional_nodes.push_back(std::make_pair(box2, second_node.get())); // MAY THROW + additional_nodes.push_back(std::make_pair(box2, second_node.get())); // MAY THROW (alloc, copy) // release the ptr second_node.release(); @@ -269,7 +269,7 @@ protected: rtree::element_indexable(m_element, m_translator)); // next traversing step - traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) + traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) } // TODO: awulkiew - change post_traverse name to handle_overflow or overflow_treatment? @@ -284,7 +284,7 @@ protected: // handle overflow if ( m_parameters.get_max_elements() < rtree::elements(n).size() ) { - split(n); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) + split(n); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) } } @@ -298,7 +298,7 @@ protected: m_traverse_data.move_to_next_level(&n, choosen_node_index); // next traversing step - rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) + rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) // restore previous traverse inputs m_traverse_data = backup_traverse_data; @@ -314,11 +314,12 @@ protected: typename split_algo::nodes_container_type additional_nodes; Box n_box; - split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW (V: alloc, copy, E: alloc, N:alloc) + split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); // TODO add all additional nodes + // For kmeans algorithm: // elements number may be greater than node max elements count // split and reinsert must take node with some elements count // and container of additional elements (std::pairs or Values) @@ -336,7 +337,7 @@ protected: // update old node's box m_traverse_data.current_element().first = n_box; // add new node to parent's children - m_traverse_data.parent_elements().push_back(additional_nodes[0]); // MAY THROW (V: alloc, copy, E: alloc) + m_traverse_data.parent_elements().push_back(additional_nodes[0]); // MAY THROW, STRONG (V, E: alloc, copy) } // node is the root - add level else @@ -344,15 +345,15 @@ protected: BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); // create new root and add nodes - node_auto_ptr new_root(rtree::create_node::apply(m_allocators), m_allocators); // MAY THROW (N:alloc) + node_auto_ptr new_root(rtree::create_node::apply(m_allocators), m_allocators); // MAY THROW, STRONG (N:alloc) try { - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); // MAY THROW (E:alloc) - rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); // MAY THROW (E:alloc) + rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); // MAY THROW, STRONG (E:alloc, copy) + rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); // MAY THROW, STRONG (E:alloc, copy) } catch (...) { // clear new root to not delete in the ~node_auto_ptr() potentially stored old root node rtree::elements(rtree::get(*new_root)).clear(); - throw; // RETHROW + throw; // RETHROW, BASIC } m_root_node = new_root.get(); @@ -421,7 +422,7 @@ public: if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step - base::traverse(*this, n); // MAY THROW (E: alloc, N: alloc) + base::traverse(*this, n); // MAY THROW, BASIC (E: alloc, copy, N: alloc) } else { @@ -430,19 +431,20 @@ public: try { // push new child node - rtree::elements(n).push_back(base::m_element); // MAY THROW (E: alloc) + rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (E: alloc, copy) } catch(...) { - // if the insert fails here, the element won't be stored in the tree + // if the insert fails above, the element won't be stored in the tree + rtree::visitors::destroy del_v(base::m_element.second, base::m_allocators); rtree::apply_visitor(del_v, *base::m_element.second); - throw; // RETHROW + throw; // RETHROW, BASIC } } - base::post_traverse(n); // MAY THROW (E: alloc, N: alloc) + base::post_traverse(n); // MAY THROW, BASIC (E: alloc, copy, N: alloc) } inline void operator()(leaf &) @@ -481,9 +483,9 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, "unexpected level"); // next traversing step - base::traverse(*this, n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + base::traverse(*this, n); // MAY THROW, BASIC (V, E: alloc, copy, N: alloc) - base::post_traverse(n); // MAY THROW (E: alloc, N: alloc) + base::post_traverse(n); // MAY THROW, BASIC (E: alloc, copy, N: alloc) } inline void operator()(leaf & n) @@ -492,9 +494,9 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level || base::m_level == (std::numeric_limits::max)(), "unexpected level"); - rtree::elements(n).push_back(base::m_element); // MAY THROW (V: alloc, copy) + rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (V: alloc, copy) - base::post_traverse(n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + base::post_traverse(n); // MAY THROW, BASIC (V: alloc, copy, N: alloc) } }; From 7bbf242891b6d917bf055e411e2aa87c46ccd54b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 20 Nov 2012 22:49:14 +0000 Subject: [PATCH 166/366] Improved exception safety of the r-tree. Requirement 'nonthrowing copy constructor of the BoundingObject/CoordinateType' changed to 'exception-safe copy constructor of the BoundingObject/CoordinateType'. From now the r-tree do not use erase() method of the elements containers. It uses copy_from_back() and pop_back() instead. erase() removed from pushable_array. Added various memory leaks fixes taking throwing by Element's copy constructor into account. Tests added. Docs modified. [SVN r81445] --- 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 | 26 +- .../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 | 3 +- .../extensions/index/pushable_array.hpp | 17 - .../extensions/index/rtree/node/node.hpp | 12 + .../rtree/quadratic/redistribute_elements.hpp | 15 +- .../extensions/index/rtree/rstar/insert.hpp | 97 +++--- .../extensions/index/rtree/visitors/copy.hpp | 15 +- .../index/rtree/visitors/insert.hpp | 26 +- .../index/rtree/visitors/remove.hpp | 50 ++- test/rtree/rtree_exceptions.cpp | 83 ++++- test/rtree/test_rtree.hpp | 18 +- test/rtree/test_rtree_exceptions.hpp | 125 ++----- test/rtree/test_throwing.hpp | 322 ++++++++++++++++++ tests/additional_speed.cpp | 4 +- 22 files changed, 610 insertions(+), 227 deletions(-) create mode 100644 test/rtree/test_throwing.hpp 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 09a46b6b3..50c29f984 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 c0ec24646..0d19fcbb5 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,14 +28,16 @@

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

            -
              -
            • - Nonthrowing copy constructor of the CoordinateType - used in the Indexable, -
            • +
              • Nonthrowing destructor of the Value.
              • +
              • + Exception-safe copy constructor of the Value. +
              • +
              • + Exception-safe copy constructor of the CoordinateType. +
              @@ -64,7 +66,7 @@ @@ -138,7 +140,7 @@ @@ -151,7 +153,7 @@ @@ -333,19 +335,19 @@

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

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

              nothrow or strong - [c] + [c]

              -

              [a] +

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

              -

              [b] +

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

              -

              [c] +

              [c] nothrow - if allocators are equal and Translator has nonthrowing copy constructor (default), strong - if allocators aren't equal or Translator diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 68a64d201..ec8a37d4a 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 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..34499d5f8 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 065642608..0262793d6 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 ae3cf7c80..6ffb17abf 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 16, 2012 at 12:39:01 GMT

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


              diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index fe1f3b91a..f98ec3c15 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -12,8 +12,9 @@ In order to be exception-safe the __rtree__ requires: -* Nonthrowing copy constructor of the `CoordinateType` used in the `__indexable__`, * Nonthrowing destructor of the `__value__`. +* Exception-safe copy constructor of the `__value__`. +* Exception-safe copy constructor of the `CoordinateType`. [table [[Operation] [exception-safety]] diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/pushable_array.hpp index d01a82b81..5e9aad018 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/pushable_array.hpp @@ -133,23 +133,6 @@ public: m_size = 0; } - // IMPORTANT! - // The sequence of elements is NOT preserved - inline void erase(iterator it) - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - BOOST_GEOMETRY_INDEX_ASSERT(begin() <= it && it < end(), "iterator points on the element outside the container"); - //std::copy(it + 1, end(), it); - // TODO: leave this code or use copy? - // code below may work differently than one might think about erase() - if ( it != (begin() + (m_size - 1)) ) - { - // NOTE: without this condition assignment may call memcpy with the same 2 addresses - *it = back(); - } - --m_size; - } - inline void push_back(Element const& v) { BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container"); diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index f01cbce03..0b87589fb 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -151,6 +151,18 @@ struct clear_node } }; +template +void copy_from_back(Container & container, Iterator it) +{ + BOOST_GEOMETRY_INDEX_ASSERT(!container.empty(), "cannot copy from empty container"); + Iterator back_it = container.end(); + --back_it; + if ( it != back_it ) + { + *it = *back_it; // MAY THROW (copy) + } +} + }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index 97e5917ef..d651777eb 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -139,13 +139,17 @@ struct redistribute_elements >::type sorted_elements; // If constructor is used instead of resize() MS implementation leaks here - sorted_elements.resize(elements_count); // MAY THROW (V: alloc, copy, E: alloc) + sorted_elements.resize(elements_count); // MAY THROW, STRONG (V, E: alloc, copy) for ( size_t i = 0 ; i < elements_count ; ++i ) { point_type element_center; geometry::centroid( rtree::element_indexable(elements[i], translator), element_center); sorted_elements[i].first = geometry::comparable_distance(node_center, element_center); - sorted_elements[i].second = elements[i]; // MAY THROW (V: copy) + sorted_elements[i].second = elements[i]; // MAY THROW (V, E: copy) } // sort elements by distances from center @@ -80,12 +80,12 @@ public: sorted_elements.begin(), sorted_elements.begin() + reinserted_elements_count, sorted_elements.end(), - distances_dsc); // MAY THROW (V: copy) + distances_dsc); // MAY THROW, BASIC (V, E: copy) // copy elements which will be reinserted - result_elements.resize(reinserted_elements_count); // MAY THROW (V: alloc, copy?, E: alloc) + result_elements.resize(reinserted_elements_count); // MAY THROW, STRONG (V, E: alloc, copy) for ( size_t i = 0 ; i < reinserted_elements_count ; ++i ) - result_elements[i] = sorted_elements[i].second; // MAY THROW (V: copy) + result_elements[i] = sorted_elements[i].second; // MAY THROW (V, E: copy) try { @@ -93,7 +93,7 @@ public: size_t elements_new_count = elements_count - reinserted_elements_count; elements.resize(elements_new_count); // SHOULDN'T THROW (new_size <= old size) for ( size_t i = 0 ; i < elements_new_count ; ++i ) - elements[i] = sorted_elements[i + reinserted_elements_count].second; // MAY THROW (V: copy) + elements[i] = sorted_elements[i + reinserted_elements_count].second; // MAY THROW (V, E: copy) } catch(...) { @@ -177,17 +177,17 @@ struct level_insert_base if ( !base::m_traverse_data.current_is_root() ) { // NOTE: exception-safety - // After an exception result_elements may contain garbage + // After an exception result_elements may contain garbage, don't use it rstar::remove_elements_to_reinsert::apply( result_elements, n, base::m_traverse_data.parent, base::m_traverse_data.current_child_index, - base::m_parameters, base::m_translator, base::m_allocators); // MAY THROW (V: alloc, copy, E: alloc) + base::m_parameters, base::m_translator, base::m_allocators); // MAY THROW, BASIC (V, E: alloc, copy) } // node is root node else { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(base::m_root_node), "node should be the root node"); - base::split(n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + base::split(n); // MAY THROW (V, E: alloc, copy, N: alloc) } } } @@ -198,7 +198,7 @@ struct level_insert_base // overflow if ( base::m_parameters.get_max_elements() < rtree::elements(n).size() ) { - base::split(n); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + base::split(n); // MAY THROW (V, E: alloc, copy, N: alloc) } } @@ -245,7 +245,7 @@ struct level_insert if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step - base::traverse(*this, n); // MAY THROW (E: alloc, N: alloc) + base::traverse(*this, n); // MAY THROW (E: alloc, copy, N: alloc) // further insert if ( 0 < InsertIndex ) @@ -254,7 +254,7 @@ struct level_insert if ( base::m_traverse_data.current_level == base::m_level - 1 ) { - base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, N: alloc) + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, copy, N: alloc) } } } @@ -262,31 +262,30 @@ struct level_insert { BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_traverse_data.current_level, "unexpected level"); + try + { + // push new child node + rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (E: alloc, copy) + } + catch(...) + { + // NOTE: exception-safety + // if the insert fails above, the element won't be stored in the tree, so delete it + + rtree::visitors::destroy del_v(base::m_element.second, base::m_allocators); + rtree::apply_visitor(del_v, *base::m_element.second); + + throw; // RETHROW + } + // first insert if ( 0 == InsertIndex ) { - try - { - // push new child node - rtree::elements(n).push_back(base::m_element); // MAY THROW (E: alloc) - } - catch(...) - { - // if the first insert fails here, the element won't be stored in the tree - rtree::visitors::destroy del_v(base::m_element.second, base::m_allocators); - rtree::apply_visitor(del_v, *base::m_element.second); - - throw; // RETHROW - } - - base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, N: alloc) + base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (E: alloc, copy, N: alloc) } // not the first insert else { - // push new child node - rtree::elements(n).push_back(base::m_element); // MAY THROW (E: alloc) - base::handle_possible_split(n); // MAY THROW (E: alloc, N: alloc) } } @@ -327,13 +326,13 @@ struct level_insert::max)(), "unexpected level"); - rtree::elements(n).push_back(base::m_element); // MAY THROW (V: alloc, copy) + rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (V: alloc, copy) base::handle_possible_split(n); // MAY THROW (V: alloc, copy, N: alloc) } @@ -395,7 +394,7 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> base::m_level == (std::numeric_limits::max)(), "unexpected level"); - rtree::elements(n).push_back(base::m_element); // MAY THROW (V: alloc, copy) + rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (V: alloc, copy) base::handle_possible_reinsert_or_split_of_root(n); // MAY THROW (V: alloc, copy, N: alloc) @@ -442,11 +441,11 @@ public: detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); - rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc) if ( !lins_v.result_elements.empty() ) { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V, E: alloc, copy, N: alloc) } } @@ -457,33 +456,43 @@ public: detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); - rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc) // we're in the root, so root should be split and there should be no elements to reinsert - assert(lins_v.result_elements.empty()); + BOOST_GEOMETRY_INDEX_ASSERT(lins_v.result_elements.empty(), "unexpected state"); } private: template - inline void recursive_reinsert(Elements const& elements, size_t relative_level) + inline void recursive_reinsert(Elements & elements, size_t relative_level) { typedef typename Elements::value_type element_type; // reinsert children starting from the minimum distance - for ( typename Elements::const_reverse_iterator it = elements.rbegin(); - it != elements.rend(); ++it) + typename Elements::reverse_iterator it = elements.rbegin(); + for ( ; it != elements.rend() ; ++it) { detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, *it, m_parameters, m_translator, m_allocators, relative_level); - rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + try + { + rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc) + } + catch(...) + { + ++it; + for ( ; it != elements.rend() ; ++it) + rtree::destroy_element::apply(*it, m_allocators); + throw; // RETHROW + } - assert(relative_level + 1 == lins_v.result_relative_level); + BOOST_GEOMETRY_INDEX_ASSERT(relative_level + 1 == lins_v.result_relative_level, "unexpected level"); // non-root relative level if ( lins_v.result_relative_level < m_leafs_level && !lins_v.result_elements.empty()) { - recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + recursive_reinsert(lins_v.result_elements, lins_v.result_relative_level); // MAY THROW (V, E: alloc, copy, N: alloc) } } } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp index 484c99ec8..ab92bc299 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp @@ -36,7 +36,7 @@ public: inline void operator()(internal_node & n) { - node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW (N: alloc) + node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW, STRONG (N: alloc) node_auto_ptr new_node(raw_new_node, m_allocators); typedef typename rtree::elements_type::type elements_type; @@ -47,9 +47,14 @@ public: for (typename elements_type::iterator it = elements.begin(); it != elements.end(); ++it) { - rtree::apply_visitor(*this, *it->second); + rtree::apply_visitor(*this, *it->second); // MAY THROW (V, E: alloc, copy, N: alloc) - elements_dst.push_back( std::make_pair(it->first, result) ); // MAY THROW (E: alloc) + // for exception safety + node_auto_ptr auto_result(result, m_allocators); + + elements_dst.push_back( std::make_pair(it->first, result) ); // MAY THROW, STRONG (E: alloc, copy) + + auto_result.release(); } result = new_node.get(); @@ -58,7 +63,7 @@ public: inline void operator()(leaf & l) { - node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW (N: alloc) + node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW, STRONG (N: alloc) node_auto_ptr new_node(raw_new_node, m_allocators); typedef typename rtree::elements_type::type elements_type; @@ -69,7 +74,7 @@ public: for (typename elements_type::iterator it = elements.begin(); it != elements.end(); ++it) { - elements_dst.push_back(*it); // MAY THROW (V: alloc, copy) + elements_dst.push_back(*it); // MAY THROW, STRONG (V: alloc, copy) } result = new_node.get(); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 36e051535..660d9da09 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -135,7 +135,7 @@ public: // TODO - consider creating nodes always with sufficient memory allocated // create additional node, use auto ptr for automatic destruction on exception - node_auto_ptr second_node(rtree::create_node::apply(allocators), allocators); // MAY THROW (N: alloc) + node_auto_ptr second_node(rtree::create_node::apply(allocators), allocators); // MAY THROW, STRONG (N: alloc) // create reference to the newly created node Node & n2 = rtree::get(*second_node); @@ -168,7 +168,7 @@ public: "unexpected number of elements"); // return the list of newly created nodes (this algorithm returns one) - additional_nodes.push_back(std::make_pair(box2, second_node.get())); // MAY THROW (alloc, copy) + additional_nodes.push_back(std::make_pair(box2, second_node.get())); // MAY THROW, STRONG (alloc, copy) // release the ptr second_node.release(); @@ -269,7 +269,7 @@ protected: rtree::element_indexable(m_element, m_translator)); // next traversing step - traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) + traverse_apply_visitor(visitor, n, choosen_node_index); // MAY THROW (V, E: alloc, copy, N:alloc) } // TODO: awulkiew - change post_traverse name to handle_overflow or overflow_treatment? @@ -284,7 +284,7 @@ protected: // handle overflow if ( m_parameters.get_max_elements() < rtree::elements(n).size() ) { - split(n); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) + split(n); // MAY THROW (V, E: alloc, copy, N:alloc) } } @@ -298,7 +298,7 @@ protected: m_traverse_data.move_to_next_level(&n, choosen_node_index); // next traversing step - rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) + rtree::apply_visitor(visitor, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V, E: alloc, copy, N:alloc) // restore previous traverse inputs m_traverse_data = backup_traverse_data; @@ -314,7 +314,7 @@ protected: typename split_algo::nodes_container_type additional_nodes; Box n_box; - split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW, BASIC (V, E: alloc, copy, N:alloc) + split_algo::apply(additional_nodes, n, n_box, m_parameters, m_translator, m_allocators); // MAY THROW (V, E: alloc, copy, N:alloc) BOOST_GEOMETRY_INDEX_ASSERT(additional_nodes.size() == 1, "unexpected number of additional nodes"); @@ -353,7 +353,7 @@ protected: } catch (...) { // clear new root to not delete in the ~node_auto_ptr() potentially stored old root node rtree::elements(rtree::get(*new_root)).clear(); - throw; // RETHROW, BASIC + throw; // RETHROW } m_root_node = new_root.get(); @@ -422,7 +422,7 @@ public: if ( base::m_traverse_data.current_level < base::m_level ) { // next traversing step - base::traverse(*this, n); // MAY THROW, BASIC (E: alloc, copy, N: alloc) + base::traverse(*this, n); // MAY THROW (E: alloc, copy, N: alloc) } else { @@ -440,11 +440,11 @@ public: rtree::visitors::destroy del_v(base::m_element.second, base::m_allocators); rtree::apply_visitor(del_v, *base::m_element.second); - throw; // RETHROW, BASIC + throw; // RETHROW } } - base::post_traverse(n); // MAY THROW, BASIC (E: alloc, copy, N: alloc) + base::post_traverse(n); // MAY THROW (E: alloc, copy, N: alloc) } inline void operator()(leaf &) @@ -483,9 +483,9 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(base::m_traverse_data.current_level < base::m_level, "unexpected level"); // next traversing step - base::traverse(*this, n); // MAY THROW, BASIC (V, E: alloc, copy, N: alloc) + base::traverse(*this, n); // MAY THROW (V, E: alloc, copy, N: alloc) - base::post_traverse(n); // MAY THROW, BASIC (E: alloc, copy, N: alloc) + base::post_traverse(n); // MAY THROW (E: alloc, copy, N: alloc) } inline void operator()(leaf & n) @@ -496,7 +496,7 @@ public: rtree::elements(n).push_back(base::m_element); // MAY THROW, STRONG (V: alloc, copy) - base::post_traverse(n); // MAY THROW, BASIC (V: alloc, copy, N: alloc) + base::post_traverse(n); // MAY THROW (V: alloc, copy, N: alloc) } }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 4fb867f9a..2f344a922 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -70,7 +70,7 @@ public: if ( geometry::covered_by(m_translator(m_value), children[child_node_index].first) ) { // next traversing step - traverse_apply_visitor(n, child_node_index); // MAY THROW + traverse_apply_visitor(n, child_node_index); // MAY THROW if ( m_is_value_removed ) break; @@ -88,14 +88,10 @@ public: if ( m_is_underflow ) { element_iterator underfl_el_it = elements.begin() + child_node_index; + size_t relative_level = m_leafs_level - m_current_level; - // move node to the container - store node's relative level as well - m_underflowed_nodes.push_back(std::make_pair(m_leafs_level - m_current_level, underfl_el_it->second)); // MAY THROW (alloc) - - elements.erase(underfl_el_it); // SHOULDN'T THROW - - // calc underflow - m_is_underflow = elements.size() < m_parameters.get_min_elements(); + // move node to the container - store node's relative level as well and return new underflow state + m_is_underflow = store_underflowed_node(elements, underfl_el_it, relative_level); // MAY THROW (E: alloc, copy) } // n is not root - adjust aabb @@ -116,7 +112,7 @@ public: BOOST_GEOMETRY_INDEX_ASSERT(m_is_value_removed, "value not found"); // reinsert elements from removed nodes (underflows) - reinsert_removed_nodes_elements(); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + reinsert_removed_nodes_elements(); // MAY THROW (V, E: alloc, copy, N: alloc) // shorten the tree if ( rtree::elements(n).size() == 1 ) @@ -141,7 +137,8 @@ public: { if ( m_translator.equals(*it, m_value) ) { - elements.erase(it); // MAY THROW (V: copy) + rtree::copy_from_back(elements, it); // MAY THROW (V: copy) + elements.pop_back(); m_is_value_removed = true; break; } @@ -166,7 +163,7 @@ private: typedef std::vector< std::pair > UnderflowNodes; - inline void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) + void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) { // save previous traverse inputs and set new ones internal_node * parent_bckup = m_parent; @@ -178,7 +175,7 @@ private: ++m_current_level; // next traversing step - rtree::apply_visitor(*this, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + rtree::apply_visitor(*this, *rtree::elements(n)[choosen_node_index].second); // MAY THROW (V, E: alloc, copy, N: alloc) // restore previous traverse inputs m_parent = parent_bckup; @@ -186,6 +183,29 @@ private: m_current_level = current_level_bckup; } + bool store_underflowed_node( + typename rtree::elements_type::type & elements, + typename rtree::elements_type::type::iterator underfl_el_it, + size_t relative_level) + { + // move node to the container - store node's relative level as well + m_underflowed_nodes.push_back(std::make_pair(relative_level, underfl_el_it->second)); // MAY THROW (E: alloc, copy) + + try + { + rtree::copy_from_back(elements, underfl_el_it); // MAY THROW (E: copy) + elements.pop_back(); + } + catch(...) + { + m_underflowed_nodes.pop_back(); + throw; // RETHROW + } + + // calc underflow + return elements.size() < m_parameters.get_min_elements(); + } + void reinsert_removed_nodes_elements() { typename UnderflowNodes::reverse_iterator it = m_underflowed_nodes.rbegin(); @@ -200,13 +220,13 @@ private: rtree::apply_visitor(ilv, *it->second); if ( ilv.result ) { - reinsert_node_elements(rtree::get(*it->second), it->first); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + reinsert_node_elements(rtree::get(*it->second), it->first); // MAY THROW (V, E: alloc, copy, N: alloc) rtree::destroy_node::apply(m_allocators, it->second); } else { - reinsert_node_elements(rtree::get(*it->second), it->first); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + reinsert_node_elements(rtree::get(*it->second), it->first); // MAY THROW (V, E: alloc, copy, N: alloc) rtree::destroy_node::apply(m_allocators, it->second); } @@ -248,7 +268,7 @@ private: m_parameters, m_translator, m_allocators, node_relative_level - 1); - rtree::apply_visitor(insert_v, *m_root_node); // MAY THROW (V: alloc, copy, E: alloc, N: alloc) + rtree::apply_visitor(insert_v, *m_root_node); // MAY THROW (V, E: alloc, copy, N: alloc) } } catch(...) diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 6ba313af7..6de5ecf3c 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -87,14 +87,93 @@ void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) } } +// test value exceptions +template +void test_rtree_elements_exceptions(Parameters const& parameters = Parameters()) +{ + typedef std::pair, throwing_value> Value; + typedef bgi::rtree Tree; + typedef typename Tree::box_type B; + + throwing_value::reset_calls_counter(); + throwing_value::set_max_calls((std::numeric_limits::max)()); + + std::vector input; + B qbox; + generate_input<2>::apply(input, qbox, 2); + + for ( size_t i = 0 ; i < 100 ; i += 2 ) + { + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(10000); + + Tree tree(parameters); + + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(i); + + BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_pushable_array_exception ); + } + + for ( size_t i = 0 ; i < 50 ; i += 2 ) + { + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(i); + + BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_pushable_array_exception ); + } + + for ( size_t i = 0 ; i < 50 ; i += 2 ) + { + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(10000); + + Tree tree(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(i); + + BOOST_CHECK_THROW( Tree tree2(tree), throwing_pushable_array_exception ); + } + + for ( size_t i = 0 ; i < 50 ; i += 2 ) + { + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(10000); + + Tree tree(parameters); + Tree tree2(parameters); + + tree.insert(input.begin(), input.end()); + + throwing_pushable_array_settings::reset_calls_counter(); + throwing_pushable_array_settings::set_max_calls(i); + + BOOST_CHECK_THROW(tree2 = tree, throwing_pushable_array_exception ); + } +} + int test_main(int, char* []) { test_rtree_value_exceptions< bgi::linear<4, 2> >(); test_rtree_value_exceptions(bgi::runtime::linear(4, 2)); test_rtree_value_exceptions< bgi::quadratic<4, 2> >(); test_rtree_value_exceptions(bgi::runtime::quadratic(4, 2)); - test_rtree_value_exceptions< bgi::rstar<4, 2> >(); - test_rtree_value_exceptions(bgi::runtime::rstar(4, 2)); + test_rtree_value_exceptions< bgi::rstar<4, 2, 0, 2> >(); + test_rtree_value_exceptions(bgi::runtime::rstar(4, 2, 0, 2)); + + test_rtree_elements_exceptions< bgi::linear_throwing<4, 2> >(); + test_rtree_elements_exceptions< bgi::quadratic_throwing<4, 2> >(); + test_rtree_elements_exceptions< bgi::rstar_throwing<4, 2, 0, 2> >(); return 0; } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 7b68cfb31..ca9a3553e 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -149,11 +149,13 @@ template <> struct generate_input<2> { template - static void apply(std::vector & input, Box & qbox) + static void apply(std::vector & input, Box & qbox, int size = 1) { - for ( int i = 0 ; i < 12 ; i += 3 ) + assert(0 < size); + + for ( int i = 0 ; i < 12 * size ; i += 3 ) { - for ( int j = 1 ; j < 25 ; j += 4 ) + for ( int j = 1 ; j < 25 * size ; j += 4 ) { input.push_back( generate_value::apply(i, j) ); } @@ -169,13 +171,15 @@ template <> struct generate_input<3> { template - static void apply(std::vector & input, Box & qbox) + static void apply(std::vector & input, Box & qbox, unsigned size = 1) { - for ( int i = 0 ; i < 12 ; i += 3 ) + assert(0 < size); + + for ( int i = 0 ; i < 12 * size ; i += 3 ) { - for ( int j = 1 ; j < 25 ; j += 4 ) + for ( int j = 1 ; j < 25 * size ; j += 4 ) { - for ( int k = 2 ; k < 12 ; k += 5 ) + for ( int k = 2 ; k < 12 * size ; k += 5 ) { input.push_back( generate_value::apply(i, j, k) ); } diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index a41e6587f..8b6d68402 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -15,7 +15,8 @@ #include #include -#include + +#include namespace boost { namespace geometry { namespace index { @@ -74,10 +75,10 @@ template : public dynamic_node { - typedef index::pushable_array< + typedef throwing_pushable_array< std::pair< Box, - dynamic_node * + dynamic_node * >, Parameters::max_elements + 1 > elements_type; @@ -95,7 +96,7 @@ template : public dynamic_node { - typedef index::pushable_array elements_type; + typedef throwing_pushable_array elements_type; template inline dynamic_leaf(Dummy) {} @@ -106,6 +107,13 @@ struct dynamic_leaf +struct container_from_elements_type, NewValue> +{ + typedef throwing_pushable_array type; +}; + // nodes traits template @@ -159,11 +167,29 @@ struct allocators::max)(); return mc; } +}; + // create_node template @@ -176,27 +202,13 @@ struct create_node< apply(Allocators & allocators) { // throw if counter meets max count - if ( get_max_calls_ref() <= get_calls_counter_ref() ) - throw internal_node_bad_alloc(); - else - ++get_calls_counter_ref(); + throwing_node_settings::throw_if_required(); return create_dynamic_node< dynamic_node, dynamic_internal_node >::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator); } - - static void reset_calls_counter() { get_calls_counter_ref() = 0; } - static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } - - static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } - static size_t & get_max_calls_ref() { static size_t mc = 0; return mc; } -}; - -struct leaf_bad_alloc : public std::exception -{ - const char * what() const throw() { return "leaf node creation failed."; } }; template @@ -209,88 +221,17 @@ struct create_node< apply(Allocators & allocators) { // throw if counter meets max count - if ( get_max_calls_ref() <= get_calls_counter_ref() ) - throw leaf_bad_alloc(); - else - ++get_calls_counter_ref(); + throwing_node_settings::throw_if_required(); return create_dynamic_node< dynamic_node, dynamic_leaf >::template apply(allocators.leaf_allocator, allocators.leaf_allocator); } - - static void reset_calls_counter() { get_calls_counter_ref() = 0; } - static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } - - static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } - static size_t & get_max_calls_ref() { static size_t mc = 0; return mc; } }; }} // namespace detail::rtree }}} // namespace boost::geometry::index -// value implementation - -struct throwing_value_copy_exception : public std::exception -{ - const char * what() const throw() { return "value copy failed."; } -}; - -struct throwing_value -{ - explicit throwing_value(int v = 0) - : value(v) - {} - - bool operator==(throwing_value const& v) const - { - return value == v.value; - } - - throwing_value(throwing_value const& v) - { - throw_if_required(); - - value = v.value; - } - - throwing_value & operator=(throwing_value const& v) - { - throw_if_required(); - - value = v.value; - return *this; - } - - void throw_if_required() - { - // throw if counter meets max count - if ( get_max_calls_ref() <= get_calls_counter_ref() ) - throw throwing_value_copy_exception(); - else - ++get_calls_counter_ref(); - } - - static void reset_calls_counter() { get_calls_counter_ref() = 0; } - static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } - - static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } - static size_t & get_max_calls_ref() { static size_t mc = 0; return mc; } - - int value; -}; - -template -struct generate_value< std::pair, throwing_value> > -{ - typedef bg::model::point P; - typedef std::pair R; - static R apply(int x, int y) - { - return std::make_pair(P(x, y), throwing_value(x + y * 100)); - } -}; - #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_EXCEPTIONS_HPP diff --git a/test/rtree/test_throwing.hpp b/test/rtree/test_throwing.hpp new file mode 100644 index 000000000..08190d18d --- /dev/null +++ b/test/rtree/test_throwing.hpp @@ -0,0 +1,322 @@ +// Boost.Geometry Index +// +// Throwing objects implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_THROWING_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_THROWING_HPP + +// value + +struct throwing_value_copy_exception : public std::exception +{ + const char * what() const throw() { return "value copy failed."; } +}; + +struct throwing_value +{ + explicit throwing_value(int v = 0) + : value(v) + {} + + bool operator==(throwing_value const& v) const + { + return value == v.value; + } + + throwing_value(throwing_value const& v) + { + throw_if_required(); + + value = v.value; + } + + throwing_value & operator=(throwing_value const& v) + { + throw_if_required(); + + value = v.value; + return *this; + } + + void throw_if_required() + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw throwing_value_copy_exception(); + else + ++get_calls_counter_ref(); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits::max)(); return mc; } + + int value; +}; + +template +struct generate_value< std::pair, throwing_value> > +{ + typedef bg::model::point P; + typedef std::pair R; + static R apply(int x, int y) + { + return std::make_pair(P(x, y), throwing_value(x + y * 100)); + } +}; + +// box +// +//#include +// +//struct throwing_box_copy_exception : public std::exception +//{ +// const char * what() const throw() { return "box copy failed."; } +//}; +// +//template +//struct throwing_box +//{ +// throwing_box(){} +// +// throwing_box(Point const& m, Point const& mm) +// : min_p(m), max_p(mm) +// {} +// +// throwing_box(throwing_box const& o) +// { +// throw_if_required(); +// +// min_p = o.min_p; +// max_p = o.max_p; +// } +// +// throwing_box & operator=(throwing_box const& o) +// { +// throw_if_required(); +// +// min_p = o.min_p; +// max_p = o.max_p; +// return *this; +// } +// +// void throw_if_required() +// { +// // throw if counter meets max count +// if ( get_max_calls_ref() <= get_calls_counter_ref() ) +// throw throwing_box_copy_exception(); +// else +// ++get_calls_counter_ref(); +// } +// +// static void reset_calls_counter() { get_calls_counter_ref() = 0; } +// static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } +// +// static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } +// static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits::max)(); return mc; } +// +// Point min_p; +// Point max_p; +//}; +// +//BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(throwing_box, min_p, max_p) +// +//namespace boost { namespace geometry { namespace index { +// +//template +//struct default_box_type< bg::model::point > +//{ +// typedef throwing_box< +// bg::model::point +// > type; +//}; +// +//}}} // namespace boost::geometry::index + +#include + +struct throwing_pushable_array_exception : public std::exception +{ + const char * what() const throw() { return "pushable array exception."; } +}; + +struct throwing_pushable_array_settings +{ + static void throw_if_required() + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw throwing_pushable_array_exception(); + else + ++get_calls_counter_ref(); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits::max)(); return mc; } +}; + +template +class throwing_pushable_array +{ + typedef typename boost::array array_type; + +public: + typedef typename array_type::value_type value_type; + typedef typename array_type::size_type size_type; + typedef typename array_type::iterator iterator; + typedef typename array_type::const_iterator const_iterator; + typedef typename array_type::reverse_iterator reverse_iterator; + typedef typename array_type::const_reverse_iterator const_reverse_iterator; + typedef typename array_type::reference reference; + typedef typename array_type::const_reference const_reference; + + inline throwing_pushable_array() + : m_size(0) + {} + + //inline explicit throwing_pushable_array(size_type s) + // : m_size(s) + //{ + // BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); + //} + + inline void resize(size_type s) + { + BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); + throwing_pushable_array_settings::throw_if_required(); + m_size = s; + } + + inline void reserve(size_type /*s*/) + { + //BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); + // do nothing + } + + inline Element & operator[](size_type i) + { + BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); + return m_array[i]; + } + + inline Element const& operator[](size_type i) const + { + BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); + return m_array[i]; + } + + inline Element const& front() const + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return m_array.front(); + } + + inline Element & front() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return m_array.front(); + } + + inline Element const& back() const + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return *(begin() + (m_size - 1)); + } + + inline Element & back() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + return *(begin() + (m_size - 1)); + } + + inline iterator begin() + { + return m_array.begin(); + } + + inline iterator end() + { + return m_array.begin() + m_size; + } + + inline const_iterator begin() const + { + return m_array.begin(); + } + + inline const_iterator end() const + { + return m_array.begin() + m_size; + } + + inline reverse_iterator rbegin() + { + return reverse_iterator(end()); + } + + inline reverse_iterator rend() + { + return reverse_iterator(begin()); + } + + inline const_reverse_iterator rbegin() const + { + return const_reverse_iterator(end()); + } + + inline const_reverse_iterator rend() const + { + return const_reverse_iterator(begin()); + } + + inline void clear() + { + m_size = 0; + } + + void push_back(Element const& v) + { + BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container"); + throwing_pushable_array_settings::throw_if_required(); + m_array[m_size] = v; + ++m_size; + } + + inline void pop_back() + { + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); + --m_size; + } + + inline bool empty() const + { + return m_size == 0; + } + + inline size_t size() const + { + return m_size; + } + + inline size_t capacity() const + { + return Capacity; + } + +private: + boost::array m_array; + size_type m_size; +}; + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_THROWING_HPP diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 15944c64a..5744e457b 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -48,9 +48,9 @@ int main() typedef bg::model::box

              B; //typedef bgi::rtree > RT; //typedef bgi::rtree RT; - typedef bgi::rtree > RT; + //typedef bgi::rtree > RT; // typedef bgi::rtree RT; - //typedef bgi::rtree > RT; + typedef bgi::rtree > RT; //typedef bgi::rtree RT; for ( ;; ) From d385e62bdd00d64182eeca7d8bb7e9f8f44d0ec5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 20 Nov 2012 23:04:15 +0000 Subject: [PATCH 167/366] compilation warning fixed. [SVN r81446] --- test/rtree/test_rtree.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index ca9a3553e..d7bf83b6f 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -171,7 +171,7 @@ template <> struct generate_input<3> { template - static void apply(std::vector & input, Box & qbox, unsigned size = 1) + static void apply(std::vector & input, Box & qbox, int size = 1) { assert(0 < size); From 6e1347948166711dd718246e99329c3b073f0fbb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 21 Nov 2012 16:06:34 +0000 Subject: [PATCH 168/366] 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 1ef9d77894a41f7199107a56932651ec94300170 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 21 Nov 2012 16:07:38 +0000 Subject: [PATCH 169/366] docs fixed [SVN r81460] --- 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 170/366] 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 171/366] 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 52e8317c3bd6d33a46374a33abdf08971adf6bd8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Nov 2012 11:31:58 +0000 Subject: [PATCH 172/366] warnings fixed, query and nearest visitors renamed [SVN r81482] --- .../extensions/index/rtree/node/node.hpp | 6 +++--- .../extensions/index/rtree/options.hpp | 19 ++++++++++++++---- .../geometry/extensions/index/rtree/rtree.hpp | 14 ++++++------- .../index/rtree/visitors/destroy.hpp | 2 +- .../{nearest.hpp => nearest_query.hpp} | 20 +++++++++---------- .../visitors/{query.hpp => spatial_query.hpp} | 12 +++++------ test/rtree/test_rtree.hpp | 2 +- 7 files changed, 43 insertions(+), 32 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/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/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/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/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 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 173/366] 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 a901b88244c97298ee50a9c6a7c11d8394dbaf44 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 22 Nov 2012 14:47:16 +0000 Subject: [PATCH 174/366] Fixed nullptr dereference errors. Merged from index_dev. [SVN r81484] --- .../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 175/366] 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 176/366] 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 177/366] 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-?uqAoByDm3bL8Ld-7F?fq_9bGbEzKIX^cyHLrvL z1e}Xf6H8K46v{J8G8EiBeFIYTQrQ_8I3zq>978H@y}cV-^;kooHF3`J@1_~4a_fE0 zow5;^U2dHBH-S^J<=%UvlgY=8+Ji$K3M*~o`WX~v^7k`T^v4(17wo@pyHx7Mu0{Ff z-Gx;#F}EeeYhSR}%cjuIMZ7qcS&;Qm z#y0(-$$^V=pG8)lI2)sBTw1$ey^2h~Sxmt!Th__H%oSTMgbEei*B4*hbNP>A`I*~y zKds@fxqiQV-c!!D%M2V-!_KeaZ@8>7Dd@NT=U)tb?@T_5?Ju4%r+K!j~=;jiy~*;IZRMkjDC|wzG$qUn`3DV;10bFk!gJ;KDqo zF;+&F;%Czxi_E?Onn0>95~@c*_&6! z@?eYJ4wIsXCJf6R^|ob|#CJ(NQrl^;{9yc+q9@9#C->{^I2fa!ZlXKKVB&NAy;mLe z(;vL>a~4@4YYDRyYc9BgY$(mde7(ozB+B*iNi(D%3RLNezUsdH=+L;%j93G z3*`>>)V9xA#&G`TDZQ7q61OGq-rePCZh7mw>TNckenXktggo zOM7Bj^7c8)BoCfBCpojsL1wRG!dFXQ?k938|E2dB>Sei^zj|lybZ+NbXYWJ7O%F|e zb3NmoULpSdN5QPSCq<9%f4A|JZ9#B;r?P}!aaGWynyXHJ#TnaXynKKC_jYBzy>*|e z?;Uf#**Gm)%Yyen=Dj%; z`5$+)7jxX&-E{d3*E7+xhaF8gzto;jbTDz4YU!K%_0RXmn=K?J?G)s>Id|DA?yPWw zlCAOY^#1GBJvBMYsc!bkb=^JP4@Ez6-g2I^OSVm&F3Tuvxo%Ed0-JyKI@^OcW%sT# z3UuA7yg*T`z3F_}hV#O6x0jyfoUe3FtXJfopuzKuIcyq%91I<7;Pf8S^h)yIg7=ck z9hIEVGOsT)Dv;WvFH<1ZkioEs@rj9p;Jv$BtV*u@J+J@x!A3zp=BAks#2#}kf4Qq* z{RchQ&^s3U8UOD-=_`8n%<;`KSp!XB>hc`Gr=ch7a@HSg1cjf-ZnNysdS7Gn}RvUA&P-sO&h z4@JuF877*|3oevuxIE`ZF4tP_rT6Zh%nZ=2eR!%mXwv-;k6x|0TvE%i@Bq)ZU2k1a z{-}K@a(AcT`QK~o(^!Ka{oFl~XYEsy=cs~62$xMcq{=ady0MGs9LAF{lAaP3s)N0sxvw6|X_gaq9L;(f9&m>H0ucS z^3qvT`t-z<4rbmf5N>i@yQlB$9Knfm*v@jReP{Wf{nGxUFz?56hr{lFjnUe0M04A% z(-tpHf_)dv&)HhEK9lX>m04V8tj>O|+kUCXSAEOYy;Hrpef^rBNeIQCb83)dwCF9c z;N2kX!YshMLAPkunLlf891)mp?el$?xMBLcf+@0UbJCO#{*g)1-^A+eFGY%G8SLM*XRGiQy(8Dpmv7tKUNo!s=&c~dg!AXa zFUK8mwm$osM|{5&&-t@oW}lmK{j)Dm`r`?H#%8Z|W`5l^PqSKc@|3e;DWuMqv#@iJiUc0~V=GMEdc12uj zU-KtS|6%dH?bbeNeZD1saw6Jm?Uv6h5^hqQvsdEpm%_&6`|pdS7F76s?qNKhbY$cH z>BdXW##o3=_WQgmVu}#|wp*Wf#7k9b^~f0C>3v*y_vyz9i)oyD4%W~9epT;_Fxzxc O4AOhPWHK-?uqAoByDm3bF|-eV`c1z`!7z84^+AoS&PUnpeUA z0?tLLi6yBi3gww484B*6z5ywEsq734Tvnbgjv*Dd-p)lbIOu_w8V1xc;N~8(X$+xhGTY{I8GQ z*7n~%8sNU$;FLxDb@uE3TN4D%gdWsbIz_Hjc6->@>9_yM&$nN*b=gC^6Mue`Ec;UY zr{jvm=EV=cpI479v$}Kh+|7OG&os?pQz-Le)^%^SHD_GTxW3?m^2z($cMGI4qAZp^ z*RkMrc#sWLm}Hjc!We4R>(AOPz+Etl zdtE~U!*a$33qR%wvo~v~x%>58b}(%^IaTU`Nq~(1^Gg=I4t~oQda(r^HYr@RvDsF3 zb>al0hKsfbgX`u0*GylyE|v3`gkWn!!t%t_c&SE}|2-~Fr>@RWEjcE_w1ng70>ks( zJbL=21-18nZS`RKv^MLiP_4qOBQM_XvHkZlea(LF6vnMa&MX&IN~WlaPn;6JW`Dc4 z1GA#}qDq55o8&Kc+*LoIx?p4Q>D9B`yE2NNY85B{(aYHR`On-!d6&-}5ngFCrrC-u zyZ*{bkZ+Nrj`&^n>l3x5IGe-oHDxYkE9=sh{^-?T-Cf=JC%*mM9ug?CRdQ{~h0eSuCLK@XPN-R2|M)WH>k9qp*93W+ zI;X$p*z3PhS^U~%8O~)#?>zNeXS{7AufAWg%8X+>w_N;t|NM?~H&(t|-}8RGePQ^U z7>VVM2KzZ;KN)tXN{ZA<%vY)BusAqp?;Js&kcS$7_f5a-ePXYT$0uk1(ggi=(W0U@F5! z1&KRs7a0yYn(W}Y;%2&e&h^h%>(-obHi)#CE%>+kaLwADZC<@|U#->4viuUB+jO(u zL&4o({`0i^>!owMZ%tXe>Z?g{{#F}?7&Yx`{{L7rXQ8nr?}4q08ZL@0ue?+G zti9oM2jAlR=ed?M7POt+o%HL8+0vG*P%B=&;AsU`w>7_NJ&!7o5@?)q)?$+N*`;^A zgf`tPO(~msFDsQzD!EW(!zJSrnLQgO?aIC`=r^6M&@Z_vQN1QJ^y`i@?{3bWczCwE z{~NuOc*dexK`h1BZYZl>3UYdvRXj^e=)#HKl)DvQzyB{bU;OpR>l^<)EEsJ~n=;R4 zGC6IY(zNrD(823f-))676K*n8TORLu93Oj&z5d&GsoNbg%Nwgb?U;93_=+w}N_nW$ z_u|*@ee)|n?DK35fB0p^^qXh&^mrLL)-S3Jz3MT4-@(4~{zjMH7SCPxy@Eq~3D@(@ zWh<9C=M>Ir;kC*%edWi#@%wIb*`Pa-D=l~#7BPA}Ued8_LJiv`yLcC7hYGd}JR#>f zDi;-osjg1VllF5i`nx%iy+`{ePt3fzTmHP5#4?A?skQhxXH?Xe_R97`-yv#VW9=)86m$i~>9NpKtz0 zT$*Vo?=Dhm#p=g=VNpijxt6Po!)ovA|7Uz)qTY0~sUW2_Eyr71B$?+pFViAMkE3f} zMSlERvv#hcqhQbdNj;k(rG&rZV==@A$_b*GYhw`mj@%0Rc#uJ`jQ(D@Z zK69oOvlgEF==A@d&Z7qzPae)>Nat(6+;GBR_F^*ztwnkl3sfxhnn51UV?KJgN-CnF zWK)*oaR;G!jm4X^gd?JhrH{v^SO1s;&VJ3ysqYh? ziuA~Rz0@psSDNMVdyTixOn9G|zqwz=JD=}q#?JDKSB<6Gb{lr=)o+S<=3$X8=rqyq z@#dF@-}x?_SEG@oVWOe3Zdgju*veByFcioLVCu-TZx^bBf%a4xY zlbf~P%(*pBFks^2J4N?SR321X)#YR~r%i^vKuX4aWzA!!Uz_z`2F^&^vbL;}%`dp| z@r*N~&lbO0dhwg?jA?V1nR~6|vAt2&@NS~u+a}rLUuLG~WgO3*`pjVZ9JT9pdltEE zIazop!^Pm9rSGd%XYR!vdSb!RHfPxt8TRWp#l4f81l6Sq)pgcOGaV}2?Va58k?;H@ z^^M2=2zkE|KDo%s@3dm{;Uq!TS*3Q1r(9@_E}my>K1WQNr)i?777U1 zUSDZ?|7M(Y)4|L|JJ0?4Z)&n8SG^%(U1!?vZ+|qz9c^Z_eczt2P+^+E#UF3@uYR{Z zRM_dhwrqbTr=E<$G?RysFa8BQv7WmprAq(*Dj$v8+axz9t1tIFvFZM-dEZ#4>^eA4 zR8y-&G(26-Sm~GWFV#8|KC>g-1IL;4paUjS3@*$K84NCte!??LnRe}7UU+bc4g2ybl4=&d zN(a|SNBTB-UcB&ro_O=+ly_@`LL!gM7gql8>)jlXz_xO=xlES5R`QX4Z&|i-7gpD< zJ!`A7+*9Y;EG|a>xcN(VcDP!f-PZp3=2^Q+f6Fb`4Y#;W^xJ&>b<3BkmDOI(r(FD$ zV=d0zeIuVVua*Z~Exk~)Zy=;c*bC-Q<3;C`0f5OGgn8goT^cybE zNnnrutCP-9B-OCISc>80lR3(rmmNf#Zcf^?qWQAMsSRy8e?X#f34ZS@Ot(I;hX zhE^w@&1IW-Mc(j;T)Xn}#z!Y@=Xv-sU*%B0UZLa%3Tpx01`WOECh4Las{;9teO)_G z?Qdq$?bzlo&sV(9oxOMW?hD~Q2Y>8if3#@%HuWpB>h@ba_&h7RU2WcFnVp4AOhPWHK-?uqAoByDm3bI-&6?R`^U|^8V42dXl&d<$F%`0I5 z0q3IB#FEq$h4Rdj3F!Z|6oAJysBK4b1u`8ZmS2RL{tn z&ysce*LXAt^s}A&Idheb+O{)K%glLsPH)oTV%YQZksw3NoRv7$n@em_C0+{&?yeiozD{!raUzH-zocfmf^Wy z2X_C9tC;3)V8P3vvGA(#HFk#OACD~mcK`D)hLCqARaf52s62b%CURlP>6P z2#T0ieTUVW*ZTK^Q*Y$64ZLUcoXk}4-f<;J!~ZMKq;~(cPxo2yGAv?rFk$FmW4Opr z(z4^#%oe>ckIy$1XF2iTm1r)gkv!Ztp-MmU|C_r18|V0?*!q?!UC+EBILlvQ`~PF! z9zm{&(#BCQ7f9cYxRVpA(f>hg`PU6c<8y=D>+^qaJs#AXaPN@h)*z{iUo@x4Fn@cI zpA+97z<9JTM!=W##qtM^J8NY{Iab`9!*<8gg-=hu zL0{ISnel#;Upstv)!&}qCc($D<=<>?o6pH*^Dchp*l}>q<~gd?r(bEE|FfOn<*xQp z`}_BAw-)VK=4!lfyH&xo%_1A$6gRjxOaJ-yK6}k)Eulic%Xbf@9_HMrhOb?rTG~8zDPQFD4W1qC-{5BB1c%VI@s#HAwqk_~ARf&S<)*WqsSPyPdlyR9n zqnw-PVTAD^N0Xf_%->s-J#0GE470g;?uhg$ys-72@j-cp%fhHcMN{Qjx%;DD^zE6^ z6xhGi<9vi>4DY;k$2`~jO*sC^K15q%&iZRCkAEwwiu<_V5j}G=U1RF9Lz_#tX?}f7DK7swJv^U0h-Da@)(ogau_j8!r2( z-Jj?*uk3P3#IpHi8;@Cut-K|@+jtkRr7!EA-Ai+u|Eiz6ze-nAf8za;c-!4Z9(H`Y zt$*(ApC-7rnQ!suQw#anjfYeNkgv%z9==WvL>)mfj48OHN z1##)!tlXZ_MN1_rFKNdMlrDC8a=raBgKEy4XOE6pzxpnD#w(X^`U_62LW{Ga2N@J* zF)YjUs=lkBAjOcKcco%Sx%TpjG5z1W&;M&pcYiH*hl?$6u3L`f$E<(SpR@K0FPgvU z&{5y7R=(PYE~+cKrh;M5nBE}I*l>j!ZlN~)~}9;>V3hn!uI1m4vj0a=ihPd{qjH8N;FKcyW7oXH)G6BD?jIR z0=Wj?HhFYq2$(C(`q%Qf^tq~DbB04hL6(ruk?UO&;M+H!>~_blRb%h_va4{`HK#3qAM7Z; z`R3oG+s(JH7D#1;e{nx_lly^B3vC4 z@7*rl{l1oWWmNR`UInR`6;zvS$*3#>Pd3cAi0#%}wt@0C-7 zpp>0b-cP+`;XZAr6_+w=CjEKQ{@+kxVcGJT^2SqFPEwrtG+%esg)&zE={vbCeVOx$ zEgXWym~8IVU%b1-g7*iP`tHy3I5%HeGAZ*mlb>@QvxTqPLyk9|r?={DnNlVaZ878F z=L4Bi3f~1c#Cg_ro>aMfzr?C{=9D1Gv<#k7D63$G>59uWg;qHhH#wSgwq7o}oFsUV z!*Y$lMFp8pM{Zd5%6+YtJ!;P)ZAlb9ACUvP5r%$|Llq@rJFe2DzqMy%sOtrPHJje5x3;`D zeELgq(L|X|sS+`3J6&D;m|0`f?O$Z=4c#gFQF)fvk zdHx@tWT3$|=J(0{?AQNapL028?%E)p7dp#d$+YJ0(@T-QG41}`603>#cIvl%&{>>t zZ*%(7+tSaL|LWn0S+rB|*4pj~x1ZN;QMhU3`^;qBx;Iz+0&L96&;Ds#c=y-7Z|~P{ zzvs-wIPvH%`2Z#VtDHQ`z4qCA{>;9*=;rx?U!?~&WH0l#3bwm7U!rRHse79@N2;e> z^R^B4dvjUYX0o1)=klBDRjUtVG6?W8C`d85FgIj?n2Q)8%uSEqa2QMuTGgx*HEN9esYO=RsF@xXZPX9^zMeJ%PN@g7{ zUS}oD_x*jt_RBJ%Q#leDE>@g7v?iEg!exkE3KQO4&kVX}&TrxSxykak)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!%^5p{#Z)YSd zpLx7Sx7FsYTS>&S`DGiAWp!V9(|cF)Zrhw?jQ4gg&29dxe(rvjuBQIP`z7(VyNx{T zX5E#ndzXB=Xo*(ep7-v%RUgl!y z&Y%U+Yqj=pZU498{&ik1QByzRiJP}BRB3-$!?xfxliKYE{DMBYmSIlY4`wRuJ`-o* zxjL{sE${OAd$I{D>-7DYC)~^x;B`pY;!qJ5pP`l}u(4Ts`OCN;3(tO&diiMnZiR-+ zUnHjO5c>Am;c%ru?~e;-O8%b>WC<6_oUit-@4j|wzVySHDI4Y4w;yLoh`F=nu6*(H z@B2KeR1`lQX}|pCS>Lq(pNp6-?-V_LASS!gPLQSLvIpncqJ7WK6-&=?>pD@)|Kx0; zm5899@=;Om3zq_0Iu0GnwBlCIwcgNuZ`*|l+K)}v3VRylKaAO%yYO&xzJ>2<*9Pfk z6R+=e!FA4l%zKZ#Jo`MngH2*i2U}I)UOtxIj1xNr%oZ_va9`crCNb^d-gfPj;~U<; zg!!$fC2~t@tNg>27d5E;v+&J6RQXkmTWr#{ zCtil1mW1yMxY{c;F<#z}dCG>uS>3|#m)y6VF*PXbnyej*R-wgN(Sr;MvlyOL`c>am zP>^EC&Qr0uvwQ00D>41wyU+h?O;3LL#FlJR!hfbh=vRJh<~dY{qde``6E3@3oy8bpGJf7n3e`Jepv9M6Bm!cG$r; z`X58Rde>eL)rs!CA$Xzc(O%(z71p!faqa!`yUbeDOfX!$x8faJ!P8e3yq3;e4&FGe zq`AoPPD92oVZRf$Gk5STa1w*0#1QT3z#bz8{V zwa48Ac=fK>gqK(Te)C}77PGS5McrvKSA!ll&)V|0_xP@hul?M;m)^3Te%WaMyszsT zHvXUgc-_1E&iD3(eSIp_lNDgFZ*%8$oo|0LKd(%86bRy2@iyj&$*;2_7t?+oSU1g* zb@RVJ^>ZIh`mw3Vqqlx)U)WxsheqX!%LN~pEq|UV#3wa> zLqyU195M4&gPP~@!d$V>Gj669NEJyR$TZ?we#ka+=e5?F_wUY}-2G=~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-!A9GJ|E2l*t>5y#{kGD|D47-i%i~Q~JcjVNHSFl_Rom@r(j;60VRN9BdI^uN7f`-8Q1O_5rYt8#afTF+&HGuP+18f>ipd}`XWV86=> z4{!5!)X8soURw8mZnbLuo32YY&TrfrJ^M04wbj|6scXKLiZ4(8aa+^t>5Ery)Ryn; zJAE?jwD#{=7w$8je;aA#W@df1RAzsFZ=r|cgWJE&!UIlRRV-@Jcw%xQJ|bg{v&&bW zn}?U*vU0KDbueML$l$^(zP-==evC&g4Z zS-+zr+rvV2_o(?p07hs z`|N|gcE#Ioy(i#1|0&0^Ex$vrR?Rw|;cD=FpZ!w)f+DE}sml*;+!H-tXqUiKjiqzu z9MAk<>g{crbj?$CE9aAG!gnor%LLD@zd5ICt^1K;kn%v&<~eF+dUG{XXWe00ep6vi zSWL<5c}FsCWM&=D4v&}Qhxb>#$ldgXkn^!a|Nmj9)`AAG~;1a{-nyG0O zCk2DJ(_U6py_YJHn$2=9`T51JIccwZULBtu|Dpe_iF8|%xdf~2}MPLY@ zna%x#t=wj>O&*>Te72+S@wRq@=Fewpr$tAIeHJ^oeOhvEnbe`m>DT9c@0H`5{LAO^ zKe6&yOWp+n4B&9-VAJ5+o6b9F^{lI2>P*WsJ7VUt?(_?MW@6D>P_#w+sfFvz%iwrp zu;g9V5?%4FYpE7XfmDd@3{{VkN@edD|s95^4E)ny&ZmGNLeU;y3rs&mmmy5Hv%?l3Z_7-Gc&M3kJ zO&bdoL(YG2NoQH^s8TFEbKCN#CLIEPt3MmffutKt-T-y|qvaCxt z_li74o9jnQ?rxhpU3Gm-tmz9orAfWatLH2eI+#=VIIL4Lz%ExRvgB)yRgjI_gloxP zZiU6gg}qA`&oqDUTDr2}>9dKu?=v5@Iy-0vs8pEAr?x?{iQ9WTG&%$|9h zpZt4kb6nDCui9L;|6J+sWzsU|DPMi=IrZ|AE*A^l1DOHIe5Gm@ypx^;R6h%u^X%-3 zrR6?+M>E52?YUzVb7X#nO?W_ zD_^JoeP;bHREqcEJ3tma^ zH$EwATHG?D+NJJ^(dC0Hw{D32s-sw}cua2Nj}4REp6@#yxAWM{peC)k&kTk3MHkMx z%=xTnNi56l^4J~kKP0sJq$d>3N>?&W6SZ~~QX&>RK!PufQ5v-+1s zJA=2}Zn*5jGWk*dfy`OSnX-HbG8z0n%X+^qVDQ_l1S-t8T;4Np=gzNlCIq!y{?+B8 zQZQ@h-Pm&_ejEk2KIBNSJ>*na4lc(Y^qAQDf3~_EUtB6MM{Q@qyhDMqE?moJ+Qn>r zdpG*G-v1jHGoSIPXsOm1I(8nO^USL6ylvBYyW~7K`68(WSLU!;SYNI&NoVI??pWGX z`CV#x=ZV~D74J9~WQDO7hhC8RTo7t`_7>BDJNzpQx8|{X8S;nEy}V}K99I7Dvr3iE z9p4AOhPWHK-?uqAoByDm3bJYbdb%=}fq_9bGbEzKIX^cyHLrvL z1e}Xf6H8K46v{J8G8EiBeFIYTQrQ_8I9NSh978H@y}g^;CuJ?rns{F0_pWzS1;ehT zq~4L2RBK_#mD+t<{=Bwp*NG0!-hThkojLV$&Oa|^m~dvfJHwu1{Y&L7=K9SG;`O<_ zZ2von$Da!eUnIwzN!<6ls^-&Ad(O6mI8h%C#UsgY9$##G`E=ud<)^*LJ#6p#V)pIZ z5%{a}kI+k-^ZX`%e&0X8@omYE$6pG|YxHNf&S5(-_j1CM6$PIJEO;j!I@qG}Kk&t| zOoJ^2QRgEqcrWa_9HYg*Gg2#c**g9+Q(GPf9%fyBGuU9Iy|5EUu&UzsmyZu?JT|F6 zA^X|yxXo+k`(MA$O|NWvXu{yM^s4b|<_9L7ORoHLkCS(J>?hp+(VG3F<&I9KSSw#I zR__j0zt2tD0z4MH4K{wvIcI}JHoN+r$-K~;u+59tf_GN(`O(( zn0Z`EuWpvw6%qJs_hS=l+mf}`Ukz{F|$?l%$nZ@rXT+TU= zy6uwcUjBZo#mgUmx#Ao3d*2h211J2Nza4rZ_R!>pPEOsi=vHaJ=8G+tZ$+}qVY_iD zGi#=z*IX;6l;T-CH*Kucm)n*rb=C5$jcC-uxP0^2;vPep`4%s4x%{dTHr=r?+V662 zg4pvOA6bF5@&XaHewUfAH$Rz^_~4IeMRH83#9im|{alvQquM7Oz8qgK)0SXy_SxoF zdvDquRgF7pYd0sYeBa|A@$Zj*-EJGUlRfX1ZXwIz%r(;^gPF8d7-#cn~Dt6@@NC1OET7u*1X2G4|s;3M7-3*$#X8JudKVu=z zc7=73cg_^DIe144S)6@wXlK;&%Hy1FS&tt=(!`0(4a%*%=2-F`6FMWBy=zV<+uve~ z|38cWN%6GTyf1S)7dv5yeB?mKSsfM!`oI3RM<@1R1WoH%t%}FzO z_@{XHp|6=HiY*l%)>!f?EI(<}{GaQ7x&`wbHCF?Mi)$WiQ3Q&tO~HSL`? zSHHRBE9-8(ZMyLs3>|FXY!K4q#2~_A!5jDVo~fjA?A(Ky6MQWmz=ES8w_@vQYq`gh z>w6v+SQSbM_)JRJXL0OD+hw0%i_jkn=GCqcxObm_68G#2ud1(I{`kG>%Hpnvm#VHl zpOoO#+~hgeH){^-MNhxr+xt2mPcaLAV|zMZb4Eqaed8CK)0<1&CtfZ&V;g=|=<|#z zoKGVw?w5Q$b6|(Pgw6EtEt^FYOkXwS@h-A(?yqk zia8RSCEu78h8WewTFfrXJ5o6R>+?kk+baHrZMhij7raZW_;#t6!Gy~Ui!INF6-X4! zx}x&U@6!EZX*LVrvWGWzutJNEqNgU?tIr2dsz``f?s-#qp%0JW=cd^LJXuf6a-Q{c zJTZ9@XRuTKhkW*b;p-9MlI=nFzXoY-IHu|K)yS@NR(iWbyvEj|_ZN7YR+@@Nl*~H( zGUP7j>>JbX2;bVBuAQ%IV#&K}@fX=e=Qs`+9C~PSzzGAw-AmSpFdx{(tTsgR;Z*$u+2l+K#;{cQ8)68#zO>lyW}ecv;${2u&o}DYzj+i%l_<`L_7W?#@C`71-C7-bLFjeCe7T|%{{jNvr_4xhlDU`J zvE+Y;;&-b#bJ)&q{#vzY4%=Oh^wnQoAo1!Dx@XR1olu34#brIO-S_(b%06*-o|MS` zb-(t>Zhk*c@5@Y3<<`9C$mbipTR(r4AOhPWHK-?uqAoByDm3bKpro_2+ofq_9bGbEzKIX^cyHLrvL z1e}Xf6H8K46v{J8G8EiBeFIYTQrQ_8*r#~9IEGZ*dV4o|(k%ml)0gJxL>+kQH?Y}<*xhn?=O0{XFW0dlhgJ6ckQq9 z`P;AF-4S;1L}r7CC9hQ3oY@9*E-Q5G-0)_;z_aQnCJrkK^d7ffX3)5idF|1Q2^SbM zj%7Lt`JdFZILl_PC{ZBQa9Kut8RHx^gOlML4jcV0^Z&gsw{%ALY>j}Wms?5>a&0`2 zX|{vuV8dmGj>je%{U3!E=D(5qc>mUk4MlC~*~%~H87IzZOXy1Eu=pZ2DS!W_C1FRSB&8oewezMh)w<|Gwp`yyk|8m>KnfCPs)MzZUc7APM_?G|O{M9cn^%U%C zwW)ug@@V+Wgp zR6_>CB1W+LKn}gYa<#;A|M%5f@8wOtt$9jBUBlA%iGIrY&ONhEtXye&mD9^lxbZpX z-nHgQf@e0~KQ9+pDCOYCe1!9|1@DE{vo_i*1rB5u>?*k9&wL{D$Qg%HKVwmT=_!1E z!U}U{%|E@vxAC$<(G5+LrzTf*KFr|z@GIZ9^U2Ss%)K#l+7c#NJLK+-nZx$~>jBxh z*Ez0Q@CvfERB$o2TKJkx7OTI0`lkQ1=V^iNKlkpN?z~>JeCDsZwtes0Sk-SC3;g+M zeYY)Ic+tJ5CZ5MG)-9UpvuNVVC)Tb``^u&MU0DCzQqlhNJ~pRM%V#+qyX!Z3cEP5f zxxZ@u&tHCc&D`vpzwd4<3STt`791UH862{VypvYVx_T;h<(y@TL3cBylGz+Qk6T&z zHXoW9y|(+Du;DU8?-P^sxv#48r89MH4z5vs{?=qC$FkRl)O{8e ziFK()J~eTdudFTmz0d#l`P?dvzSOl<8p|2I&Sst~O}e|6V|nKCnOgg;T3G!yJ6foo zfBNf7dA)v@$==F4)7R%uyd2_?bMVaGYau73p; zlfeSTkn1`IAyuOJO@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|8TU9-9fY2A+7@+NfQenfm11 zl=dE3cjbu!tP_4%-e3IqlZ%L6UispiJMQFdk7k%~rrn)k&#~v%^mR@@(!6@WME2MD z*yNaa@%Y*`-Iizg>*d1j{<9wxIJ3HmQ?aF@x7OyC!QMUJ?1TRm^jth-JMsN`eYq)h zasN9?<~>)J`uBbR{iNG3Kcw!oiMb!0rnsE3=(&l6rPdr97Qf~t1qO;I>&12zO7ZB< zxmGOZ$Gqj8$^EJAcXFm01)pbs=5^@fiib^?=V;Eja-UPNW#yy^)jMO>82Npc-x z<*es550?L{`=sY@Fo(@y#g?jPH4JmqCQiBa|HO0Vj60c+O#eMmuoO2BT;RRjb7cbO z#sisg1*}bs%NZve&umzHvn#3ZM5iV1F2OT_D;bwN7SEaMT`cv$V|k#e^V-CyQoqM% z?XHMSlimBS%(~b7_lHyO=4TsT-ynH9v%q7=m0*qaRc((R2Iue8U(VRUrXbaj!LW#t zZPBh*k-V{MG(O)goHbc)*R{F7ByzVMPWO&yI=Dr5&MmV?5|7qN-+f{tVHIb!G#%Yc?VlYQ{JvQ_1{;&tySj#ee+evy{en5m- zT~z(-RFB;oqx~-TCYXKi@sSl+%g?dKZu!f`JKay}yUmZq9)2-z*YEWcidUCr_*Zxt z%y|}baL)sw^^fG_{fe!2KKk)nZuK2*^RLq^njV@Qo;>NvYO$hO%QQD$){j5kuWa}0 z_saiiowE<_bH1Fv{B7)&Icm!NVs4%DR_!%j?|ql&+U?&)bDp_8oU+Dk@8;s^RqIoy z><+So1&{!*fxxPC=Ac!xwtg+Iewq8&ggNk4>|dGs?MuUjEO;NL6gEw~Rbc^9UL-Zg zeWhNyU-Ltj&&o2}bql2aoYlB{Vh${p9ZU|~UNO(~$nMxfE4ORwh)*`N^nLu~6@#DU zjx&~S+gZQye0*-w%(?vgZBYweh2<+R%zLlqEcKqtZ?ocz>MfHRGK6M4pLw_;qd}{9 z*0a|?>-A!G@t?fI(e}nK_$uqx{0}dDl)igM=+!+nxyz|u_Q`eMUEP9kk;?MVGosfo zU-M)~kyKM}p`x95$BE4cR^U z7H3UbmmXr@`fZ^T$JIM8o~my7HScR}`1kwXbydpCSAN-$?QO7fw`cEe1*?;pS=IWF ztd_nNNq_&zo$J`2ZP#z!W>j4MlHv31IOSC5NbdKu*UgKR=ofE({%KypHl-G|xoWB> z#pgY^GG|%X!xcVrpYO^3AI7tB)~i&`CnmBVG8(6q+!86g7PR+?$%<2z-{%zs%7m(P4AaEQ_RM(v{&DSvhq@V&j$@!0NlzwberkALQ7 zEZ#n6SxM-#n>vXOe#||OOxzD99>@%ue1qMy{(P>)1CyJrkB{mWK(g)x?d3b`zuTyG zvbUAano_PbrSo8BT!Cnx7v5M|2x0eKQccTdTim9^1V~J-V}BP z?d@6Zx7m#4*X$tm?`>%UK5JJVSa!Ka*Sl2MtWa;K`Iho@ZFyZ2OWs|JzsN31V@Z&B zSRnO41yp7%&?%aA=FhqtUo0-~cw%d@wq!=ZET^WQdrwpe`E<7adsk~X=h=h1t6Zio z{l3yl)$YFa_oD@~n%~A=)_h`;_&a6i7U3^?M}D6-k9xmw&aw>=)mkibe*VmQ<(hLV z^IiFlE1BP1%TKNUXx4Ty<5K3lw^r3N$mCPxxo|Wp>5wv8$*jx?rH{&3Qc7nD{E`=p&N`(0#Dt+K(?o`KP8$DO zUuVase!)fOLbVSS{^y%CciELW+6#Vv$eEY^T%-Y#YZ{~^|IJzUr1tXzle^r{Zk}(L zK6lyo)+@iK)XTgu>GwO>s{g=5S|{H7d+fP}Icyfz%NettpOEwPYt~~a_CL9ZZ#n0x zw7nlza78_md3V^E@20%gtGhhKITH?B^G^ICZ}`Nnee&f6m3?;pQ!X!%ekfBq??fip zCo8(97tdPD)sl6kv+(bV?VkT5i@papKbpUK-}~!tc3*C_E83}`po0X{3k07E~V{|o`1Y_x`5M;yLoYES%iMFR~$S4EZDS20aQ4AOhPWHK-?uqAoByDm3bHd>xCWkLU|^8V42dXl&d<$F%`0I5 z0q3IB#FEq$h4Rdj3F!Z|??{-LevCO`LeOGS<-O)CnKA zW3?FzG#R6BOwv7h|NoV#K|wv+ww=3p@#4d(y>ZM9DRwqY4{Ymv_dY1vS>a_`V6*Pm z>vM*E{oTRxkCQkKU!H$_;`#rM1}vY~B{*>?&P$f>HzYmL<56*v8o@RJ9YL2C!{`r-s-b7yi z&1{@@X?F73r*q7g$Jth2J8>jv>g6R*{(awL-*9ZM+PufMY$q*ubTY+S`FgQ=bFx{S zm0ssy@W6!OlLhYvv*6V;Op}uQn)6sThh-edydV>O{L&n@h|8HNCj(v^t+iTSxQX9X z_w+Tn^38LPowWONIOJ}`vR6-~)RGN(PjRb#HLdQ*Y)~c8W!y?8q zm(rV?rB+24PM&MR|1-nWVCDLQrkdV|~&5W1ScLT7z%8$T-g_T|9dR+ucb< zC(rG?=Ss z37$)Dl)I!{`0q}3z?UMnsB)=A4sSa$85SX2;b6jWk->%8#L+zT-2K;ApUpdQxMrEw z+mucvw+aESr{ajtOb9&tQB&me+ ze$A&|F431-?pP_*^yhH>95xTJbGP<#Snyt$boq*r^ORRsOew{)7H-=3Ge`OI#>|lC zCWj4MD%NI*n}7T3dh~vx$?qxJ6Uvge&sZjZ(1-Wid7J&Kw=USTbH+0EBK}GBr^=J& zTLtx4C4ibFZHNuuoUk^MOgr=-c|OrtiDlnWlt-Su6)_7ENJsnS8*2M~2OXIYjcZ$^7&GcNM%W^nB)K zkWxNtmEMZj1DkC-@3e1-`Ex3Bm$2WPC*3hIx*sNpL|RqytbHErmK0;id(h^rlAi6s z${gGEMw47a1uqB|Pj6cPj%)7kI&;D8yQF4zUA5%h;HJc&AO#Mt0M1S6I~GSwy{s@X z{pc#L2ut2H4)!^aY+%T{f$zQ8+CH%*$1HB0>bl&JFt4Dmu<^1?|HGh%%~HPu6kD?L zz7%n+-IxA1;_Bbx6Y}CmOs3|Q`Esh2nyoApb5S?+&3&$PuCsT~_IXdQi}d`;?sj8T^|gO5adf17l9f!6c6yU!oYWH987N?lvK@XBs$OWswfZ^brL zpO5piI$Ox0xW=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 178/366] 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]

    nothrow or strong - [b] + [b]

    -

    [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 179/366] 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 180/366] 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. From d1174a227e8b4e9436aca828c17924e54de96bce Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 25 Nov 2012 21:56:12 +0000 Subject: [PATCH 181/366] Small change in docs. [SVN r81544] --- .../geometry_index/r_tree/introduction.html | 17 ++++++++--------- doc/html/index.html | 2 +- doc/rtree/introduction.qbk | 9 ++++----- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 4f362b0d4..41dd3a17f 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -51,15 +51,14 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - 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 - 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. + is node splitting algorithm [2] [3]. Each algorithm produces different splits so the internal structure + of a tree may be different for each one of them. In general more complex + algorithms analyses elements better and produces less overlapping nodes. + In the searching process less nodes must be traversed in order to find desired + 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.

    diff --git a/doc/html/index.html b/doc/html/index.html index 6a7d9f32b..ecf1044c9 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

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

    Last revised: November 25, 2012 at 21:53:32 GMT


    diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index d3482b919..25f6f7ea0 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -28,11 +28,10 @@ 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 [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. +Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. +In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed +in order to find desired 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]] From 6f5b384b9357c7283440eb7064849f51152c2764 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 26 Nov 2012 18:54:09 +0000 Subject: [PATCH 182/366] Merged from index_dev. not_xxx predicates generators removed. Added rtree constructor, insert() and remove() taking Range. Added default translator for boost::tuple<>. Each R*tree test divided into 2 files. Docs updated/modified/fixed. [SVN r81571] --- doc/html/geometry_index/r_tree.html | 18 +- .../r_tree/creation_and_modification.html | 194 ++++++++++++---- .../r_tree/exception_safety.html | 30 ++- .../r_tree/nearest_neighbours_queries.html | 6 +- .../r_tree/rtree_quickstart.html | 2 +- .../r_tree/spatial_queries.html | 60 +++-- doc/html/index.html | 2 +- doc/rtree/creation.qbk | 128 +++++++--- doc/rtree/exception_safety.qbk | 4 +- doc/rtree/nearest_query.qbk | 2 +- doc/rtree/quickstart.qbk | 2 +- doc/rtree/spatial_query.qbk | 38 ++- .../geometry/extensions/index/predicates.hpp | 108 +-------- .../geometry/extensions/index/rtree/rtree.hpp | 91 +++++++- .../extensions/index/translator/def.hpp | 63 +++++ test/rtree/Jamfile.v2 | 8 + test/rtree/rtree2d_rstar_d.cpp | 1 - test/rtree/rtree2d_rstar_d_rt.cpp | 23 ++ test/rtree/rtree2d_rstar_f.cpp | 1 - test/rtree/rtree2d_rstar_f_rt.cpp | 23 ++ test/rtree/rtree2d_rstar_i.cpp | 1 - test/rtree/rtree2d_rstar_i_rt.cpp | 23 ++ test/rtree/rtree2d_rstar_tt.cpp | 1 - test/rtree/rtree2d_rstar_tt_rt.cpp | 26 +++ test/rtree/rtree3d_rstar_d.cpp | 1 - test/rtree/rtree3d_rstar_d_rt.cpp | 23 ++ test/rtree/rtree3d_rstar_f.cpp | 1 - test/rtree/rtree3d_rstar_f_rt.cpp | 23 ++ test/rtree/rtree3d_rstar_i.cpp | 1 - test/rtree/rtree3d_rstar_i_rt.cpp | 23 ++ test/rtree/rtree3d_rstar_tt.cpp | 1 - test/rtree/rtree3d_rstar_tt_rt.cpp | 26 +++ test/rtree/test_rtree.hpp | 219 ++++++++++++++++-- 33 files changed, 921 insertions(+), 252 deletions(-) create mode 100644 test/rtree/rtree2d_rstar_d_rt.cpp create mode 100644 test/rtree/rtree2d_rstar_f_rt.cpp create mode 100644 test/rtree/rtree2d_rstar_i_rt.cpp create mode 100644 test/rtree/rtree2d_rstar_tt_rt.cpp create mode 100644 test/rtree/rtree3d_rstar_d_rt.cpp create mode 100644 test/rtree/rtree3d_rstar_f_rt.cpp create mode 100644 test/rtree/rtree3d_rstar_i_rt.cpp create mode 100644 test/rtree/rtree3d_rstar_tt_rt.cpp diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 610c173c3..cda674285 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -36,14 +36,16 @@ parameters
    Values, Indexables and default Translator
    -
    Inserting - and splitting algorithms
    +
    Inserting + and splitting algorithms (compile-time)
    Inserting and splitting algorithms (run-time)
    -
    Copying - and moving
    -
    Inserting - and removing Values
    +
    Copying, + moving and swapping
    +
    Inserting + and removing of Values
    +
    Additional + interface
    Spatial queries
    @@ -51,6 +53,10 @@ queries
    Spatial predicates
    +
    Connecting + predicates
    +
    Value + predicate
    Nearest neighbours queries
    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 8725a9e0f..07814d84f 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -32,14 +32,16 @@ parameters
    Values, Indexables and default Translator
    -
    Inserting - and splitting algorithms
    +
    Inserting + and splitting algorithms (compile-time)
    Inserting and splitting algorithms (run-time)
    -
    Copying - and moving
    -
    Inserting - and removing Values
    +
    Copying, + moving and swapping
    +
    Inserting + and removing of Values
    +
    Additional + interface

    @@ -49,25 +51,25 @@

    R-tree has 4 parameters:

    -
    rtree<Value, Parameters, Translator, Allocator>
    +
    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    • - Value - type of object which will be stored in the container. + Value - type of object which will be stored in the container,
    • - Parameters - compile-time - parameters, e.g. inserting/splitting algorithm with min and max nodes' - elements numbers. + Parameters - parameters + type, inserting/splitting algorithm,
    • Translator - type of object translating Value objects to Indexable objects (Point or Box) - which R-tree can handle. + which R-tree can handle,
    • - Allocator - the allocator. + Allocator - Values allocator, all allocators + needed by the container are created from it.

    @@ -78,15 +80,13 @@

    R-tree may store Values of any type as long the Translator - is passed as parameter. It knows how to interpret those Values - and extract an object understandable by the R-tree. Those objects are called - Indexables. Each type adapted to Point + knows how to interpret those Values and extract an object + that the R-tree can handle. Those objects are called Indexables + in this documentation. Each type adapted to Point or Box - concept is an Indexable. Default Translator - index::translator::def<Value> is able to handle Point, - Box - or std::pair<...> - Values. + concept is an Indexable. Values types which can + be handled by the default Translator - index::translator::def<Value> + are defined as follows:

    • @@ -96,33 +96,55 @@
    • Value = Indexable | std::pair<Indexable, - T> + T> + | boost::tuple<Indexable, + ...>
    +

    + Examples of default Value types: +

    +
    geometry::model::point<...>
    +geometry::model::point_xy<...>
    +geometry::model::box<...>
    +std::pair<geometry::model::box<...>, unsigned>
    +boost::tuple<geometry::model::point<...>, int, float>
    +
    +

    + A Translator is a type which knows how to handle Values. + It has two purposes: +

    +
      +
    • + it translates Value to a more suitable Indexable + type which is needed by most of operations, +
    • +
    • + performs a comparison of Value which is needed by the + removing process. +
    • +
    +

    + A Translator translates the Value each time the + R-tree needs it. For this reason it should rather return const reference + to the Indexable than a copy. +

    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: -

    -
    geometry::model::point<...>
    -geometry::model::point_xy<...>
    -geometry::model::box<...>
    -std::pair<geometry::model::box<...>, size_t>
    -

    Values may be inserted to the R-tree in many various ways. Final internal structure of the R-tree depends on algorithms used in the - insertion process. The most important is nodes' splitting algorithm. Currently, - three well-known types of R-trees may be created. + insertion process and parameters. The most important is nodes' splitting + algorithm. Currently, three well-known types of R-trees may be created.

    Linear - classic R-tree using splitting algorithm of linear complexity @@ -146,66 +168,136 @@ and splitting algorithms (run-time)

    - By default splitting algorithm parameters are passed to the R-tree in compile - time. To use run-time versions of the R-tree one may pass parameters defined + Splitting algorithm parameters may be passed to the R-tree in run time. + To use run-time versions of the R-tree one may pass parameters defined in index::runtime namespace.

    // linear
     index::rtree<Value, index::runtime::linear> rt(index::runtime::linear(32, 8));
    +
     // quadratic
     index::rtree<Value, index::runtime::quadratic> rt(index::runtime::quadratic(32, 8));
    +
     // rstar
     index::rtree<Value, index::runtime::rstar> rt(index::runtime::rstar(32, 8));
     
    +

    + The obvious drawback is a slightly slower R-tree. +

    The R-tree is copyable and movable container. Move semantics is implemented using Boost.Move library which also supports compilers not supporting rvalue references.

    -
    index::rtree< Value, index::quadratic<32, 8> > rt1;
    +
    // default constructor
    +index::rtree< Value, index::quadratic<32, 8> > rt1;
    +
     // copy constructor
    -index::rtree< Value, index::quadratic<32, 8> > rt2;
    +index::rtree< Value, index::quadratic<32, 8> > rt2(r1);
    +
     // copy assignment
     rt2 = r1;
    +
     // move constructor
     index::rtree< Value, index::quadratic<32, 8> > rt3(boost::move(rt1));
    +
     // move assignment
     rt3 = boost::move(rt2);
    +
    +// swap
    +rt3.swap(rt2);
     

    - Following code creates an R-tree using quadratic algorithm. + The following code creates an R-tree using quadratic algorithm.

    using namespace boost::geometry;
     typedef std::pair<Box, int> Value;
     index::rtree< Value, index::quadratic<32, 8> > rt;
     

    - To insert or remove Value's by method calls one may use the following code. -

    -
    Value v = std::make_pair(Box(...), 0);
    -rt.insert(v);
    -rt.remove(v);
    -
    -

    - To insert or remove Value's by function calls one may use the following + To insert or remove a `Value' by method call one may use the following code.

    Value v = std::make_pair(Box(...), 0);
    +
    +rt.insert(v);
    +
    +rt.remove(v);
    +
    +

    + To insert or remove a `Value' by function call one may use the following + code. +

    +
    Value v = std::make_pair(Box(...), 0);
    +
     index::insert(rt, v);
    +
     index::remove(rt, v);
     
    +

    + Typically you will perform those operations in a loop in order to e.g. + insert some number of Values corresponding to geometrical + objects (e.g. Polygons) + stored in another container. +

    +
    +
    + +

    + The R-tree allows creation, inserting and removing of Values from a range. + The range may be passed as [first, last) Iterators pair or as a Range. +

    +
    namespace bgi = boost::geometry::index;
    +typedef std::pair<Box, int> Value;
    +typedef bgi::rtree< Value, bgi::linear<32, 8> > RTree;
    +
    +std::vector<Value> values;
    +/* vector filling code, here */
    +
    +// create a RTree with default constructor and insert values with RTree::insert(Value const&)
    +RTree rt1;
    +BOOST_FOREACH(Value const& v, values)
    +   rt1.insert(v);
    +
    +// create a RTree with default constructor and insert values with RTree::insert(Iter, Iter)
    +RTree rt2;
    +rt2.insert(values.begin(), values.end());
    +
    +// create a RTree with default constructor and insert values with RTree::insert(Range)
    +RTree rt3;
    +rt3.insert(values);
    +
    +// create a RTree with constructor taking Iterators
    +RTree rt4(values.begin(), values.end());
    +
    +// create a RTree with constructor taking Range
    +RTree rt5(values);
    +
    +// remove values with RTree::remove(Value const&)
    +BOOST_FOREACH(Value const& v, values)
    +   rt1.remove(v);
    +
    +// remove values with RTree::remove(Iter, Iter)
    +rt2.remove(values.begin(), values.end());
    +
    +// remove values with RTree::remove(Range)
    +rt3.remove(values);
    +
    diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 6b34a74f4..9afbcf6a3 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -29,9 +29,6 @@ In order to be exception-safe the R-tree requires:

      -
    • - Nonthrowing destructor of the Value. -
    • Exception-safe copy constructor of the Value.
    • @@ -42,6 +39,9 @@
    • Nonthrowing copy constructor of the Translator.
    • +
    • + Nonthrowing destructors of the above types. +
    @@ -203,6 +203,18 @@ + + + + + + + + diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 5e2471181..9ec8f8b5c 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -87,7 +87,7 @@ 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 + objects will probably be created with geometry::envelope() function. But to keep it simple lets just generate some boxes manually and insert them into the R-tree by using insert() method.

    diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index 7076a9506..6da37a16f 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -31,13 +31,19 @@ queries
    Spatial predicates
    +
    Connecting + predicates
    +
    Value + predicate

    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. + intersecting some area or are within some other area. Names of predicates + corresponds to names of Boost.Geometry + algorithms. The examples of some basic queries may be found in the table + below. The query region and result Values + are orange.

    +

    + insert(range) +

    +
    +

    + basic +

    +

    remove(Value) @@ -228,6 +240,18 @@

    +

    + remove(range) +

    +
    +

    + basic +

    +
    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 497577ccc..390fe04c5 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -59,12 +59,14 @@

    - knn in a ring (Value's furthest point) + knn query - distance to Indexable's furthest point greather than + ...

    - knn in a ring (Value's closest point) + knn query - distance to Indexable's closest point greather than + ...

    @@ -139,10 +145,8 @@ predicates

    - It is possible to define other relations between queried Values - and region/regions of interest. Names of predicates corresponds to names - of Boost.Geometry - algorithms. + To explicitly define one of the predicates one may pass it to the spatial_query() + as the first argument instead of Box.

    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
    @@ -158,21 +162,38 @@
     // the same as
     rt.spatial_query(index::disjoint(box), std::back_inserter(result));
     
    + +
    +

    - It's possible to use some number of predicates by passing std::pair<Pred1, Pred2> -

    -
    rt.spatial_query(
    -  std::make_pair(index::intersects(box1), !index::within(box2))
    -  , std::back_inserter(result));
    -
    -

    - or boost::tuple<Pred1, Pred2, Pred3, ...> + It's possible to use some number of predicates in one time by passing + std::pair<Pred1, Pred2> + or boost::tuple<Pred1, Pred2, Pred3, ...>. These predicates are connected + by logical AND. Passing all predicates together not only makes possible + to construct advanced queries but is also faster than separate calls because + the tree is traversed only once. Traversing is continued and Values are returned only if all predicates + are met. Predicates are checked left-to-right so placing most restictive + predicates first should accelerate the search even more.

    rt.spatial_query(
    +  std::make_pair(
    +    index::intersects(box1), !index::within(box2) ),
    +  std::back_inserter(result));
    +
    +rt.spatial_query(
       boost::make_tuple(
    -    index::intersects(box1), !index::within(box2), index::overlaps(box3))
    -  , std::back_inserter(result));
    +    index::intersects(box1), !index::within(box2), index::overlaps(box3) ),
    +  std::back_inserter(result));
     
    +
    +
    +

    There is also a unique predicate index::value(...) taking user-defined function/functor which checks if Value should be returned by the query. @@ -185,8 +206,9 @@ // ... rt.spatial_query( - boost::make_pair(index::intersects(box), index::value(fun)) -, std::back_inserter(result)); + boost::make_pair( + index::intersects(box), index::value(fun) ), + std::back_inserter(result));

    diff --git a/doc/html/index.html b/doc/html/index.html index ecf1044c9..16d52db19 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: November 25, 2012 at 21:53:32 GMT

    Last revised: November 26, 2012 at 17:58:58 GMT


    diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 3025132e5..9a1393065 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -14,46 +14,53 @@ __rtree__ has 4 parameters: - rtree + rtree, Allocator> = std::allocator > -* `__value__` - type of object which will be stored in the container. -* `Parameters` - compile-time parameters, e.g. inserting/splitting - algorithm with min and max nodes' elements numbers. +* `__value__` - type of object which will be stored in the container, +* `Parameters` - parameters type, inserting/splitting algorithm, * `__translator__` - type of object translating `Value` objects to - `__indexable__` objects (`__point__` or `__box__`) which __rtree__ can handle. -* `Allocator` - the allocator. + `__indexable__` objects (`__point__` or `__box__`) which __rtree__ can handle, +* `Allocator` - `Value`s allocator, all allocators needed by the container are created from it. [endsect] [section Values, Indexables and default Translator] -__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<__value__>` -is able to handle `__point__`, `__box__` or `std::pair<...>` `__value__`s. +__rtree__ may store `__value__`s of any type as long the `__translator__` knows how to interpret those `__value__`s +and extract an object that the __rtree__ can handle. Those objects are called +`__indexable__`s in this documentation. Each type adapted to `__point__` or `__box__` concept is an `__indexable__`. +`__value__`s types which can be handled by the default `__translator__` - `index::translator::def<__value__>` +are defined as follows: * `__indexable__ = __point__ | __box__` -* `__value__ = Indexable | std::pair<__indexable__, T>` +* `__value__ = Indexable | std::pair<__indexable__, T> | boost::tuple<__indexable__, ...>` + +Examples of default `__value__` types: + + geometry::model::point<...> + geometry::model::point_xy<...> + geometry::model::box<...> + std::pair, unsigned> + boost::tuple, int, float> + +A `__translator__` is a type which knows how to handle `__value__`s. It has two purposes: + +* it translates `__value__` to a more suitable `__indexable__` type which is needed by most of operations, +* performs a comparison of `__value__` which is needed by the removing process. + +A `__translator__` translates the `__value__` each time the __rtree__ needs it. For this reason +it should rather return const reference to the `__indexable__` than a copy. 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: - - geometry::model::point<...> - geometry::model::point_xy<...> - geometry::model::box<...> - std::pair, size_t> - [endsect] -[section Inserting and splitting algorithms] +[section Inserting and splitting algorithms (compile-time)] `__value__`s may be inserted to the __rtree__ in many various ways. Final internal structure -of the __rtree__ depends on algorithms used in the insertion process. The most important is +of the __rtree__ depends on algorithms used in the insertion process and parameters. The most important is nodes' splitting algorithm. Currently, three well-known types of R-trees may be created. Linear - classic __rtree__ using splitting algorithm of linear complexity @@ -72,58 +79,121 @@ R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions [section Inserting and splitting algorithms (run-time)] -By default splitting algorithm parameters are passed to the __rtree__ in compile time. +Splitting algorithm parameters may be passed to the __rtree__ in run time. To use run-time versions of the __rtree__ one may pass parameters defined in index::runtime namespace. // linear index::rtree<__value__, index::runtime::linear> rt(index::runtime::linear(32, 8)); + // quadratic index::rtree<__value__, index::runtime::quadratic> rt(index::runtime::quadratic(32, 8)); + // rstar index::rtree<__value__, index::runtime::rstar> rt(index::runtime::rstar(32, 8)); +The obvious drawback is a slightly slower __rtree__. + [endsect] -[section Copying and moving] +[section Copying, moving and swapping] The __rtree__ is copyable and movable container. Move semantics is implemented using Boost.Move library which also supports compilers not supporting rvalue references. + // default constructor index::rtree< __value__, index::quadratic<32, 8> > rt1; + // copy constructor - index::rtree< __value__, index::quadratic<32, 8> > rt2; + index::rtree< __value__, index::quadratic<32, 8> > rt2(r1); + // copy assignment rt2 = r1; + // move constructor index::rtree< __value__, index::quadratic<32, 8> > rt3(boost::move(rt1)); + // move assignment rt3 = boost::move(rt2); + // swap + rt3.swap(rt2); + [endsect] -[section Inserting and removing Values] +[section Inserting and removing of Values] -Following code creates an __rtree__ using quadratic algorithm. +The following code creates an __rtree__ using quadratic algorithm. using namespace boost::geometry; typedef std::pair __value__; index::rtree< __value__, index::quadratic<32, 8> > rt; -To insert or remove __value__'s by method calls one may use the following +To insert or remove a `__value__' by method call one may use the following code. __value__ v = std::make_pair(__box__(...), 0); + rt.insert(v); + rt.remove(v); -To insert or remove __value__'s by function calls one may use the following +To insert or remove a `__value__' by function call one may use the following code. __value__ v = std::make_pair(__box__(...), 0); + index::insert(rt, v); + index::remove(rt, v); +Typically you will perform those operations in a loop in order to e.g. insert +some number of `__value__`s corresponding to geometrical objects (e.g. `Polygons`) +stored in another container. + +[endsect] + +[section Additional interface] + +The __rtree__ allows creation, inserting and removing of Values from a range. The range may be passed as +[first, last) Iterators pair or as a Range. + + namespace bgi = boost::geometry::index; + typedef std::pair __value__; + typedef bgi::rtree< __value__, bgi::linear<32, 8> > RTree; + + std::vector<__value__> values; + /* vector filling code, here */ + + // create a RTree with default constructor and insert values with RTree::insert(Value const&) + RTree rt1; + BOOST_FOREACH(__value__ const& v, values) + rt1.insert(v); + + // create a RTree with default constructor and insert values with RTree::insert(Iter, Iter) + RTree rt2; + rt2.insert(values.begin(), values.end()); + + // create a RTree with default constructor and insert values with RTree::insert(Range) + RTree rt3; + rt3.insert(values); + + // create a RTree with constructor taking Iterators + RTree rt4(values.begin(), values.end()); + + // create a RTree with constructor taking Range + RTree rt5(values); + + // remove values with RTree::remove(Value const&) + BOOST_FOREACH(__value__ const& v, values) + rt1.remove(v); + + // remove values with RTree::remove(Iter, Iter) + rt2.remove(values.begin(), values.end()); + + // remove values with RTree::remove(Range) + rt3.remove(values); + [endsect] [endsect] [/ Creation and modification /] diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index 3b9847480..bfc70e9f7 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -12,10 +12,10 @@ 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` used in the `Indexable`. * Nonthrowing copy constructor of the `Translator`. +* Nonthrowing destructors of the above types. [table [[Operation] [exception-safety]] @@ -33,8 +33,10 @@ In order to be exception-safe the __rtree__ requires: [[][]] [[`insert(__value__)`] [ basic ]] [[`insert(first, last)`] [ basic ]] +[[`insert(range)`] [ basic ]] [[`remove(__value__)`] [ basic ]] [[`remove(first, last)`] [ basic ]] +[[`remove(range)`] [ basic ]] [[][]] [[`spatial_query(...)`] [ *strong* ]] [[`nearest_query(...)`] [ *strong* ]] diff --git a/doc/rtree/nearest_query.qbk b/doc/rtree/nearest_query.qbk index d3ba7fc69..f993de169 100644 --- a/doc/rtree/nearest_query.qbk +++ b/doc/rtree/nearest_query.qbk @@ -17,7 +17,7 @@ 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)]] +[[Basic knn query] [knn query - distance to Indexable's furthest point greather than ...] [knn query - distance to Indexable's closest point greather than ...]] [[[$../images/knn.png]] [[$../images/knn_inters.png]] [[$../images/knn_cover.png]]] ] diff --git a/doc/rtree/quickstart.qbk b/doc/rtree/quickstart.qbk index 0f28622b8..8b5b60e9c 100644 --- a/doc/rtree/quickstart.qbk +++ b/doc/rtree/quickstart.qbk @@ -31,7 +31,7 @@ passed as template parameters. Maximum number of elements in nodes are set to 32 [rtree_quickstart_create] 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. +In this case `Box` objects will probably be created with `geometry::envelope()` function. But to keep it simple lets just generate some boxes manually and insert them into the R-tree by using `insert()` method. diff --git a/doc/rtree/spatial_query.qbk b/doc/rtree/spatial_query.qbk index 198c56b15..e9802a977 100644 --- a/doc/rtree/spatial_query.qbk +++ b/doc/rtree/spatial_query.qbk @@ -11,7 +11,8 @@ [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 +retrieve Values intersecting some area or are within some other area. Names of predicates +corresponds to names of __boost_geometry__ algorithms. The examples of some basic queries may be found in the table below. The query region and result `Value`s are orange. [table @@ -45,8 +46,8 @@ Use of pipe operator generating a range [section Spatial predicates] -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. +To explicitly define one of the predicates one may pass it to the `spatial_query()` as +the first argument instead of `Box`. 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 @@ -61,18 +62,30 @@ All predicates may be negated, e.g.: // the same as rt.spatial_query(index::disjoint(box), std::back_inserter(result)); -It's possible to use some number of predicates by passing `std::pair` +[endsect] + +[section Connecting predicates] + +It's possible to use some number of predicates in one time by passing `std::pair` +or `boost::tuple`. These predicates are connected by logical AND. +Passing all predicates together not only makes possible to construct advanced queries but is also +faster than separate calls because the tree is traversed only once. Traversing is continued and +`Value`s are returned only if all predicates are met. Predicates are checked left-to-right so placing +most restictive predicates first should accelerate the search even more. rt.spatial_query( - std::make_pair(index::intersects(box1), !index::within(box2)) - , std::back_inserter(result)); - -or `boost::tuple` + std::make_pair( + index::intersects(box1), !index::within(box2) ), + std::back_inserter(result)); rt.spatial_query( boost::make_tuple( - index::intersects(box1), !index::within(box2), index::overlaps(box3)) - , std::back_inserter(result)); + index::intersects(box1), !index::within(box2), index::overlaps(box3) ), + std::back_inserter(result)); + +[endsect] + +[section Value predicate] There is also a unique predicate `index::value(...)` taking user-defined function/functor which checks if `__value__` should be returned by the query. @@ -85,8 +98,9 @@ which checks if `__value__` should be returned by the query. // ... rt.spatial_query( - boost::make_pair(index::intersects(box), index::value(fun)) - , std::back_inserter(result)); + boost::make_pair( + index::intersects(box), index::value(fun) ), + std::back_inserter(result)); [endsect] diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 07350416e..3a9777d26 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -203,15 +203,15 @@ inline detail::overlaps overlaps(Geometry const& g) return detail::overlaps(g); } -/*! -Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::touches(Indexable, Geometry) -returns true. - -\tparam Geometry The Geometry type. - -\param g The Geometry object. -*/ +//*! +//Generate a predicate defining Value and Geometry relationship. +//Value will be returned by the query if bg::touches(Indexable, Geometry) +//returns true. +// +//\tparam Geometry The Geometry type. +// +//\param g The Geometry object. +//*/ //template //inline detail::touches touches(Geometry const& g) //{ @@ -233,96 +233,6 @@ inline detail::within within(Geometry const& g) return detail::within(g); } -/*! -Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::covered_by(Indexable, Geometry) -returns false. - -\tparam Geometry The Geometry type. - -\param g The Geometry object. -*/ -template -inline detail::not_covered_by not_covered_by(Geometry const& g) -{ - return detail::not_covered_by(g); -} - -/*! -Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::disjoint(Indexable, Geometry) -returns false. - -\tparam Geometry The Geometry type. - -\param g The Geometry object. -*/ -template -inline detail::not_disjoint not_disjoint(Geometry const& g) -{ - return detail::not_disjoint(g); -} - -/*! -Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::intersects(Indexable, Geometry) -returns false. - -\tparam Geometry The Geometry type. - -\param g The Geometry object. -*/ -template -inline detail::not_intersects not_intersects(Geometry const& g) -{ - return detail::not_intersects(g); -} - -/*! -Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::overlaps(Indexable, Geometry) -returns false. - -\tparam Geometry The Geometry type. - -\param g The Geometry object. -*/ -template -inline detail::not_overlaps not_overlaps(Geometry const& g) -{ - return detail::not_overlaps(g); -} - -/*! -Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::touches(Indexable, Geometry) -returns false. - -\tparam Geometry The Geometry type. - -\param g The Geometry object. -*/ -//template -//inline detail::not_touches not_touches(Geometry const& g) -//{ -// return detail::not_touches(g); -//} - -/*! -Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::within(Indexable, Geometry) -returns false. - -\tparam Geometry The Geometry type. - -\param g The Geometry object. -*/ -template -inline detail::not_within not_within(Geometry const& g) -{ - return detail::not_within(g); -} - namespace detail { diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 452ee8a1b..349d0ca77 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -149,6 +149,36 @@ public: } } + /*! + The constructor. + + \note Exception-safety: strong + + \param rng The range of Values. + \param parameters The parameters object. + \param translator The translator object. + \param allocator The allocator object. + */ + template + inline rtree(Range const& rng, Parameters parameters = Parameters(), translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) + : m_translator(translator) // SHOULDN'T THROW + , m_parameters(parameters) + , m_allocators(allocator) + , m_values_count(0) + , m_leafs_level(0) + , m_root(0) + { + try + { + this->insert(rng); + } + catch(...) + { + this->raw_destroy(*this, true); + throw; + } + } + /*! The destructor. @@ -317,7 +347,25 @@ public: } /*! - Remove the value from the container. + Insert a range of values to the index. + + \note Exception-safety: basic + + \param rng The range of values. + */ + template + inline void insert(Range const& rng) + { + if ( !m_root ) + this->raw_create(); + + typedef typename boost::range_const_iterator::type It; + for ( It it = boost::const_begin(rng); it != boost::const_end(rng) ; ++it ) + this->raw_insert(*it); + } + + /*! + Remove a value from the container. \note Exception-safety: basic @@ -329,7 +377,7 @@ public: } /*! - Remove the range of values from the container. + Remove a range of values from the container. \note Exception-safety: basic @@ -343,6 +391,21 @@ public: this->raw_remove(*first); } + /*! + Remove a range of values from the container. + + \note Exception-safety: basic + + \param rng The range of values. + */ + template + inline void remove(Range const& rng) + { + typedef typename boost::range_const_iterator::type It; + for ( It it = boost::const_begin(rng); it != boost::const_end(rng) ; ++it ) + this->raw_remove(*it); + } + /*! Find values meeting spatial predicates, e.g. intersecting some box. @@ -876,6 +939,18 @@ inline void insert(rtree & tree, Iterator tree.insert(first, last); } +/*! +Insert a range of values to the index. + +\param tree The spatial index. +\param rng The range of values. +*/ +template +inline void insert(rtree & tree, Range const& rng) +{ + tree.insert(rng); +} + /*! Remove a value from the index. @@ -901,6 +976,18 @@ inline void remove(rtree & tree, Iterator tree.remove(first, last); } +/*! +Remove a range of values from the index. + +\param tree The spatial index. +\param rng The range of values. +*/ +template +inline void remove(rtree & tree, Range const& rng) +{ + tree.remove(rng); +} + /*! Find values meeting spatial predicates. diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index 5020a5b32..6c65a0d52 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -176,6 +176,69 @@ struct def< std::pair > } }; +namespace detail +{ + +template +struct compare_tuples +{ + inline static bool apply(Tuple const& t1, Tuple const& t2) + { + typedef typename boost::tuples::element::type T; + return dispatch::equals< + T, + typename geometry::traits::tag::type + >::apply(boost::get(t1), boost::get(t2)) + && + compare_tuples::apply(t1, t2); + } +}; + +template +struct compare_tuples +{ + inline static bool apply(Tuple const&, Tuple const&) + { + return true; + } +}; + +} // namespace detail + +/*! +The default translator. This specialization translates from boost::tuple. + +\tparam Indexable The Indexable type. +\tparam Second The second type. +*/ +template +struct def< boost::tuple > +{ + typedef boost::tuple value_type; + + BOOST_MPL_ASSERT_MSG( + (!detail::indexable_not_found_error< + typename traits::indexable_type::type + >::value), + NOT_VALID_INDEXABLE_TYPE, + (Indexable) + ); + + typedef Indexable const& result_type; + + result_type operator()(value_type const& value) const + { + return boost::get<0>(value); + } + + bool equals(value_type const& v1, value_type const& v2) const + { + return detail::compare_tuples::value> + ::apply(v1, v2); + } +}; + }}}} // namespace boost::geometry::index::translator #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_DEF_HPP diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index c424bcf21..b2b98d998 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -22,6 +22,10 @@ test-suite boost-geometry-index-rtree [ run rtree2d_rstar_f.cpp ] [ run rtree2d_rstar_d.cpp ] [ run rtree2d_rstar_tt.cpp ] + [ run rtree2d_rstar_i_rt.cpp ] + [ run rtree2d_rstar_f_rt.cpp ] + [ run rtree2d_rstar_d_rt.cpp ] + [ run rtree2d_rstar_tt_rt.cpp ] [ run rtree3d_linear_i.cpp ] [ run rtree3d_linear_f.cpp ] @@ -37,6 +41,10 @@ test-suite boost-geometry-index-rtree [ run rtree3d_rstar_f.cpp ] [ run rtree3d_rstar_d.cpp ] [ run rtree3d_rstar_tt.cpp ] + [ run rtree3d_rstar_i_rt.cpp ] + [ run rtree3d_rstar_f_rt.cpp ] + [ run rtree3d_rstar_d_rt.cpp ] + [ run rtree3d_rstar_tt_rt.cpp ] [ run rtree_exceptions.cpp ] ; diff --git a/test/rtree/rtree2d_rstar_d.cpp b/test/rtree/rtree2d_rstar_d.cpp index 7b51787db..a9ffbb38d 100644 --- a/test/rtree/rtree2d_rstar_d.cpp +++ b/test/rtree/rtree2d_rstar_d.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2dc; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_rstar_d_rt.cpp b/test/rtree/rtree2d_rstar_d_rt.cpp new file mode 100644 index 000000000..e9106fde4 --- /dev/null +++ b/test/rtree/rtree2d_rstar_d_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2dc; + + test_rtree(bgi::runtime::rstar(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_rstar_f.cpp b/test/rtree/rtree2d_rstar_f.cpp index 3ae5bc669..a9b436323 100644 --- a/test/rtree/rtree2d_rstar_f.cpp +++ b/test/rtree/rtree2d_rstar_f.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2fc; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_rstar_f_rt.cpp b/test/rtree/rtree2d_rstar_f_rt.cpp new file mode 100644 index 000000000..deb8e9861 --- /dev/null +++ b/test/rtree/rtree2d_rstar_f_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2fc; + + test_rtree(bgi::runtime::rstar(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_rstar_i.cpp b/test/rtree/rtree2d_rstar_i.cpp index 83ab75dcb..0ede4c08f 100644 --- a/test/rtree/rtree2d_rstar_i.cpp +++ b/test/rtree/rtree2d_rstar_i.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2ic; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_rstar_i_rt.cpp b/test/rtree/rtree2d_rstar_i_rt.cpp new file mode 100644 index 000000000..113eeb58a --- /dev/null +++ b/test/rtree/rtree2d_rstar_i_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + + test_rtree(bgi::runtime::rstar(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_rstar_tt.cpp b/test/rtree/rtree2d_rstar_tt.cpp index f18c4a5ca..789581c08 100644 --- a/test/rtree/rtree2d_rstar_tt.cpp +++ b/test/rtree/rtree2d_rstar_tt.cpp @@ -20,7 +20,6 @@ int test_main(int, char* []) typedef bg::model::point P2ttmc; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); #endif return 0; diff --git a/test/rtree/rtree2d_rstar_tt_rt.cpp b/test/rtree/rtree2d_rstar_tt_rt.cpp new file mode 100644 index 000000000..cef0962fe --- /dev/null +++ b/test/rtree/rtree2d_rstar_tt_rt.cpp @@ -0,0 +1,26 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + + test_rtree(bgi::runtime::rstar(4, 2)); +#endif + + return 0; +} diff --git a/test/rtree/rtree3d_rstar_d.cpp b/test/rtree/rtree3d_rstar_d.cpp index df6d5b168..7552edeb2 100644 --- a/test/rtree/rtree3d_rstar_d.cpp +++ b/test/rtree/rtree3d_rstar_d.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3dc; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_rstar_d_rt.cpp b/test/rtree/rtree3d_rstar_d_rt.cpp new file mode 100644 index 000000000..eff900313 --- /dev/null +++ b/test/rtree/rtree3d_rstar_d_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3dc; + + test_rtree(bgi::runtime::rstar(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_rstar_f.cpp b/test/rtree/rtree3d_rstar_f.cpp index 289779802..f258ce1ae 100644 --- a/test/rtree/rtree3d_rstar_f.cpp +++ b/test/rtree/rtree3d_rstar_f.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3fc; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_rstar_f_rt.cpp b/test/rtree/rtree3d_rstar_f_rt.cpp new file mode 100644 index 000000000..408928029 --- /dev/null +++ b/test/rtree/rtree3d_rstar_f_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3fc; + + test_rtree(bgi::runtime::rstar(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_rstar_i.cpp b/test/rtree/rtree3d_rstar_i.cpp index 233fe186d..6688566a3 100644 --- a/test/rtree/rtree3d_rstar_i.cpp +++ b/test/rtree/rtree3d_rstar_i.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3ic; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_rstar_i_rt.cpp b/test/rtree/rtree3d_rstar_i_rt.cpp new file mode 100644 index 000000000..d9a501f71 --- /dev/null +++ b/test/rtree/rtree3d_rstar_i_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + + test_rtree(bgi::runtime::rstar(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_rstar_tt.cpp b/test/rtree/rtree3d_rstar_tt.cpp index c76f80f15..2f03ed6a9 100644 --- a/test/rtree/rtree3d_rstar_tt.cpp +++ b/test/rtree/rtree3d_rstar_tt.cpp @@ -20,7 +20,6 @@ int test_main(int, char* []) typedef bg::model::point P3ttmc; test_rtree >(); - test_rtree(bgi::runtime::rstar(4, 2)); #endif return 0; diff --git a/test/rtree/rtree3d_rstar_tt_rt.cpp b/test/rtree/rtree3d_rstar_tt_rt.cpp new file mode 100644 index 000000000..c99d9ddfc --- /dev/null +++ b/test/rtree/rtree3d_rstar_tt_rt.cpp @@ -0,0 +1,26 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + +#ifdef HAVE_TTMATH + typedef bg::model::point P3ttmc; + + test_rtree(bgi::runtime::rstar(4, 2)); +#endif + + return 0; +} diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index d3ea2e8c4..a40e6f716 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -97,6 +97,29 @@ struct generate_value< std::pair >, in } }; +template +struct generate_value< boost::tuple, int, int> > +{ + typedef bg::model::point P; + typedef boost::tuple R; + static R apply(int x, int y) + { + return boost::make_tuple(P(x, y), x + y * 100, 0); + } +}; + +template +struct generate_value< boost::tuple >, int, int> > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + typedef boost::tuple R; + static R apply(int x, int y) + { + return boost::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0); + } +}; + template struct generate_value< bg::model::point > { @@ -141,6 +164,29 @@ struct generate_value< std::pair >, in } }; +template +struct generate_value< boost::tuple, int, int> > +{ + typedef bg::model::point P; + typedef boost::tuple R; + static R apply(int x, int y, int z) + { + return boost::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0); + } +}; + +template +struct generate_value< boost::tuple >, int, int> > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + typedef boost::tuple R; + static R apply(int x, int y, int z) + { + return boost::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0); + } +}; + template struct generate_input {}; @@ -281,7 +327,7 @@ void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector -void test_intersects_and_disjoint(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -291,11 +337,23 @@ void test_intersects_and_disjoint(bgi::rtree const& tree, std::vect test_spatial_query(tree, qbox, expected_output); test_spatial_query(tree, bgi::intersects(qbox), expected_output); - test_spatial_query(tree, !bgi::not_intersects(qbox), expected_output); test_spatial_query(tree, !bgi::disjoint(qbox), expected_output); - test_spatial_query(tree, bgi::not_disjoint(qbox), expected_output); } +template +void test_disjoint(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +{ + std::vector expected_output; + + BOOST_FOREACH(Value const& v, input) + if ( bg::disjoint(tree.translator()(v), qbox) ) + expected_output.push_back(v); + + test_spatial_query(tree, bgi::disjoint(qbox), expected_output); + test_spatial_query(tree, !bgi::intersects(qbox), expected_output); +} + + template void test_covered_by(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { @@ -599,26 +657,148 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con //TODO - test SWAP } +// rtree creation and insertion + +template +void test_create_insert(bgi::rtree & tree, std::vector const& input, Box const& qbox) +{ + typedef bgi::rtree T; + + std::vector expected_output; + tree.spatial_query(qbox, std::back_inserter(expected_output)); + + { + T t(tree.parameters()); + BOOST_FOREACH(Value const& v, input) + t.insert(v); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + t.spatial_query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + { + T t(input.begin(), input.end(), tree.parameters()); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + t.spatial_query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + { + T t(input, tree.parameters()); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + t.spatial_query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + { + T t(tree.parameters()); + t.insert(input.begin(), input.end()); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + t.spatial_query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + { + T t(tree.parameters()); + t.insert(input); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + t.spatial_query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + + { + T t(tree.parameters()); + BOOST_FOREACH(Value const& v, input) + bgi::insert(t, v); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + bgi::spatial_query(t, qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + { + T t(tree.parameters()); + bgi::insert(t, input.begin(), input.end()); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + bgi::spatial_query(t, qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + { + T t(tree.parameters()); + bgi::insert(t, input); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + bgi::spatial_query(t, qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } +} + // rtree removing template void test_remove(bgi::rtree & tree, Box const& qbox) { - size_t prev_size = tree.size(); + typedef bgi::rtree T; - std::vector output; - tree.spatial_query(qbox, std::back_inserter(output)); + std::vector values_to_remove; + tree.spatial_query(qbox, std::back_inserter(values_to_remove)); + BOOST_CHECK(0 < values_to_remove.size()); - BOOST_CHECK(0 < output.size()); + std::vector expected_output; + tree.spatial_query(bgi::disjoint(qbox), std::back_inserter(expected_output)); - tree.remove(output.begin(), output.end()); + { + T t(tree); + BOOST_FOREACH(Value const& v, values_to_remove) + t.remove(v); + std::vector output; + t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + test_compare_outputs(t, output, expected_output); + } + { + T t(tree); + t.remove(values_to_remove.begin(), values_to_remove.end()); + std::vector output; + t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + test_compare_outputs(t, output, expected_output); + } + { + T t(tree); + t.remove(values_to_remove); + std::vector output; + t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + test_compare_outputs(t, output, expected_output); + } - BOOST_CHECK(tree.size() == prev_size - output.size()); - - output.clear(); - tree.spatial_query(qbox, std::back_inserter(output)); - - BOOST_CHECK(0 == output.size()); + { + T t(tree); + BOOST_FOREACH(Value const& v, values_to_remove) + bgi::remove(t, v); + std::vector output; + bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + test_compare_outputs(t, output, expected_output); + } + { + T t(tree); + bgi::remove(t, values_to_remove.begin(), values_to_remove.end()); + std::vector output; + bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + test_compare_outputs(t, output, expected_output); + } + { + T t(tree); + bgi::remove(t, values_to_remove); + std::vector output; + bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); + BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + test_compare_outputs(t, output, expected_output); + } } // run all tests for a single Algorithm and single rtree @@ -638,7 +818,8 @@ void test_rtree_by_value(Parameters const& parameters) generate_rtree(tree, input, qbox); - test_intersects_and_disjoint(tree, input, qbox); + test_intersects(tree, input, qbox); + test_disjoint(tree, input, qbox); test_covered_by(tree, input, qbox); test_overlaps(tree, input, qbox); //test_touches(tree, input, qbox); @@ -654,6 +835,7 @@ void test_rtree_by_value(Parameters const& parameters) test_copy_assignment_swap_move(tree, qbox); + test_create_insert(tree, input, qbox); test_remove(tree, qbox); // empty tree test @@ -661,7 +843,8 @@ void test_rtree_by_value(Parameters const& parameters) Tree empty_tree(parameters); std::vector empty_input; - test_intersects_and_disjoint(empty_tree, empty_input, qbox); + test_intersects(empty_tree, empty_input, qbox); + test_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); @@ -681,11 +864,15 @@ void test_rtree(Parameters const& parameters = Parameters()) typedef bg::model::box Box; typedef std::pair PairB; typedef std::pair PairP; + typedef boost::tuple TupleP; + typedef boost::tuple TupleB; test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); + test_rtree_by_value(parameters); + test_rtree_by_value(parameters); } #endif From 640ae6ced69093e09414ebd1d0190d0d7110aa88 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 26 Nov 2012 22:20:38 +0000 Subject: [PATCH 183/366] Inserter included in the rtree.hpp Added docs regarding inserter and creation of the rtree from the query results. Added info about comparison of tuples in default translator. Merged from index_dev. [SVN r81582] --- doc/html/geometry_index/r_tree.html | 4 ++ .../r_tree/creation_and_modification.html | 69 ++++++++++++++++--- .../r_tree/spatial_queries.html | 39 +++++++++++ doc/html/index.html | 2 +- doc/rtree/creation.qbk | 50 +++++++++++--- doc/rtree/spatial_query.qbk | 30 ++++++++ .../geometry/extensions/index/inserter.hpp | 10 +-- .../geometry/extensions/index/rtree/rtree.hpp | 2 + test/rtree/test_rtree.hpp | 8 +++ 9 files changed, 184 insertions(+), 30 deletions(-) diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index cda674285..42ae4edb7 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -46,6 +46,8 @@ and removing of Values

    Additional interface
    +
    Insert + iterator
    Spatial queries
    @@ -57,6 +59,8 @@ predicates
    Value predicate
    +
    Inserting + query results into the other R-tree
    Nearest neighbours queries
    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 07814d84f..a79271bfb 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -42,6 +42,8 @@ and removing of Values
    Additional interface
    +
    Insert + iterator
    - +

    Last revised: November 27, 2012 at 12:09:04 GMT

    Last revised: December 13, 2012 at 18:36:05 GMT


    diff --git a/doc/images/intersects_poly.png b/doc/images/intersects_poly.png new file mode 100644 index 0000000000000000000000000000000000000000..d87607857b8c95c8768bdc5bf5a20bed2afa7e93 GIT binary patch literal 2654 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?uqAoByD&4RNs**F`o)B`M z_V2=tdnOMjGH7<~-CvctWj$xRvuHrfv&wnA3@*h_#Tb@+6yB9EOYPkxmbQhj>c4Ne zc3}R=||4e51&7Z zy|n0)ma5xpe|y{Eho?&lx4oYbDR7zLNnhrI=YbCo_#Vhq$g+?Se3H+5w?OJel*QWP zIu^VRul+Ws$Q22Dr5-!S-{aKwcp9s?#o3unoqLZ-B(o_xzk6A!h2Ekdj$#o0`vpkZD{@b4CcX;fVEdNco`AN>54yF(*Umvz^MX?7a zoa-7A7?v|O*!VFA%)X$p%+06ga)Z>tD_pzW(Fu8vfsSy7=dBIl9k+mthg3g9$?i8^cA0 zl9nBBX10W`33zt%p^5t4l47xKthMG{#PCw!GJ}E?g9~#*27>^|4KSvI@QTQ%fA+@ZzVEZS;h*7JlCe45TibEn zEf(S56CC;yw#`%Y3vOJxJ!$F}%bc}6a&pbreWR-5a-6c~9uL>AfBr()g}Jb4=lS*Z z_Iit27pJl~eDmS%j*$DbP2)JrPhHi#0x4d-&$==T`yLDXWpCvukkW0+JW$w?$?{cT z>8d^x^%-n3%Wuy}6S-y<`#5px?PbX<&5uu%&MGuGcCM+)aP@D;oA!JkYj*!T`*GoH z!_S{f_kONrpL4_4XR*IQbnoAthAsPk-p{wy$k$tT(czujr|gp*TX%O|v}{j#ojCJw zZXM_2-%-DJ)z$rKFXLcaZW(UieS4c(e?n5+_gLqi=F3l1u3OaYJ@zWVEZ_FF{N)GE zhZI(~U0#toRkfSzQL<~p;|C@}C!ZOtZus}OV;!5kcGLUUVe@Auv+kPOQ4!bIEw%h5 z_w_pgmu9WHQ8{Bud=1Hv1NemYiX7n7^QdoBK+KFW5Cr{;dQ>F$zYfgIKA7uE*L}A(FgPA76H=Fft z8W(D}Cx?qY`LS>P_bqF34`&Me&R=-{+|PT{wy8WY;ZW}vUbDY^>XQp1cOO7gmcZo$ zofSs0?qQaXO)kt$usc*)G`m3R$9%sq<;PGZ3Q`OXCJgP0)z<{v!#V4V(i(McmRQbn zjrMx^?1$bQwoB60%R~e^OXKs_@*D?oVzaJ{mg$4w$JXgifno~lWB>c zT97fr#fs`{?SHQ%m@Rvh7;t8v@~kk{&1n*B+Y7ux`zBsl{aj?zqomg=O!wYBDwXK^ zDf?Pr#fF=icN!A}{Q4e7ezyGaz0v!%*8llhM(p z|Hn63GO+J|RXpde-(pt_GXs_Er{QvOx*z`h{oP+C_V}2f?YHxDCyxYGkm0nzxz54fl^R>mdJ?ak|FOAL@^hrCY z^MC7B_Bm-1XH-7cMg8ZGH=F$T(YLry^Ah)a=;S!9Heb@W_qzAjg==>SG^a;9+{k2- zpQa@dpTDVN>9x*y@ok=~yB!xNNoDRfk#~;q-+1%$jqA-b=cmg1_#T`SwtsEnK^|-0 zM%LL}H&)$mOSp5SMC07U+OEqUPXi7I%m|E@Vs5fjn{$Cgv6)Ec3(;h$w~SBHh8_`!4QWxJ!Xb{g=g-~SXL62w)a)Y zl^(O|LIEB_-oEApEel^=m-REXo?1w@{IJ~SG;77wJY(^PChHd1r`68n`hF;}V3y3G zmuZi~ma%P}vwYFh6013&l2t*9;e_PnHQ(nQXZgr**UHzYc7@vZYfMv0q~_07keG04 zSMDfHK1_K|Vj`0wHkOKBaYr zntA+g^~qUM=7;{6%s(^3Q0=wa=CH6C4@_EFKChmbDdck`Ur%t0_pOtw&t(QxuU?{a zx_oX!bCTA@;ORnj6VI#IuxD!ft+VBJJ2Jr`$gt;5efK3R4z1)_7tVZIXzIDIZNt?U zPV*-Q1nVvnICkv)?Vj6H)_JNd)4a2pO_)(AYt_-PzMG$a7aa|5x~63I*5viZb+zIW ze3mDE{aus%?6%*=xlb)tE}a&3{p${`jh@SIzAF8e65*Aex=8!i{D&4@*^?idXqM$Z z{nP7hYc#R1IiVx-%28KUS@wepQZ3C10=!cM`I;O}I6!<2Wf_*{3;_^7z|De#?IHtT zbH;+6+X^!lv4pemEDqcq^>wz8s9ZPa@$Fd*2j{#taaLcRVNz~&Xxd{12}!@?o_|6c zmulIB70Y}sJ!IUZxU6x*V+Dyuzsuad^R^ey|3CL#&2z~|CQ~!kN^xxYd+lTbTT?C zcW9g6OxeFuVY~5}i;iXQO*&lucPM_hkul^o@qhc%B}pnkc}~>lPFTgh$fGaQNs?nz zpnBhH{kdUhE6sP7URC&Q_p17CT7Q`Mu4f`XZ%ikMTYulXpiE}lWM;$lJ4-E|6@$}d zOR?DO{rBD#yvbBr#<)W6vQF}WwT6$beLcccXe+*@^?K&D$*zWv9oL%nAK$C&FQlBy nSN`_fj(0}qjc*$<3jN?dSu4+8nCDdmYUX*m`njxgN@xNAtl!El literal 0 HcmV?d00001 diff --git a/doc/images/intersects_ring.png b/doc/images/intersects_ring.png new file mode 100644 index 0000000000000000000000000000000000000000..6af2c96a39a63357072cddd2cede05dbebfecb6e GIT binary patch literal 2641 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?uqAoByD5Sc#^U|3a?%C{MVYvRI=-MU?~nYI3|(I9({bN>EEXt|3CeF>{=9Cp4+tB>B39r zAC6w~*g`Jj$Mg5;(PdV5eDA*dQ8ts+lDDD6k6G8f)mEHwIpg|*3(6<$x$YK7Wkgvl zeXe7{>+sTVbBNrM!l_2J*V)}vAMQv!%<4Be*kGT1a*yHONfWAHS-DC2eeNzfbDQ7j zHS_#m)z2d34n8npNSG3KK0=;h&N1Qnx9U&7W)9eK`NqMzB7u_!do>n#E&sSOK`@EY zulS&-0M7#x28G8a3@Zy=4K<6B=CG|2^jUR;Jtjsl2`q= zLvX~jsynRKyz0LnoO+{gI>XfG*b|cpDlw}xr!22xyLfo{t)lojYz!9}6r>njm>V(} zq?}^E`W)5^>nMI-Fv~}L?po_#8Edy64)-)?JUB&HCRcc)so9IpyeB3XN_I$maxpJs zaoDUUA+_^?34;Z%hv4dqwOVU71{NjGVfztrvkI~=F_mZkEFn#BFt zELAMUCH#f6Saddv?q2e_V2klC`Cq~2ns4hSUS`QTMN5&E=lGhGk(_HXaGH>sxDj zxO1|X%B9cQ?l%7O9{BnNuSl3veC({Oz<=R0#s5UP`;=#2zS2+<_ig{d?A!q3UC!n4 zt#j6`b)J6c@^*t=_4$lzk8WSPdr4jj~^^8nB||Lbj7!5 z_i?XXv!4H+VzK^wEcbz@O5KkqJbz%a^ugpO?Jdc1O^W9aW(El)@6D+4lXt&U{r~jC z8|VI?U%ltpODpN)GvklV2rvKlzCh~3%(uyJR&u?nd^>aUA5H7(Czf&lmnoGW%2eWe zF~eG|>F~zQk^fH}h3#QQhq9Qf8?D!Tmf>P-NMN#G->Ag6Xl1C*O4i^)i?)oY z!s#+inM-th6&-Fn+<$2NC4TPz2WL<2(s}#QcJIFVi|%k<)DZW%&~R4N?r4d)tF@p& zub3a(k)U1s_TEij@3ZIcn)=l<cn{1MnTn&;ziHa zz5cnkVAh<9dF!TRrM=i(U|IWmZ_Kyf&--6gvzdH6o>|m&)Y;(Dp+ei(gLYrz&41@^ znz!~~CYJ!unsw8g9$z_Y-7EWMIs0bAiSleyH{W#4eRT4NNwfRwrkg@f1zUFRK72)M z&fBf7CNCw98_qiXr!qq51h;zOj2NLu?m(J6C$Ia?Aa@djCIXD@$~zWN}|_n!8NwVZ_Up`cmfLxP`ZO zvzoP^e>d-e%Wz zg~k~k7ejvZWC-vzIhxFDZLU})#&NG*u!#0USedlL6 z&ds0Za4ly%kSSF*Tk|Z>``>T;=CECvw2O63_@wxc-xQW#{<7Fm?I6##yWgBn{@7J8 z>D`?TZ{uFK2ODUvt6!x)iE+uP%%t$tZM*#hc_v(D*z(L|WyYn%ZR%FehiEXq8%H;B{yVquC4v(ceW)p=~UgDi`stZ$sR>dF`5Kh+|veLhn~ zX7>{lJK5NXjvSNonHn;?-?MF{BrWb+? zzbntpTfimG=f_-l^zwsW+>01z7Vrx2GFbK+T@#hg&M9qwxvg4IwYWW~Y{mnVi7cDt zQcOA3jydfAy+>k>+Q%Hx#ixR*!{f4{s%d}GG)o97C?-A%Y*df9!h=KQz5JZl4&T$VX&rMNln&CDW| zRHfw?^<;eSzL{Q^(r_76(ZT8&aGeLKeN>L`R9+z8TVd|nd*sCj4qhwY`zI_OzT{AN zWpeDweI>K7c6Wv4j111^QZlRsvjn_ew=tcXtClu@bx_OU&*cYhXC{5!$+W`GM*8@~ zQZ9xfXk}`0>5rA~ndfJj{et%<^u;mncw@4af61-gf1I6`-;8EeuVI{X?BJI-+lioNfZwXGF0i^hH0E4pj3~#dK*`6y!se^}l`Fcv&hgvd74P59 z*n2zng`%d!{rQZMZ|;0+yS33?kMGBxZR-yQp36LUhvlHcoEVw9YUu|zF1z?KPq0}Y znRH;W#K#xUPfGqt)6?h0|qoR$5#lvCSwf3sNk`dQ_(2(<&O|Ck@y XzN+p}(0{_fz`)??>gTe~DWM4fQaI2S literal 0 HcmV?d00001 diff --git a/doc/rtree/spatial_query.qbk b/doc/rtree/spatial_query.qbk index 562555444..305bc241f 100644 --- a/doc/rtree/spatial_query.qbk +++ b/doc/rtree/spatial_query.qbk @@ -13,17 +13,22 @@ 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. Names of predicates corresponds to names of __boost_geometry__ algorithms. The examples of some -basic queries may be found in the table below. The query region and result `Value`s are orange. +basic queries may be found in tables below. The query region and result `Value`s are orange. [table -[[intersects (default)] [covered_by] [disjoint] [overlaps] [within]] +[[intersects(Box) - default] [covered_by(Box)] [disjoint(Box)] [overlaps(Box)] [within(Box)]] [[[$../images/intersects.png]] [[$../images/within.png]] [[$../images/disjoint.png]] [[$../images/overlaps.png]] [[$../images/within.png]]] ] +[table +[[intersects(Ring)] [intersects(Polygon)]] +[[[$../images/intersects_ring.png]] [[$../images/intersects_poly.png]]] +] + [section Basic queries] There are three ways to perform a spatial query. Following queries returns -`__value__`s intersecting some box_region. +`__value__`s intersecting some region defined as a box in this example. Method call @@ -47,7 +52,7 @@ Use of pipe operator generating a range [section Spatial predicates] To explicitly define one of the predicates one may pass it to the `spatial_query()` as -the first argument instead of `Box`. +the first argument. 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 @@ -71,7 +76,7 @@ or `boost::tuple`. These predicates are connected by l Passing all predicates together not only makes possible to construct advanced queries but is also faster than separate calls because the tree is traversed only once. Traversing is continued and `Value`s are returned only if all predicates are met. Predicates are checked left-to-right so placing -most restictive predicates first should accelerate the search even more. +most restictive predicates first should accelerate the search. rt.spatial_query( std::make_pair( diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 4dab18cff..74d3aed82 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -11,8 +11,13 @@ #define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE +#include + #include +#include +#include + #include #include #include @@ -24,6 +29,8 @@ namespace bgi = bg::index; typedef bg::model::point P; typedef bg::model::box

    B; //bgi::rtree t(2, 1); +typedef bg::model::ring

    R; +typedef bg::model::polygon

    Poly; bgi::rtree< B, @@ -38,9 +45,11 @@ float max_distance = 30; size_t count = 5; std::vector nearest_boxes; B search_box; +R search_ring; +Poly search_poly; enum query_mode_type { - qm_knn, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw, qm_all + qm_knn, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw, qm_all, qm_ri, qm_pi } query_mode = qm_knn; bool search_valid = false; @@ -113,6 +122,111 @@ void query() std::cout << "boxes not found\n"; } +template +void query_ring() +{ + float x = ( rand() % 1000 ) / 10.0f; + float y = ( rand() % 1000 ) / 10.0f; + float w = 10 + ( rand() % 1000 ) / 100.0f; + float h = 10 + ( rand() % 1000 ) / 100.0f; + + search_ring.clear(); + search_ring.push_back(P(x - w, y - h)); + search_ring.push_back(P(x - w/2, y - h)); + search_ring.push_back(P(x, y - 3*h/2)); + search_ring.push_back(P(x + w/2, y - h)); + search_ring.push_back(P(x + w, y - h)); + search_ring.push_back(P(x + w, y - h/2)); + search_ring.push_back(P(x + 3*w/2, y)); + search_ring.push_back(P(x + w, y + h/2)); + search_ring.push_back(P(x + w, y + h)); + search_ring.push_back(P(x + w/2, y + h)); + search_ring.push_back(P(x, y + 3*h/2)); + search_ring.push_back(P(x - w/2, y + h)); + search_ring.push_back(P(x - w, y + h)); + search_ring.push_back(P(x - w, y + h/2)); + search_ring.push_back(P(x - 3*w/2, y)); + search_ring.push_back(P(x - w, y - h/2)); + search_ring.push_back(P(x - w, y - h)); + + nearest_boxes.clear(); + found_count = t.spatial_query(Predicate(search_ring), std::back_inserter(nearest_boxes) ); + + if ( found_count > 0 ) + { + std::cout << "search ring: "; + BOOST_FOREACH(P const& p, search_ring) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, p); + std::cout << ' '; + } + std::cout << "\nfound: "; + for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); + std::cout << '\n'; + } + } + else + std::cout << "boxes not found\n"; +} + +template +void query_poly() +{ + float x = ( rand() % 1000 ) / 10.0f; + float y = ( rand() % 1000 ) / 10.0f; + float w = 10 + ( rand() % 1000 ) / 100.0f; + float h = 10 + ( rand() % 1000 ) / 100.0f; + + search_poly.clear(); + search_poly.outer().push_back(P(x - w, y - h)); + search_poly.outer().push_back(P(x - w/2, y - h)); + search_poly.outer().push_back(P(x, y - 3*h/2)); + search_poly.outer().push_back(P(x + w/2, y - h)); + search_poly.outer().push_back(P(x + w, y - h)); + search_poly.outer().push_back(P(x + w, y - h/2)); + search_poly.outer().push_back(P(x + 3*w/2, y)); + search_poly.outer().push_back(P(x + w, y + h/2)); + search_poly.outer().push_back(P(x + w, y + h)); + search_poly.outer().push_back(P(x + w/2, y + h)); + search_poly.outer().push_back(P(x, y + 3*h/2)); + search_poly.outer().push_back(P(x - w/2, y + h)); + search_poly.outer().push_back(P(x - w, y + h)); + search_poly.outer().push_back(P(x - w, y + h/2)); + search_poly.outer().push_back(P(x - 3*w/2, y)); + search_poly.outer().push_back(P(x - w, y - h/2)); + search_poly.outer().push_back(P(x - w, y - h)); + + search_poly.inners().push_back(Poly::ring_type()); + search_poly.inners()[0].push_back(P(x - w/2, y - h/2)); + search_poly.inners()[0].push_back(P(x + w/2, y - h/2)); + search_poly.inners()[0].push_back(P(x + w/2, y + h/2)); + search_poly.inners()[0].push_back(P(x - w/2, y + h/2)); + search_poly.inners()[0].push_back(P(x - w/2, y - h/2)); + + nearest_boxes.clear(); + found_count = t.spatial_query(Predicate(search_poly), std::back_inserter(nearest_boxes) ); + + if ( found_count > 0 ) + { + std::cout << "search poly outer: "; + BOOST_FOREACH(P const& p, search_poly.outer()) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, p); + std::cout << ' '; + } + std::cout << "\nfound: "; + for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); + std::cout << '\n'; + } + } + else + std::cout << "boxes not found\n"; +} + void search() { if ( query_mode == qm_knn ) @@ -139,6 +253,10 @@ void search() query< bgi::detail::not_within >(); else if ( query_mode == qm_all ) query< bgi::detail::intersects >(); + else if ( query_mode == qm_ri ) + query_ring< bgi::detail::intersects >(); + else if ( query_mode == qm_pi ) + query_poly< bgi::detail::intersects >(); search_valid = true; } @@ -171,7 +289,7 @@ void draw_knn_area() glEnd(); } -void draw_query_area() +void draw_query_box_area() { float x1 = boost::geometry::get(search_box); float y1 = boost::geometry::get(search_box); @@ -188,6 +306,36 @@ void draw_query_area() glEnd(); } +template +void draw_ring_area(Range const& range) +{ + float z = t.depth(); + + // search box + glBegin(GL_LINE_LOOP); + + BOOST_FOREACH(P const& p, range) + { + float x = boost::geometry::get<0>(p); + float y = boost::geometry::get<1>(p); + + glVertex3f(x, y, z); + } + glEnd(); +} + +void draw_query_ring_area() +{ + draw_ring_area(search_ring); +} + +void draw_query_poly_area() +{ + draw_ring_area(search_poly.outer()); + BOOST_FOREACH(Poly::ring_type const& r, search_poly.inners()) + draw_ring_area(r); +} + void render_scene(void) { glClear(GL_COLOR_BUFFER_BIT); @@ -200,8 +348,12 @@ void render_scene(void) if ( query_mode == qm_knn ) draw_knn_area(); + else if ( query_mode == qm_ri ) + draw_query_ring_area(); + else if ( query_mode == qm_pi ) + draw_query_poly_area(); else - draw_query_area(); + draw_query_box_area(); for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) boost::geometry::index::detail::rtree::visitors::detail::gl_draw_indexable(nearest_boxes[i], t.depth()); @@ -357,6 +509,10 @@ void keyboard(unsigned char key, int x, int y) query_mode = qm_nw; else if ( current_line == "all" ) query_mode = qm_all; + else if ( current_line == "ri" ) + query_mode = qm_ri; + else if ( current_line == "pi" ) + query_mode = qm_pi; search(); glutPostRedisplay(); @@ -372,8 +528,15 @@ void keyboard(unsigned char key, int x, int y) } } +#include +#include + int main(int argc, char **argv) { + bg::model::linestring

    s; + B b; + bg::intersects(s, b); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); glutInitWindowPosition(100,100); From 1840b1abee90f127cdfdc3fabe170192c4a4a221 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 18:50:38 +0000 Subject: [PATCH 195/366] Removed not compiling test code from GLUT Vis. [SVN r81909] --- tests/additional_glut_vis.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 74d3aed82..4bd34935b 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -528,15 +528,8 @@ void keyboard(unsigned char key, int x, int y) } } -#include -#include - int main(int argc, char **argv) { - bg::model::linestring

    s; - B b; - bg::intersects(s, b); - glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); glutInitWindowPosition(100,100); From d04440d13e9941592e428a8593e9fb44ba0fc588 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 20:38:05 +0000 Subject: [PATCH 196/366] rtree all tests divided into 2 files(for points and boxes) because b2 was complaining about the files sizes. rtree tests were generated by tests/rtree_test_generator.cpp [SVN r81912] --- test/Jamfile.v2 | 2 - test/rtree/Jamfile.v2 | 56 +------- test/rtree/generated/Jamfile.v2 | 108 ++++++++++++++++ test/rtree/generated/rtree_b2d_linear.cpp | 20 +++ test/rtree/generated/rtree_b2d_linear_rt.cpp | 20 +++ test/rtree/generated/rtree_b2d_quadratic.cpp | 20 +++ .../generated/rtree_b2d_quadratic_rt.cpp | 20 +++ test/rtree/generated/rtree_b2d_rstar.cpp | 20 +++ test/rtree/generated/rtree_b2d_rstar_rt.cpp | 20 +++ .../rtree_b2f_linear.cpp} | 7 +- .../rtree_b2f_linear_rt.cpp} | 7 +- .../rtree_b2f_quadratic.cpp} | 7 +- .../rtree_b2f_quadratic_rt.cpp} | 7 +- test/rtree/generated/rtree_b2f_rstar.cpp | 20 +++ test/rtree/generated/rtree_b2f_rstar_rt.cpp | 20 +++ test/rtree/generated/rtree_b2i_linear.cpp | 20 +++ test/rtree/generated/rtree_b2i_linear_rt.cpp | 20 +++ test/rtree/generated/rtree_b2i_quadratic.cpp | 20 +++ .../generated/rtree_b2i_quadratic_rt.cpp | 20 +++ test/rtree/generated/rtree_b2i_rstar.cpp | 20 +++ test/rtree/generated/rtree_b2i_rstar_rt.cpp | 20 +++ .../rtree_b2tt_linear.cpp} | 8 +- .../rtree_b2tt_linear_rt.cpp} | 9 +- .../rtree_b2tt_quadratic.cpp} | 8 +- .../rtree_b2tt_quadratic_rt.cpp} | 8 +- test/rtree/generated/rtree_b2tt_rstar.cpp | 22 ++++ test/rtree/generated/rtree_b2tt_rstar_rt.cpp | 22 ++++ test/rtree/generated/rtree_b3d_linear.cpp | 20 +++ test/rtree/generated/rtree_b3d_linear_rt.cpp | 20 +++ test/rtree/generated/rtree_b3d_quadratic.cpp | 20 +++ .../generated/rtree_b3d_quadratic_rt.cpp | 20 +++ test/rtree/generated/rtree_b3d_rstar.cpp | 20 +++ test/rtree/generated/rtree_b3d_rstar_rt.cpp | 20 +++ test/rtree/generated/rtree_b3f_linear.cpp | 20 +++ test/rtree/generated/rtree_b3f_linear_rt.cpp | 20 +++ test/rtree/generated/rtree_b3f_quadratic.cpp | 20 +++ .../generated/rtree_b3f_quadratic_rt.cpp | 20 +++ test/rtree/generated/rtree_b3f_rstar.cpp | 20 +++ test/rtree/generated/rtree_b3f_rstar_rt.cpp | 20 +++ test/rtree/generated/rtree_b3i_linear.cpp | 20 +++ test/rtree/generated/rtree_b3i_linear_rt.cpp | 20 +++ test/rtree/generated/rtree_b3i_quadratic.cpp | 20 +++ .../generated/rtree_b3i_quadratic_rt.cpp | 20 +++ test/rtree/generated/rtree_b3i_rstar.cpp | 20 +++ test/rtree/generated/rtree_b3i_rstar_rt.cpp | 20 +++ .../rtree_b3tt_linear.cpp} | 8 +- .../rtree_b3tt_linear_rt.cpp} | 8 +- .../rtree_b3tt_quadratic.cpp} | 8 +- .../rtree_b3tt_quadratic_rt.cpp} | 8 +- test/rtree/generated/rtree_b3tt_rstar.cpp | 22 ++++ test/rtree/generated/rtree_b3tt_rstar_rt.cpp | 22 ++++ test/rtree/generated/rtree_p2d_linear.cpp | 19 +++ test/rtree/generated/rtree_p2d_linear_rt.cpp | 19 +++ test/rtree/generated/rtree_p2d_quadratic.cpp | 19 +++ .../generated/rtree_p2d_quadratic_rt.cpp | 19 +++ test/rtree/generated/rtree_p2d_rstar.cpp | 19 +++ test/rtree/generated/rtree_p2d_rstar_rt.cpp | 19 +++ test/rtree/generated/rtree_p2f_linear.cpp | 19 +++ test/rtree/generated/rtree_p2f_linear_rt.cpp | 19 +++ test/rtree/generated/rtree_p2f_quadratic.cpp | 19 +++ .../generated/rtree_p2f_quadratic_rt.cpp | 19 +++ test/rtree/generated/rtree_p2f_rstar.cpp | 19 +++ test/rtree/generated/rtree_p2f_rstar_rt.cpp | 19 +++ test/rtree/generated/rtree_p2i_linear.cpp | 19 +++ test/rtree/generated/rtree_p2i_linear_rt.cpp | 19 +++ test/rtree/generated/rtree_p2i_quadratic.cpp | 19 +++ .../generated/rtree_p2i_quadratic_rt.cpp | 19 +++ test/rtree/generated/rtree_p2i_rstar.cpp | 19 +++ test/rtree/generated/rtree_p2i_rstar_rt.cpp | 19 +++ test/rtree/generated/rtree_p2tt_linear.cpp | 21 +++ test/rtree/generated/rtree_p2tt_linear_rt.cpp | 21 +++ test/rtree/generated/rtree_p2tt_quadratic.cpp | 21 +++ .../generated/rtree_p2tt_quadratic_rt.cpp | 21 +++ test/rtree/generated/rtree_p2tt_rstar.cpp | 21 +++ test/rtree/generated/rtree_p2tt_rstar_rt.cpp | 21 +++ test/rtree/generated/rtree_p3d_linear.cpp | 19 +++ test/rtree/generated/rtree_p3d_linear_rt.cpp | 19 +++ test/rtree/generated/rtree_p3d_quadratic.cpp | 19 +++ .../generated/rtree_p3d_quadratic_rt.cpp | 19 +++ test/rtree/generated/rtree_p3d_rstar.cpp | 19 +++ test/rtree/generated/rtree_p3d_rstar_rt.cpp | 19 +++ test/rtree/generated/rtree_p3f_linear.cpp | 19 +++ test/rtree/generated/rtree_p3f_linear_rt.cpp | 19 +++ test/rtree/generated/rtree_p3f_quadratic.cpp | 19 +++ .../generated/rtree_p3f_quadratic_rt.cpp | 19 +++ test/rtree/generated/rtree_p3f_rstar.cpp | 19 +++ test/rtree/generated/rtree_p3f_rstar_rt.cpp | 19 +++ test/rtree/generated/rtree_p3i_linear.cpp | 19 +++ test/rtree/generated/rtree_p3i_linear_rt.cpp | 19 +++ test/rtree/generated/rtree_p3i_quadratic.cpp | 19 +++ .../generated/rtree_p3i_quadratic_rt.cpp | 19 +++ test/rtree/generated/rtree_p3i_rstar.cpp | 19 +++ test/rtree/generated/rtree_p3i_rstar_rt.cpp | 19 +++ test/rtree/generated/rtree_p3tt_linear.cpp | 21 +++ test/rtree/generated/rtree_p3tt_linear_rt.cpp | 21 +++ test/rtree/generated/rtree_p3tt_quadratic.cpp | 21 +++ .../generated/rtree_p3tt_quadratic_rt.cpp | 21 +++ test/rtree/generated/rtree_p3tt_rstar.cpp | 21 +++ test/rtree/generated/rtree_p3tt_rstar_rt.cpp | 21 +++ test/rtree/rtree2d_linear_d.cpp | 23 ---- test/rtree/rtree2d_linear_d_rt.cpp | 23 ---- test/rtree/rtree2d_linear_f_rt.cpp | 23 ---- test/rtree/rtree2d_linear_i_rt.cpp | 23 ---- test/rtree/rtree2d_linear_tt_rt.cpp | 27 ---- test/rtree/rtree2d_quadratic_d.cpp | 23 ---- test/rtree/rtree2d_quadratic_d_rt.cpp | 23 ---- test/rtree/rtree2d_quadratic_f.cpp | 23 ---- test/rtree/rtree2d_quadratic_f_rt.cpp | 23 ---- test/rtree/rtree2d_quadratic_i.cpp | 23 ---- test/rtree/rtree2d_quadratic_i_rt.cpp | 23 ---- test/rtree/rtree2d_quadratic_tt_rt.cpp | 26 ---- test/rtree/rtree2d_rstar_d.cpp | 23 ---- test/rtree/rtree2d_rstar_d_rt.cpp | 23 ---- test/rtree/rtree2d_rstar_f.cpp | 23 ---- test/rtree/rtree2d_rstar_f_rt.cpp | 23 ---- test/rtree/rtree2d_rstar_i.cpp | 23 ---- test/rtree/rtree2d_rstar_i_rt.cpp | 23 ---- test/rtree/rtree3d_linear_d.cpp | 23 ---- test/rtree/rtree3d_linear_d_rt.cpp | 23 ---- test/rtree/rtree3d_linear_f.cpp | 23 ---- test/rtree/rtree3d_linear_f_rt.cpp | 23 ---- test/rtree/rtree3d_linear_i.cpp | 23 ---- test/rtree/rtree3d_linear_i_rt.cpp | 23 ---- test/rtree/rtree3d_linear_tt_rt.cpp | 26 ---- test/rtree/rtree3d_quadratic_d.cpp | 23 ---- test/rtree/rtree3d_quadratic_d_rt.cpp | 23 ---- test/rtree/rtree3d_quadratic_f.cpp | 23 ---- test/rtree/rtree3d_quadratic_f_rt.cpp | 23 ---- test/rtree/rtree3d_quadratic_i.cpp | 23 ---- test/rtree/rtree3d_quadratic_i_rt.cpp | 23 ---- test/rtree/rtree3d_quadratic_tt_rt.cpp | 26 ---- test/rtree/rtree3d_rstar_d.cpp | 23 ---- test/rtree/rtree3d_rstar_d_rt.cpp | 23 ---- test/rtree/rtree3d_rstar_f_rt.cpp | 23 ---- test/rtree/rtree3d_rstar_i_rt.cpp | 23 ---- test/rtree/test_rtree.hpp | 21 ++- tests/rtree_test_generator.cpp | 122 ++++++++++++++++++ 137 files changed, 1934 insertions(+), 973 deletions(-) create mode 100644 test/rtree/generated/Jamfile.v2 create mode 100644 test/rtree/generated/rtree_b2d_linear.cpp create mode 100644 test/rtree/generated/rtree_b2d_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_b2d_quadratic.cpp create mode 100644 test/rtree/generated/rtree_b2d_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_b2d_rstar.cpp create mode 100644 test/rtree/generated/rtree_b2d_rstar_rt.cpp rename test/rtree/{rtree3d_rstar_i.cpp => generated/rtree_b2f_linear.cpp} (74%) rename test/rtree/{rtree2d_linear_i.cpp => generated/rtree_b2f_linear_rt.cpp} (74%) rename test/rtree/{rtree3d_rstar_f.cpp => generated/rtree_b2f_quadratic.cpp} (74%) rename test/rtree/{rtree2d_linear_f.cpp => generated/rtree_b2f_quadratic_rt.cpp} (74%) create mode 100644 test/rtree/generated/rtree_b2f_rstar.cpp create mode 100644 test/rtree/generated/rtree_b2f_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_b2i_linear.cpp create mode 100644 test/rtree/generated/rtree_b2i_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_b2i_quadratic.cpp create mode 100644 test/rtree/generated/rtree_b2i_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_b2i_rstar.cpp create mode 100644 test/rtree/generated/rtree_b2i_rstar_rt.cpp rename test/rtree/{rtree2d_rstar_tt.cpp => generated/rtree_b2tt_linear.cpp} (83%) rename test/rtree/{rtree2d_linear_tt.cpp => generated/rtree_b2tt_linear_rt.cpp} (83%) rename test/rtree/{rtree2d_quadratic_tt.cpp => generated/rtree_b2tt_quadratic.cpp} (83%) rename test/rtree/{rtree2d_rstar_tt_rt.cpp => generated/rtree_b2tt_quadratic_rt.cpp} (83%) create mode 100644 test/rtree/generated/rtree_b2tt_rstar.cpp create mode 100644 test/rtree/generated/rtree_b2tt_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_b3d_linear.cpp create mode 100644 test/rtree/generated/rtree_b3d_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_b3d_quadratic.cpp create mode 100644 test/rtree/generated/rtree_b3d_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_b3d_rstar.cpp create mode 100644 test/rtree/generated/rtree_b3d_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_b3f_linear.cpp create mode 100644 test/rtree/generated/rtree_b3f_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_b3f_quadratic.cpp create mode 100644 test/rtree/generated/rtree_b3f_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_b3f_rstar.cpp create mode 100644 test/rtree/generated/rtree_b3f_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_b3i_linear.cpp create mode 100644 test/rtree/generated/rtree_b3i_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_b3i_quadratic.cpp create mode 100644 test/rtree/generated/rtree_b3i_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_b3i_rstar.cpp create mode 100644 test/rtree/generated/rtree_b3i_rstar_rt.cpp rename test/rtree/{rtree3d_rstar_tt.cpp => generated/rtree_b3tt_linear.cpp} (83%) rename test/rtree/{rtree3d_linear_tt.cpp => generated/rtree_b3tt_linear_rt.cpp} (83%) rename test/rtree/{rtree3d_rstar_tt_rt.cpp => generated/rtree_b3tt_quadratic.cpp} (83%) rename test/rtree/{rtree3d_quadratic_tt.cpp => generated/rtree_b3tt_quadratic_rt.cpp} (82%) create mode 100644 test/rtree/generated/rtree_b3tt_rstar.cpp create mode 100644 test/rtree/generated/rtree_b3tt_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p2d_linear.cpp create mode 100644 test/rtree/generated/rtree_p2d_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p2d_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p2d_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p2d_rstar.cpp create mode 100644 test/rtree/generated/rtree_p2d_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p2f_linear.cpp create mode 100644 test/rtree/generated/rtree_p2f_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p2f_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p2f_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p2f_rstar.cpp create mode 100644 test/rtree/generated/rtree_p2f_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p2i_linear.cpp create mode 100644 test/rtree/generated/rtree_p2i_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p2i_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p2i_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p2i_rstar.cpp create mode 100644 test/rtree/generated/rtree_p2i_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p2tt_linear.cpp create mode 100644 test/rtree/generated/rtree_p2tt_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p2tt_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p2tt_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p2tt_rstar.cpp create mode 100644 test/rtree/generated/rtree_p2tt_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p3d_linear.cpp create mode 100644 test/rtree/generated/rtree_p3d_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p3d_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p3d_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p3d_rstar.cpp create mode 100644 test/rtree/generated/rtree_p3d_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p3f_linear.cpp create mode 100644 test/rtree/generated/rtree_p3f_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p3f_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p3f_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p3f_rstar.cpp create mode 100644 test/rtree/generated/rtree_p3f_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p3i_linear.cpp create mode 100644 test/rtree/generated/rtree_p3i_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p3i_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p3i_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p3i_rstar.cpp create mode 100644 test/rtree/generated/rtree_p3i_rstar_rt.cpp create mode 100644 test/rtree/generated/rtree_p3tt_linear.cpp create mode 100644 test/rtree/generated/rtree_p3tt_linear_rt.cpp create mode 100644 test/rtree/generated/rtree_p3tt_quadratic.cpp create mode 100644 test/rtree/generated/rtree_p3tt_quadratic_rt.cpp create mode 100644 test/rtree/generated/rtree_p3tt_rstar.cpp create mode 100644 test/rtree/generated/rtree_p3tt_rstar_rt.cpp delete mode 100644 test/rtree/rtree2d_linear_d.cpp delete mode 100644 test/rtree/rtree2d_linear_d_rt.cpp delete mode 100644 test/rtree/rtree2d_linear_f_rt.cpp delete mode 100644 test/rtree/rtree2d_linear_i_rt.cpp delete mode 100644 test/rtree/rtree2d_linear_tt_rt.cpp delete mode 100644 test/rtree/rtree2d_quadratic_d.cpp delete mode 100644 test/rtree/rtree2d_quadratic_d_rt.cpp delete mode 100644 test/rtree/rtree2d_quadratic_f.cpp delete mode 100644 test/rtree/rtree2d_quadratic_f_rt.cpp delete mode 100644 test/rtree/rtree2d_quadratic_i.cpp delete mode 100644 test/rtree/rtree2d_quadratic_i_rt.cpp delete mode 100644 test/rtree/rtree2d_quadratic_tt_rt.cpp delete mode 100644 test/rtree/rtree2d_rstar_d.cpp delete mode 100644 test/rtree/rtree2d_rstar_d_rt.cpp delete mode 100644 test/rtree/rtree2d_rstar_f.cpp delete mode 100644 test/rtree/rtree2d_rstar_f_rt.cpp delete mode 100644 test/rtree/rtree2d_rstar_i.cpp delete mode 100644 test/rtree/rtree2d_rstar_i_rt.cpp delete mode 100644 test/rtree/rtree3d_linear_d.cpp delete mode 100644 test/rtree/rtree3d_linear_d_rt.cpp delete mode 100644 test/rtree/rtree3d_linear_f.cpp delete mode 100644 test/rtree/rtree3d_linear_f_rt.cpp delete mode 100644 test/rtree/rtree3d_linear_i.cpp delete mode 100644 test/rtree/rtree3d_linear_i_rt.cpp delete mode 100644 test/rtree/rtree3d_linear_tt_rt.cpp delete mode 100644 test/rtree/rtree3d_quadratic_d.cpp delete mode 100644 test/rtree/rtree3d_quadratic_d_rt.cpp delete mode 100644 test/rtree/rtree3d_quadratic_f.cpp delete mode 100644 test/rtree/rtree3d_quadratic_f_rt.cpp delete mode 100644 test/rtree/rtree3d_quadratic_i.cpp delete mode 100644 test/rtree/rtree3d_quadratic_i_rt.cpp delete mode 100644 test/rtree/rtree3d_quadratic_tt_rt.cpp delete mode 100644 test/rtree/rtree3d_rstar_d.cpp delete mode 100644 test/rtree/rtree3d_rstar_d_rt.cpp delete mode 100644 test/rtree/rtree3d_rstar_f_rt.cpp delete mode 100644 test/rtree/rtree3d_rstar_i_rt.cpp create mode 100644 tests/rtree_test_generator.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index c38dfdf12..e102b45d0 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -21,5 +21,3 @@ project boost-geometry-index-test build-project algorithms ; build-project rtree ; -#build-project filters ; -#build-project translator ; diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index b4f756d70..543f40c70 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -6,62 +6,10 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +build-project generated ; + test-suite boost-geometry-index-rtree : - [ run rtree2d_linear_i.cpp ] - [ run rtree2d_linear_f.cpp ] - [ run rtree2d_linear_d.cpp ] - [ run rtree2d_linear_tt.cpp ] - [ run rtree2d_linear_i_rt.cpp ] - [ run rtree2d_linear_f_rt.cpp ] - [ run rtree2d_linear_d_rt.cpp ] - [ run rtree2d_linear_tt_rt.cpp ] - - [ run rtree2d_quadratic_i.cpp ] - [ run rtree2d_quadratic_f.cpp ] - [ run rtree2d_quadratic_d.cpp ] - [ run rtree2d_quadratic_tt.cpp ] - [ run rtree2d_quadratic_i_rt.cpp ] - [ run rtree2d_quadratic_f_rt.cpp ] - [ run rtree2d_quadratic_d_rt.cpp ] - [ run rtree2d_quadratic_tt_rt.cpp ] - - [ run rtree2d_rstar_i.cpp ] - [ run rtree2d_rstar_f.cpp ] - [ run rtree2d_rstar_d.cpp ] - [ run rtree2d_rstar_tt.cpp ] - [ run rtree2d_rstar_i_rt.cpp ] - [ run rtree2d_rstar_f_rt.cpp ] - [ run rtree2d_rstar_d_rt.cpp ] - [ run rtree2d_rstar_tt_rt.cpp ] - - [ run rtree3d_linear_i.cpp ] - [ run rtree3d_linear_f.cpp ] - [ run rtree3d_linear_d.cpp ] - [ run rtree3d_linear_tt.cpp ] - [ run rtree3d_linear_i_rt.cpp ] - [ run rtree3d_linear_f_rt.cpp ] - [ run rtree3d_linear_d_rt.cpp ] - [ run rtree3d_linear_tt_rt.cpp ] - - [ run rtree3d_quadratic_i.cpp ] - [ run rtree3d_quadratic_f.cpp ] - [ run rtree3d_quadratic_d.cpp ] - [ run rtree3d_quadratic_tt.cpp ] - [ run rtree3d_quadratic_i_rt.cpp ] - [ run rtree3d_quadratic_f_rt.cpp ] - [ run rtree3d_quadratic_d_rt.cpp ] - [ run rtree3d_quadratic_tt_rt.cpp ] - - [ run rtree3d_rstar_i.cpp ] - [ run rtree3d_rstar_f.cpp ] - [ run rtree3d_rstar_d.cpp ] - [ run rtree3d_rstar_tt.cpp ] - [ run rtree3d_rstar_i_rt.cpp ] - [ run rtree3d_rstar_f_rt.cpp ] - [ run rtree3d_rstar_d_rt.cpp ] - [ run rtree3d_rstar_tt_rt.cpp ] - [ run rtree_exceptions.cpp ] ; diff --git a/test/rtree/generated/Jamfile.v2 b/test/rtree/generated/Jamfile.v2 new file mode 100644 index 000000000..9a9b5e510 --- /dev/null +++ b/test/rtree/generated/Jamfile.v2 @@ -0,0 +1,108 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +test-suite boost-geometry-index-rtree-generated + : + [ run rtree_p2d_linear.cpp ] + [ run rtree_b2d_linear.cpp ] + [ run rtree_p2d_quadratic.cpp ] + [ run rtree_b2d_quadratic.cpp ] + [ run rtree_p2d_rstar.cpp ] + [ run rtree_b2d_rstar.cpp ] + [ run rtree_p2d_linear_rt.cpp ] + [ run rtree_b2d_linear_rt.cpp ] + [ run rtree_p2d_quadratic_rt.cpp ] + [ run rtree_b2d_quadratic_rt.cpp ] + [ run rtree_p2d_rstar_rt.cpp ] + [ run rtree_b2d_rstar_rt.cpp ] + [ run rtree_p2f_linear.cpp ] + [ run rtree_b2f_linear.cpp ] + [ run rtree_p2f_quadratic.cpp ] + [ run rtree_b2f_quadratic.cpp ] + [ run rtree_p2f_rstar.cpp ] + [ run rtree_b2f_rstar.cpp ] + [ run rtree_p2f_linear_rt.cpp ] + [ run rtree_b2f_linear_rt.cpp ] + [ run rtree_p2f_quadratic_rt.cpp ] + [ run rtree_b2f_quadratic_rt.cpp ] + [ run rtree_p2f_rstar_rt.cpp ] + [ run rtree_b2f_rstar_rt.cpp ] + [ run rtree_p2i_linear.cpp ] + [ run rtree_b2i_linear.cpp ] + [ run rtree_p2i_quadratic.cpp ] + [ run rtree_b2i_quadratic.cpp ] + [ run rtree_p2i_rstar.cpp ] + [ run rtree_b2i_rstar.cpp ] + [ run rtree_p2i_linear_rt.cpp ] + [ run rtree_b2i_linear_rt.cpp ] + [ run rtree_p2i_quadratic_rt.cpp ] + [ run rtree_b2i_quadratic_rt.cpp ] + [ run rtree_p2i_rstar_rt.cpp ] + [ run rtree_b2i_rstar_rt.cpp ] + [ run rtree_p2tt_linear.cpp ] + [ run rtree_b2tt_linear.cpp ] + [ run rtree_p2tt_quadratic.cpp ] + [ run rtree_b2tt_quadratic.cpp ] + [ run rtree_p2tt_rstar.cpp ] + [ run rtree_b2tt_rstar.cpp ] + [ run rtree_p2tt_linear_rt.cpp ] + [ run rtree_b2tt_linear_rt.cpp ] + [ run rtree_p2tt_quadratic_rt.cpp ] + [ run rtree_b2tt_quadratic_rt.cpp ] + [ run rtree_p2tt_rstar_rt.cpp ] + [ run rtree_b2tt_rstar_rt.cpp ] + [ run rtree_p3d_linear.cpp ] + [ run rtree_b3d_linear.cpp ] + [ run rtree_p3d_quadratic.cpp ] + [ run rtree_b3d_quadratic.cpp ] + [ run rtree_p3d_rstar.cpp ] + [ run rtree_b3d_rstar.cpp ] + [ run rtree_p3d_linear_rt.cpp ] + [ run rtree_b3d_linear_rt.cpp ] + [ run rtree_p3d_quadratic_rt.cpp ] + [ run rtree_b3d_quadratic_rt.cpp ] + [ run rtree_p3d_rstar_rt.cpp ] + [ run rtree_b3d_rstar_rt.cpp ] + [ run rtree_p3f_linear.cpp ] + [ run rtree_b3f_linear.cpp ] + [ run rtree_p3f_quadratic.cpp ] + [ run rtree_b3f_quadratic.cpp ] + [ run rtree_p3f_rstar.cpp ] + [ run rtree_b3f_rstar.cpp ] + [ run rtree_p3f_linear_rt.cpp ] + [ run rtree_b3f_linear_rt.cpp ] + [ run rtree_p3f_quadratic_rt.cpp ] + [ run rtree_b3f_quadratic_rt.cpp ] + [ run rtree_p3f_rstar_rt.cpp ] + [ run rtree_b3f_rstar_rt.cpp ] + [ run rtree_p3i_linear.cpp ] + [ run rtree_b3i_linear.cpp ] + [ run rtree_p3i_quadratic.cpp ] + [ run rtree_b3i_quadratic.cpp ] + [ run rtree_p3i_rstar.cpp ] + [ run rtree_b3i_rstar.cpp ] + [ run rtree_p3i_linear_rt.cpp ] + [ run rtree_b3i_linear_rt.cpp ] + [ run rtree_p3i_quadratic_rt.cpp ] + [ run rtree_b3i_quadratic_rt.cpp ] + [ run rtree_p3i_rstar_rt.cpp ] + [ run rtree_b3i_rstar_rt.cpp ] + [ run rtree_p3tt_linear.cpp ] + [ run rtree_b3tt_linear.cpp ] + [ run rtree_p3tt_quadratic.cpp ] + [ run rtree_b3tt_quadratic.cpp ] + [ run rtree_p3tt_rstar.cpp ] + [ run rtree_b3tt_rstar.cpp ] + [ run rtree_p3tt_linear_rt.cpp ] + [ run rtree_b3tt_linear_rt.cpp ] + [ run rtree_p3tt_quadratic_rt.cpp ] + [ run rtree_b3tt_quadratic_rt.cpp ] + [ run rtree_p3tt_rstar_rt.cpp ] + [ run rtree_b3tt_rstar_rt.cpp ] + ; + diff --git a/test/rtree/generated/rtree_b2d_linear.cpp b/test/rtree/generated/rtree_b2d_linear.cpp new file mode 100644 index 000000000..30c9f7186 --- /dev/null +++ b/test/rtree/generated/rtree_b2d_linear.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b2d_linear_rt.cpp b/test/rtree/generated/rtree_b2d_linear_rt.cpp new file mode 100644 index 000000000..06299af28 --- /dev/null +++ b/test/rtree/generated/rtree_b2d_linear_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b2d_quadratic.cpp b/test/rtree/generated/rtree_b2d_quadratic.cpp new file mode 100644 index 000000000..e403991d6 --- /dev/null +++ b/test/rtree/generated/rtree_b2d_quadratic.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b2d_quadratic_rt.cpp b/test/rtree/generated/rtree_b2d_quadratic_rt.cpp new file mode 100644 index 000000000..ed9ef4531 --- /dev/null +++ b/test/rtree/generated/rtree_b2d_quadratic_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b2d_rstar.cpp b/test/rtree/generated/rtree_b2d_rstar.cpp new file mode 100644 index 000000000..44e249dec --- /dev/null +++ b/test/rtree/generated/rtree_b2d_rstar.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b2d_rstar_rt.cpp b/test/rtree/generated/rtree_b2d_rstar_rt.cpp new file mode 100644 index 000000000..2f2deb99b --- /dev/null +++ b/test/rtree/generated/rtree_b2d_rstar_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/rtree3d_rstar_i.cpp b/test/rtree/generated/rtree_b2f_linear.cpp similarity index 74% rename from test/rtree/rtree3d_rstar_i.cpp rename to test/rtree/generated/rtree_b2f_linear.cpp index 6688566a3..cfee39bbb 100644 --- a/test/rtree/rtree3d_rstar_i.cpp +++ b/test/rtree/generated/rtree_b2f_linear.cpp @@ -9,15 +9,12 @@ #include -#include #include #include int test_main(int, char* []) { - typedef bg::model::point P3ic; - - test_rtree >(); - + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); return 0; } diff --git a/test/rtree/rtree2d_linear_i.cpp b/test/rtree/generated/rtree_b2f_linear_rt.cpp similarity index 74% rename from test/rtree/rtree2d_linear_i.cpp rename to test/rtree/generated/rtree_b2f_linear_rt.cpp index f1ea68bd0..5ee826746 100644 --- a/test/rtree/rtree2d_linear_i.cpp +++ b/test/rtree/generated/rtree_b2f_linear_rt.cpp @@ -9,15 +9,12 @@ #include -#include #include #include int test_main(int, char* []) { - typedef bg::model::point P2ic; - - test_rtree >(); - + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_rstar_f.cpp b/test/rtree/generated/rtree_b2f_quadratic.cpp similarity index 74% rename from test/rtree/rtree3d_rstar_f.cpp rename to test/rtree/generated/rtree_b2f_quadratic.cpp index f258ce1ae..84a4ecbdc 100644 --- a/test/rtree/rtree3d_rstar_f.cpp +++ b/test/rtree/generated/rtree_b2f_quadratic.cpp @@ -9,15 +9,12 @@ #include -#include #include #include int test_main(int, char* []) { - typedef bg::model::point P3fc; - - test_rtree >(); - + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); return 0; } diff --git a/test/rtree/rtree2d_linear_f.cpp b/test/rtree/generated/rtree_b2f_quadratic_rt.cpp similarity index 74% rename from test/rtree/rtree2d_linear_f.cpp rename to test/rtree/generated/rtree_b2f_quadratic_rt.cpp index 8ea8d04ff..c20fcee60 100644 --- a/test/rtree/rtree2d_linear_f.cpp +++ b/test/rtree/generated/rtree_b2f_quadratic_rt.cpp @@ -9,15 +9,12 @@ #include -#include #include #include int test_main(int, char* []) { - typedef bg::model::point P2fc; - - test_rtree >(); - + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); return 0; } diff --git a/test/rtree/generated/rtree_b2f_rstar.cpp b/test/rtree/generated/rtree_b2f_rstar.cpp new file mode 100644 index 000000000..5c9ffe78c --- /dev/null +++ b/test/rtree/generated/rtree_b2f_rstar.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b2f_rstar_rt.cpp b/test/rtree/generated/rtree_b2f_rstar_rt.cpp new file mode 100644 index 000000000..7c1f9dc61 --- /dev/null +++ b/test/rtree/generated/rtree_b2f_rstar_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b2i_linear.cpp b/test/rtree/generated/rtree_b2i_linear.cpp new file mode 100644 index 000000000..b46e391c5 --- /dev/null +++ b/test/rtree/generated/rtree_b2i_linear.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b2i_linear_rt.cpp b/test/rtree/generated/rtree_b2i_linear_rt.cpp new file mode 100644 index 000000000..f29d856be --- /dev/null +++ b/test/rtree/generated/rtree_b2i_linear_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b2i_quadratic.cpp b/test/rtree/generated/rtree_b2i_quadratic.cpp new file mode 100644 index 000000000..ebf03ea64 --- /dev/null +++ b/test/rtree/generated/rtree_b2i_quadratic.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b2i_quadratic_rt.cpp b/test/rtree/generated/rtree_b2i_quadratic_rt.cpp new file mode 100644 index 000000000..9c4e46e75 --- /dev/null +++ b/test/rtree/generated/rtree_b2i_quadratic_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b2i_rstar.cpp b/test/rtree/generated/rtree_b2i_rstar.cpp new file mode 100644 index 000000000..c7767e513 --- /dev/null +++ b/test/rtree/generated/rtree_b2i_rstar.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b2i_rstar_rt.cpp b/test/rtree/generated/rtree_b2i_rstar_rt.cpp new file mode 100644 index 000000000..ed4601a05 --- /dev/null +++ b/test/rtree/generated/rtree_b2i_rstar_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/rtree2d_rstar_tt.cpp b/test/rtree/generated/rtree_b2tt_linear.cpp similarity index 83% rename from test/rtree/rtree2d_rstar_tt.cpp rename to test/rtree/generated/rtree_b2tt_linear.cpp index 789581c08..5e258da29 100644 --- a/test/rtree/rtree2d_rstar_tt.cpp +++ b/test/rtree/generated/rtree_b2tt_linear.cpp @@ -9,18 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P2ttmc; - - test_rtree >(); + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); #endif - return 0; } diff --git a/test/rtree/rtree2d_linear_tt.cpp b/test/rtree/generated/rtree_b2tt_linear_rt.cpp similarity index 83% rename from test/rtree/rtree2d_linear_tt.cpp rename to test/rtree/generated/rtree_b2tt_linear_rt.cpp index 1d5de3635..db89744fc 100644 --- a/test/rtree/rtree2d_linear_tt.cpp +++ b/test/rtree/generated/rtree_b2tt_linear_rt.cpp @@ -9,19 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P2ttmc; - - test_rtree >(); - + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); #endif - return 0; } diff --git a/test/rtree/rtree2d_quadratic_tt.cpp b/test/rtree/generated/rtree_b2tt_quadratic.cpp similarity index 83% rename from test/rtree/rtree2d_quadratic_tt.cpp rename to test/rtree/generated/rtree_b2tt_quadratic.cpp index 1ff26daa5..78174b822 100644 --- a/test/rtree/rtree2d_quadratic_tt.cpp +++ b/test/rtree/generated/rtree_b2tt_quadratic.cpp @@ -9,18 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P2ttmc; - - test_rtree >(); + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); #endif - return 0; } diff --git a/test/rtree/rtree2d_rstar_tt_rt.cpp b/test/rtree/generated/rtree_b2tt_quadratic_rt.cpp similarity index 83% rename from test/rtree/rtree2d_rstar_tt_rt.cpp rename to test/rtree/generated/rtree_b2tt_quadratic_rt.cpp index cef0962fe..994a354f9 100644 --- a/test/rtree/rtree2d_rstar_tt_rt.cpp +++ b/test/rtree/generated/rtree_b2tt_quadratic_rt.cpp @@ -9,18 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P2ttmc; - - test_rtree(bgi::runtime::rstar(4, 2)); + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); #endif - return 0; } diff --git a/test/rtree/generated/rtree_b2tt_rstar.cpp b/test/rtree/generated/rtree_b2tt_rstar.cpp new file mode 100644 index 000000000..594946963 --- /dev/null +++ b/test/rtree/generated/rtree_b2tt_rstar.cpp @@ -0,0 +1,22 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_b2tt_rstar_rt.cpp b/test/rtree/generated/rtree_b2tt_rstar_rt.cpp new file mode 100644 index 000000000..7a5d85204 --- /dev/null +++ b/test/rtree/generated/rtree_b2tt_rstar_rt.cpp @@ -0,0 +1,22 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_b3d_linear.cpp b/test/rtree/generated/rtree_b3d_linear.cpp new file mode 100644 index 000000000..a846fa70f --- /dev/null +++ b/test/rtree/generated/rtree_b3d_linear.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3d_linear_rt.cpp b/test/rtree/generated/rtree_b3d_linear_rt.cpp new file mode 100644 index 000000000..fa17aba0c --- /dev/null +++ b/test/rtree/generated/rtree_b3d_linear_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3d_quadratic.cpp b/test/rtree/generated/rtree_b3d_quadratic.cpp new file mode 100644 index 000000000..f01a96ea9 --- /dev/null +++ b/test/rtree/generated/rtree_b3d_quadratic.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3d_quadratic_rt.cpp b/test/rtree/generated/rtree_b3d_quadratic_rt.cpp new file mode 100644 index 000000000..4a8304f06 --- /dev/null +++ b/test/rtree/generated/rtree_b3d_quadratic_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3d_rstar.cpp b/test/rtree/generated/rtree_b3d_rstar.cpp new file mode 100644 index 000000000..00cbbff8e --- /dev/null +++ b/test/rtree/generated/rtree_b3d_rstar.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3d_rstar_rt.cpp b/test/rtree/generated/rtree_b3d_rstar_rt.cpp new file mode 100644 index 000000000..2be2b343f --- /dev/null +++ b/test/rtree/generated/rtree_b3d_rstar_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3f_linear.cpp b/test/rtree/generated/rtree_b3f_linear.cpp new file mode 100644 index 000000000..d624f338d --- /dev/null +++ b/test/rtree/generated/rtree_b3f_linear.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3f_linear_rt.cpp b/test/rtree/generated/rtree_b3f_linear_rt.cpp new file mode 100644 index 000000000..360bcd554 --- /dev/null +++ b/test/rtree/generated/rtree_b3f_linear_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3f_quadratic.cpp b/test/rtree/generated/rtree_b3f_quadratic.cpp new file mode 100644 index 000000000..01481d0fa --- /dev/null +++ b/test/rtree/generated/rtree_b3f_quadratic.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3f_quadratic_rt.cpp b/test/rtree/generated/rtree_b3f_quadratic_rt.cpp new file mode 100644 index 000000000..ff46cb91c --- /dev/null +++ b/test/rtree/generated/rtree_b3f_quadratic_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3f_rstar.cpp b/test/rtree/generated/rtree_b3f_rstar.cpp new file mode 100644 index 000000000..445d030a6 --- /dev/null +++ b/test/rtree/generated/rtree_b3f_rstar.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3f_rstar_rt.cpp b/test/rtree/generated/rtree_b3f_rstar_rt.cpp new file mode 100644 index 000000000..d6c3e4b9c --- /dev/null +++ b/test/rtree/generated/rtree_b3f_rstar_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3i_linear.cpp b/test/rtree/generated/rtree_b3i_linear.cpp new file mode 100644 index 000000000..3cde64aa4 --- /dev/null +++ b/test/rtree/generated/rtree_b3i_linear.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3i_linear_rt.cpp b/test/rtree/generated/rtree_b3i_linear_rt.cpp new file mode 100644 index 000000000..5dd58494e --- /dev/null +++ b/test/rtree/generated/rtree_b3i_linear_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3i_quadratic.cpp b/test/rtree/generated/rtree_b3i_quadratic.cpp new file mode 100644 index 000000000..8e2620be0 --- /dev/null +++ b/test/rtree/generated/rtree_b3i_quadratic.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3i_quadratic_rt.cpp b/test/rtree/generated/rtree_b3i_quadratic_rt.cpp new file mode 100644 index 000000000..b115b6b50 --- /dev/null +++ b/test/rtree/generated/rtree_b3i_quadratic_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_b3i_rstar.cpp b/test/rtree/generated/rtree_b3i_rstar.cpp new file mode 100644 index 000000000..5a9162e2b --- /dev/null +++ b/test/rtree/generated/rtree_b3i_rstar.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_b3i_rstar_rt.cpp b/test/rtree/generated/rtree_b3i_rstar_rt.cpp new file mode 100644 index 000000000..4372f8821 --- /dev/null +++ b/test/rtree/generated/rtree_b3i_rstar_rt.cpp @@ -0,0 +1,20 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/rtree3d_rstar_tt.cpp b/test/rtree/generated/rtree_b3tt_linear.cpp similarity index 83% rename from test/rtree/rtree3d_rstar_tt.cpp rename to test/rtree/generated/rtree_b3tt_linear.cpp index 2f03ed6a9..ac00d5cc2 100644 --- a/test/rtree/rtree3d_rstar_tt.cpp +++ b/test/rtree/generated/rtree_b3tt_linear.cpp @@ -9,18 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P3ttmc; - - test_rtree >(); + typedef bg::model::point Point; + test_rtree_for_box(bgi::linear<4, 2>()); #endif - return 0; } diff --git a/test/rtree/rtree3d_linear_tt.cpp b/test/rtree/generated/rtree_b3tt_linear_rt.cpp similarity index 83% rename from test/rtree/rtree3d_linear_tt.cpp rename to test/rtree/generated/rtree_b3tt_linear_rt.cpp index 12ddbd444..0446c802c 100644 --- a/test/rtree/rtree3d_linear_tt.cpp +++ b/test/rtree/generated/rtree_b3tt_linear_rt.cpp @@ -9,18 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P3ttmc; - - test_rtree >(); + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::linear(4, 2)); #endif - return 0; } diff --git a/test/rtree/rtree3d_rstar_tt_rt.cpp b/test/rtree/generated/rtree_b3tt_quadratic.cpp similarity index 83% rename from test/rtree/rtree3d_rstar_tt_rt.cpp rename to test/rtree/generated/rtree_b3tt_quadratic.cpp index c99d9ddfc..e73ed1996 100644 --- a/test/rtree/rtree3d_rstar_tt_rt.cpp +++ b/test/rtree/generated/rtree_b3tt_quadratic.cpp @@ -9,18 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P3ttmc; - - test_rtree(bgi::runtime::rstar(4, 2)); + typedef bg::model::point Point; + test_rtree_for_box(bgi::quadratic<4, 2>()); #endif - return 0; } diff --git a/test/rtree/rtree3d_quadratic_tt.cpp b/test/rtree/generated/rtree_b3tt_quadratic_rt.cpp similarity index 82% rename from test/rtree/rtree3d_quadratic_tt.cpp rename to test/rtree/generated/rtree_b3tt_quadratic_rt.cpp index 9ed655257..f91e35431 100644 --- a/test/rtree/rtree3d_quadratic_tt.cpp +++ b/test/rtree/generated/rtree_b3tt_quadratic_rt.cpp @@ -9,18 +9,14 @@ #include -#include #include #include int test_main(int, char* []) { - #ifdef HAVE_TTMATH - typedef bg::model::point P3ttmc; - - test_rtree >(); + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::quadratic(4, 2)); #endif - return 0; } diff --git a/test/rtree/generated/rtree_b3tt_rstar.cpp b/test/rtree/generated/rtree_b3tt_rstar.cpp new file mode 100644 index 000000000..3b2dec2f8 --- /dev/null +++ b/test/rtree/generated/rtree_b3tt_rstar.cpp @@ -0,0 +1,22 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_box(bgi::rstar<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_b3tt_rstar_rt.cpp b/test/rtree/generated/rtree_b3tt_rstar_rt.cpp new file mode 100644 index 000000000..a352816b1 --- /dev/null +++ b/test/rtree/generated/rtree_b3tt_rstar_rt.cpp @@ -0,0 +1,22 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_box(bgi::runtime::rstar(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p2d_linear.cpp b/test/rtree/generated/rtree_p2d_linear.cpp new file mode 100644 index 000000000..9e140d87d --- /dev/null +++ b/test/rtree/generated/rtree_p2d_linear.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2d_linear_rt.cpp b/test/rtree/generated/rtree_p2d_linear_rt.cpp new file mode 100644 index 000000000..fa0987d8d --- /dev/null +++ b/test/rtree/generated/rtree_p2d_linear_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2d_quadratic.cpp b/test/rtree/generated/rtree_p2d_quadratic.cpp new file mode 100644 index 000000000..12b482b28 --- /dev/null +++ b/test/rtree/generated/rtree_p2d_quadratic.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2d_quadratic_rt.cpp b/test/rtree/generated/rtree_p2d_quadratic_rt.cpp new file mode 100644 index 000000000..f5fff67dc --- /dev/null +++ b/test/rtree/generated/rtree_p2d_quadratic_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2d_rstar.cpp b/test/rtree/generated/rtree_p2d_rstar.cpp new file mode 100644 index 000000000..33abbe06e --- /dev/null +++ b/test/rtree/generated/rtree_p2d_rstar.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2d_rstar_rt.cpp b/test/rtree/generated/rtree_p2d_rstar_rt.cpp new file mode 100644 index 000000000..d4a570cf0 --- /dev/null +++ b/test/rtree/generated/rtree_p2d_rstar_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2f_linear.cpp b/test/rtree/generated/rtree_p2f_linear.cpp new file mode 100644 index 000000000..365b7a30c --- /dev/null +++ b/test/rtree/generated/rtree_p2f_linear.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2f_linear_rt.cpp b/test/rtree/generated/rtree_p2f_linear_rt.cpp new file mode 100644 index 000000000..73f2800a8 --- /dev/null +++ b/test/rtree/generated/rtree_p2f_linear_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2f_quadratic.cpp b/test/rtree/generated/rtree_p2f_quadratic.cpp new file mode 100644 index 000000000..43e6dbe42 --- /dev/null +++ b/test/rtree/generated/rtree_p2f_quadratic.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2f_quadratic_rt.cpp b/test/rtree/generated/rtree_p2f_quadratic_rt.cpp new file mode 100644 index 000000000..5a7c7df12 --- /dev/null +++ b/test/rtree/generated/rtree_p2f_quadratic_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2f_rstar.cpp b/test/rtree/generated/rtree_p2f_rstar.cpp new file mode 100644 index 000000000..607369cae --- /dev/null +++ b/test/rtree/generated/rtree_p2f_rstar.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2f_rstar_rt.cpp b/test/rtree/generated/rtree_p2f_rstar_rt.cpp new file mode 100644 index 000000000..481f72fd6 --- /dev/null +++ b/test/rtree/generated/rtree_p2f_rstar_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2i_linear.cpp b/test/rtree/generated/rtree_p2i_linear.cpp new file mode 100644 index 000000000..3fdfe97fa --- /dev/null +++ b/test/rtree/generated/rtree_p2i_linear.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2i_linear_rt.cpp b/test/rtree/generated/rtree_p2i_linear_rt.cpp new file mode 100644 index 000000000..f97caa12c --- /dev/null +++ b/test/rtree/generated/rtree_p2i_linear_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2i_quadratic.cpp b/test/rtree/generated/rtree_p2i_quadratic.cpp new file mode 100644 index 000000000..be431bdc4 --- /dev/null +++ b/test/rtree/generated/rtree_p2i_quadratic.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2i_quadratic_rt.cpp b/test/rtree/generated/rtree_p2i_quadratic_rt.cpp new file mode 100644 index 000000000..feab0546e --- /dev/null +++ b/test/rtree/generated/rtree_p2i_quadratic_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2i_rstar.cpp b/test/rtree/generated/rtree_p2i_rstar.cpp new file mode 100644 index 000000000..40fe0d148 --- /dev/null +++ b/test/rtree/generated/rtree_p2i_rstar.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p2i_rstar_rt.cpp b/test/rtree/generated/rtree_p2i_rstar_rt.cpp new file mode 100644 index 000000000..ad55f2397 --- /dev/null +++ b/test/rtree/generated/rtree_p2i_rstar_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p2tt_linear.cpp b/test/rtree/generated/rtree_p2tt_linear.cpp new file mode 100644 index 000000000..7f1069109 --- /dev/null +++ b/test/rtree/generated/rtree_p2tt_linear.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p2tt_linear_rt.cpp b/test/rtree/generated/rtree_p2tt_linear_rt.cpp new file mode 100644 index 000000000..1520a3f20 --- /dev/null +++ b/test/rtree/generated/rtree_p2tt_linear_rt.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p2tt_quadratic.cpp b/test/rtree/generated/rtree_p2tt_quadratic.cpp new file mode 100644 index 000000000..b1502cf7c --- /dev/null +++ b/test/rtree/generated/rtree_p2tt_quadratic.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p2tt_quadratic_rt.cpp b/test/rtree/generated/rtree_p2tt_quadratic_rt.cpp new file mode 100644 index 000000000..631a7f112 --- /dev/null +++ b/test/rtree/generated/rtree_p2tt_quadratic_rt.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p2tt_rstar.cpp b/test/rtree/generated/rtree_p2tt_rstar.cpp new file mode 100644 index 000000000..a92617bf2 --- /dev/null +++ b/test/rtree/generated/rtree_p2tt_rstar.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p2tt_rstar_rt.cpp b/test/rtree/generated/rtree_p2tt_rstar_rt.cpp new file mode 100644 index 000000000..5464a8f1a --- /dev/null +++ b/test/rtree/generated/rtree_p2tt_rstar_rt.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p3d_linear.cpp b/test/rtree/generated/rtree_p3d_linear.cpp new file mode 100644 index 000000000..f7d143a1a --- /dev/null +++ b/test/rtree/generated/rtree_p3d_linear.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3d_linear_rt.cpp b/test/rtree/generated/rtree_p3d_linear_rt.cpp new file mode 100644 index 000000000..e413d09c5 --- /dev/null +++ b/test/rtree/generated/rtree_p3d_linear_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3d_quadratic.cpp b/test/rtree/generated/rtree_p3d_quadratic.cpp new file mode 100644 index 000000000..2d92eef5d --- /dev/null +++ b/test/rtree/generated/rtree_p3d_quadratic.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3d_quadratic_rt.cpp b/test/rtree/generated/rtree_p3d_quadratic_rt.cpp new file mode 100644 index 000000000..553dea5cc --- /dev/null +++ b/test/rtree/generated/rtree_p3d_quadratic_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3d_rstar.cpp b/test/rtree/generated/rtree_p3d_rstar.cpp new file mode 100644 index 000000000..b1e00bd33 --- /dev/null +++ b/test/rtree/generated/rtree_p3d_rstar.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3d_rstar_rt.cpp b/test/rtree/generated/rtree_p3d_rstar_rt.cpp new file mode 100644 index 000000000..bea115c70 --- /dev/null +++ b/test/rtree/generated/rtree_p3d_rstar_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3f_linear.cpp b/test/rtree/generated/rtree_p3f_linear.cpp new file mode 100644 index 000000000..9cc816df5 --- /dev/null +++ b/test/rtree/generated/rtree_p3f_linear.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3f_linear_rt.cpp b/test/rtree/generated/rtree_p3f_linear_rt.cpp new file mode 100644 index 000000000..1dc3bc40f --- /dev/null +++ b/test/rtree/generated/rtree_p3f_linear_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3f_quadratic.cpp b/test/rtree/generated/rtree_p3f_quadratic.cpp new file mode 100644 index 000000000..060a49795 --- /dev/null +++ b/test/rtree/generated/rtree_p3f_quadratic.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3f_quadratic_rt.cpp b/test/rtree/generated/rtree_p3f_quadratic_rt.cpp new file mode 100644 index 000000000..8ed2a9dcc --- /dev/null +++ b/test/rtree/generated/rtree_p3f_quadratic_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3f_rstar.cpp b/test/rtree/generated/rtree_p3f_rstar.cpp new file mode 100644 index 000000000..d0b0b5e2f --- /dev/null +++ b/test/rtree/generated/rtree_p3f_rstar.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3f_rstar_rt.cpp b/test/rtree/generated/rtree_p3f_rstar_rt.cpp new file mode 100644 index 000000000..c07a1ea30 --- /dev/null +++ b/test/rtree/generated/rtree_p3f_rstar_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3i_linear.cpp b/test/rtree/generated/rtree_p3i_linear.cpp new file mode 100644 index 000000000..5db6a7926 --- /dev/null +++ b/test/rtree/generated/rtree_p3i_linear.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3i_linear_rt.cpp b/test/rtree/generated/rtree_p3i_linear_rt.cpp new file mode 100644 index 000000000..19fb4a70a --- /dev/null +++ b/test/rtree/generated/rtree_p3i_linear_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3i_quadratic.cpp b/test/rtree/generated/rtree_p3i_quadratic.cpp new file mode 100644 index 000000000..ebbe705ec --- /dev/null +++ b/test/rtree/generated/rtree_p3i_quadratic.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3i_quadratic_rt.cpp b/test/rtree/generated/rtree_p3i_quadratic_rt.cpp new file mode 100644 index 000000000..4a3aab46a --- /dev/null +++ b/test/rtree/generated/rtree_p3i_quadratic_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3i_rstar.cpp b/test/rtree/generated/rtree_p3i_rstar.cpp new file mode 100644 index 000000000..c33e48617 --- /dev/null +++ b/test/rtree/generated/rtree_p3i_rstar.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); + return 0; +} diff --git a/test/rtree/generated/rtree_p3i_rstar_rt.cpp b/test/rtree/generated/rtree_p3i_rstar_rt.cpp new file mode 100644 index 000000000..c13c3f673 --- /dev/null +++ b/test/rtree/generated/rtree_p3i_rstar_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); + return 0; +} diff --git a/test/rtree/generated/rtree_p3tt_linear.cpp b/test/rtree/generated/rtree_p3tt_linear.cpp new file mode 100644 index 000000000..d5d10511c --- /dev/null +++ b/test/rtree/generated/rtree_p3tt_linear.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::linear<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p3tt_linear_rt.cpp b/test/rtree/generated/rtree_p3tt_linear_rt.cpp new file mode 100644 index 000000000..b4e8ac342 --- /dev/null +++ b/test/rtree/generated/rtree_p3tt_linear_rt.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::linear(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p3tt_quadratic.cpp b/test/rtree/generated/rtree_p3tt_quadratic.cpp new file mode 100644 index 000000000..687868a19 --- /dev/null +++ b/test/rtree/generated/rtree_p3tt_quadratic.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::quadratic<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p3tt_quadratic_rt.cpp b/test/rtree/generated/rtree_p3tt_quadratic_rt.cpp new file mode 100644 index 000000000..c23896e92 --- /dev/null +++ b/test/rtree/generated/rtree_p3tt_quadratic_rt.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::quadratic(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p3tt_rstar.cpp b/test/rtree/generated/rtree_p3tt_rstar.cpp new file mode 100644 index 000000000..4205017eb --- /dev/null +++ b/test/rtree/generated/rtree_p3tt_rstar.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::rstar<4, 2>()); +#endif + return 0; +} diff --git a/test/rtree/generated/rtree_p3tt_rstar_rt.cpp b/test/rtree/generated/rtree_p3tt_rstar_rt.cpp new file mode 100644 index 000000000..d07498686 --- /dev/null +++ b/test/rtree/generated/rtree_p3tt_rstar_rt.cpp @@ -0,0 +1,21 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +int test_main(int, char* []) +{ +#ifdef HAVE_TTMATH + typedef bg::model::point Point; + test_rtree_for_point(bgi::runtime::rstar(4, 2)); +#endif + return 0; +} diff --git a/test/rtree/rtree2d_linear_d.cpp b/test/rtree/rtree2d_linear_d.cpp deleted file mode 100644 index c73a356bc..000000000 --- a/test/rtree/rtree2d_linear_d.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2dc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree2d_linear_d_rt.cpp b/test/rtree/rtree2d_linear_d_rt.cpp deleted file mode 100644 index 09d7c449c..000000000 --- a/test/rtree/rtree2d_linear_d_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2dc; - - test_rtree(bgi::runtime::linear(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_linear_f_rt.cpp b/test/rtree/rtree2d_linear_f_rt.cpp deleted file mode 100644 index dbb7723dc..000000000 --- a/test/rtree/rtree2d_linear_f_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2fc; - - test_rtree(bgi::runtime::linear(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_linear_i_rt.cpp b/test/rtree/rtree2d_linear_i_rt.cpp deleted file mode 100644 index 6ae2ffa34..000000000 --- a/test/rtree/rtree2d_linear_i_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2ic; - - test_rtree(bgi::runtime::linear(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_linear_tt_rt.cpp b/test/rtree/rtree2d_linear_tt_rt.cpp deleted file mode 100644 index 7f832830f..000000000 --- a/test/rtree/rtree2d_linear_tt_rt.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - -#ifdef HAVE_TTMATH - typedef bg::model::point P2ttmc; - - test_rtree(bgi::runtime::linear(4, 2)); - -#endif - - return 0; -} diff --git a/test/rtree/rtree2d_quadratic_d.cpp b/test/rtree/rtree2d_quadratic_d.cpp deleted file mode 100644 index 0da13f9b3..000000000 --- a/test/rtree/rtree2d_quadratic_d.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2dc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree2d_quadratic_d_rt.cpp b/test/rtree/rtree2d_quadratic_d_rt.cpp deleted file mode 100644 index 2323ef2d0..000000000 --- a/test/rtree/rtree2d_quadratic_d_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2dc; - - test_rtree(bgi::runtime::quadratic(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_quadratic_f.cpp b/test/rtree/rtree2d_quadratic_f.cpp deleted file mode 100644 index b7cd17f6c..000000000 --- a/test/rtree/rtree2d_quadratic_f.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2fc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree2d_quadratic_f_rt.cpp b/test/rtree/rtree2d_quadratic_f_rt.cpp deleted file mode 100644 index 2094a94a5..000000000 --- a/test/rtree/rtree2d_quadratic_f_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2fc; - - test_rtree(bgi::runtime::quadratic(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_quadratic_i.cpp b/test/rtree/rtree2d_quadratic_i.cpp deleted file mode 100644 index c3a5d9180..000000000 --- a/test/rtree/rtree2d_quadratic_i.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2ic; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree2d_quadratic_i_rt.cpp b/test/rtree/rtree2d_quadratic_i_rt.cpp deleted file mode 100644 index 3ba08f4e1..000000000 --- a/test/rtree/rtree2d_quadratic_i_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2ic; - - test_rtree(bgi::runtime::quadratic(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_quadratic_tt_rt.cpp b/test/rtree/rtree2d_quadratic_tt_rt.cpp deleted file mode 100644 index e7a61fe69..000000000 --- a/test/rtree/rtree2d_quadratic_tt_rt.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - -#ifdef HAVE_TTMATH - typedef bg::model::point P2ttmc; - - test_rtree(bgi::runtime::quadratic(4, 2)); -#endif - - return 0; -} diff --git a/test/rtree/rtree2d_rstar_d.cpp b/test/rtree/rtree2d_rstar_d.cpp deleted file mode 100644 index a9ffbb38d..000000000 --- a/test/rtree/rtree2d_rstar_d.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2dc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree2d_rstar_d_rt.cpp b/test/rtree/rtree2d_rstar_d_rt.cpp deleted file mode 100644 index e9106fde4..000000000 --- a/test/rtree/rtree2d_rstar_d_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2dc; - - test_rtree(bgi::runtime::rstar(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_rstar_f.cpp b/test/rtree/rtree2d_rstar_f.cpp deleted file mode 100644 index a9b436323..000000000 --- a/test/rtree/rtree2d_rstar_f.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2fc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree2d_rstar_f_rt.cpp b/test/rtree/rtree2d_rstar_f_rt.cpp deleted file mode 100644 index deb8e9861..000000000 --- a/test/rtree/rtree2d_rstar_f_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2fc; - - test_rtree(bgi::runtime::rstar(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree2d_rstar_i.cpp b/test/rtree/rtree2d_rstar_i.cpp deleted file mode 100644 index 0ede4c08f..000000000 --- a/test/rtree/rtree2d_rstar_i.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2ic; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree2d_rstar_i_rt.cpp b/test/rtree/rtree2d_rstar_i_rt.cpp deleted file mode 100644 index 113eeb58a..000000000 --- a/test/rtree/rtree2d_rstar_i_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P2ic; - - test_rtree(bgi::runtime::rstar(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_linear_d.cpp b/test/rtree/rtree3d_linear_d.cpp deleted file mode 100644 index 0f9fa35e6..000000000 --- a/test/rtree/rtree3d_linear_d.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3dc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree3d_linear_d_rt.cpp b/test/rtree/rtree3d_linear_d_rt.cpp deleted file mode 100644 index 609a36b70..000000000 --- a/test/rtree/rtree3d_linear_d_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3dc; - - test_rtree(bgi::runtime::linear(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_linear_f.cpp b/test/rtree/rtree3d_linear_f.cpp deleted file mode 100644 index 12d54f332..000000000 --- a/test/rtree/rtree3d_linear_f.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3fc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree3d_linear_f_rt.cpp b/test/rtree/rtree3d_linear_f_rt.cpp deleted file mode 100644 index 0f0627197..000000000 --- a/test/rtree/rtree3d_linear_f_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3fc; - - test_rtree(bgi::runtime::linear(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_linear_i.cpp b/test/rtree/rtree3d_linear_i.cpp deleted file mode 100644 index f715ed202..000000000 --- a/test/rtree/rtree3d_linear_i.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3ic; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree3d_linear_i_rt.cpp b/test/rtree/rtree3d_linear_i_rt.cpp deleted file mode 100644 index c97bb1ed8..000000000 --- a/test/rtree/rtree3d_linear_i_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3ic; - - test_rtree(bgi::runtime::linear(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_linear_tt_rt.cpp b/test/rtree/rtree3d_linear_tt_rt.cpp deleted file mode 100644 index b478beb66..000000000 --- a/test/rtree/rtree3d_linear_tt_rt.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - -#ifdef HAVE_TTMATH - typedef bg::model::point P3ttmc; - - test_rtree(bgi::runtime::linear(4, 2)); -#endif - - return 0; -} diff --git a/test/rtree/rtree3d_quadratic_d.cpp b/test/rtree/rtree3d_quadratic_d.cpp deleted file mode 100644 index 721290dbe..000000000 --- a/test/rtree/rtree3d_quadratic_d.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3dc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree3d_quadratic_d_rt.cpp b/test/rtree/rtree3d_quadratic_d_rt.cpp deleted file mode 100644 index e0ef632a9..000000000 --- a/test/rtree/rtree3d_quadratic_d_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3dc; - - test_rtree(bgi::runtime::quadratic(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_quadratic_f.cpp b/test/rtree/rtree3d_quadratic_f.cpp deleted file mode 100644 index 9236da6fd..000000000 --- a/test/rtree/rtree3d_quadratic_f.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3fc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree3d_quadratic_f_rt.cpp b/test/rtree/rtree3d_quadratic_f_rt.cpp deleted file mode 100644 index b3c161b6d..000000000 --- a/test/rtree/rtree3d_quadratic_f_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3fc; - - test_rtree(bgi::runtime::quadratic(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_quadratic_i.cpp b/test/rtree/rtree3d_quadratic_i.cpp deleted file mode 100644 index 192be28ae..000000000 --- a/test/rtree/rtree3d_quadratic_i.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3ic; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree3d_quadratic_i_rt.cpp b/test/rtree/rtree3d_quadratic_i_rt.cpp deleted file mode 100644 index eaa400ec8..000000000 --- a/test/rtree/rtree3d_quadratic_i_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3ic; - - test_rtree(bgi::runtime::quadratic(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_quadratic_tt_rt.cpp b/test/rtree/rtree3d_quadratic_tt_rt.cpp deleted file mode 100644 index 3c2368ac4..000000000 --- a/test/rtree/rtree3d_quadratic_tt_rt.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - -#ifdef HAVE_TTMATH - typedef bg::model::point P3ttmc; - - test_rtree(bgi::runtime::quadratic(4, 2)); -#endif - - return 0; -} diff --git a/test/rtree/rtree3d_rstar_d.cpp b/test/rtree/rtree3d_rstar_d.cpp deleted file mode 100644 index 7552edeb2..000000000 --- a/test/rtree/rtree3d_rstar_d.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3dc; - - test_rtree >(); - - return 0; -} diff --git a/test/rtree/rtree3d_rstar_d_rt.cpp b/test/rtree/rtree3d_rstar_d_rt.cpp deleted file mode 100644 index eff900313..000000000 --- a/test/rtree/rtree3d_rstar_d_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3dc; - - test_rtree(bgi::runtime::rstar(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_rstar_f_rt.cpp b/test/rtree/rtree3d_rstar_f_rt.cpp deleted file mode 100644 index 408928029..000000000 --- a/test/rtree/rtree3d_rstar_f_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3fc; - - test_rtree(bgi::runtime::rstar(4, 2)); - - return 0; -} diff --git a/test/rtree/rtree3d_rstar_i_rt.cpp b/test/rtree/rtree3d_rstar_i_rt.cpp deleted file mode 100644 index d9a501f71..000000000 --- a/test/rtree/rtree3d_rstar_i_rt.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// Unit Test - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -int test_main(int, char* []) -{ - typedef bg::model::point P3ic; - - test_rtree(bgi::runtime::rstar(4, 2)); - - return 0; -} diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 780ed9646..31ec99c54 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1092,25 +1092,32 @@ void test_count_rtree_values(Parameters const& parameters) // defined by some number of Values constructed from given Point template -void test_rtree(Parameters const& parameters = Parameters()) +void test_rtree_for_point(Parameters const& parameters = Parameters()) { - typedef bg::model::box Box; - typedef std::pair PairB; typedef std::pair PairP; typedef boost::tuple TupleP; - typedef boost::tuple TupleB; typedef boost::shared_ptr< test_object > SharedPtrP; test_rtree_by_value(parameters); - test_rtree_by_value(parameters); - test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); - test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_count_rtree_values(parameters); +} + +template +void test_rtree_for_box(Parameters const& parameters = Parameters()) +{ + typedef bg::model::box Box; + typedef std::pair PairB; + typedef boost::tuple TupleB; + + test_rtree_by_value(parameters); + test_rtree_by_value(parameters); + test_rtree_by_value(parameters); + test_count_rtree_values(parameters); } diff --git a/tests/rtree_test_generator.cpp b/tests/rtree_test_generator.cpp new file mode 100644 index 000000000..4c68a5816 --- /dev/null +++ b/tests/rtree_test_generator.cpp @@ -0,0 +1,122 @@ +// Boost.Geometry Index +// Rtree tests generator + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include + +int main() +{ + std::vector generated_files; + + typedef boost::tuple CT; + std::vector coordinate_types; + coordinate_types.push_back(boost::make_tuple("double", "d", "")); + coordinate_types.push_back(boost::make_tuple("float", "f", "")); + coordinate_types.push_back(boost::make_tuple("int", "i", "")); + coordinate_types.push_back(boost::make_tuple("ttmath_big", "tt", "HAVE_TTMATH")); + + std::vector dimensions; + dimensions.push_back("2"); + dimensions.push_back("3"); + + typedef boost::tuple P; + std::vector

    parameters; + parameters.push_back(boost::make_tuple("bgi::linear<4, 2>()", "linear")); + parameters.push_back(boost::make_tuple("bgi::quadratic<4, 2>()", "quadratic")); + parameters.push_back(boost::make_tuple("bgi::rstar<4, 2>()", "rstar")); + parameters.push_back(boost::make_tuple("bgi::runtime::linear(4, 2)", "linear_rt")); + parameters.push_back(boost::make_tuple("bgi::runtime::quadratic(4, 2)", "quadratic_rt")); + parameters.push_back(boost::make_tuple("bgi::runtime::rstar(4, 2)","rstar_rt")); + + std::vector indexables; + indexables.push_back("p"); + indexables.push_back("b"); + + BOOST_FOREACH(std::string const& d, dimensions) + { + BOOST_FOREACH(CT const& c, coordinate_types) + { + BOOST_FOREACH(P const& p, parameters) + { + BOOST_FOREACH(std::string const& i, indexables) + { + std::string point_type = std::string() + + "bg::model::point<" + boost::get<0>(c) + ", " + d + ", bg::cs::cartesian>"; + + std::string filename = std::string() + + "rtree_" + i + d + boost::get<1>(c) + '_' + boost::get<1>(p) + ".cpp"; + + std::ofstream f(filename.c_str(), std::ios::trunc); + + f << + "// Boost.Geometry Index\n" << + "// Unit Test\n" << + "\n" << + "// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.\n" << + "\n" << + "// Use, modification and distribution is subject to the Boost Software License,\n" << + "// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" << + "// http://www.boost.org/LICENSE_1_0.txt)\n" << + "\n"; + + f << + "#include \n" << + "\n" << + "#include \n" << + (i == "p" ? "" : "#include \n") << + "\n"; + + f << + "int test_main(int, char* [])\n" << + "{\n" << + (boost::get<2>(c).empty() ? "" : "#ifdef HAVE_TTMATH\n") << + " typedef " << point_type << " Point;\n" << + " " << + (i == "p" ? "test_rtree_for_point" : "test_rtree_for_box" ) << + "(" << boost::get<0>(p) << ");\n" << + (boost::get<2>(c).empty() ? "" : "#endif\n") << + " return 0;\n" << + "}\n"; + + generated_files.push_back(filename); + } + } + + } + } + + std::ofstream f("Jamfile.v2", std::ios::trunc); + + f << + "# Boost.Geometry Index\n" << + "#\n" << + "# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.\n" << + "#\n" << + "# Use, modification and distribution is subject to the Boost Software License,\n" << + "# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" << + "# http://www.boost.org/LICENSE_1_0.txt)\n" << + "\n" << + "test-suite boost-geometry-index-rtree-generated\n" << + " :\n"; + + BOOST_FOREACH(std::string const& s, generated_files) + { + f << + " [ run " << s << " ]\n"; + } + + f << + " ;\n" << + "\n"; + + return 0; +} \ No newline at end of file From 3f1d769d9fa239283fbc5fe7bdd9e967df1efbdd Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 22:37:06 +0000 Subject: [PATCH 197/366] Added MultiPolygon spatial query picture to docs. Added MultiPolygon query to GLUT Vis. [SVN r81921] --- .../r_tree/spatial_queries.html | 11 ++ doc/html/index.html | 2 +- doc/images/intersects_mpoly.png | Bin 0 -> 2687 bytes doc/rtree/spatial_query.qbk | 4 +- tests/additional_glut_vis.cpp | 117 +++++++++++++++--- 5 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 doc/images/intersects_mpoly.png diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index 833e069d7..dc19fd16b 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -114,6 +114,7 @@

    @@ -130,10 +132,27 @@ to the Indexable than a copy.

    - 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==(). + If comparison of two Values is required, the default translator:

    +
      +
    • + for Point + and Box + - compares Values with geometry::equals(). +
    • +
    • + for std::pair<...> + - compares both components of the Value. The first one + is compared with geometry::equals(). If the second one is a Geometry, geometry::equals() function is used. For other types + it uses operator==(). +
    • +
    • + for boost::tuple<...> + - compares all components of the Value. If the component + is a Geometry, geometry::equals() + function is used. For other types it uses operator==(). +
    • +

    @@ -269,36 +288,64 @@ std::vector<Value> values; /* vector filling code, here */ -// create a RTree with default constructor and insert values with RTree::insert(Value const&) +// create R-tree with default constructor and insert values with insert(Value const&) RTree rt1; BOOST_FOREACH(Value const& v, values) rt1.insert(v); -// create a RTree with default constructor and insert values with RTree::insert(Iter, Iter) +// create R-tree with default constructor and insert values with insert(Iter, Iter) RTree rt2; rt2.insert(values.begin(), values.end()); -// create a RTree with default constructor and insert values with RTree::insert(Range) +// create R-tree with default constructor and insert values with insert(Range) RTree rt3; rt3.insert(values); -// create a RTree with constructor taking Iterators +// create R-tree with constructor taking Iterators RTree rt4(values.begin(), values.end()); -// create a RTree with constructor taking Range +// create R-tree with constructor taking Range RTree rt5(values); -// remove values with RTree::remove(Value const&) +// remove values with remove(Value const&) BOOST_FOREACH(Value const& v, values) rt1.remove(v); -// remove values with RTree::remove(Iter, Iter) +// remove values with remove(Iter, Iter) rt2.remove(values.begin(), values.end()); -// remove values with RTree::remove(Range) +// remove values with remove(Range) rt3.remove(values);

    +
    + +

    + There are functions like std::copy(), or R-tree's queries that copy values + to an output iterator. In order to insert values to a container in this + kind of function insert iterators may be used. Geometry.Index provide its + own bgi::insert_iterator<Container> + which is generated by bgi::inserter() function. +

    +
    namespace bgi = boost::geometry::index;
    +typedef std::pair<Box, int> Value;
    +typedef bgi::rtree< Value, bgi::linear<32, 8> > RTree;
    +
    +std::vector<Value> values;
    +/* vector filling code, here */
    +
    +// create R-tree and insert values from the vector
    +RTree rt1;
    +std::copy(values.begin(), values.end(), bgi::inserter(rt1));
    +
    +// create R-tree and insert values returned by a query
    +RTree rt2;
    +rt1.spatial_query(Box(/*...*/), bgi::inserter(rt2));
    +
    +
    diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index 6da37a16f..a26b1bcc2 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -35,6 +35,8 @@ predicates
    Value predicate
    +
    Inserting + query results into the other R-tree

    Spatial queries returns Values @@ -211,6 +213,43 @@ std::back_inserter(result)); +

    + +

    + There are several ways of inserting Values returned by a query to the other + R-tree container. The most basic way is creating a temporary container + for Values and insert them later. +

    +
    namespace bgi = boost::geometry::index;
    +typedef std::pair<Box, int> Value;
    +typedef bgi::rtree< Value, bgi::linear<32, 8> > RTree;
    +
    +RTree rt1;
    +/* some inserting into the tree */
    +
    +std::vector<Value> result;
    +rt1.spatial_query(Box(/*...*/), std::back_inserter(result));
    +RTree rt2(result.begin(), result.end());
    +
    +

    + However there are better ways. One of these methods is mentioned in the + "Creation and modification" section. The insert iterator may + be passed directly to the query, which will be the fastest way of inserting + query results because temporary container won't be used. +

    +
    RTree rt3;
    +rt1.spatial_query(Box(/*...*/), bgi::inserter(rt3));
    +
    +

    + If you like Boost.Range you'll appreciate the third option. You may pass + the result Range directly to the constructor. +

    +
    RTree rt4(rt1 | bgi::adaptors::spatial_queried(Box(/*...*/)));
    +
    +
    diff --git a/doc/html/index.html b/doc/html/index.html index 16d52db19..ea9ad1961 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: November 26, 2012 at 17:58:58 GMT

    Last revised: November 26, 2012 at 22:11:47 GMT


    diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 9a1393065..4a70e0ef3 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -51,9 +51,13 @@ A `__translator__` is a type which knows how to handle `__value__`s. It has two A `__translator__` translates the `__value__` each time the __rtree__ needs it. For this reason it should rather return const reference to the `__indexable__` than a copy. -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==()`. +If comparison of two `__value__`s is required, the default translator: + +* for `__point__` and `__box__` - compares `__value__`s with geometry::equals(). +* for `std::pair<...>` - compares both components of the `__value__`. The first one is compared with `geometry::equals()`. + If the second one is a `Geometry`, `geometry::equals()` function is used. For other types it uses `operator==()`. +* for `boost::tuple<...>` - compares all components of the `__value__`. If the component is a `Geometry`, `geometry::equals()` + function is used. For other types it uses `operator==()`. [endsect] @@ -165,35 +169,59 @@ The __rtree__ allows creation, inserting and removing of Values from a range. Th std::vector<__value__> values; /* vector filling code, here */ - // create a RTree with default constructor and insert values with RTree::insert(Value const&) + // create R-tree with default constructor and insert values with insert(Value const&) RTree rt1; BOOST_FOREACH(__value__ const& v, values) rt1.insert(v); - // create a RTree with default constructor and insert values with RTree::insert(Iter, Iter) + // create R-tree with default constructor and insert values with insert(Iter, Iter) RTree rt2; rt2.insert(values.begin(), values.end()); - // create a RTree with default constructor and insert values with RTree::insert(Range) + // create R-tree with default constructor and insert values with insert(Range) RTree rt3; rt3.insert(values); - // create a RTree with constructor taking Iterators + // create R-tree with constructor taking Iterators RTree rt4(values.begin(), values.end()); - // create a RTree with constructor taking Range + // create R-tree with constructor taking Range RTree rt5(values); - // remove values with RTree::remove(Value const&) + // remove values with remove(Value const&) BOOST_FOREACH(__value__ const& v, values) rt1.remove(v); - // remove values with RTree::remove(Iter, Iter) + // remove values with remove(Iter, Iter) rt2.remove(values.begin(), values.end()); - // remove values with RTree::remove(Range) + // remove values with remove(Range) rt3.remove(values); [endsect] +[section Insert iterator] + +There are functions like `std::copy()`, or __rtree__'s queries that copy values to an output iterator. +In order to insert values to a container in this kind of function insert iterators may be used. +Geometry.Index provide its own `bgi::insert_iterator` which is generated by +`bgi::inserter()` function. + + namespace bgi = boost::geometry::index; + typedef std::pair __value__; + typedef bgi::rtree< __value__, bgi::linear<32, 8> > RTree; + + std::vector<__value__> values; + /* vector filling code, here */ + + // create R-tree and insert values from the vector + RTree rt1; + std::copy(values.begin(), values.end(), bgi::inserter(rt1)); + + // create R-tree and insert values returned by a query + RTree rt2; + rt1.spatial_query(Box(/*...*/), bgi::inserter(rt2)); + +[endsect] + [endsect] [/ Creation and modification /] diff --git a/doc/rtree/spatial_query.qbk b/doc/rtree/spatial_query.qbk index e9802a977..562555444 100644 --- a/doc/rtree/spatial_query.qbk +++ b/doc/rtree/spatial_query.qbk @@ -104,4 +104,34 @@ which checks if `__value__` should be returned by the query. [endsect] +[section Inserting query results into the other R-tree] + +There are several ways of inserting Values returned by a query to the other R-tree container. +The most basic way is creating a temporary container for Values and insert them later. + + namespace bgi = boost::geometry::index; + typedef std::pair __value__; + typedef bgi::rtree< __value__, bgi::linear<32, 8> > RTree; + + RTree rt1; + /* some inserting into the tree */ + + std::vector result; + rt1.spatial_query(Box(/*...*/), std::back_inserter(result)); + RTree rt2(result.begin(), result.end()); + +However there are better ways. One of these methods is mentioned in the "Creation and modification" section. +The insert iterator may be passed directly to the query, which will be the fastest way of inserting +query results because temporary container won't be used. + + RTree rt3; + rt1.spatial_query(Box(/*...*/), bgi::inserter(rt3)); + +If you like Boost.Range you'll appreciate the third option. You may pass the result Range directly to the +constructor. + + RTree rt4(rt1 | bgi::adaptors::spatial_queried(Box(/*...*/))); + +[endsect] + [endsect] [/ Spatial queries /] diff --git a/include/boost/geometry/extensions/index/inserter.hpp b/include/boost/geometry/extensions/index/inserter.hpp index 15f4b176b..186d62f9a 100644 --- a/include/boost/geometry/extensions/index/inserter.hpp +++ b/include/boost/geometry/extensions/index/inserter.hpp @@ -22,17 +22,13 @@ class insert_iterator : public: typedef Container container_type; - inline explicit insert_iterator() -// : container(0) - {} - inline explicit insert_iterator(Container & c) - : container(&c) + : container(c) {} insert_iterator & operator=(typename Container::value_type const& value) { - index::insert(*container, value); + container.insert(value); return *this; } @@ -52,7 +48,7 @@ public: } private: - Container * container; + Container & container; }; template diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 349d0ca77..dc2946fcc 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -45,6 +45,8 @@ #include //#include +#include + // TODO change the name to bounding_tree namespace boost { namespace geometry { namespace index { diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index a40e6f716..4bd8d77a5 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -676,6 +676,14 @@ void test_create_insert(bgi::rtree & tree, std::vector const t.spatial_query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } + { + T t(tree.parameters()); + std::copy(input.begin(), input.end(), bgi::inserter(t)); + BOOST_CHECK(tree.size() == t.size()); + std::vector output; + t.spatial_query(qbox, std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } { T t(input.begin(), input.end(), tree.parameters()); BOOST_CHECK(tree.size() == t.size()); From f4f0094c3aaa9295bc337f8d2b7fd4e1edfdf04f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 7 Dec 2012 22:52:53 +0000 Subject: [PATCH 184/366] Merged from index_dev Fixed rtree::clear() mem leak. Added test for clear() and boost::shared_ptr as Values. Each linear algo test file divided into 2 files. Added reference in docs->rtree introduction. [SVN r81778] --- .../geometry_index/r_tree/introduction.html | 15 ++-- doc/html/index.html | 2 +- doc/rtree/introduction.qbk | 5 +- .../geometry/extensions/index/inserter.hpp | 6 +- .../geometry/extensions/index/rtree/rtree.hpp | 21 ++--- test/rtree/Jamfile.v2 | 16 ++++ test/rtree/rtree2d_linear_d.cpp | 1 - test/rtree/rtree2d_linear_d_rt.cpp | 23 ++++++ test/rtree/rtree2d_linear_f.cpp | 1 - test/rtree/rtree2d_linear_f_rt.cpp | 23 ++++++ test/rtree/rtree2d_linear_i.cpp | 1 - test/rtree/rtree2d_linear_i_rt.cpp | 23 ++++++ test/rtree/rtree2d_linear_tt.cpp | 1 - test/rtree/rtree2d_linear_tt_rt.cpp | 27 +++++++ test/rtree/rtree2d_quadratic_d.cpp | 1 - test/rtree/rtree2d_quadratic_d_rt.cpp | 23 ++++++ test/rtree/rtree2d_quadratic_f.cpp | 1 - test/rtree/rtree2d_quadratic_f_rt.cpp | 23 ++++++ test/rtree/rtree2d_quadratic_i.cpp | 1 - test/rtree/rtree2d_quadratic_i_rt.cpp | 23 ++++++ test/rtree/rtree2d_quadratic_tt.cpp | 1 - test/rtree/rtree2d_quadratic_tt_rt.cpp | 26 +++++++ test/rtree/rtree3d_linear_d.cpp | 1 - test/rtree/rtree3d_linear_d_rt.cpp | 23 ++++++ test/rtree/rtree3d_linear_f.cpp | 1 - test/rtree/rtree3d_linear_f_rt.cpp | 23 ++++++ test/rtree/rtree3d_linear_i.cpp | 1 - test/rtree/rtree3d_linear_i_rt.cpp | 23 ++++++ test/rtree/rtree3d_linear_tt.cpp | 1 - test/rtree/rtree3d_linear_tt_rt.cpp | 26 +++++++ test/rtree/rtree3d_quadratic_d.cpp | 1 - test/rtree/rtree3d_quadratic_d_rt.cpp | 23 ++++++ test/rtree/rtree3d_quadratic_f.cpp | 1 - test/rtree/rtree3d_quadratic_f_rt.cpp | 23 ++++++ test/rtree/rtree3d_quadratic_i.cpp | 1 - test/rtree/rtree3d_quadratic_i_rt.cpp | 23 ++++++ test/rtree/rtree3d_quadratic_tt.cpp | 1 - test/rtree/rtree3d_quadratic_tt_rt.cpp | 26 +++++++ test/rtree/test_rtree.hpp | 77 ++++++++++++++++++- 39 files changed, 496 insertions(+), 43 deletions(-) create mode 100644 test/rtree/rtree2d_linear_d_rt.cpp create mode 100644 test/rtree/rtree2d_linear_f_rt.cpp create mode 100644 test/rtree/rtree2d_linear_i_rt.cpp create mode 100644 test/rtree/rtree2d_linear_tt_rt.cpp create mode 100644 test/rtree/rtree2d_quadratic_d_rt.cpp create mode 100644 test/rtree/rtree2d_quadratic_f_rt.cpp create mode 100644 test/rtree/rtree2d_quadratic_i_rt.cpp create mode 100644 test/rtree/rtree2d_quadratic_tt_rt.cpp create mode 100644 test/rtree/rtree3d_linear_d_rt.cpp create mode 100644 test/rtree/rtree3d_linear_f_rt.cpp create mode 100644 test/rtree/rtree3d_linear_i_rt.cpp create mode 100644 test/rtree/rtree3d_linear_tt_rt.cpp create mode 100644 test/rtree/rtree3d_quadratic_d_rt.cpp create mode 100644 test/rtree/rtree3d_quadratic_f_rt.cpp create mode 100644 test/rtree/rtree3d_quadratic_i_rt.cpp create mode 100644 test/rtree/rtree3d_quadratic_tt_rt.cpp diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 41dd3a17f..c326a0c36 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -31,7 +31,7 @@ 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. + close to some point in space [2].

    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [2] [3]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -192,8 +192,9 @@ capable to store arbitrary Value type,

  • - sophisticated queries - e.g. search for 5 nearest values intersecting - some region but not within the other one. + advanced queries - e.g. search for 5 nearest values further than some + minimal distance and intersecting some region but not within the other + one.
  • @@ -203,10 +204,14 @@ Searching

    [2] + Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search + on the R-tree +

    +

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

    -

    [3] +

    [4] 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/index.html b/doc/html/index.html index ea9ad1961..8ff4a0cf7 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: November 26, 2012 at 22:11:47 GMT

    Last revised: November 27, 2012 at 12:09:04 GMT


    diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index 25f6f7ea0..18f613ac9 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -13,7 +13,8 @@ __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/] 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. +perform a spatial query later. This query may return objects that are inside some area or are close to some point in space +[footnote Cheung, K.; Fu, A. (1998). /Enhanced Nearest Neighbour Search on the R-tree/]. 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 @@ -46,7 +47,7 @@ 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. +* advanced queries - e.g. search for 5 nearest values further than some minimal distance and intersecting some region but not within the other one. [endsect] diff --git a/include/boost/geometry/extensions/index/inserter.hpp b/include/boost/geometry/extensions/index/inserter.hpp index 186d62f9a..ef1e949cc 100644 --- a/include/boost/geometry/extensions/index/inserter.hpp +++ b/include/boost/geometry/extensions/index/inserter.hpp @@ -23,12 +23,12 @@ public: typedef Container container_type; inline explicit insert_iterator(Container & c) - : container(c) + : container(&c) {} insert_iterator & operator=(typename Container::value_type const& value) { - container.insert(value); + container->insert(value); return *this; } @@ -48,7 +48,7 @@ public: } private: - Container & container; + Container * container; }; template diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index dc2946fcc..4e7db8132 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -146,7 +146,7 @@ public: } catch(...) { - this->raw_destroy(*this, true); + this->raw_destroy(*this); throw; } } @@ -176,7 +176,7 @@ public: } catch(...) { - this->raw_destroy(*this, true); + this->raw_destroy(*this); throw; } } @@ -188,7 +188,7 @@ public: */ inline ~rtree() { - this->raw_destroy(*this, true); + this->raw_destroy(*this); } /*! @@ -586,7 +586,7 @@ public: */ inline void clear() { - this->raw_destroy(*this, false); + this->raw_destroy(*this); } /*! @@ -775,19 +775,12 @@ private: \param t The container which is going to be destroyed. */ - inline void raw_destroy(rtree & t, bool destroy_root = true) + inline void raw_destroy(rtree & t) { if ( t.m_root ) { - if ( destroy_root ) - { - detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); - detail::rtree::apply_visitor(del_v, *t.m_root); - } - else - { - detail::rtree::clear_node::apply(*t.m_root, t.m_allocators); - } + detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); + detail::rtree::apply_visitor(del_v, *t.m_root); t.m_root = 0; } diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index b2b98d998..b4f756d70 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -12,11 +12,19 @@ test-suite boost-geometry-index-rtree [ run rtree2d_linear_f.cpp ] [ run rtree2d_linear_d.cpp ] [ run rtree2d_linear_tt.cpp ] + [ run rtree2d_linear_i_rt.cpp ] + [ run rtree2d_linear_f_rt.cpp ] + [ run rtree2d_linear_d_rt.cpp ] + [ run rtree2d_linear_tt_rt.cpp ] [ run rtree2d_quadratic_i.cpp ] [ run rtree2d_quadratic_f.cpp ] [ run rtree2d_quadratic_d.cpp ] [ run rtree2d_quadratic_tt.cpp ] + [ run rtree2d_quadratic_i_rt.cpp ] + [ run rtree2d_quadratic_f_rt.cpp ] + [ run rtree2d_quadratic_d_rt.cpp ] + [ run rtree2d_quadratic_tt_rt.cpp ] [ run rtree2d_rstar_i.cpp ] [ run rtree2d_rstar_f.cpp ] @@ -31,11 +39,19 @@ test-suite boost-geometry-index-rtree [ run rtree3d_linear_f.cpp ] [ run rtree3d_linear_d.cpp ] [ run rtree3d_linear_tt.cpp ] + [ run rtree3d_linear_i_rt.cpp ] + [ run rtree3d_linear_f_rt.cpp ] + [ run rtree3d_linear_d_rt.cpp ] + [ run rtree3d_linear_tt_rt.cpp ] [ run rtree3d_quadratic_i.cpp ] [ run rtree3d_quadratic_f.cpp ] [ run rtree3d_quadratic_d.cpp ] [ run rtree3d_quadratic_tt.cpp ] + [ run rtree3d_quadratic_i_rt.cpp ] + [ run rtree3d_quadratic_f_rt.cpp ] + [ run rtree3d_quadratic_d_rt.cpp ] + [ run rtree3d_quadratic_tt_rt.cpp ] [ run rtree3d_rstar_i.cpp ] [ run rtree3d_rstar_f.cpp ] diff --git a/test/rtree/rtree2d_linear_d.cpp b/test/rtree/rtree2d_linear_d.cpp index a3e3fb47a..c73a356bc 100644 --- a/test/rtree/rtree2d_linear_d.cpp +++ b/test/rtree/rtree2d_linear_d.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2dc; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_linear_d_rt.cpp b/test/rtree/rtree2d_linear_d_rt.cpp new file mode 100644 index 000000000..09d7c449c --- /dev/null +++ b/test/rtree/rtree2d_linear_d_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2dc; + + test_rtree(bgi::runtime::linear(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_linear_f.cpp b/test/rtree/rtree2d_linear_f.cpp index a1ce1268e..8ea8d04ff 100644 --- a/test/rtree/rtree2d_linear_f.cpp +++ b/test/rtree/rtree2d_linear_f.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2fc; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_linear_f_rt.cpp b/test/rtree/rtree2d_linear_f_rt.cpp new file mode 100644 index 000000000..dbb7723dc --- /dev/null +++ b/test/rtree/rtree2d_linear_f_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2fc; + + test_rtree(bgi::runtime::linear(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_linear_i.cpp b/test/rtree/rtree2d_linear_i.cpp index 3fd9a5c30..f1ea68bd0 100644 --- a/test/rtree/rtree2d_linear_i.cpp +++ b/test/rtree/rtree2d_linear_i.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2ic; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_linear_i_rt.cpp b/test/rtree/rtree2d_linear_i_rt.cpp new file mode 100644 index 000000000..6ae2ffa34 --- /dev/null +++ b/test/rtree/rtree2d_linear_i_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + + test_rtree(bgi::runtime::linear(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_linear_tt.cpp b/test/rtree/rtree2d_linear_tt.cpp index 0e0478a25..1d5de3635 100644 --- a/test/rtree/rtree2d_linear_tt.cpp +++ b/test/rtree/rtree2d_linear_tt.cpp @@ -20,7 +20,6 @@ int test_main(int, char* []) typedef bg::model::point P2ttmc; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); #endif diff --git a/test/rtree/rtree2d_linear_tt_rt.cpp b/test/rtree/rtree2d_linear_tt_rt.cpp new file mode 100644 index 000000000..7f832830f --- /dev/null +++ b/test/rtree/rtree2d_linear_tt_rt.cpp @@ -0,0 +1,27 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + + test_rtree(bgi::runtime::linear(4, 2)); + +#endif + + return 0; +} diff --git a/test/rtree/rtree2d_quadratic_d.cpp b/test/rtree/rtree2d_quadratic_d.cpp index 775f36846..0da13f9b3 100644 --- a/test/rtree/rtree2d_quadratic_d.cpp +++ b/test/rtree/rtree2d_quadratic_d.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2dc; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_quadratic_d_rt.cpp b/test/rtree/rtree2d_quadratic_d_rt.cpp new file mode 100644 index 000000000..2323ef2d0 --- /dev/null +++ b/test/rtree/rtree2d_quadratic_d_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2dc; + + test_rtree(bgi::runtime::quadratic(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_quadratic_f.cpp b/test/rtree/rtree2d_quadratic_f.cpp index 3e9b2e1df..b7cd17f6c 100644 --- a/test/rtree/rtree2d_quadratic_f.cpp +++ b/test/rtree/rtree2d_quadratic_f.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2fc; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_quadratic_f_rt.cpp b/test/rtree/rtree2d_quadratic_f_rt.cpp new file mode 100644 index 000000000..2094a94a5 --- /dev/null +++ b/test/rtree/rtree2d_quadratic_f_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2fc; + + test_rtree(bgi::runtime::quadratic(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_quadratic_i.cpp b/test/rtree/rtree2d_quadratic_i.cpp index 859d71a70..c3a5d9180 100644 --- a/test/rtree/rtree2d_quadratic_i.cpp +++ b/test/rtree/rtree2d_quadratic_i.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P2ic; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); return 0; } diff --git a/test/rtree/rtree2d_quadratic_i_rt.cpp b/test/rtree/rtree2d_quadratic_i_rt.cpp new file mode 100644 index 000000000..3ba08f4e1 --- /dev/null +++ b/test/rtree/rtree2d_quadratic_i_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2ic; + + test_rtree(bgi::runtime::quadratic(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree2d_quadratic_tt.cpp b/test/rtree/rtree2d_quadratic_tt.cpp index b00faddc1..1ff26daa5 100644 --- a/test/rtree/rtree2d_quadratic_tt.cpp +++ b/test/rtree/rtree2d_quadratic_tt.cpp @@ -20,7 +20,6 @@ int test_main(int, char* []) typedef bg::model::point P2ttmc; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); #endif return 0; diff --git a/test/rtree/rtree2d_quadratic_tt_rt.cpp b/test/rtree/rtree2d_quadratic_tt_rt.cpp new file mode 100644 index 000000000..e7a61fe69 --- /dev/null +++ b/test/rtree/rtree2d_quadratic_tt_rt.cpp @@ -0,0 +1,26 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + +#ifdef HAVE_TTMATH + typedef bg::model::point P2ttmc; + + test_rtree(bgi::runtime::quadratic(4, 2)); +#endif + + return 0; +} diff --git a/test/rtree/rtree3d_linear_d.cpp b/test/rtree/rtree3d_linear_d.cpp index 3c28142e4..0f9fa35e6 100644 --- a/test/rtree/rtree3d_linear_d.cpp +++ b/test/rtree/rtree3d_linear_d.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3dc; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_linear_d_rt.cpp b/test/rtree/rtree3d_linear_d_rt.cpp new file mode 100644 index 000000000..609a36b70 --- /dev/null +++ b/test/rtree/rtree3d_linear_d_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3dc; + + test_rtree(bgi::runtime::linear(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_linear_f.cpp b/test/rtree/rtree3d_linear_f.cpp index 569b72938..12d54f332 100644 --- a/test/rtree/rtree3d_linear_f.cpp +++ b/test/rtree/rtree3d_linear_f.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3fc; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_linear_f_rt.cpp b/test/rtree/rtree3d_linear_f_rt.cpp new file mode 100644 index 000000000..0f0627197 --- /dev/null +++ b/test/rtree/rtree3d_linear_f_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3fc; + + test_rtree(bgi::runtime::linear(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_linear_i.cpp b/test/rtree/rtree3d_linear_i.cpp index 3b5771171..f715ed202 100644 --- a/test/rtree/rtree3d_linear_i.cpp +++ b/test/rtree/rtree3d_linear_i.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3ic; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_linear_i_rt.cpp b/test/rtree/rtree3d_linear_i_rt.cpp new file mode 100644 index 000000000..c97bb1ed8 --- /dev/null +++ b/test/rtree/rtree3d_linear_i_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + + test_rtree(bgi::runtime::linear(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_linear_tt.cpp b/test/rtree/rtree3d_linear_tt.cpp index ed750c2c1..12ddbd444 100644 --- a/test/rtree/rtree3d_linear_tt.cpp +++ b/test/rtree/rtree3d_linear_tt.cpp @@ -20,7 +20,6 @@ int test_main(int, char* []) typedef bg::model::point P3ttmc; test_rtree >(); - test_rtree(bgi::runtime::linear(4, 2)); #endif return 0; diff --git a/test/rtree/rtree3d_linear_tt_rt.cpp b/test/rtree/rtree3d_linear_tt_rt.cpp new file mode 100644 index 000000000..b478beb66 --- /dev/null +++ b/test/rtree/rtree3d_linear_tt_rt.cpp @@ -0,0 +1,26 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + +#ifdef HAVE_TTMATH + typedef bg::model::point P3ttmc; + + test_rtree(bgi::runtime::linear(4, 2)); +#endif + + return 0; +} diff --git a/test/rtree/rtree3d_quadratic_d.cpp b/test/rtree/rtree3d_quadratic_d.cpp index 733422555..721290dbe 100644 --- a/test/rtree/rtree3d_quadratic_d.cpp +++ b/test/rtree/rtree3d_quadratic_d.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3dc; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_quadratic_d_rt.cpp b/test/rtree/rtree3d_quadratic_d_rt.cpp new file mode 100644 index 000000000..e0ef632a9 --- /dev/null +++ b/test/rtree/rtree3d_quadratic_d_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3dc; + + test_rtree(bgi::runtime::quadratic(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_quadratic_f.cpp b/test/rtree/rtree3d_quadratic_f.cpp index 54a2fcbd1..9236da6fd 100644 --- a/test/rtree/rtree3d_quadratic_f.cpp +++ b/test/rtree/rtree3d_quadratic_f.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3fc; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_quadratic_f_rt.cpp b/test/rtree/rtree3d_quadratic_f_rt.cpp new file mode 100644 index 000000000..b3c161b6d --- /dev/null +++ b/test/rtree/rtree3d_quadratic_f_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3fc; + + test_rtree(bgi::runtime::quadratic(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_quadratic_i.cpp b/test/rtree/rtree3d_quadratic_i.cpp index b1e23bf9a..192be28ae 100644 --- a/test/rtree/rtree3d_quadratic_i.cpp +++ b/test/rtree/rtree3d_quadratic_i.cpp @@ -18,7 +18,6 @@ int test_main(int, char* []) typedef bg::model::point P3ic; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); return 0; } diff --git a/test/rtree/rtree3d_quadratic_i_rt.cpp b/test/rtree/rtree3d_quadratic_i_rt.cpp new file mode 100644 index 000000000..eaa400ec8 --- /dev/null +++ b/test/rtree/rtree3d_quadratic_i_rt.cpp @@ -0,0 +1,23 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P3ic; + + test_rtree(bgi::runtime::quadratic(4, 2)); + + return 0; +} diff --git a/test/rtree/rtree3d_quadratic_tt.cpp b/test/rtree/rtree3d_quadratic_tt.cpp index de52abd8a..9ed655257 100644 --- a/test/rtree/rtree3d_quadratic_tt.cpp +++ b/test/rtree/rtree3d_quadratic_tt.cpp @@ -20,7 +20,6 @@ int test_main(int, char* []) typedef bg::model::point P3ttmc; test_rtree >(); - test_rtree(bgi::runtime::quadratic(4, 2)); #endif return 0; diff --git a/test/rtree/rtree3d_quadratic_tt_rt.cpp b/test/rtree/rtree3d_quadratic_tt_rt.cpp new file mode 100644 index 000000000..3c2368ac4 --- /dev/null +++ b/test/rtree/rtree3d_quadratic_tt_rt.cpp @@ -0,0 +1,26 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +int test_main(int, char* []) +{ + +#ifdef HAVE_TTMATH + typedef bg::model::point P3ttmc; + + test_rtree(bgi::runtime::quadratic(4, 2)); +#endif + + return 0; +} diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 4bd8d77a5..90ee4acaf 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -187,6 +187,62 @@ struct generate_value< boost::tuple >, } }; +// shared_ptr value + +template +struct test_object +{ + test_object(Indexable const& indexable_) : indexable(indexable_) {} + Indexable indexable; +}; + +namespace boost { namespace geometry { namespace index { namespace translator { + +template +struct def< boost::shared_ptr< test_object > > +{ + typedef boost::shared_ptr< test_object > value_type; + typedef Indexable const& result_type; + + result_type operator()(value_type const& value) const + { + return value->indexable; + } + + bool equals(value_type const& v1, value_type const& v2) const + { + return v1 == v2; + } +}; + +}}}} + +template +struct generate_value< boost::shared_ptr > > > +{ + typedef bg::model::point P; + typedef test_object

    O; + + static boost::shared_ptr apply(int x, int y) + { + return boost::shared_ptr(new O(P(x, y))); + } +}; + +template +struct generate_value< boost::shared_ptr > > > +{ + typedef bg::model::point P; + typedef test_object

    O; + + static boost::shared_ptr apply(int x, int y, int z) + { + return boost::shared_ptr(new O(P(x, y, z))); + } +}; + +// generate input + template struct generate_input {}; @@ -745,7 +801,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const // rtree removing template -void test_remove(bgi::rtree & tree, Box const& qbox) +void test_remove_clear(bgi::rtree & tree, std::vector const& input, Box const& qbox) { typedef bgi::rtree T; @@ -807,6 +863,21 @@ void test_remove(bgi::rtree & tree, Box const& qbox) BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); test_compare_outputs(t, output, expected_output); } + + //clear + { + std::vector expected_output; + tree.spatial_query(bgi::intersects(qbox), std::back_inserter(expected_output)); + size_t s = tree.size(); + tree.clear(); + BOOST_CHECK(tree.empty()); + BOOST_CHECK(tree.size() == 0); + tree.insert(input); + BOOST_CHECK(tree.size() == s); + std::vector output; + tree.spatial_query(bgi::intersects(qbox), std::back_inserter(output)); + test_exactly_the_same_outputs(tree, output, expected_output); + } } // run all tests for a single Algorithm and single rtree @@ -844,7 +915,7 @@ void test_rtree_by_value(Parameters const& parameters) test_copy_assignment_swap_move(tree, qbox); test_create_insert(tree, input, qbox); - test_remove(tree, qbox); + test_remove_clear(tree, input, qbox); // empty tree test @@ -874,6 +945,7 @@ void test_rtree(Parameters const& parameters = Parameters()) typedef std::pair PairP; typedef boost::tuple TupleP; typedef boost::tuple TupleB; + typedef boost::shared_ptr< test_object > SharedPtrP; test_rtree_by_value(parameters); test_rtree_by_value(parameters); @@ -881,6 +953,7 @@ void test_rtree(Parameters const& parameters = Parameters()) test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); + test_rtree_by_value(parameters); } #endif From dd6430083d9be691bd3dcacf263aa60a6431b621 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 8 Dec 2012 23:47:52 +0000 Subject: [PATCH 185/366] Coding style improved (issues detected by Boost Inspect tool). [SVN r81802] --- .../rtree/linear/redistribute_elements.hpp | 26 ++-- .../index/rtree/node/dynamic_visitor.hpp | 8 +- .../index/rtree/node/node_d_mem_dynamic.hpp | 8 +- .../index/rtree/node/node_d_mem_static.hpp | 6 +- .../index/rtree/node/node_s_mem_dynamic.hpp | 22 +-- .../index/rtree/node/node_s_mem_static.hpp | 8 +- .../index/rtree/node/static_visitor.hpp | 18 +-- .../rtree/quadratic/redistribute_elements.hpp | 10 +- .../index/rtree/rstar/choose_next_node.hpp | 138 +++++++++--------- .../extensions/index/rtree/rstar/insert.hpp | 2 +- .../index/rtree/visitors/insert.hpp | 2 +- test/rtree/test_rtree.hpp | 4 +- test/rtree/test_rtree_exceptions.hpp | 6 +- tests/additional_glut_vis.cpp | 10 +- tests/additional_sizes_and_times.cpp | 10 +- tests/additional_speed.cpp | 9 ++ tests/main.cpp | 10 +- tests/rtree_filters.hpp | 11 +- tests/rtree_function.hpp | 9 ++ tests/t1.cpp | 9 ++ tests/t2.cpp | 10 +- tests/translators.hpp | 33 +++-- 22 files changed, 211 insertions(+), 158 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp index 910b77a39..fb52e3b5e 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp @@ -54,9 +54,9 @@ struct find_greatest_normalized_separation size_t & seed1, size_t & seed2) { - const size_t elements_count = parameters.get_max_elements() + 1; - BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected number of elements"); - BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); + const size_t elements_count = parameters.get_max_elements() + 1; + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); // find the lowest low, highest high coordinate_type lowest_low = index::get(rtree::element_indexable(elements[0], translator)); @@ -180,9 +180,9 @@ struct pick_seeds static inline void apply(Elements const& elements, Parameters const& parameters, - Translator const& tr, - size_t & seed1, - size_t & seed2) + Translator const& tr, + size_t & seed1, + size_t & seed2) { coordinate_type separation = 0; pick_seeds_impl::apply(elements, parameters, tr, separation, seed1, seed2); @@ -217,14 +217,14 @@ struct redistribute_elements::type coordinate_type; typedef typename index::default_content_result::type content_type; - elements_type & elements1 = rtree::elements(n); - elements_type & elements2 = rtree::elements(second_node); - const size_t elements1_count = parameters.get_max_elements() + 1; + elements_type & elements1 = rtree::elements(n); + elements_type & elements2 = rtree::elements(second_node); + const size_t elements1_count = parameters.get_max_elements() + 1; - BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(elements1.size() == elements1_count, "unexpected number of elements"); - // copy original elements - elements_type elements_copy(elements1); // MAY THROW, STRONG (alloc, copy) + // copy original elements + elements_type elements_copy(elements1); // MAY THROW, STRONG (alloc, copy) // calculate initial seeds size_t seed1 = 0; @@ -309,7 +309,7 @@ struct redistribute_elements template inline Derived & get(dynamic_node & n) { - assert(dynamic_cast(&n)); + BOOST_GEOMETRY_INDEX_ASSERT(dynamic_cast(&n), "can't cast to a Derived type"); return static_cast(n); } template inline Derived * get(dynamic_node * n) { - assert(dynamic_cast(n)); + BOOST_GEOMETRY_INDEX_ASSERT(dynamic_cast(n), "can't cast to a Derived type"); return static_cast(n); } // apply visitor template -inline void apply_visitor(Visitor &v, Visitable & n) +inline void apply_visitor(Visitor & v, Visitable & n) { - assert(&n); + BOOST_GEOMETRY_INDEX_ASSERT(&n, "null ptr"); n.apply_visitor(v); } diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index e66cef8c7..66aa289f1 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -108,7 +108,7 @@ template inline typename Translator::result_type element_indexable(Value const& el, Translator const& tr) { - return tr(el); + return tr(el); } template @@ -125,21 +125,21 @@ element_indexable( template struct elements_type { - typedef typename Node::elements_type type; + typedef typename Node::elements_type type; }; template inline typename elements_type::type & elements(Node & n) { - return n.elements; + return n.elements; } template inline typename elements_type::type const& elements(Node const& n) { - return n.elements; + return n.elements; } // elements derived type diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp index 35d087a15..ff70774c3 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp @@ -20,14 +20,14 @@ namespace detail { namespace rtree { template struct dynamic_internal_node - : public dynamic_node + : public dynamic_node { typedef index::pushable_array< std::pair< Box, dynamic_node * >, - Parameters::max_elements + 1 + Parameters::max_elements + 1 > elements_type; template @@ -41,7 +41,7 @@ struct dynamic_internal_node struct dynamic_leaf - : public dynamic_node + : public dynamic_node { typedef index::pushable_array elements_type; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp index 6f14beb80..237141e74 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp @@ -59,10 +59,10 @@ struct static_leaf template struct node { - typedef boost::variant< - static_leaf, - static_internal_node - > type; + typedef boost::variant< + static_leaf, + static_internal_node + > type; }; template @@ -107,13 +107,13 @@ struct element_indexable_type< template inline Box const& element_indexable(std::pair< - Box, - boost::variant< - static_leaf, - static_internal_node - > * - > const& el, - Translator const&) + Box, + boost::variant< + static_leaf, + static_internal_node + > * + > const& el, + Translator const&) { return el.first; } diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp index 67e9b9ea9..8220b3de4 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp @@ -54,10 +54,10 @@ struct static_leaf template struct node { - typedef boost::variant< - static_leaf, - static_internal_node - > type; + typedef boost::variant< + static_leaf, + static_internal_node + > type; }; template diff --git a/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp b/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp index 70524f036..cf089b3d2 100644 --- a/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp @@ -51,22 +51,22 @@ inline V * get( template inline void apply_visitor(Visitor & v, - boost::variant< - static_leaf, - static_internal_node - > & n) + boost::variant< + static_leaf, + static_internal_node + > & n) { boost::apply_visitor(v, n); } template inline void apply_visitor(Visitor & v, - boost::variant< - static_leaf, - static_internal_node - > const& n) + boost::variant< + static_leaf, + static_internal_node + > const& n) { - boost::apply_visitor(v, n); + boost::apply_visitor(v, n); } }} // namespace detail::rtree diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp index d651777eb..e4bf7d42b 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp @@ -44,8 +44,8 @@ struct pick_seeds size_t & seed2) { const size_t elements_count = parameters.get_max_elements() + 1; - BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "wrong number of elements"); - BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "wrong number of elements"); + BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); content_type greatest_free_content = 0; seed1 = 0; @@ -80,7 +80,7 @@ struct pick_seeds template struct redistribute_elements { - typedef typename Options::parameters_type parameters_type; + typedef typename Options::parameters_type parameters_type; typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -216,12 +216,12 @@ struct redistribute_elements::type leaf; typedef typename rtree::elements_type::type children_type; - typedef typename children_type::value_type child_type; + typedef typename children_type::value_type child_type; - typedef typename Options::parameters_type parameters_type; + typedef typename Options::parameters_type parameters_type; typedef typename index::default_content_result::type content_type; @@ -53,13 +53,13 @@ public: // children are leafs if ( node_relative_level <= 1 ) - { - if ( 0 < parameters.get_overlap_cost_threshold() && - parameters.get_overlap_cost_threshold() < children.size() ) - return choose_by_nearly_minimum_overlap_cost(children, indexable, parameters.get_overlap_cost_threshold()); - else - return choose_by_minimum_overlap_cost(children, indexable); - } + { + if ( 0 < parameters.get_overlap_cost_threshold() && + parameters.get_overlap_cost_threshold() < children.size() ) + return choose_by_nearly_minimum_overlap_cost(children, indexable, parameters.get_overlap_cost_threshold()); + else + return choose_by_minimum_overlap_cost(children, indexable); + } // children are internal nodes else return choose_by_minimum_content_cost(children, indexable); @@ -123,86 +123,86 @@ private: return choosen_index; } - template - static inline size_t choose_by_nearly_minimum_overlap_cost(children_type const& children, + template + static inline size_t choose_by_nearly_minimum_overlap_cost(children_type const& children, Indexable const& indexable, size_t overlap_cost_threshold) - { - const size_t children_count = children.size(); + { + const size_t children_count = children.size(); - // create container of children sorted by content enlargement needed to include the new value - std::vector< boost::tuple > sorted_children(children_count); - for ( size_t i = 0 ; i < children_count ; ++i ) - { - child_type const& ch_i = children[i]; + // create container of children sorted by content enlargement needed to include the new value + std::vector< boost::tuple > sorted_children(children_count); + for ( size_t i = 0 ; i < children_count ; ++i ) + { + child_type const& ch_i = children[i]; - // expanded child node's box - Box box_exp(ch_i.first); - geometry::expand(box_exp, indexable); + // expanded child node's box + Box box_exp(ch_i.first); + geometry::expand(box_exp, indexable); - // areas difference - content_type content = index::content(box_exp); - content_type content_diff = content - index::content(ch_i.first); + // areas difference + content_type content = index::content(box_exp); + content_type content_diff = content - index::content(ch_i.first); - sorted_children[i] = boost::make_tuple(i, content_diff, content); - } + sorted_children[i] = boost::make_tuple(i, content_diff, content); + } - // sort by content_diff - std::sort(sorted_children.begin(), sorted_children.end(), content_diff_less); + // sort by content_diff + std::sort(sorted_children.begin(), sorted_children.end(), content_diff_less); - BOOST_GEOMETRY_INDEX_ASSERT(overlap_cost_threshold <= children_count, "there are not enough children"); + BOOST_GEOMETRY_INDEX_ASSERT(overlap_cost_threshold <= children_count, "there are not enough children"); - // for overlap_cost_threshold child nodes find the one with smallest overlap value - size_t choosen_index = 0; - content_type smallest_overlap_diff = (std::numeric_limits::max)(); + // for overlap_cost_threshold child nodes find the one with smallest overlap value + size_t choosen_index = 0; + content_type smallest_overlap_diff = (std::numeric_limits::max)(); - // for each node - for (size_t i = 0 ; i < overlap_cost_threshold ; ++i ) - { - size_t child_index = boost::get<0>(sorted_children[i]); + // for each node + for (size_t i = 0 ; i < overlap_cost_threshold ; ++i ) + { + size_t child_index = boost::get<0>(sorted_children[i]); - typedef typename children_type::value_type child_type; - child_type const& ch_i = children[child_index]; + typedef typename children_type::value_type child_type; + child_type const& ch_i = children[child_index]; - Box box_exp(ch_i.first); - // calculate expanded box of child node ch_i - geometry::expand(box_exp, indexable); + Box box_exp(ch_i.first); + // calculate expanded box of child node ch_i + geometry::expand(box_exp, indexable); - content_type overlap = 0; - content_type overlap_exp = 0; + content_type overlap = 0; + content_type overlap_exp = 0; - // calculate overlap - for ( size_t j = 0 ; j < children_count ; ++j ) - { - if ( child_index != j ) - { - child_type const& ch_j = children[j]; + // calculate overlap + for ( size_t j = 0 ; j < children_count ; ++j ) + { + if ( child_index != j ) + { + child_type const& ch_j = children[j]; - overlap += index::intersection_content(ch_i.first, ch_j.first); - overlap_exp += index::intersection_content(box_exp, ch_j.first); - } - } + overlap += index::intersection_content(ch_i.first, ch_j.first); + overlap_exp += index::intersection_content(box_exp, ch_j.first); + } + } - content_type overlap_diff = overlap_exp - overlap; + content_type overlap_diff = overlap_exp - overlap; - // update result - if ( overlap_diff < smallest_overlap_diff ) - { - smallest_overlap_diff = overlap_diff; - choosen_index = child_index; - } - } + // update result + if ( overlap_diff < smallest_overlap_diff ) + { + smallest_overlap_diff = overlap_diff; + choosen_index = child_index; + } + } - return choosen_index; - } + return choosen_index; + } - static inline bool content_diff_less(boost::tuple const& p1, boost::tuple const& p2) - { - return boost::get<1>(p1) < boost::get<1>(p2) || - (boost::get<1>(p1) == boost::get<1>(p2) && boost::get<2>(p1) < boost::get<2>(p2)); - } + static inline bool content_diff_less(boost::tuple const& p1, boost::tuple const& p2) + { + return boost::get<1>(p1) < boost::get<1>(p2) || + (boost::get<1>(p1) == boost::get<1>(p2) && boost::get<2>(p1) < boost::get<2>(p2)); + } - template + template static inline size_t choose_by_minimum_content_cost(children_type const& children, Indexable const& indexable) { size_t children_count = children.size(); diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index 3f34914ee..e7e7567c2 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -295,7 +295,7 @@ struct level_insert inline void operator()(leaf &) { - assert(false); + BOOST_GEOMETRY_INDEX_ASSERT(false, "this visitor can't be used for a leaf"); } }; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index 660d9da09..d7e88dbe4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -449,7 +449,7 @@ public: inline void operator()(leaf &) { - assert(false); + BOOST_GEOMETRY_INDEX_ASSERT(false, "this visitor can't be used for a leaf"); } }; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 90ee4acaf..9ec8e7dcc 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -253,7 +253,7 @@ struct generate_input<2> template static void apply(std::vector & input, Box & qbox, int size = 1) { - assert(0 < size); + BOOST_GEOMETRY_INDEX_ASSERT(0 < size, "the value must be greather than 0"); for ( int i = 0 ; i < 12 * size ; i += 3 ) { @@ -275,7 +275,7 @@ struct generate_input<3> template static void apply(std::vector & input, Box & qbox, int size = 1) { - assert(0 < size); + BOOST_GEOMETRY_INDEX_ASSERT(0 < size, "the value must be greather than 0"); for ( int i = 0 ; i < 12 * size ; i += 3 ) { diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 8b6d68402..9c6fc62f3 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -73,14 +73,14 @@ namespace detail { namespace rtree { template struct dynamic_internal_node - : public dynamic_node + : public dynamic_node { typedef throwing_pushable_array< std::pair< Box, dynamic_node * >, - Parameters::max_elements + 1 + Parameters::max_elements + 1 > elements_type; template @@ -94,7 +94,7 @@ struct dynamic_internal_node struct dynamic_leaf - : public dynamic_node + : public dynamic_node { typedef throwing_pushable_array elements_type; diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 647b72b6b..4dab18cff 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -1,8 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - example -// -// Copyright 2011 Adam Wulkiewicz. +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 6749725b8..05d24995f 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -1,8 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - example -// -// Copyright 2011 Adam Wulkiewicz. +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 71d669b90..d56c4f613 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -1,3 +1,12 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #include #include diff --git a/tests/main.cpp b/tests/main.cpp index 50a1d4632..0fc440ff3 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,8 +1,8 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.Index - unit tests -// -// Copyright 2011 Adam Wulkiewicz. +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/tests/rtree_filters.hpp b/tests/rtree_filters.hpp index 86a9454af..6dd0c82a8 100644 --- a/tests/rtree_filters.hpp +++ b/tests/rtree_filters.hpp @@ -1,3 +1,12 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #ifndef TESTS_RTREE_FILTERS_HPP #define TESTS_RTREE_FILTERS_HPP @@ -32,7 +41,7 @@ BOOST_AUTO_TEST_CASE(tests_rtree_query_filter) { #ifdef TEST_PRINT_INFO - std::cout << "tests/rtree_filters.hpp\n"; + std::cout << "tests/rtree_filters.hpp\n"; #endif typedef boost::geometry::model::point P; diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp index a9e442aab..bae08189b 100644 --- a/tests/rtree_function.hpp +++ b/tests/rtree_function.hpp @@ -1,3 +1,12 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #ifndef TESTS_RTREE_FUNCTION_HPP #define TESTS_RTREE_FUNCTION_HPP diff --git a/tests/t1.cpp b/tests/t1.cpp index 4ad96e2e6..2bb455e62 100644 --- a/tests/t1.cpp +++ b/tests/t1.cpp @@ -1,3 +1,12 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #include #include diff --git a/tests/t2.cpp b/tests/t2.cpp index e0eab887c..ab888fbca 100644 --- a/tests/t2.cpp +++ b/tests/t2.cpp @@ -1,3 +1,11 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) #include #include @@ -63,4 +71,4 @@ int main() std::cout << "Total objects: " << rTree.size(); std::cin.get(); return 0; -} \ No newline at end of file +} diff --git a/tests/translators.hpp b/tests/translators.hpp index 133da68ec..dda074baf 100644 --- a/tests/translators.hpp +++ b/tests/translators.hpp @@ -1,3 +1,12 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #ifndef TESTS_TRANSLATORS_HPP #define TESTS_TRANSLATORS_HPP @@ -19,17 +28,17 @@ struct tests_translators_val : i(ii) {} - Indexable const& get_box() const - { - return i; - } + Indexable const& get_box() const + { + return i; + } - bool operator==(tests_translators_val const& v2) - { - return boost::geometry::equals(i, v2.i); - } + bool operator==(tests_translators_val const& v2) + { + return boost::geometry::equals(i, v2.i); + } - Indexable i; + Indexable i; }; BOOST_AUTO_TEST_CASE(tests_translators) @@ -43,7 +52,7 @@ BOOST_AUTO_TEST_CASE(tests_translators) namespace bgi = bg::index; namespace bgit = bgi::translator; - typedef bgm::point P; + typedef bgm::point P; typedef bgm::box

    B; bgit::def< P > p; @@ -81,8 +90,8 @@ BOOST_AUTO_TEST_CASE(tests_translators) BOOST_CHECK( bg::equals(tmp_p, scpip(tmp_scpip)) ); BOOST_CHECK( bg::equals(tmp_p, scppi(tmp_scppi)) ); - //bgit::def d; // error - //bgit::def< bgm::segment

    > d; // error + //bgit::def d; // error + //bgit::def< bgm::segment

    > d; // error B tmp_b(P(2, 3), P(4, 5)); std::pair, B> tmp_ppb = From 00481f40c229343f4c0e1d195c22c99830e5885e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 10 Dec 2012 01:21:00 +0000 Subject: [PATCH 186/366] BOOST_ASSERT used instead of std assert [SVN r81812] --- include/boost/geometry/extensions/index/assert.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/boost/geometry/extensions/index/assert.hpp b/include/boost/geometry/extensions/index/assert.hpp index e42dc6210..bf3b3038a 100644 --- a/include/boost/geometry/extensions/index/assert.hpp +++ b/include/boost/geometry/extensions/index/assert.hpp @@ -6,21 +6,22 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include + #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP -#ifdef NDEBUG +#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) \ + BOOST_ASSERT_MSG(CONDITION, TEXT_MSG) + +#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) #define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM) -#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) - #else #define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM) PARAM -#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) assert((CONDITION) && (TEXT_MSG)) - #endif #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP From b62ed82e198f75e3b20245528212cc60d5e02f2e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 12 Dec 2012 00:19:29 +0000 Subject: [PATCH 187/366] Added commented out tests of rtree spatial queries for Polygon and Ring query regions. [SVN r81868] --- test/rtree/test_rtree.hpp | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 9ec8e7dcc..ee36f456f 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -21,6 +21,9 @@ #include #include +//#include +//#include + // Set point's coordinates template @@ -394,6 +397,16 @@ void test_intersects(bgi::rtree const& tree, std::vector con test_spatial_query(tree, qbox, expected_output); test_spatial_query(tree, bgi::intersects(qbox), expected_output); test_spatial_query(tree, !bgi::disjoint(qbox), expected_output); + + /*typedef bg::traits::point_type::type P; + bg::model::ring

    qring; + bg::convert(qbox, qring); + test_spatial_query(tree, bgi::intersects(qring), expected_output); + test_spatial_query(tree, !bgi::disjoint(qring), expected_output); + bg::model::polygon

    qpoly; + bg::convert(qbox, qpoly); + test_spatial_query(tree, bgi::intersects(qpoly), expected_output); + test_spatial_query(tree, !bgi::disjoint(qpoly), expected_output);*/ } template @@ -407,6 +420,14 @@ void test_disjoint(bgi::rtree const& tree, std::vector const test_spatial_query(tree, bgi::disjoint(qbox), expected_output); test_spatial_query(tree, !bgi::intersects(qbox), expected_output); + + /*typedef bg::traits::point_type::type P; + bg::model::ring

    qring; + bg::convert(qbox, qring); + test_spatial_query(tree, bgi::disjoint(qring), expected_output); + bg::model::polygon

    qpoly; + bg::convert(qbox, qpoly); + test_spatial_query(tree, bgi::disjoint(qpoly), expected_output);*/ } @@ -420,6 +441,14 @@ void test_covered_by(bgi::rtree const& tree, std::vector con expected_output.push_back(v); test_spatial_query(tree, bgi::covered_by(qbox), expected_output); + + /*typedef bg::traits::point_type::type P; + bg::model::ring

    qring; + bg::convert(qbox, qring); + test_spatial_query(tree, bgi::covered_by(qring), expected_output); + bg::model::polygon

    qpoly; + bg::convert(qbox, qpoly); + test_spatial_query(tree, bgi::covered_by(qpoly), expected_output);*/ } template @@ -435,6 +464,14 @@ struct test_overlap_impl expected_output.push_back(v); test_spatial_query(tree, bgi::overlaps(qbox), expected_output); + + /*typedef bg::traits::point_type::type P; + bg::model::ring

    qring; + bg::convert(qbox, qring); + test_spatial_query(tree, bgi::overlaps(qring), expected_output); + bg::model::polygon

    qpoly; + bg::convert(qbox, qpoly); + test_spatial_query(tree, bgi::overlaps(qpoly), expected_output);*/ } }; @@ -503,6 +540,14 @@ void test_within(bgi::rtree const& tree, std::vector const& expected_output.push_back(v); test_spatial_query(tree, bgi::within(qbox), expected_output); + + /*typedef bg::traits::point_type::type P; + bg::model::ring

    qring; + bg::convert(qbox, qring); + test_spatial_query(tree, bgi::within(qring), expected_output); + bg::model::polygon

    qpoly; + bg::convert(qbox, qpoly); + test_spatial_query(tree, bgi::within(qpoly), expected_output);*/ } // rtree nearest queries From 4778fbe04917ca91aafd8d1a9957208734e71464 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 12 Dec 2012 15:27:53 +0000 Subject: [PATCH 188/366] Added static_vector test implementation. [SVN r81874] --- tests/static_vector.cpp | 186 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 tests/static_vector.cpp diff --git a/tests/static_vector.cpp b/tests/static_vector.cpp new file mode 100644 index 000000000..a8f94dec4 --- /dev/null +++ b/tests/static_vector.cpp @@ -0,0 +1,186 @@ +#include +#include + +template +class static_vector +{ +public: + typedef Value value_type; + typedef size_t size_type; + typedef Value& reference; + typedef Value const& const_reference; + typedef Value* iterator; + typedef const Value * const_iterator; + + static_vector() + : m_size(0) + {} + + static_vector(size_type s) + { + try + { + resize(s); // may throw + } + catch(...) + { + this->destroy(0, m_size); + } + } + + ~static_vector() + { + this->destroy(0, m_size); + } + + void resize(size_type s) + { + if ( s < m_size ) + { + this->destroy(s, m_size); + m_size = s; + } + else + { + for ( size_type i = m_size ; i < s ; ++i ) + { + this->construct(i); // may throw + ++m_size; + } + } + } + + void push_back(Value const& value) + { + BOOST_ASSERT_MSG(m_size < Capacity, "max capacity reached"); + this->construct(m_size, value); // may throw + ++m_size; + } + + void pop_back() + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + --m_size; + this->destroy(m_size); + } + + Value & operator[](size_t i) + { + BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); + return *(this->ptr(i)); + } + + Value const& operator[](size_t i) const + { + BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); + return *(this->ptr(i)); + } + + Value & front() + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(0)); + } + + Value const& front() const + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(0)); + } + + Value & back() + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(m_size - 1)); + } + + Value const& back() const + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(m_size - 1)); + } + + size_type capacity() const + { + return Capacity; + } + + size_type size() const + { + return m_size; + } + + bool empty() const + { + return 0 == m_size; + } + +private: + Value * ptr(size_type i) + { + return (reinterpret_cast(m_storage.address()) + i); + } + + const Value * ptr(size_type i) const + { + return (reinterpret_cast(m_storage.address()) + i); + } + + void construct(size_type i) + { + new (ptr(i)) value_type(); // may throw + } + + void construct(size_type i, Value const& value) + { + new (ptr(i)) value_type(value); // may throw + } + + void destroy(size_type i) + { + ptr(i)->~value_type(); + } + + void destroy(size_type first_i, size_type last_i) + { + for ( size_type i = first_i ; i < last_i ; ++i ) + this->destroy(i); + } + + boost::aligned_storage m_storage; + size_type m_size; +}; + +// ------------------------------- TEST ---------------------------------- + +#include + +struct A +{ + A() : v(0) { std::cout << "A()" << std::endl; } + A(int i) : v(i) { std::cout << "A(" << i << ")" << std::endl; } + ~A() { std::cout << "~A" << v << "()" << std::endl; } + A(A const& a) { std::cout << "A(A(" << a.v << "))" << std::endl; v = a.v; } + A & operator=(A const& a) { std::cout << "A" << v << " = A" << a.v << std::endl; v = a.v; return *this; } + int v; +}; + +int main() +{ + static_vector sv; + std::cout << "resize(2)" << std::endl; + sv.resize(2); // 0 0 + std::cout << "push_back(A(22))" << std::endl; + sv.push_back(A(22)); // 0 0 22 + std::cout << "push_back(A(23))" << std::endl; + sv.push_back(A(23)); // 0 0 22 23 + std::cout << "pop_back()" << std::endl; + sv.pop_back(); // 0 0 22 + sv.front().v = 10; // 10 0 22 + sv.back().v = 100; // 10 0 100 + sv[1].v = 50; // 10 50 100 + std::cout << "resize(1)" << std::endl; + sv.resize(1); // 10 + std::cout << "~static_vector()" << std::endl; + return 0; +} From d8f96837b8616d057fabc54cf00563fcdf1ef02d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 12 Dec 2012 15:31:46 +0000 Subject: [PATCH 189/366] Added license info. [SVN r81875] --- tests/static_vector.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/static_vector.cpp b/tests/static_vector.cpp index a8f94dec4..d6ba6f0d1 100644 --- a/tests/static_vector.cpp +++ b/tests/static_vector.cpp @@ -1,3 +1,12 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + #include #include From aaf737a5ce2c9dbd2779a8b7237b41270c449fb8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 03:34:54 +0000 Subject: [PATCH 190/366] static_vector implemented and used in the rtree instead of pushable_array [SVN r81885] --- .../index/rtree/node/node_d_mem_static.hpp | 10 +- .../index/rtree/node/node_s_mem_static.hpp | 6 +- .../index/rtree/visitors/insert.hpp | 2 +- .../extensions/index/static_vector.hpp | 236 ++++++++++++++++++ test/rtree/rtree_exceptions.cpp | 2 +- tests/static_vector.cpp | 159 +----------- 6 files changed, 250 insertions(+), 165 deletions(-) create mode 100644 include/boost/geometry/extensions/index/static_vector.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp index ff70774c3..5fde64552 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp @@ -12,7 +12,7 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -22,7 +22,7 @@ template : public dynamic_node { - typedef index::pushable_array< + typedef index::static_vector< std::pair< Box, dynamic_node * @@ -43,7 +43,7 @@ template : public dynamic_node { - typedef index::pushable_array elements_type; + typedef index::static_vector elements_type; template inline dynamic_leaf(Dummy) {} @@ -82,9 +82,9 @@ struct visitor -struct container_from_elements_type, NewValue> +struct container_from_elements_type, NewValue> { - typedef index::pushable_array type; + typedef index::static_vector type; }; // allocators diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp index 8220b3de4..54ac35a9d 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#include +#include #include @@ -24,7 +24,7 @@ namespace detail { namespace rtree { template struct static_internal_node { - typedef index::pushable_array< + typedef index::static_vector< std::pair< Box, typename node::type * @@ -41,7 +41,7 @@ struct static_internal_node struct static_leaf { - typedef index::pushable_array elements_type; + typedef index::static_vector elements_type; template inline static_leaf(Dummy) {} diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp index d7e88dbe4..5635ce013 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp @@ -122,7 +122,7 @@ protected: typedef rtree::node_auto_ptr node_auto_ptr; public: - typedef index::pushable_array, 1> nodes_container_type; + typedef index::static_vector, 1> nodes_container_type; template static inline void apply(nodes_container_type & additional_nodes, diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp new file mode 100644 index 000000000..1de6829d7 --- /dev/null +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -0,0 +1,236 @@ +// Boost.Geometry Index +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP + +namespace boost { namespace geometry { namespace index { + +template +class static_vector +{ +public: + typedef Value value_type; + typedef size_t size_type; + typedef Value& reference; + typedef Value const& const_reference; + typedef Value* iterator; + typedef const Value * const_iterator; + typedef boost::reverse_iterator reverse_iterator; + typedef boost::reverse_iterator const_reverse_iterator; + + // nothrow + static_vector() + : m_size(0) + {} + + // strong + static_vector(size_type s) + : m_size(0) + { + resize(s); // may throw + } + + // strong + static_vector(static_vector const& other) + : m_size(0) + { + //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); + + try + { + for ( ; m_size < other.m_size ; ++m_size ) + this->construct(m_size, other[m_size]); // may throw + } + catch(...) + { + this->destroy(0, m_size); + throw; // rethrow + } + } + + // basic + static_vector & operator=(static_vector const& other) + { + //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); + + size_t min_size = m_size < other.m_size ? m_size : other.m_size; + + for ( size_t i = 0 ; i < min_size ; ++i ) + (*this)[i] = other[i]; // may throw + + for ( ; m_size < other.m_size ; ++m_size ) + this->construct(m_size, other[m_size]); // may throw + + for ( size_t i = other.m_size ; i < m_size ; ++i ) + this->destroy(i); + + return *this; + } + + // nothrow + ~static_vector() + { + this->destroy(0, m_size); + } + + // nothrow if s <= size(), strong otherwise + void resize(size_type s) + { + if ( s < m_size ) + { + this->destroy(s, m_size); + m_size = s; + } + else + { + size_type i = m_size; + try + { + for ( ; i < s ; ++i ) + this->construct(i); // may throw + m_size = s; + } + catch(...) + { + this->destroy(m_size, i); + throw; // rethrow + } + } + } + + // nothrow + void reserve(size_type s) + { + BOOST_ASSERT_MSG(s <= Capacity, "max capacity reached"); + } + + // strong + void push_back(Value const& value) + { + BOOST_ASSERT_MSG(m_size < Capacity, "max capacity reached"); + this->construct(m_size, value); // may throw + ++m_size; + } + + // nothrow + void pop_back() + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + --m_size; + this->destroy(m_size); + } + + // nothrow + void clear() + { + this->destroy(0, m_size); + m_size = 0; + } + + // nothrow + Value & operator[](size_t i) + { + BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); + return *(this->ptr(i)); + } + + // nothrow + Value const& operator[](size_t i) const + { + BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); + return *(this->ptr(i)); + } + + // nothrow + Value & front() + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(0)); + } + + // nothrow + Value const& front() const + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(0)); + } + + // nothrow + Value & back() + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(m_size - 1)); + } + + // nothrow + Value const& back() const + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + return *(this->ptr(m_size - 1)); + } + + // nothrow + iterator begin() { return this->ptr(0); } + const_iterator begin() const { return this->ptr(0); } + iterator end() { return this->ptr(m_size); } + const_iterator end() const { return this->ptr(m_size); } + // nothrow + reverse_iterator rbegin() { return reverse_iterator(this->end()); } + const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); } + reverse_iterator rend() { return reverse_iterator(this->begin()); } + const_reverse_iterator rend() const { return reverse_iterator(this->begin()); } + + // nothrow + size_type capacity() const { return Capacity; } + size_type size() const { return m_size; } + bool empty() const { return 0 == m_size; } + +private: + void construct(size_type i) + { + new (this->ptr(i)) value_type(); // may throw + } + + void construct(size_type i, Value const& value) + { + new (this->ptr(i)) value_type(value); // may throw + } + + void destroy(size_type i) + { + this->ptr(i)->~value_type(); + } + + void destroy(size_type first_i, size_type last_i) + { + for ( size_type i = first_i ; i < last_i ; ++i ) + this->destroy(i); + } + + Value * ptr(size_type i) + { + return (reinterpret_cast(m_storage.address()) + i); + } + + const Value * ptr(size_type i) const + { + return (reinterpret_cast(m_storage.address()) + i); + } + + boost::aligned_storage m_storage; + size_type m_size; +}; + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 6de5ecf3c..2e279a121 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -27,7 +27,7 @@ void test_rtree_value_exceptions(Parameters const& parameters = Parameters()) B qbox; generate_input<2>::apply(input, qbox); - for ( size_t i = 0 ; i < 100 ; i += 5 ) + for ( size_t i = 0 ; i < 50 ; i += 2 ) { throwing_value::reset_calls_counter(); throwing_value::set_max_calls(10000); diff --git a/tests/static_vector.cpp b/tests/static_vector.cpp index d6ba6f0d1..c3bce7ace 100644 --- a/tests/static_vector.cpp +++ b/tests/static_vector.cpp @@ -7,160 +7,7 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include - -template -class static_vector -{ -public: - typedef Value value_type; - typedef size_t size_type; - typedef Value& reference; - typedef Value const& const_reference; - typedef Value* iterator; - typedef const Value * const_iterator; - - static_vector() - : m_size(0) - {} - - static_vector(size_type s) - { - try - { - resize(s); // may throw - } - catch(...) - { - this->destroy(0, m_size); - } - } - - ~static_vector() - { - this->destroy(0, m_size); - } - - void resize(size_type s) - { - if ( s < m_size ) - { - this->destroy(s, m_size); - m_size = s; - } - else - { - for ( size_type i = m_size ; i < s ; ++i ) - { - this->construct(i); // may throw - ++m_size; - } - } - } - - void push_back(Value const& value) - { - BOOST_ASSERT_MSG(m_size < Capacity, "max capacity reached"); - this->construct(m_size, value); // may throw - ++m_size; - } - - void pop_back() - { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - --m_size; - this->destroy(m_size); - } - - Value & operator[](size_t i) - { - BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); - return *(this->ptr(i)); - } - - Value const& operator[](size_t i) const - { - BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); - return *(this->ptr(i)); - } - - Value & front() - { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(0)); - } - - Value const& front() const - { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(0)); - } - - Value & back() - { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(m_size - 1)); - } - - Value const& back() const - { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(m_size - 1)); - } - - size_type capacity() const - { - return Capacity; - } - - size_type size() const - { - return m_size; - } - - bool empty() const - { - return 0 == m_size; - } - -private: - Value * ptr(size_type i) - { - return (reinterpret_cast(m_storage.address()) + i); - } - - const Value * ptr(size_type i) const - { - return (reinterpret_cast(m_storage.address()) + i); - } - - void construct(size_type i) - { - new (ptr(i)) value_type(); // may throw - } - - void construct(size_type i, Value const& value) - { - new (ptr(i)) value_type(value); // may throw - } - - void destroy(size_type i) - { - ptr(i)->~value_type(); - } - - void destroy(size_type first_i, size_type last_i) - { - for ( size_type i = first_i ; i < last_i ; ++i ) - this->destroy(i); - } - - boost::aligned_storage m_storage; - size_type m_size; -}; - -// ------------------------------- TEST ---------------------------------- +#include #include @@ -176,7 +23,9 @@ struct A int main() { - static_vector sv; + namespace bgi = boost::geometry::index; + + bgi::static_vector sv; std::cout << "resize(2)" << std::endl; sv.resize(2); // 0 0 std::cout << "push_back(A(22))" << std::endl; From 6f103fc04e23491fa0a103b329fb3213d07e8a2e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 13:16:06 +0000 Subject: [PATCH 191/366] explicit keyword added in static_vector. [SVN r81895] --- include/boost/geometry/extensions/index/static_vector.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 1de6829d7..e9180e81c 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -34,7 +34,7 @@ public: {} // strong - static_vector(size_type s) + explicit static_vector(size_type s) : m_size(0) { resize(s); // may throw From 4689284174977348c4ddee4114f9c36576366a4b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 13:48:51 +0000 Subject: [PATCH 192/366] added throwing static vector to exceptions test [SVN r81897] --- test/rtree/test_rtree_exceptions.hpp | 6 ++-- test/rtree/test_throwing.hpp | 54 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 9c6fc62f3..8c98a6ac3 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -75,7 +75,7 @@ template : public dynamic_node { - typedef throwing_pushable_array< + typedef throwing_static_vector< std::pair< Box, dynamic_node * @@ -96,7 +96,7 @@ template : public dynamic_node { - typedef throwing_pushable_array elements_type; + typedef throwing_static_vector elements_type; template inline dynamic_leaf(Dummy) {} @@ -111,7 +111,7 @@ struct dynamic_leaf struct container_from_elements_type, NewValue> { - typedef throwing_pushable_array type; + typedef throwing_static_vector type; }; // nodes traits diff --git a/test/rtree/test_throwing.hpp b/test/rtree/test_throwing.hpp index 08190d18d..40d823b37 100644 --- a/test/rtree/test_throwing.hpp +++ b/test/rtree/test_throwing.hpp @@ -319,4 +319,58 @@ private: size_type m_size; }; +#include + +struct throwing_static_vector_exception : public std::exception +{ + const char * what() const throw() { return "static vector exception."; } +}; + +struct throwing_static_vector_settings +{ + static void throw_if_required() + { + // throw if counter meets max count + if ( get_max_calls_ref() <= get_calls_counter_ref() ) + throw throwing_pushable_array_exception(); + else + ++get_calls_counter_ref(); + } + + static void reset_calls_counter() { get_calls_counter_ref() = 0; } + static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } + + static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } + static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits::max)(); return mc; } +}; + +template +class throwing_static_vector + : public boost::geometry::index::static_vector +{ + typedef boost::geometry::index::static_vector container; + +public: + typedef typename container::value_type value_type; + typedef typename container::size_type size_type; + typedef typename container::iterator iterator; + typedef typename container::const_iterator const_iterator; + typedef typename container::reverse_iterator reverse_iterator; + typedef typename container::const_reverse_iterator const_reverse_iterator; + typedef typename container::reference reference; + typedef typename container::const_reference const_reference; + + inline void resize(size_type s) + { + throwing_pushable_array_settings::throw_if_required(); + container::resize(s); + } + + void push_back(Element const& v) + { + throwing_pushable_array_settings::throw_if_required(); + container::push_back(v); + } +}; + #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_THROWING_HPP From c6095f72f79b80c9149074cbd05222d15e17d7f6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 17:14:06 +0000 Subject: [PATCH 193/366] Added rtree test counting existing Values objects while inserting and removing. [SVN r81902] --- test/rtree/test_rtree.hpp | 113 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index ee36f456f..780ed9646 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -244,6 +244,72 @@ struct generate_value< boost::shared_ptr > } }; +// counting value + +template +struct counting_value +{ + counting_value() { counter()++; } + counting_value(Indexable const& i) : indexable(i) { counter()++; } + counting_value(counting_value const& c) : indexable(c.indexable) { counter()++; } + ~counting_value() { counter()--; } + + static size_t & counter() { static size_t c = 0; return c; } + Indexable indexable; +}; + +namespace boost { namespace geometry { namespace index { namespace translator { + +template +struct def< counting_value > +{ + typedef counting_value value_type; + typedef Indexable const& result_type; + + result_type operator()(value_type const& value) const + { + return value.indexable; + } + + bool equals(value_type const& v1, value_type const& v2) const + { + return boost::geometry::equals(v1.indexable, v2.indexable); + return false; + } +}; + +}}}} + +template +struct generate_value< counting_value > > +{ + typedef bg::model::point P; + static counting_value

    apply(int x, int y) { return counting_value

    (P(x, y)); } +}; + +template +struct generate_value< counting_value > > +{ + typedef bg::model::point P; + static counting_value

    apply(int x, int y, int z) { return counting_value

    (P(x, y, z)); } +}; + +template +struct generate_value< counting_value > > > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + static counting_value apply(int x, int y) { return counting_value(B(P(x, y), P(x+2, y+3))); } +}; + +template +struct generate_value< counting_value > > > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + static counting_value apply(int x, int y, int z) { return counting_value(B(P(x, y, z), P(x+2, y+3, z+4))); } +}; + // generate input template @@ -979,6 +1045,49 @@ void test_rtree_by_value(Parameters const& parameters) test_copy_assignment_swap_move(empty_tree, qbox); } +// rtree inserting removing by use of counting_value + +template +void test_count_rtree_values(Parameters const& parameters) +{ + typedef counting_value Value; + typedef bgi::rtree Tree; + typedef typename Tree::box_type B; + + Tree t(parameters); + std::vector input; + B qbox; + + generate_rtree(t, input, qbox); + + { + BOOST_FOREACH(Value const& v, input) + t.insert(v); + } + + size_t rest_count = input.size(); + + BOOST_CHECK(t.size() + rest_count == Value::counter()); + + std::vector values_to_remove; + t.spatial_query(qbox, std::back_inserter(values_to_remove)); + + rest_count += values_to_remove.size(); + + BOOST_CHECK(t.size() + rest_count == Value::counter()); + + size_t values_count = Value::counter(); + + BOOST_FOREACH(Value const& v, values_to_remove) + { + t.remove(v); + --values_count; + + BOOST_CHECK(Value::counter() == values_count); + BOOST_CHECK(t.size() + rest_count == values_count); + } +} + // run all tests for one Algorithm for some number of rtrees // defined by some number of Values constructed from given Point @@ -998,7 +1107,11 @@ void test_rtree(Parameters const& parameters = Parameters()) test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); + test_rtree_by_value(parameters); + + test_count_rtree_values(parameters); + test_count_rtree_values(parameters); } #endif From 531629051ad26ac59c40f97fbcc3c4bbe9f0f2d4 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 18:39:31 +0000 Subject: [PATCH 194/366] Info about spatial predicates using Ring and Polygon added in docs. Ring and Polygon queries added to GLUT Vis test. [SVN r81907] --- .../r_tree/spatial_queries.html | 50 ++++-- doc/html/index.html | 2 +- doc/images/intersects_poly.png | Bin 0 -> 2654 bytes doc/images/intersects_ring.png | Bin 0 -> 2641 bytes doc/rtree/spatial_query.qbk | 15 +- tests/additional_glut_vis.cpp | 169 +++++++++++++++++- 6 files changed, 217 insertions(+), 19 deletions(-) create mode 100644 doc/images/intersects_poly.png create mode 100644 doc/images/intersects_ring.png diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html index a26b1bcc2..833e069d7 100644 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ b/doc/html/geometry_index/r_tree/spatial_queries.html @@ -43,8 +43,8 @@ which meets some predicates. For instance it may be used to retrieve Values intersecting some area or are within some other area. Names of predicates corresponds to names of Boost.Geometry - algorithms. The examples of some basic queries may be found in the table - below. The query region and result Values + algorithms. The examples of some basic queries may be found in tables below. + The query region and result Values are orange.

    @@ -58,27 +58,27 @@ @@ -110,6 +110,36 @@

    - intersects (default) + intersects(Box) - default

    - covered_by + covered_by(Box)

    - disjoint + disjoint(Box)

    - overlaps + overlaps(Box)

    - within + within(Box)

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

    + intersects(Ring) +

    +
    +

    + intersects(Polygon) +

    +
    +

    + intersects_ring +

    +
    +

    + intersects_poly +

    +

    To explicitly define one of the predicates one may pass it to the spatial_query() - as the first argument instead of Box. + as the first argument.

    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
    @@ -178,7 +208,7 @@
               to construct advanced queries but is also faster than separate calls because
               the tree is traversed only once. Traversing is continued and Values are returned only if all predicates
               are met. Predicates are checked left-to-right so placing most restictive
    -          predicates first should accelerate the search even more.
    +          predicates first should accelerate the search.
             

    rt.spatial_query(
       std::make_pair(
    diff --git a/doc/html/index.html b/doc/html/index.html
    index 8ff4a0cf7..78510d922 100644
    --- a/doc/html/index.html
    +++ b/doc/html/index.html
    @@ -56,7 +56,7 @@
     
    @@ -126,6 +127,11 @@ intersects(Polygon)

    +

    + intersects(MultiPolygon) +

    +
    @@ -138,6 +144,11 @@ intersects_poly

    +

    + intersects_mpoly +

    +
    diff --git a/doc/html/index.html b/doc/html/index.html index 78510d922..73e908eea 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: December 13, 2012 at 18:36:05 GMT

    Last revised: December 13, 2012 at 22:34:06 GMT


    diff --git a/doc/images/intersects_mpoly.png b/doc/images/intersects_mpoly.png new file mode 100644 index 0000000000000000000000000000000000000000..f6172d2109ec47d7b0be44b9fb63c262c5ab64f8 GIT binary patch literal 2687 zcmeAS@N?(olHy`uVBq!ia0y~yU^olH9Bd2>4AOhPWHK-?uqAoByDKysXz`!7z84^+AoS&PUnpeUA z0?tLLi6yBi3gww484B*6z5ywEsq734oR2+S978H@y`39bw%9-)bimYLGhYnF#EU3kUkvWX^x!Ly^v3>C+&-{n45_(b!m!)>>}JK|oy zF1vU#L%dmv@BcdecmG=x1kMB>)L1&@-PRuW)who4{y+WXP*k>5p3}7X{_bA(zay6% zHkgy~+3e;<3>yvyjY^&w-A z_SG*6q)zlr@C#UxFvn$ckIj!~c^a2X>Jm<<$XwUiA#i-P%E1}?+%%WoQtW59G2>m^ z)7TJS(|>vU-uXWpOaIsw>h~uUNHLr!RcQFhcp#IE_BIR~c z;ktpY^>V|=dFNG@GS&uv**7WX(54%2&)v#AmZ!5%%CqR;l@j}TW?Pd zvsSEw+Wq(d^@A@WvksPA&Yy8j^xd8G`|&eYKQhr|-JGBE#Jq!zho!kdfH#7J?V*Cy z57+%uXC?^nEn?*7G(B{3(i^w)MG;45ok?BNvamx<{-Dl!O(%kUH;|va(jFBQ<*lkR~=g~g{ki{+$p)L{GHm;d%g49Ou5y? z&VE0?f2satqn9bA>!)7oP~$&Xky3O1=fsv!W+o+ZxAR8gXTmH@Rc}8r;W!r0Cr~&y zYK7DHjTegVJhc`-mg(g?kJ+kkimtqxXI*+>ljYVqwWj-K>})&#@Wtf!x@qgLxK7Hi zUgdljByKgSxMghR9ky)v*)@qRuRtnX@7vNfsncb?uZxLWK4Gsz_#w@;VvK&m9tIA6lS}y% zLragOv(B8Hty6vB>yvMi?bi!M*DMjf;Z-n8adXW(4Y_?ii<76uoRalZ?|5zE{Q6#V z)wbC`_=G=yyQkh;{qJ^=*EhraUcU3^zc#twCA|A&CJX1YwwI3u((3=mE&jsPc=Nf5 zP(h~3<%6dGbR;j{S|u?z@LkCRtNNDDTaqu>U!P<5s?f1u&N8LxAMdV~Tf6bqR=#rm zb?Yq)Wr}3xJTueT-1pf2?ELTVuSZnQXWXBCM&+A@@7c;T3z=uM<=NSBKMZ|k(#ay6 z)O&UQ#I@alCgR&?iCv61^YBI7dcSHH&)=!9N@uY&S!PK%UJIFd=kmpDo|dhAYBn5S zm%N?6@^Yq7TT1jp7s-8FcOKvT{SE7<3x!MGOka6EbH-bKWv`++U2IGY4;7?hKuM8> zxr6QC1G7m#oeV@DU3#JKcIBPh$t5~$wTd&i<~~}LXdhW?U|%n9%HVZt(udF*<%I7G z%^ylwA9PGt%{&%g=jS}9cek=sOLKw%?;%HnMH9Au>ybIW=cByp<5LT-G59qR@{qGUdC2>g)>wd`%xugopAj{9rlf?X3-q zU(GA``TgN_%hM@LD{f|TmCM9yH~6aQ9WRe%+MxO9yp8Y5LpMXeo8+rr@7({c;+h5T z&$FgIQy!Z5f0|u-^2G8&?b2g zF5d|HRq?M%=l;1w3n%_P*1lovSE`PESJQDap5r#HfN#>np!csnVH(RE@@lEirA%m@e$~EI(W9LY4c{MT<6nQ_j2{R zy(=o6!=`Y|fq`KWBZCVlZx}URG>({9#%1ise9*#5ZSk_j#syLz)MO51G89PV-^jD^ z-rJb{@7~S#0!K4h9^QH}eNsTfWd#}Thet~0-hGu*)?pXFrD~@_X!g}!Wk2DVl8rL$ zd;cb~ZnjBVD?4Xd?$sF&o1@BO=h>c^p#3iTb`KQeA~Sv+orZjB7XJ#sI1*F%ExS9$E~-05vtGitk20W zxTr2!K_Z@a5u1=8!?wJ!qO*RD z)Rii~OIfl@4`&t?O0yq4qQ{s$>52Een7yU5$^yJtUme``wdKF`yr~lN=FByCtEeJ< z>x8!XlV?Bk{DfD_y?{_q^I6|Z?fj8z|FOf6(owJDqdJ{xGlTv zvUuCt!yIhOKi;fZl&8e3aVgX6(8Dv{2Qne08biG0*}C^X<-RRq_S-CcMmA?H>zrqe zvlS#xOs&2BMN)9$<%WubKi)mqpR@mn*zL-xCqMobm>;nJYOGemW08fcKF3&{4HbOR z8o(-|@w_Xc$d@&5?lS4)1;0(~LU!v5-rqkxJNM}gC*|dgg)Mf@Q=}LJdJ77q8e)oP zY1rIxKP)+U!lW&Jht+frWIp0he{QU{UD-@1TdLiLefbnowI?QxESqyvCb0-FTDW_j zcyPL(@Q#PO{v~Ydb$E4akHGimMR7cS!Z+_lmT+CQJ{!7zD~HM!VGr>~|Ndn~TYLBk zN35B|#uRif-mlrt)%xtdcH^~a@>`a_dG%T%Yq7_2%h#njReLYkK6NQ3&t2>zlUh;ZYO|9>EVdB2|L5qIFf=xGtivrk}2lmYJe3&6(a>V9Ncl(+>_8}*>8-Kaz81~+z!=>)XgKD|H zIc#0(-)fXBc{>FC*8Fst!^QyeU&ES;IhXJBIv7YzHCVU)tI5lqC*Q7Sd--$4``X#1 zYxTZ-(v-M-y&?Wf$oHmO3vK0P41V6;$j4sqSNv3sgYDsxM_=A;ZB6c1w&ZpAGAFH* z@qE&e&DSRz&-fY>AU54^^L!nnPWGkOY~*s3{n^}3@sxk9jJfV}`N%e(2KGP9X)5eS TpS!;Bg4%(eu6{1-oD!M #include +#include #include #include @@ -31,6 +32,7 @@ typedef bg::model::box

    B; //bgi::rtree t(2, 1); typedef bg::model::ring

    R; typedef bg::model::polygon

    Poly; +typedef bg::model::multi_polygon MPoly; bgi::rtree< B, @@ -47,9 +49,10 @@ std::vector nearest_boxes; B search_box; R search_ring; Poly search_poly; +MPoly search_multi_poly; enum query_mode_type { - qm_knn, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw, qm_all, qm_ri, qm_pi + qm_knn, qm_c, qm_d, qm_i, qm_o, qm_w, qm_nc, qm_nd, qm_ni, qm_no, qm_nw, qm_all, qm_ri, qm_pi, qm_mpi } query_mode = qm_knn; bool search_valid = false; @@ -227,6 +230,78 @@ void query_poly() std::cout << "boxes not found\n"; } +template +void query_multi_poly() +{ + float x = ( rand() % 1000 ) / 10.0f; + float y = ( rand() % 1000 ) / 10.0f; + float w = 10 + ( rand() % 1000 ) / 100.0f; + float h = 10 + ( rand() % 1000 ) / 100.0f; + + search_multi_poly.clear(); + + search_multi_poly.push_back(Poly()); + search_multi_poly[0].outer().push_back(P(x - w, y - h)); + search_multi_poly[0].outer().push_back(P(x - w/2, y - h)); + search_multi_poly[0].outer().push_back(P(x, y - 3*h/2)); + search_multi_poly[0].outer().push_back(P(x + w/2, y - h)); + search_multi_poly[0].outer().push_back(P(x + w, y - h)); + search_multi_poly[0].outer().push_back(P(x + w, y - h/2)); + search_multi_poly[0].outer().push_back(P(x + 3*w/2, y)); + search_multi_poly[0].outer().push_back(P(x + w, y + h/2)); + search_multi_poly[0].outer().push_back(P(x + w, y + h)); + search_multi_poly[0].outer().push_back(P(x + w/2, y + h)); + search_multi_poly[0].outer().push_back(P(x, y + 3*h/2)); + search_multi_poly[0].outer().push_back(P(x - w/2, y + h)); + search_multi_poly[0].outer().push_back(P(x - w, y + h)); + search_multi_poly[0].outer().push_back(P(x - w, y + h/2)); + search_multi_poly[0].outer().push_back(P(x - 3*w/2, y)); + search_multi_poly[0].outer().push_back(P(x - w, y - h/2)); + search_multi_poly[0].outer().push_back(P(x - w, y - h)); + + search_multi_poly[0].inners().push_back(Poly::ring_type()); + search_multi_poly[0].inners()[0].push_back(P(x - w/2, y - h/2)); + search_multi_poly[0].inners()[0].push_back(P(x + w/2, y - h/2)); + search_multi_poly[0].inners()[0].push_back(P(x + w/2, y + h/2)); + search_multi_poly[0].inners()[0].push_back(P(x - w/2, y + h/2)); + search_multi_poly[0].inners()[0].push_back(P(x - w/2, y - h/2)); + + search_multi_poly.push_back(Poly()); + search_multi_poly[1].outer().push_back(P(x - 2*w, y - 2*h)); + search_multi_poly[1].outer().push_back(P(x - 6*w/5, y - 2*h)); + search_multi_poly[1].outer().push_back(P(x - 6*w/5, y - 6*h/5)); + search_multi_poly[1].outer().push_back(P(x - 2*w, y - 6*h/5)); + search_multi_poly[1].outer().push_back(P(x - 2*w, y - 2*h)); + + search_multi_poly.push_back(Poly()); + search_multi_poly[2].outer().push_back(P(x + 6*w/5, y + 6*h/5)); + search_multi_poly[2].outer().push_back(P(x + 2*w, y + 6*h/5)); + search_multi_poly[2].outer().push_back(P(x + 2*w, y + 2*h)); + search_multi_poly[2].outer().push_back(P(x + 6*w/5, y + 2*h)); + search_multi_poly[2].outer().push_back(P(x + 6*w/5, y + 6*h/5)); + + nearest_boxes.clear(); + found_count = t.spatial_query(Predicate(search_multi_poly), std::back_inserter(nearest_boxes) ); + + if ( found_count > 0 ) + { + std::cout << "search multi_poly[0] outer: "; + BOOST_FOREACH(P const& p, search_multi_poly[0].outer()) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, p); + std::cout << ' '; + } + std::cout << "\nfound: "; + for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) + { + bgi::detail::rtree::visitors::detail::print_indexable(std::cout, nearest_boxes[i]); + std::cout << '\n'; + } + } + else + std::cout << "boxes not found\n"; +} + void search() { if ( query_mode == qm_knn ) @@ -257,6 +332,8 @@ void search() query_ring< bgi::detail::intersects >(); else if ( query_mode == qm_pi ) query_poly< bgi::detail::intersects >(); + else if ( query_mode == qm_mpi ) + query_multi_poly< bgi::detail::intersects >(); search_valid = true; } @@ -289,12 +366,13 @@ void draw_knn_area() glEnd(); } -void draw_query_box_area() +template +void draw_box(Box const& box) { - float x1 = boost::geometry::get(search_box); - float y1 = boost::geometry::get(search_box); - float x2 = boost::geometry::get(search_box); - float y2 = boost::geometry::get(search_box); + float x1 = boost::geometry::get(box); + float y1 = boost::geometry::get(box); + float x2 = boost::geometry::get(box); + float y2 = boost::geometry::get(box); float z = t.depth(); // search box @@ -307,7 +385,7 @@ void draw_query_box_area() } template -void draw_ring_area(Range const& range) +void draw_ring(Range const& range) { float z = t.depth(); @@ -324,16 +402,19 @@ void draw_ring_area(Range const& range) glEnd(); } -void draw_query_ring_area() +template +void draw_polygon(Polygon const& polygon) { - draw_ring_area(search_ring); + draw_ring(polygon.outer()); + BOOST_FOREACH(Poly::ring_type const& r, polygon.inners()) + draw_ring(r); } -void draw_query_poly_area() +template +void draw_multi_polygon(MultiPolygon const& multi_polygon) { - draw_ring_area(search_poly.outer()); - BOOST_FOREACH(Poly::ring_type const& r, search_poly.inners()) - draw_ring_area(r); + BOOST_FOREACH(Poly const& p, multi_polygon) + draw_polygon(p); } void render_scene(void) @@ -349,11 +430,13 @@ void render_scene(void) if ( query_mode == qm_knn ) draw_knn_area(); else if ( query_mode == qm_ri ) - draw_query_ring_area(); + draw_ring(search_ring); else if ( query_mode == qm_pi ) - draw_query_poly_area(); + draw_polygon(search_poly); + else if ( query_mode == qm_mpi ) + draw_multi_polygon(search_multi_poly); else - draw_query_box_area(); + draw_box(search_box); for ( size_t i = 0 ; i < nearest_boxes.size() ; ++i ) boost::geometry::index::detail::rtree::visitors::detail::gl_draw_indexable(nearest_boxes[i], t.depth()); @@ -513,6 +596,8 @@ void keyboard(unsigned char key, int x, int y) query_mode = qm_ri; else if ( current_line == "pi" ) query_mode = qm_pi; + else if ( current_line == "mpi" ) + query_mode = qm_mpi; search(); glutPostRedisplay(); From 34768c2fb2f3992c14b3b3eba355fc93b2108bbf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 13 Dec 2012 23:08:37 +0000 Subject: [PATCH 198/366] Some VS warnings fixed. [SVN r81923] --- .../extensions/index/rtree/rstar/redistribute_elements.hpp | 5 ++++- include/boost/geometry/extensions/index/static_vector.hpp | 5 +++-- test/rtree/test_rtree.hpp | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 7a81aa9f7..06e212412 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -301,7 +301,10 @@ template struct partial_sort { template - static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr) + static inline void apply(Elements & elements, + const size_t BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(axis), + const size_t index, + Translator const& tr) { BOOST_GEOMETRY_INDEX_ASSERT(axis == 0, "unexpected axis value"); diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index e9180e81c..3bad6f5c3 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -7,9 +7,10 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include +#include + #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP @@ -109,7 +110,7 @@ public: } // nothrow - void reserve(size_type s) + void reserve(size_type BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(s)) { BOOST_ASSERT_MSG(s <= Capacity, "max capacity reached"); } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 31ec99c54..f3d1de6a3 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -274,7 +274,6 @@ struct def< counting_value > bool equals(value_type const& v1, value_type const& v2) const { return boost::geometry::equals(v1.indexable, v2.indexable); - return false; } }; From a8f5d60f93b6b4b0a0db1e19b5de4824f1d21cd4 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 00:13:20 +0000 Subject: [PATCH 199/366] Added optimized uninitialized_copy() and destroy() to static_vector. [SVN r81925] --- .../extensions/index/static_vector.hpp | 55 +++++++++++++------ tests/additional_speed.cpp | 6 +- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 3bad6f5c3..9dfc06ef1 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -9,6 +9,13 @@ #include #include +#include +#include +#include +#include +#include +#include + #include #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP @@ -43,20 +50,12 @@ public: // strong static_vector(static_vector const& other) - : m_size(0) { //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); - try - { - for ( ; m_size < other.m_size ; ++m_size ) - this->construct(m_size, other[m_size]); // may throw - } - catch(...) - { - this->destroy(0, m_size); - throw; // rethrow - } + this->uninitialized_copy(other.ptr(0), other.ptr(other.m_size), this->ptr(0), + boost::has_trivial_copy_constructor()); + m_size = other.m_size; } // basic @@ -197,6 +196,32 @@ public: bool empty() const { return 0 == m_size; } private: + void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, boost::true_type const&) + { + ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); + } + + void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, boost::false_type const&) + { + std::uninitialized_copy(first, last, dst); // may throw + } + + void destroy(const value_type * first, const value_type * last, boost::true_type const&) + {} + + void destroy(const value_type * first, const value_type * last, boost::false_type const&) + { + for ( ; first != last ; ++first ) + first->~value_type(); + } + + // old version - remove + void destroy(size_type first_i, size_type last_i) + { + for ( size_type i = first_i ; i < last_i ; ++i ) + this->destroy(i); + } + void construct(size_type i) { new (this->ptr(i)) value_type(); // may throw @@ -212,12 +237,6 @@ private: this->ptr(i)->~value_type(); } - void destroy(size_type first_i, size_type last_i) - { - for ( size_type i = first_i ; i < last_i ; ++i ) - this->destroy(i); - } - Value * ptr(size_type i) { return (reinterpret_cast(m_storage.address()) + i); @@ -228,7 +247,7 @@ private: return (reinterpret_cast(m_storage.address()) + i); } - boost::aligned_storage m_storage; + boost::aligned_storage::value> m_storage; size_type m_size; }; diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index d56c4f613..623a7b57e 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -30,7 +30,7 @@ int main() namespace bgi = bg::index; size_t values_count = 1000000; - size_t queries_count = 1000000; + size_t queries_count = 100000; std::vector< std::pair > coords; @@ -55,11 +55,11 @@ int main() //typedef bg::model::d2::point_xy P; typedef bg::model::point P; typedef bg::model::box

    B; - //typedef bgi::rtree > RT; + typedef bgi::rtree > RT; //typedef bgi::rtree RT; //typedef bgi::rtree > RT; // typedef bgi::rtree RT; - typedef bgi::rtree > RT; + //typedef bgi::rtree > RT; //typedef bgi::rtree RT; for ( ;; ) From ae07c2936040f3ccf34dfc9d81d914c03cf702b8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 02:02:52 +0000 Subject: [PATCH 200/366] added optimized versions of static_vector operations, however preliminary tests on linux shows no speed difference [SVN r81930] --- .../extensions/index/static_vector.hpp | 117 +++++++++++------- 1 file changed, 73 insertions(+), 44 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 9dfc06ef1..a4c57663c 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -54,7 +54,7 @@ public: //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); this->uninitialized_copy(other.ptr(0), other.ptr(other.m_size), this->ptr(0), - boost::has_trivial_copy_constructor()); + boost::has_trivial_copy()); m_size = other.m_size; } @@ -63,16 +63,24 @@ public: { //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); - size_t min_size = m_size < other.m_size ? m_size : other.m_size; + if ( m_size <= other.m_size ) + { + this->copy(other.ptr(0), other.ptr(m_size), this->ptr(0), + boost::has_trivial_assign()); // may throw - for ( size_t i = 0 ; i < min_size ; ++i ) - (*this)[i] = other[i]; // may throw + this->uninitialized_copy(other.ptr(m_size), other.ptr(other.m_size), this->ptr(m_size), + boost::has_trivial_copy()); // may throw + m_size = other.m_size; + } + else + { + this->copy(other.ptr(0), other.ptr(other.m_size), this->ptr(0), + boost::has_trivial_assign()); // may throw - for ( ; m_size < other.m_size ; ++m_size ) - this->construct(m_size, other[m_size]); // may throw - - for ( size_t i = other.m_size ; i < m_size ; ++i ) - this->destroy(i); + this->destroy(this->ptr(other.m_size), this->ptr(m_size), + boost::has_trivial_destructor()); + m_size = other.m_size; + } return *this; } @@ -80,31 +88,24 @@ public: // nothrow ~static_vector() { - this->destroy(0, m_size); + this->destroy(this->ptr(0), this->ptr(m_size), + boost::has_trivial_destructor()); } - // nothrow if s <= size(), strong otherwise + // strong void resize(size_type s) { if ( s < m_size ) { - this->destroy(s, m_size); + this->destroy(this->ptr(s), this->ptr(m_size), + boost::has_trivial_destructor()); m_size = s; } else { - size_type i = m_size; - try - { - for ( ; i < s ; ++i ) - this->construct(i); // may throw - m_size = s; - } - catch(...) - { - this->destroy(m_size, i); - throw; // rethrow - } + this->construct(this->ptr(m_size), this->ptr(s), + boost::has_trivial_constructor()); // may throw + m_size = s; } } @@ -117,8 +118,11 @@ public: // strong void push_back(Value const& value) { + if ( Capacity <= m_size ) + std::cout << m_size << '\n'; BOOST_ASSERT_MSG(m_size < Capacity, "max capacity reached"); - this->construct(m_size, value); // may throw + this->uninitialized_copy(this->ptr(m_size), value, + boost::has_trivial_copy()); // may throw ++m_size; } @@ -127,13 +131,14 @@ public: { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); --m_size; - this->destroy(m_size); + this->destroy(this->ptr(m_size), boost::has_trivial_destructor()); } // nothrow void clear() { - this->destroy(0, m_size); + this->destroy(this->ptr(0), this->ptr(m_size), + boost::has_trivial_destructor()); m_size = 0; } @@ -196,6 +201,16 @@ public: bool empty() const { return 0 == m_size; } private: + void copy(const value_type * first, const value_type * last, value_type * dst, boost::true_type const&) + { + ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); + } + + void copy(const value_type * first, const value_type * last, value_type * dst, boost::false_type const&) + { + std::copy(first, last, dst); // may throw + } + void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, boost::true_type const&) { ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); @@ -203,10 +218,20 @@ private: void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, boost::false_type const&) { - std::uninitialized_copy(first, last, dst); // may throw + std::uninitialized_copy(first, last, dst); // may throw } - void destroy(const value_type * first, const value_type * last, boost::true_type const&) + void uninitialized_copy(value_type * ptr, value_type const& v, boost::true_type const&) + { + ::memcpy(ptr, &v, sizeof(value_type)); + } + + void uninitialized_copy(value_type * ptr, value_type const& v, boost::false_type const&) + { + new (ptr) value_type(v); // may throw + } + + void destroy(const value_type *, const value_type *, boost::true_type const&) {} void destroy(const value_type * first, const value_type * last, boost::false_type const&) @@ -215,26 +240,30 @@ private: first->~value_type(); } - // old version - remove - void destroy(size_type first_i, size_type last_i) + void destroy(const value_type *, boost::true_type const&) + {} + + void destroy(const value_type * ptr, boost::false_type const&) { - for ( size_type i = first_i ; i < last_i ; ++i ) - this->destroy(i); + ptr->~value_type(); } - void construct(size_type i) - { - new (this->ptr(i)) value_type(); // may throw - } + void construct(value_type *, value_type *, boost::true_type const&) + {} - void construct(size_type i, Value const& value) + void construct(value_type * first, value_type * last, boost::false_type const&) { - new (this->ptr(i)) value_type(value); // may throw - } - - void destroy(size_type i) - { - this->ptr(i)->~value_type(); + value_type * it = first; + try + { + for ( ; it != last ; ++it ) + new (it) value_type(); // may throw + } + catch(...) + { + this->destroy(first, it, boost::has_trivial_destructor()); + throw; + } } Value * ptr(size_type i) From 4022ec2cccb01b22ba4836704aa87149aa6b38b3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 04:18:21 +0000 Subject: [PATCH 201/366] added val_ref parameter to static_vector::resize() and constructor, added methods max_size(), data(), at(), added some comments [SVN r81931] --- .../extensions/index/static_vector.hpp | 74 +++++++++++++------ 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index a4c57663c..c1186b17a 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -6,6 +6,7 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include @@ -31,6 +32,8 @@ public: typedef size_t size_type; typedef Value& reference; typedef Value const& const_reference; + typedef Value * pointer; + typedef const Value* const_pointer; typedef Value* iterator; typedef const Value * const_iterator; typedef boost::reverse_iterator reverse_iterator; @@ -42,10 +45,10 @@ public: {} // strong - explicit static_vector(size_type s) + explicit static_vector(size_type s, value_type const& value = value_type()) : m_size(0) { - resize(s); // may throw + resize(s, value); // may throw } // strong @@ -93,7 +96,7 @@ public: } // strong - void resize(size_type s) + void resize(size_type s, value_type const& value = value_type()) { if ( s < m_size ) { @@ -103,8 +106,7 @@ public: } else { - this->construct(this->ptr(m_size), this->ptr(s), - boost::has_trivial_constructor()); // may throw + this->uninitialized_fill(this->ptr(m_size), this->ptr(s), value); // may throw m_size = s; } } @@ -142,15 +144,31 @@ public: m_size = 0; } + // strong + Value & at(size_type i) + { + if ( Capacity <= i ) + throw std::out_of_range("static_vector element index out of bounds"); + return *(this->ptr(i)); + } + + // strong + Value const& at(size_type i) const + { + if ( Capacity <= i ) + throw std::out_of_range("static_vector element index out of bounds"); + return *(this->ptr(i)); + } + // nothrow - Value & operator[](size_t i) + Value & operator[](size_type i) { BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); return *(this->ptr(i)); } // nothrow - Value const& operator[](size_t i) const + Value const& operator[](size_type i) const { BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); return *(this->ptr(i)); @@ -184,6 +202,10 @@ public: return *(this->ptr(m_size - 1)); } + // nothrow + Value * data() { return this->ptr(0); } + const Value * data() const { return this->ptr(0); } + // nothrow iterator begin() { return this->ptr(0); } const_iterator begin() const { return this->ptr(0); } @@ -197,67 +219,75 @@ public: // nothrow size_type capacity() const { return Capacity; } + size_type max_size() const { return Capacity; } size_type size() const { return m_size; } bool empty() const { return 0 == m_size; } private: - void copy(const value_type * first, const value_type * last, value_type * dst, boost::true_type const&) + void copy(const value_type * first, const value_type * last, value_type * dst, + boost::true_type const& /*has_trivial_assign*/) { ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); } - void copy(const value_type * first, const value_type * last, value_type * dst, boost::false_type const&) + void copy(const value_type * first, const value_type * last, value_type * dst, + boost::false_type const& /*has_trivial_assign*/) { std::copy(first, last, dst); // may throw } - void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, boost::true_type const&) + void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, + boost::true_type const& /*has_trivial_copy*/) { ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); } - void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, boost::false_type const&) + void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, + boost::false_type const& /*has_trivial_copy*/) { std::uninitialized_copy(first, last, dst); // may throw } - void uninitialized_copy(value_type * ptr, value_type const& v, boost::true_type const&) + void uninitialized_copy(value_type * ptr, value_type const& v, + boost::true_type const& /*has_trivial_copy*/) { ::memcpy(ptr, &v, sizeof(value_type)); } - void uninitialized_copy(value_type * ptr, value_type const& v, boost::false_type const&) + void uninitialized_copy(value_type * ptr, value_type const& v, + boost::false_type const& /*has_trivial_copy*/) { new (ptr) value_type(v); // may throw } - void destroy(const value_type *, const value_type *, boost::true_type const&) + void destroy(const value_type *, const value_type *, + boost::true_type const& /*has_trivial_destructor*/) {} - void destroy(const value_type * first, const value_type * last, boost::false_type const&) + void destroy(const value_type * first, const value_type * last, + boost::false_type const& /*has_trivial_destructor*/) { for ( ; first != last ; ++first ) first->~value_type(); } - void destroy(const value_type *, boost::true_type const&) + void destroy(const value_type *, + boost::true_type const& /*has_trivial_destructor*/) {} - void destroy(const value_type * ptr, boost::false_type const&) + void destroy(const value_type * ptr, boost::false_type const& /*has_trivial_destructor*/) { ptr->~value_type(); } - void construct(value_type *, value_type *, boost::true_type const&) - {} - - void construct(value_type * first, value_type * last, boost::false_type const&) + void uninitialized_fill(value_type * first, value_type * last, value_type const& value) { + // std::uninitialized_fill() value_type * it = first; try { for ( ; it != last ; ++it ) - new (it) value_type(); // may throw + new (it) value_type(value); // may throw } catch(...) { From 95000752cd6d4ca95b5b0d3ad8e3d06c56e4d231 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 11:33:48 +0000 Subject: [PATCH 202/366] static_vector changes: added MPL_ASSERT, added difference_type. [SVN r81934] --- .../boost/geometry/extensions/index/static_vector.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index c1186b17a..559e8b25e 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -7,6 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include +#include #include #include @@ -27,9 +28,15 @@ namespace boost { namespace geometry { namespace index { template class static_vector { + BOOST_MPL_ASSERT_MSG( + (0 < Capacity), + INVALID_CAPACITY, + static_vector); + public: typedef Value value_type; typedef size_t size_type; + typedef ptrdiff_t difference_type; typedef Value& reference; typedef Value const& const_reference; typedef Value * pointer; @@ -209,13 +216,17 @@ public: // nothrow iterator begin() { return this->ptr(0); } const_iterator begin() const { return this->ptr(0); } + const_iterator cbegin() const { return this->ptr(0); } iterator end() { return this->ptr(m_size); } const_iterator end() const { return this->ptr(m_size); } + const_iterator cend() const { return this->ptr(m_size); } // nothrow reverse_iterator rbegin() { return reverse_iterator(this->end()); } const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); } + const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); } reverse_iterator rend() { return reverse_iterator(this->begin()); } const_reverse_iterator rend() const { return reverse_iterator(this->begin()); } + const_reverse_iterator crend() const { return reverse_iterator(this->begin()); } // nothrow size_type capacity() const { return Capacity; } From 79436250e52b9064120c436af9a1b069ede930e8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 11:58:40 +0000 Subject: [PATCH 203/366] Added assign() to the rtree interface. Fixed compilation error in static_vector. [SVN r81935] --- .../geometry/extensions/index/rtree/rtree.hpp | 29 +++++++ .../extensions/index/static_vector.hpp | 2 +- test/rtree/test_rtree.hpp | 85 ++++++++++++++++--- 3 files changed, 104 insertions(+), 12 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 4e7db8132..fd7b8572f 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -408,6 +408,35 @@ public: this->raw_remove(*it); } + /*! + Assign new elements to the rtree. This method replaces the content of the rtree. + + \note Exception-safety: strong + + \param first The beginning of the range of values. + \param last The end of the range of values. + */ + template + inline void assign(Iterator first, Iterator last) + { + rtree foo(first, last, this->parameters(), this->translator(), this->get_allocator()); + this->swap(foo); + } + + /*! + Assign new elements to the rtree. This method replaces the content of the rtree. + + \note Exception-safety: strong + + \param rng The range of values. + */ + template + inline void assign(Range const& rng) + { + rtree foo(rng, this->parameters(), this->translator(), this->get_allocator()); + this->swap(foo); + } + /*! Find values meeting spatial predicates, e.g. intersecting some box. diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 559e8b25e..5796ef6a6 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -31,7 +31,7 @@ class static_vector BOOST_MPL_ASSERT_MSG( (0 < Capacity), INVALID_CAPACITY, - static_vector); + (static_vector)); public: typedef Value value_type; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index f3d1de6a3..0919d3945 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -911,7 +911,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const // rtree removing template -void test_remove_clear(bgi::rtree & tree, std::vector const& input, Box const& qbox) +void test_remove(bgi::rtree & tree, std::vector const& input, Box const& qbox) { typedef bgi::rtree T; @@ -973,20 +973,82 @@ void test_remove_clear(bgi::rtree & tree, std::vector const& BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); test_compare_outputs(t, output, expected_output); } +} + +template +void test_clear_assign(bgi::rtree & tree, std::vector const& input, Box const& qbox) +{ + typedef bgi::rtree T; + + std::vector values_to_remove; + tree.spatial_query(qbox, std::back_inserter(values_to_remove)); + BOOST_CHECK(0 < values_to_remove.size()); //clear { + T t(tree); + std::vector expected_output; - tree.spatial_query(bgi::intersects(qbox), std::back_inserter(expected_output)); - size_t s = tree.size(); - tree.clear(); - BOOST_CHECK(tree.empty()); - BOOST_CHECK(tree.size() == 0); - tree.insert(input); - BOOST_CHECK(tree.size() == s); + t.spatial_query(bgi::intersects(qbox), std::back_inserter(expected_output)); + size_t s = t.size(); + t.clear(); + BOOST_CHECK(t.empty()); + BOOST_CHECK(t.size() == 0); + t.insert(input); + BOOST_CHECK(t.size() == s); std::vector output; - tree.spatial_query(bgi::intersects(qbox), std::back_inserter(output)); - test_exactly_the_same_outputs(tree, output, expected_output); + t.spatial_query(bgi::intersects(qbox), std::back_inserter(output)); + test_exactly_the_same_outputs(t, output, expected_output); + } + + //assign iterators + { + T t(tree); + + BOOST_CHECK(t.size() == tree.size()); + + std::vector expected_output; + t.spatial_query(t.box(), std::back_inserter(expected_output)); + + std::vector values_to_remove; + t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); + t.remove(values_to_remove); + + BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); + + t.assign(input.begin(), input.end()); + + BOOST_CHECK(t.size() == tree.size()); + + std::vector output; + t.spatial_query(t.box(), std::back_inserter(output)); + + test_exactly_the_same_outputs(t, output, expected_output); + } + + //assign range + { + T t(tree); + + BOOST_CHECK(t.size() == tree.size()); + + std::vector expected_output; + t.spatial_query(t.box(), std::back_inserter(expected_output)); + + std::vector values_to_remove; + t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); + t.remove(values_to_remove); + + BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); + + t.assign(input); + + BOOST_CHECK(t.size() == tree.size()); + + std::vector output; + t.spatial_query(t.box(), std::back_inserter(output)); + + test_exactly_the_same_outputs(t, output, expected_output); } } @@ -1025,7 +1087,8 @@ void test_rtree_by_value(Parameters const& parameters) test_copy_assignment_swap_move(tree, qbox); test_create_insert(tree, input, qbox); - test_remove_clear(tree, input, qbox); + test_remove(tree, input, qbox); + test_clear_assign(tree, input, qbox); // empty tree test From 8f67c58ea481e18071955cf31873546682486a99 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 12:07:25 +0000 Subject: [PATCH 204/366] rtree::assign() commented out. [SVN r81936] --- include/boost/geometry/extensions/index/rtree/rtree.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index fd7b8572f..876a6edf2 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -416,12 +416,12 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. */ - template + /*template inline void assign(Iterator first, Iterator last) { rtree foo(first, last, this->parameters(), this->translator(), this->get_allocator()); this->swap(foo); - } + }*/ /*! Assign new elements to the rtree. This method replaces the content of the rtree. @@ -430,12 +430,12 @@ public: \param rng The range of values. */ - template + /*template inline void assign(Range const& rng) { rtree foo(rng, this->parameters(), this->translator(), this->get_allocator()); this->swap(foo); - } + }*/ /*! Find values meeting spatial predicates, e.g. intersecting some box. From 1ae333d9a6b8f7f14d2d5f8d75669e59768a63b6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 12:10:34 +0000 Subject: [PATCH 205/366] rtree assign() test commented out. [SVN r81937] --- test/rtree/test_rtree.hpp | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 0919d3945..4c5f6dc89 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -976,7 +976,7 @@ void test_remove(bgi::rtree & tree, std::vector const& input } template -void test_clear_assign(bgi::rtree & tree, std::vector const& input, Box const& qbox) +void test_clear(bgi::rtree & tree, std::vector const& input, Box const& qbox) { typedef bgi::rtree T; @@ -1001,55 +1001,55 @@ void test_clear_assign(bgi::rtree & tree, std::vector const& test_exactly_the_same_outputs(t, output, expected_output); } - //assign iterators - { - T t(tree); + ////assign iterators + //{ + // T t(tree); - BOOST_CHECK(t.size() == tree.size()); + // BOOST_CHECK(t.size() == tree.size()); - std::vector expected_output; - t.spatial_query(t.box(), std::back_inserter(expected_output)); - - std::vector values_to_remove; - t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); - t.remove(values_to_remove); - - BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); + // std::vector expected_output; + // t.spatial_query(t.box(), std::back_inserter(expected_output)); + // + // std::vector values_to_remove; + // t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); + // t.remove(values_to_remove); + // + // BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); - t.assign(input.begin(), input.end()); + // t.assign(input.begin(), input.end()); - BOOST_CHECK(t.size() == tree.size()); + // BOOST_CHECK(t.size() == tree.size()); - std::vector output; - t.spatial_query(t.box(), std::back_inserter(output)); + // std::vector output; + // t.spatial_query(t.box(), std::back_inserter(output)); - test_exactly_the_same_outputs(t, output, expected_output); - } + // test_exactly_the_same_outputs(t, output, expected_output); + //} - //assign range - { - T t(tree); + ////assign range + //{ + // T t(tree); - BOOST_CHECK(t.size() == tree.size()); + // BOOST_CHECK(t.size() == tree.size()); - std::vector expected_output; - t.spatial_query(t.box(), std::back_inserter(expected_output)); + // std::vector expected_output; + // t.spatial_query(t.box(), std::back_inserter(expected_output)); - std::vector values_to_remove; - t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); - t.remove(values_to_remove); + // std::vector values_to_remove; + // t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); + // t.remove(values_to_remove); - BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); + // BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); - t.assign(input); + // t.assign(input); - BOOST_CHECK(t.size() == tree.size()); + // BOOST_CHECK(t.size() == tree.size()); - std::vector output; - t.spatial_query(t.box(), std::back_inserter(output)); + // std::vector output; + // t.spatial_query(t.box(), std::back_inserter(output)); - test_exactly_the_same_outputs(t, output, expected_output); - } + // test_exactly_the_same_outputs(t, output, expected_output); + //} } // run all tests for a single Algorithm and single rtree @@ -1088,7 +1088,7 @@ void test_rtree_by_value(Parameters const& parameters) test_create_insert(tree, input, qbox); test_remove(tree, input, qbox); - test_clear_assign(tree, input, qbox); + test_clear(tree, input, qbox); // empty tree test From d7cf32bcfaba6d2c9bc85bd067e9117e8d752bf2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 14:49:45 +0000 Subject: [PATCH 206/366] Rtree value_type must no longer have default ctor defined. Added static_vector::assign(), added assertion in static_vector::resize(). Added test for value without default ctor.. [SVN r81940] --- .../extensions/index/rtree/rstar/insert.hpp | 45 ++++--- .../rtree/rstar/redistribute_elements.hpp | 6 +- .../geometry/extensions/index/rtree/rtree.hpp | 5 +- .../index/rtree/visitors/nearest_query.hpp | 7 +- .../extensions/index/static_vector.hpp | 45 ++++--- test/rtree/test_rtree.hpp | 116 ++++++++++++++++-- 6 files changed, 168 insertions(+), 56 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp index e7e7567c2..1d4e17f2e 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp @@ -60,19 +60,22 @@ public: geometry::centroid(rtree::elements(*parent)[current_child_index].first, node_center); // fill the container of centers' distances of children from current node's center - typename index::detail::rtree::container_from_elements_type< + typedef typename index::detail::rtree::container_from_elements_type< elements_type, std::pair - >::type sorted_elements; + >::type sorted_elements_type; + sorted_elements_type sorted_elements; // If constructor is used instead of resize() MS implementation leaks here - sorted_elements.resize(elements_count); // MAY THROW, STRONG (V, E: alloc, copy) + sorted_elements.reserve(elements_count); // MAY THROW, STRONG (V, E: alloc, copy) - for ( size_t i = 0 ; i < elements_count ; ++i ) + for ( typename elements_type::const_iterator it = elements.begin() ; + it != elements.end() ; ++it ) { point_type element_center; - geometry::centroid( rtree::element_indexable(elements[i], translator), element_center); - sorted_elements[i].first = geometry::comparable_distance(node_center, element_center); - sorted_elements[i].second = elements[i]; // MAY THROW (V, E: copy) + geometry::centroid( rtree::element_indexable(*it, translator), element_center); + sorted_elements.push_back(std::make_pair( + geometry::comparable_distance(node_center, element_center), + *it)); // MAY THROW (V, E: copy) } // sort elements by distances from center @@ -83,24 +86,34 @@ public: distances_dsc); // MAY THROW, BASIC (V, E: copy) // copy elements which will be reinserted - result_elements.resize(reinserted_elements_count); // MAY THROW, STRONG (V, E: alloc, copy) - for ( size_t i = 0 ; i < reinserted_elements_count ; ++i ) - result_elements[i] = sorted_elements[i].second; // MAY THROW (V, E: copy) + result_elements.clear(); + result_elements.reserve(reinserted_elements_count); // MAY THROW, STRONG (V, E: alloc, copy) + for ( typename sorted_elements_type::const_iterator it = sorted_elements.begin() ; + it != sorted_elements.begin() + reinserted_elements_count ; ++it ) + { + result_elements.push_back(it->second); // MAY THROW (V, E: copy) + } try { // copy remaining elements to the current node - size_t elements_new_count = elements_count - reinserted_elements_count; - elements.resize(elements_new_count); // SHOULDN'T THROW (new_size <= old size) - for ( size_t i = 0 ; i < elements_new_count ; ++i ) - elements[i] = sorted_elements[i + reinserted_elements_count].second; // MAY THROW (V, E: copy) + elements.clear(); + elements.reserve(elements_count - reinserted_elements_count); // SHOULDN'T THROW (new_size <= old size) + for ( typename sorted_elements_type::const_iterator it = sorted_elements.begin() + reinserted_elements_count; + it != sorted_elements.end() ; ++it ) + { + elements.push_back(it->second); // MAY THROW (V, E: copy) + } } catch(...) { elements.clear(); - for ( size_t i = 0 ; i < elements_count ; ++i ) - destroy_element::apply(sorted_elements[i].second, allocators); + for ( typename sorted_elements_type::iterator it = sorted_elements.begin() ; + it != sorted_elements.end() ; ++it ) + { + destroy_element::apply(it->second, allocators); + } throw; // RETHROW } diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp index 06e212412..f90e7656b 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp @@ -382,10 +382,8 @@ struct redistribute_elements(elements1.begin(), elements1.end(), translator); diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 876a6edf2..90ac2b5dd 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -873,7 +873,7 @@ private: point_type > result_type; - result_type result; + result_type result(v); detail::rtree::visitors::nearest_query< value_type, @@ -888,7 +888,8 @@ private: detail::rtree::apply_visitor(nearest_v, *m_root); - return result.get(v); + //return result.get(v); + return result.is_comparable_distance_valid() ? 1 : 0; } /*! diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp index 54b81d8bf..5b52dac39 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp @@ -33,8 +33,9 @@ public: typename translator::indexable_type::type >::type distance_type; - inline nearest_query_result_one() - : m_comp_dist((std::numeric_limits::max)()) + inline nearest_query_result_one(Value & value) + : m_value(value) + , m_comp_dist((std::numeric_limits::max)()) {} inline void store(Value const& val, distance_type const& curr_comp_dist) @@ -63,7 +64,7 @@ public: } private: - Value m_value; + Value & m_value; distance_type m_comp_dist; }; diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 5796ef6a6..b5f60d7eb 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -73,24 +73,7 @@ public: { //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); - if ( m_size <= other.m_size ) - { - this->copy(other.ptr(0), other.ptr(m_size), this->ptr(0), - boost::has_trivial_assign()); // may throw - - this->uninitialized_copy(other.ptr(m_size), other.ptr(other.m_size), this->ptr(m_size), - boost::has_trivial_copy()); // may throw - m_size = other.m_size; - } - else - { - this->copy(other.ptr(0), other.ptr(other.m_size), this->ptr(0), - boost::has_trivial_assign()); // may throw - - this->destroy(this->ptr(other.m_size), this->ptr(m_size), - boost::has_trivial_destructor()); - m_size = other.m_size; - } + this->assign(other->ptr(0), other->ptr(other.m_size)); return *this; } @@ -113,6 +96,7 @@ public: } else { + BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); this->uninitialized_fill(this->ptr(m_size), this->ptr(s), value); // may throw m_size = s; } @@ -143,6 +127,31 @@ public: this->destroy(this->ptr(m_size), boost::has_trivial_destructor()); } + // basic + void assign(const value_type * first, const value_type * last) + { + size_type s = std::distance(first, last); + + if ( m_size <= s ) + { + this->copy(first, first + m_size, this->ptr(0), + boost::has_trivial_assign()); // may throw + + this->uninitialized_copy(first + m_size, last, this->ptr(m_size), + boost::has_trivial_copy()); // may throw + m_size = s; + } + else + { + this->copy(first, last, this->ptr(0), + boost::has_trivial_assign()); // may throw + + this->destroy(this->ptr(s), this->ptr(m_size), + boost::has_trivial_destructor()); + m_size = s; + } + } + // nothrow void clear() { diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 4c5f6dc89..0281fd4b2 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -50,6 +50,14 @@ struct generate_outside_point< bg::model::point > } }; +// Default value generation + +template +struct generate_value_default +{ + static Value apply(){ return Value(); } +}; + // Values, input and rtree generation template @@ -225,10 +233,11 @@ struct generate_value< boost::shared_ptr > { typedef bg::model::point P; typedef test_object

    O; + typedef boost::shared_ptr R; - static boost::shared_ptr apply(int x, int y) + static R apply(int x, int y) { - return boost::shared_ptr(new O(P(x, y))); + return R(new O(P(x, y))); } }; @@ -237,10 +246,11 @@ struct generate_value< boost::shared_ptr > { typedef bg::model::point P; typedef test_object

    O; + typedef boost::shared_ptr R; - static boost::shared_ptr apply(int x, int y, int z) + static R apply(int x, int y, int z) { - return boost::shared_ptr(new O(P(x, y, z))); + return R(new O(P(x, y, z))); } }; @@ -283,14 +293,16 @@ template struct generate_value< counting_value > > { typedef bg::model::point P; - static counting_value

    apply(int x, int y) { return counting_value

    (P(x, y)); } + typedef counting_value

    R; + static R apply(int x, int y) { return R(P(x, y)); } }; template struct generate_value< counting_value > > { typedef bg::model::point P; - static counting_value

    apply(int x, int y, int z) { return counting_value

    (P(x, y, z)); } + typedef counting_value

    R; + static R apply(int x, int y, int z) { return R(P(x, y, z)); } }; template @@ -298,7 +310,8 @@ struct generate_value< counting_value > { typedef bg::model::point P; typedef bg::model::box

    B; - static counting_value apply(int x, int y) { return counting_value(B(P(x, y), P(x+2, y+3))); } + typedef counting_value R; + static R apply(int x, int y) { return R(B(P(x, y), P(x+2, y+3))); } }; template @@ -306,7 +319,78 @@ struct generate_value< counting_value > { typedef bg::model::point P; typedef bg::model::box

    B; - static counting_value apply(int x, int y, int z) { return counting_value(B(P(x, y, z), P(x+2, y+3, z+4))); } + typedef counting_value R; + static R apply(int x, int y, int z) { return R(B(P(x, y, z), P(x+2, y+3, z+4))); } +}; + +// value without default constructor + +template +struct value_no_dctor +{ + value_no_dctor(Indexable const& i) : indexable(i) {} + Indexable indexable; +}; + +namespace boost { namespace geometry { namespace index { namespace translator { + + template + struct def< value_no_dctor > + { + typedef value_no_dctor value_type; + typedef Indexable const& result_type; + + result_type operator()(value_type const& value) const + { + return value.indexable; + } + + bool equals(value_type const& v1, value_type const& v2) const + { + return boost::geometry::equals(v1.indexable, v2.indexable); + } + }; + +}}}} + +template +struct generate_value_default< value_no_dctor > +{ + static value_no_dctor apply() { return value_no_dctor(Indexable()); } +}; + +template +struct generate_value< value_no_dctor > > +{ + typedef bg::model::point P; + typedef value_no_dctor

    R; + static R apply(int x, int y) { return R(P(x, y)); } +}; + +template +struct generate_value< value_no_dctor > > +{ + typedef bg::model::point P; + typedef value_no_dctor

    R; + static R apply(int x, int y, int z) { return R(P(x, y, z)); } +}; + +template +struct generate_value< value_no_dctor > > > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + typedef value_no_dctor R; + static R apply(int x, int y) { return R(B(P(x, y), P(x+2, y+3))); } +}; + +template +struct generate_value< value_no_dctor > > > +{ + typedef bg::model::point P; + typedef bg::model::box

    B; + typedef value_no_dctor R; + static R apply(int x, int y, int z) { return R(B(P(x, y, z), P(x+2, y+3, z+4))); } }; // generate input @@ -625,7 +709,7 @@ void test_nearest_query(Rtree const& rtree, std::vector const& input, Poi typedef typename bg::default_distance_result::type D; D smallest_d = (std::numeric_limits::max)(); - Value expected_output; + Value expected_output(generate_value_default::apply()); BOOST_FOREACH(Value const& v, input) { D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); @@ -637,7 +721,7 @@ void test_nearest_query(Rtree const& rtree, std::vector const& input, Poi } size_t n = ( (std::numeric_limits::max)() == smallest_d ) ? 0 : 1; - Value output; + Value output(generate_value_default::apply()); size_t n_res = rtree.nearest_query(pt, output); BOOST_CHECK(n == n_res); @@ -711,7 +795,7 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P biggest_d = test_output.back().first; // transform test output to vector of values - std::vector expected_output(test_output.size()); + std::vector expected_output(test_output.size(), generate_value_default::apply()); std::transform(test_output.begin(), test_output.end(), expected_output.begin(), TestNearestKTransform()); // calculate output using rtree @@ -744,11 +828,12 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P template void test_nearest_query_not_found(Rtree const& rtree, Point const& pt, CoordinateType max_distance_1, CoordinateType max_distance_k) { - typename Rtree::value_type output; + typedef typename Rtree::value_type Value; + Value output(generate_value_default::apply()); size_t n_res = rtree.nearest_query(bgi::max_bounded(pt, max_distance_1), output); BOOST_CHECK(0 == n_res); - std::vector output_v; + std::vector output_v; n_res = rtree.nearest_query(bgi::max_bounded(pt, max_distance_k), 5, std::back_inserter(output_v)); BOOST_CHECK(output_v.size() == n_res); BOOST_CHECK(n_res < 5); @@ -1159,12 +1244,14 @@ void test_rtree_for_point(Parameters const& parameters = Parameters()) typedef std::pair PairP; typedef boost::tuple TupleP; typedef boost::shared_ptr< test_object > SharedPtrP; + typedef value_no_dctor VNoDCtor; test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); + test_rtree_by_value(parameters); test_count_rtree_values(parameters); } @@ -1175,11 +1262,14 @@ void test_rtree_for_box(Parameters const& parameters = Parameters()) typedef bg::model::box Box; typedef std::pair PairB; typedef boost::tuple TupleB; + typedef value_no_dctor VNoDCtor; test_rtree_by_value(parameters); test_rtree_by_value(parameters); test_rtree_by_value(parameters); + test_rtree_by_value(parameters); + test_count_rtree_values(parameters); } From cce223726a72e1cb30f15b57cf72a7971034858b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 15:01:04 +0000 Subject: [PATCH 207/366] Added info about the Value with no default ctor in docs. [SVN r81941] --- doc/html/geometry_index/r_tree/exception_safety.html | 9 ++++----- doc/html/geometry_index/r_tree/introduction.html | 9 ++++++--- doc/html/index.html | 2 +- doc/rtree/exception_safety.qbk | 8 ++++---- doc/rtree/introduction.qbk | 3 ++- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 9afbcf6a3..04dd96621 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -30,17 +30,16 @@

    • - Exception-safe copy constructor of the Value. + exception-safe copy constructor and copy assignment of the Value.
    • - Exception-safe copy constructor of the CoordinateType - used in the Indexable. + exception-safe copy constructor and copy assignment of the CoordinateType used in the Indexable.
    • - Nonthrowing copy constructor of the Translator. + nonthrowing copy constructor of the Translator.
    • - Nonthrowing destructors of the above types. + nonthrowing destructors of above types.
    diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index c326a0c36..89d93898c 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -181,6 +181,12 @@ Key features of this implementation of the R-tree are:

      +
    • + capable to store arbitrary Value type, +
    • +
    • + capable to store Value type with no default constructor, +
    • three different creation algorithms - linear, quadratic or rstar,
    • @@ -188,9 +194,6 @@ 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, -
    • advanced queries - e.g. search for 5 nearest values further than some minimal distance and intersecting some region but not within the other diff --git a/doc/html/index.html b/doc/html/index.html index 73e908eea..e369d528c 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: December 13, 2012 at 22:34:06 GMT

    Last revised: December 14, 2012 at 15:00:09 GMT


    diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index bfc70e9f7..2e6cad42f 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -12,10 +12,10 @@ In order to be exception-safe the __rtree__ requires: -* Exception-safe copy constructor of the `__value__`. -* Exception-safe copy constructor of the `CoordinateType` used in the `Indexable`. -* Nonthrowing copy constructor of the `Translator`. -* Nonthrowing destructors of the above types. +* exception-safe copy constructor and copy assignment of the `__value__`. +* exception-safe copy constructor and copy assignment of the `CoordinateType` used in the `Indexable`. +* nonthrowing copy constructor of the `Translator`. +* nonthrowing destructors of above types. [table [[Operation] [exception-safety]] diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index 18f613ac9..e08d5a72a 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -44,9 +44,10 @@ and vice versa. Example structures of trees created by use of three different al Key features of this implementation of the __rtree__ are: +* capable to store arbitrary __value__ type, +* capable to store __value__ type with no default constructor, * 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, * advanced queries - e.g. search for 5 nearest values further than some minimal distance and intersecting some region but not within the other one. [endsect] From 627452da2ac4ceb1cc6ca05b763b855844087c3c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 19:15:34 +0000 Subject: [PATCH 208/366] Added rtree::count() method. Docs modified. [SVN r81947] --- .../r_tree/exception_safety.html | 28 ++-- doc/html/index.html | 2 +- doc/rtree/exception_safety.qbk | 11 +- .../geometry/extensions/index/rtree/rtree.hpp | 25 ++++ .../extensions/index/rtree/visitors/count.hpp | 124 ++++++++++++++++++ test/rtree/test_rtree.hpp | 40 +++++- 6 files changed, 210 insertions(+), 20 deletions(-) create mode 100644 include/boost/geometry/extensions/index/rtree/visitors/count.hpp diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 04dd96621..08be8978b 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -75,8 +75,8 @@

    - rtree(first, - last) + rtree(Iterator, + Iterator)

    @@ -191,8 +191,8 @@

    - insert(first, - last) + insert(Iterator, + Iterator)

    @@ -204,7 +204,7 @@

    - insert(range) + insert(Range)

    @@ -228,8 +228,8 @@

    - remove(first, - last) + remove(Iterator, + Iterator)

    @@ -241,7 +241,7 @@

    - remove(range) + remove(Range)

    @@ -287,6 +287,18 @@
    +

    + count(ValueOrIndexable) +

    +
    +

    + nothrow +

    +

    size() diff --git a/doc/html/index.html b/doc/html/index.html index e369d528c..2084b6801 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@ - +

    Last revised: December 14, 2012 at 15:00:09 GMT

    Last revised: December 14, 2012 at 19:10:44 GMT


    diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index 2e6cad42f..37b91ced3 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -20,7 +20,7 @@ In order to be exception-safe the __rtree__ requires: [table [[Operation] [exception-safety]] [[`rtree()`] [ /nothrow/ ]] -[[`rtree(first, last)`] [ *strong* ]] +[[`rtree(Iterator, Iterator)`] [ *strong* ]] [[`~rtree()`] [ /nothrow/ ]] [[][]] [[`rtree(rtree const&)`] [ *strong* ]] @@ -32,15 +32,16 @@ In order to be exception-safe the __rtree__ requires: [[`swap(rtree &)`] [ /nothrow/ ]] [[][]] [[`insert(__value__)`] [ basic ]] -[[`insert(first, last)`] [ basic ]] -[[`insert(range)`] [ basic ]] +[[`insert(Iterator, Iterator)`][ basic ]] +[[`insert(Range)`] [ basic ]] [[`remove(__value__)`] [ basic ]] -[[`remove(first, last)`] [ basic ]] -[[`remove(range)`] [ basic ]] +[[`remove(Iterator, Iterator)`][ basic ]] +[[`remove(Range)`] [ basic ]] [[][]] [[`spatial_query(...)`] [ *strong* ]] [[`nearest_query(...)`] [ *strong* ]] [[][]] +[[`count(ValueOrIndexable)`] [ /nothrow/ ]] [[`size()`] [ /nothrow/ ]] [[`empty()`] [ /nothrow/ ]] [[`clear()`] [ /nothrow/ ]] diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 90ac2b5dd..601273803 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -644,6 +645,30 @@ public: return children_box_v.result; } + /*! + For indexable_type it returns the number of values which indexables equals the parameter. + For value_type it returns the number of values which equals the parameter. + + \note Exception-safety: nothrow. + + \param The value or indexable which will be counted. + + \return The number of values found. + */ + template + size_type count(ValueOrIndexable const& vori) const + { + if ( !m_root ) + return 0; + + detail::rtree::visitors::count + count_v(vori, m_translator); + + detail::rtree::apply_visitor(count_v, *m_root); + + return count_v.found_count; + } + /*! Returns parameters. diff --git a/include/boost/geometry/extensions/index/rtree/visitors/count.hpp b/include/boost/geometry/extensions/index/rtree/visitors/count.hpp new file mode 100644 index 000000000..2b8a324c6 --- /dev/null +++ b/include/boost/geometry/extensions/index/rtree/visitors/count.hpp @@ -0,0 +1,124 @@ +// Boost.Geometry Index +// +// R-tree count visitor implementation +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP + +#include + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { namespace visitors { + +template +struct count + : public rtree::visitor::type + , index::nonassignable +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + inline count(Indexable const& i, Translator const& t) + : indexable(i), tr(t), found_count(0) + {} + + inline void operator()(internal_node const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + // traverse nodes meeting predicates + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + if ( geometry::covered_by(indexable, it->first) ) + rtree::apply_visitor(*this, *it->second); + } + } + + inline void operator()(leaf const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + // get all values meeting predicates + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + // if value meets predicates + if ( geometry::equals(indexable, tr(*it)) ) + { + ++found_count; + } + } + } + + Indexable const& indexable; + Translator const& tr; + typename Allocators::size_type found_count; +}; + +template +struct count + : public rtree::visitor::type + , index::nonassignable +{ + typedef typename rtree::node::type node; + typedef typename rtree::internal_node::type internal_node; + typedef typename rtree::leaf::type leaf; + + inline count(Value const& v, Translator const& t) + : value(v), tr(t), found_count(0) + {} + + inline void operator()(internal_node const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + // traverse nodes meeting predicates + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + if ( geometry::covered_by(tr(value), it->first) ) + rtree::apply_visitor(*this, *it->second); + } + } + + inline void operator()(leaf const& n) + { + typedef typename rtree::elements_type::type elements_type; + elements_type const& elements = rtree::elements(n); + + // get all values meeting predicates + for (typename elements_type::const_iterator it = elements.begin(); + it != elements.end(); ++it) + { + // if value meets predicates + if ( tr.equals(value, *it) ) + { + ++found_count; + } + } + } + + Value const& value; + Translator const& tr; + typename Allocators::size_type found_count; +}; + +}}} // namespace detail::rtree::visitors + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 0281fd4b2..07c9bc37e 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1192,7 +1192,7 @@ void test_rtree_by_value(Parameters const& parameters) test_copy_assignment_swap_move(empty_tree, qbox); } -// rtree inserting removing by use of counting_value +// rtree inserting and removing of counting_value template void test_count_rtree_values(Parameters const& parameters) @@ -1207,11 +1207,6 @@ void test_count_rtree_values(Parameters const& parameters) generate_rtree(t, input, qbox); - { - BOOST_FOREACH(Value const& v, input) - t.insert(v); - } - size_t rest_count = input.size(); BOOST_CHECK(t.size() + rest_count == Value::counter()); @@ -1235,6 +1230,35 @@ void test_count_rtree_values(Parameters const& parameters) } } +// rtree count + +template +void test_rtree_count(Parameters const& parameters) +{ + typedef std::pair Value; + typedef bgi::rtree Tree; + typedef typename Tree::box_type B; + + Tree t(parameters); + std::vector input; + B qbox; + + generate_rtree(t, input, qbox); + + BOOST_CHECK(t.count(input[0]) == 1); + BOOST_CHECK(t.count(input[0].first) == 1); + + t.insert(input[0]); + + BOOST_CHECK(t.count(input[0]) == 2); + BOOST_CHECK(t.count(input[0].first) == 2); + + t.insert(std::make_pair(input[0].first, -1)); + + BOOST_CHECK(t.count(input[0]) == 2); + BOOST_CHECK(t.count(input[0].first) == 3); +} + // run all tests for one Algorithm for some number of rtrees // defined by some number of Values constructed from given Point @@ -1254,6 +1278,8 @@ void test_rtree_for_point(Parameters const& parameters = Parameters()) test_rtree_by_value(parameters); test_count_rtree_values(parameters); + + test_rtree_count(parameters); } template @@ -1271,6 +1297,8 @@ void test_rtree_for_box(Parameters const& parameters = Parameters()) test_rtree_by_value(parameters); test_count_rtree_values(parameters); + + test_rtree_count(parameters); } #endif From ac27db1a2cc2120952a84d623b58e64a3c223d8c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 19:23:11 +0000 Subject: [PATCH 209/366] Exception safety table rearranged. [SVN r81948] --- .../r_tree/exception_safety.html | 42 +++++++++++-------- doc/html/index.html | 2 +- doc/rtree/exception_safety.qbk | 5 ++- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 08be8978b..43b4b8476 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -251,6 +251,18 @@
    +

    + clear() +

    +
    +

    + nothrow +

    +
    @@ -281,12 +293,6 @@
    - -

    count(ValueOrIndexable) @@ -299,6 +305,12 @@

    + +

    size() @@ -323,18 +335,6 @@

    -

    - clear() -

    -
    -

    - nothrow -

    -

    box() @@ -348,6 +348,12 @@

    + +

    get_allocator() diff --git a/doc/html/index.html b/doc/html/index.html index 2084b6801..1e374d495 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@ - +

    Last revised: December 14, 2012 at 19:10:44 GMT

    Last revised: December 14, 2012 at 19:21:38 GMT


    diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index 37b91ced3..7d74ec85a 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -37,16 +37,17 @@ In order to be exception-safe the __rtree__ requires: [[`remove(__value__)`] [ basic ]] [[`remove(Iterator, Iterator)`][ basic ]] [[`remove(Range)`] [ basic ]] +[[`clear()`] [ /nothrow/ ]] [[][]] [[`spatial_query(...)`] [ *strong* ]] [[`nearest_query(...)`] [ *strong* ]] -[[][]] [[`count(ValueOrIndexable)`] [ /nothrow/ ]] +[[][]] [[`size()`] [ /nothrow/ ]] [[`empty()`] [ /nothrow/ ]] -[[`clear()`] [ /nothrow/ ]] [[`box()`] [ /nothrow/ or *strong* [footnote /nothrow/ - if `CoordinateType` has nonthrowing copy constructor, *strong* - otherwise]]] +[[][]] [[`get_allocator()`] [ /nothrow/ ]] [[`parameters()`] [ /nothrow/ ]] [[`translator()`] [ /nothrow/ ]] From 3005f91f841e089df9e75938772b8d2762cffa85 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 19:46:18 +0000 Subject: [PATCH 210/366] Small improvement to the nearest_query added. [SVN r81949] --- include/boost/geometry/extensions/index/rtree/rtree.hpp | 3 +-- .../extensions/index/rtree/visitors/nearest_query.hpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 601273803..142db8bcf 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -913,8 +913,7 @@ private: detail::rtree::apply_visitor(nearest_v, *m_root); - //return result.get(v); - return result.is_comparable_distance_valid() ? 1 : 0; + return result.get(v); } /*! diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp index 5b52dac39..b48aac667 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp @@ -33,7 +33,7 @@ public: typename translator::indexable_type::type >::type distance_type; - inline nearest_query_result_one(Value & value) + inline nearest_query_result_one(Value const& value) : m_value(value) , m_comp_dist((std::numeric_limits::max)()) {} @@ -64,7 +64,7 @@ public: } private: - Value & m_value; + Value m_value; distance_type m_comp_dist; }; From 17ed2a700b7fa40c237325141f81ea97dc58857a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 21:26:14 +0000 Subject: [PATCH 211/366] static_vector resize() and corresponding ctor divided into 2 methods/ctors (C++11). First one uses default ctors (for noncopyable values). Second one uses copy ctors (for values with no default ctor). [SVN r81952] --- .../extensions/index/static_vector.hpp | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index b5f60d7eb..346de138b 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -52,7 +52,14 @@ public: {} // strong - explicit static_vector(size_type s, value_type const& value = value_type()) + explicit static_vector(size_type s) + : m_size(0) + { + resize(s); // may throw + } + + // strong + static_vector(size_type s, value_type const& value) : m_size(0) { resize(s, value); // may throw @@ -73,7 +80,7 @@ public: { //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); - this->assign(other->ptr(0), other->ptr(other.m_size)); + assign(other->ptr(0), other->ptr(other.m_size)); return *this; } @@ -86,7 +93,7 @@ public: } // strong - void resize(size_type s, value_type const& value = value_type()) + void resize(size_type s) { if ( s < m_size ) { @@ -97,7 +104,25 @@ public: else { BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - this->uninitialized_fill(this->ptr(m_size), this->ptr(s), value); // may throw + this->construct(this->ptr(m_size), this->ptr(s) + boost::has_trivial_constructor()); // may throw + m_size = s; + } + } + + // strong + void resize(size_type s, value_type const& value) + { + if ( s < m_size ) + { + this->destroy(this->ptr(s), this->ptr(m_size), + boost::has_trivial_destructor()); + m_size = s; + } + else + { + BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); + std::uninitialized_fill(this->ptr(m_size), this->ptr(s), value); // may throw m_size = s; } } @@ -111,8 +136,6 @@ public: // strong void push_back(Value const& value) { - if ( Capacity <= m_size ) - std::cout << m_size << '\n'; BOOST_ASSERT_MSG(m_size < Capacity, "max capacity reached"); this->uninitialized_copy(this->ptr(m_size), value, boost::has_trivial_copy()); // may throw @@ -277,7 +300,7 @@ private: void uninitialized_copy(value_type * ptr, value_type const& v, boost::false_type const& /*has_trivial_copy*/) { - new (ptr) value_type(v); // may throw + new (ptr) value_type(v); // may throw } void destroy(const value_type *, const value_type *, @@ -300,14 +323,14 @@ private: ptr->~value_type(); } - void uninitialized_fill(value_type * first, value_type * last, value_type const& value) + void construct(value_type * first, value_type * last, + boost::true_type const& /*has_trivial_constructor*/) { - // std::uninitialized_fill() value_type * it = first; try { for ( ; it != last ; ++it ) - new (it) value_type(value); // may throw + new (it) value_type(); // may throw } catch(...) { @@ -316,6 +339,10 @@ private: } } + void construct(value_type * first, value_type * last, + boost::false_type const& /*has_trivial_constructor*/) + {} + Value * ptr(size_type i) { return (reinterpret_cast(m_storage.address()) + i); From bbba565874ae270e9e3b78911221dad6fdaf8eb2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 21:28:04 +0000 Subject: [PATCH 212/366] Compilation error fixed. [SVN r81953] --- include/boost/geometry/extensions/index/static_vector.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 346de138b..ef2f71ba8 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -104,7 +104,7 @@ public: else { BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - this->construct(this->ptr(m_size), this->ptr(s) + this->construct(this->ptr(m_size), this->ptr(s), boost::has_trivial_constructor()); // may throw m_size = s; } From b22bd9525c15a70350607c32791ae76422018554 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 21:46:53 +0000 Subject: [PATCH 213/366] assertion added in static_vector::assign(); [SVN r81954] --- include/boost/geometry/extensions/index/static_vector.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index ef2f71ba8..df80de54c 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -155,6 +155,8 @@ public: { size_type s = std::distance(first, last); + BOOST_ASSERT_MSG(s <= Capacity, "max capacity reached"); + if ( m_size <= s ) { this->copy(first, first + m_size, this->ptr(0), From 479c6a3bab23036a5b63954645d6aecf69af1a4f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 22:35:46 +0000 Subject: [PATCH 214/366] Error fixed in static_vector::at(). Added test for static_vector. [SVN r81958] --- .../extensions/index/static_vector.hpp | 10 +- test/Jamfile.v2 | 9 +- test/static_vector.cpp | 107 ++++++++++++++++++ 3 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 test/static_vector.cpp diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index df80de54c..8968b4c5d 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -188,7 +188,7 @@ public: // strong Value & at(size_type i) { - if ( Capacity <= i ) + if ( m_size <= i ) throw std::out_of_range("static_vector element index out of bounds"); return *(this->ptr(i)); } @@ -196,7 +196,7 @@ public: // strong Value const& at(size_type i) const { - if ( Capacity <= i ) + if ( m_size <= i ) throw std::out_of_range("static_vector element index out of bounds"); return *(this->ptr(i)); } @@ -305,7 +305,7 @@ private: new (ptr) value_type(v); // may throw } - void destroy(const value_type *, const value_type *, + void destroy(const value_type * /*first*/, const value_type * /*last*/, boost::true_type const& /*has_trivial_destructor*/) {} @@ -316,7 +316,7 @@ private: first->~value_type(); } - void destroy(const value_type *, + void destroy(const value_type * /*ptr*/, boost::true_type const& /*has_trivial_destructor*/) {} @@ -341,7 +341,7 @@ private: } } - void construct(value_type * first, value_type * last, + void construct(value_type * /*first*/, value_type * /*last*/, boost::false_type const& /*has_trivial_constructor*/) {} diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index e102b45d0..9a3b55ef1 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -19,5 +19,10 @@ project boost-geometry-index-test msvc:on ; -build-project algorithms ; -build-project rtree ; +test-suite boost-geometry-index + : + [ run static_vector.cpp ] + ; + +#build-project algorithms ; +#build-project rtree ; diff --git a/test/static_vector.cpp b/test/static_vector.cpp new file mode 100644 index 000000000..7756dd7df --- /dev/null +++ b/test/static_vector.cpp @@ -0,0 +1,107 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +#include + +using namespace boost::geometry::index; + +class value_ndc +{ +public: + value_ndc(int a) : aa(a) {} + bool operator==(value_ndc const& v) const { return aa == v.aa; } +private: + value_ndc(value_ndc const&) {} + value_ndc & operator=(value_ndc const&) { return *this; } + int aa; +}; + +class value_nd +{ +public: + value_nd(int a) : aa(a) {} + bool operator==(value_nd const& v) const { return aa == v.aa; } +private: + int aa; +}; + +class value_nc +{ +public: + value_nc(int a = 0) : aa(a) {} + bool operator==(value_nc const& v) const { return aa == v.aa; } +private: + value_nc(value_nc const&) {} + value_nc & operator=(value_ndc const&) { return *this; } + int aa; +}; + +template +void test_ctor_d() +{ + static_vector s; + BOOST_CHECK(s.size() == 0); + BOOST_CHECK(s.capacity() == N); + BOOST_CHECK_THROW( s.at(0), std::out_of_range ); +} + +template +void test_ctor_r(size_t n) +{ + static_vector s(n); + BOOST_CHECK(s.size() == n); + BOOST_CHECK(s.capacity() == N); + BOOST_CHECK_THROW( s.at(n), std::out_of_range ); + if ( 1 < n ) + { + s[0] = T(10); + BOOST_CHECK(T(10) == s[0]); + BOOST_CHECK(T(10) == s.at(0)); + s.at(1) = T(20); + BOOST_CHECK(T(20) == s[1]); + BOOST_CHECK(T(20) == s.at(1)); + } +} + +template +void test_ctor_rv(size_t n, T const& v) +{ + static_vector s(n, v); + BOOST_CHECK(s.size() == n); + BOOST_CHECK(s.capacity() == N); + BOOST_CHECK_THROW( s.at(n), std::out_of_range ); + if ( 1 < n ) + { + BOOST_CHECK(v == s[0]); + BOOST_CHECK(v == s.at(0)); + BOOST_CHECK(v == s[1]); + BOOST_CHECK(v == s.at(1)); + s[0] = T(10); + BOOST_CHECK(T(10) == s[0]); + BOOST_CHECK(T(10) == s.at(0)); + s.at(1) = T(20); + BOOST_CHECK(T(20) == s[1]); + BOOST_CHECK(T(20) == s.at(1)); + } +} + +int test_main(int, char* []) +{ + test_ctor_d(); + test_ctor_d(); + test_ctor_r(5); + test_ctor_r(5); + test_ctor_rv(5, 0); + test_ctor_rv(5, 0); + + return 0; +} From da5a91bad4cd68a82bbd263fd6158f29fe5a6676 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 22:59:19 +0000 Subject: [PATCH 215/366] static_vector error fixed, tests added. [SVN r81960] --- .../extensions/index/static_vector.hpp | 2 +- test/static_vector.cpp | 151 ++++++++++++++++-- 2 files changed, 143 insertions(+), 10 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 8968b4c5d..981cf4a65 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -80,7 +80,7 @@ public: { //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); - assign(other->ptr(0), other->ptr(other.m_size)); + assign(other.ptr(0), other.ptr(other.m_size)); return *this; } diff --git a/test/static_vector.cpp b/test/static_vector.cpp index 7756dd7df..dbd6c854c 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -18,6 +18,7 @@ class value_ndc { public: value_ndc(int a) : aa(a) {} + ~value_ndc() {} bool operator==(value_ndc const& v) const { return aa == v.aa; } private: value_ndc(value_ndc const&) {} @@ -29,6 +30,7 @@ class value_nd { public: value_nd(int a) : aa(a) {} + ~value_nd() {} bool operator==(value_nd const& v) const { return aa == v.aa; } private: int aa; @@ -38,6 +40,7 @@ class value_nc { public: value_nc(int a = 0) : aa(a) {} + ~value_nc() {} bool operator==(value_nc const& v) const { return aa == v.aa; } private: value_nc(value_nc const&) {} @@ -46,7 +49,7 @@ private: }; template -void test_ctor_d() +void test_ctor_ndc() { static_vector s; BOOST_CHECK(s.size() == 0); @@ -55,7 +58,7 @@ void test_ctor_d() } template -void test_ctor_r(size_t n) +void test_ctor_nc(size_t n) { static_vector s(n); BOOST_CHECK(s.size() == n); @@ -73,7 +76,7 @@ void test_ctor_r(size_t n) } template -void test_ctor_rv(size_t n, T const& v) +void test_ctor_nd(size_t n, T const& v) { static_vector s(n, v); BOOST_CHECK(s.size() == n); @@ -94,14 +97,144 @@ void test_ctor_rv(size_t n, T const& v) } } +template +void test_resize_nc(size_t n) +{ + static_vector s; + + s.resize(n); + BOOST_CHECK(s.size() == n); + BOOST_CHECK(s.capacity() == N); + BOOST_CHECK_THROW( s.at(n), std::out_of_range ); + if ( 1 < n ) + { + s[0] = T(10); + BOOST_CHECK(T(10) == s[0]); + BOOST_CHECK(T(10) == s.at(0)); + s.at(1) = T(20); + BOOST_CHECK(T(20) == s[1]); + BOOST_CHECK(T(20) == s.at(1)); + } +} + +template +void test_resize_nd(size_t n, T const& v) +{ + static_vector s; + + s.resize(n, v); + BOOST_CHECK(s.size() == n); + BOOST_CHECK(s.capacity() == N); + BOOST_CHECK_THROW( s.at(n), std::out_of_range ); + if ( 1 < n ) + { + BOOST_CHECK(v == s[0]); + BOOST_CHECK(v == s.at(0)); + BOOST_CHECK(v == s[1]); + BOOST_CHECK(v == s.at(1)); + s[0] = T(10); + BOOST_CHECK(T(10) == s[0]); + BOOST_CHECK(T(10) == s.at(0)); + s.at(1) = T(20); + BOOST_CHECK(T(20) == s[1]); + BOOST_CHECK(T(20) == s.at(1)); + } +} + +template +void test_push_back_nd() +{ + static_vector s; + + BOOST_CHECK(s.size() == 0); + BOOST_CHECK_THROW( s.at(0), std::out_of_range ); + + for ( size_t i = 0 ; i < N ; ++i ) + { + s.push_back(T(i)); + BOOST_CHECK(s.size() == i + 1); + BOOST_CHECK_THROW( s.at(i + 1), std::out_of_range ); + BOOST_CHECK(T(i) == s.at(i)); + BOOST_CHECK(T(i) == s[i]); + BOOST_CHECK(T(i) == s.back()); + BOOST_CHECK(T(0) == s.front()); + } +} + +template +void test_pop_back_nd() +{ + static_vector s; + + for ( size_t i = 0 ; i < N ; ++i ) + s.push_back(i); + + for ( size_t i = N ; i > 1 ; --i ) + { + s.pop_back(); + BOOST_CHECK(s.size() == i - 1); + BOOST_CHECK_THROW( s.at(i - 1), std::out_of_range ); + BOOST_CHECK(T(i - 2) == s.at(i - 2)); + BOOST_CHECK(T(i - 2) == s[i - 2]); + BOOST_CHECK(T(i - 2) == s.back()); + BOOST_CHECK(T(0) == s.front()); + } +} + +template +void test_copy_and_assign_nd() +{ + static_vector s; + + for ( size_t i = 0 ; i < N ; ++i ) + s.push_back(i); + + { + static_vector s1(s); + BOOST_CHECK(s.size() == s1.size()); + for ( size_t i = 0 ; i < N ; ++i ) + BOOST_CHECK(s[i] == s1[i]) ; + } + { + static_vector s1; + BOOST_CHECK(0 == s1.size()); + s1 = s; + BOOST_CHECK(s.size() == s1.size()); + for ( size_t i = 0 ; i < N ; ++i ) + BOOST_CHECK(s[i] == s1[i]) ; + } + { + static_vector s1; + BOOST_CHECK(0 == s1.size()); + s1.assign(s.begin(), s.end()); + BOOST_CHECK(s.size() == s1.size()); + for ( size_t i = 0 ; i < N ; ++i ) + BOOST_CHECK(s[i] == s1[i]) ; + } +} + int test_main(int, char* []) { - test_ctor_d(); - test_ctor_d(); - test_ctor_r(5); - test_ctor_r(5); - test_ctor_rv(5, 0); - test_ctor_rv(5, 0); + test_ctor_ndc(); + test_ctor_ndc(); + test_ctor_nc(5); + test_ctor_nc(5); + test_ctor_nd(5, 1); + test_ctor_nd(5, 1); + + test_resize_nc(5); + test_resize_nc(5); + test_resize_nd(5, 1); + test_resize_nd(5, 1); + + test_push_back_nd(); + test_push_back_nd(); + + test_pop_back_nd(); + test_pop_back_nd(); + + test_copy_and_assign_nd(); + test_copy_and_assign_nd(); return 0; } From ec661bbe1e45b115e8d0ad5f7c960663ae1431e6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 23:03:04 +0000 Subject: [PATCH 216/366] bgi tests reenabled in Jamfile. [SVN r81961] --- test/Jamfile.v2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 9a3b55ef1..390409723 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -24,5 +24,5 @@ test-suite boost-geometry-index [ run static_vector.cpp ] ; -#build-project algorithms ; -#build-project rtree ; +build-project algorithms ; +build-project rtree ; From 395777fb9d84cbb3913060a8f1987c1d6d4a94fe Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 14 Dec 2012 23:22:16 +0000 Subject: [PATCH 217/366] fixed static_vector error related to construction of values with nontrivial default constructor. tests added. [SVN r81962] --- .../extensions/index/static_vector.hpp | 10 +++--- test/static_vector.cpp | 35 +++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 981cf4a65..ae5a48862 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -325,8 +325,12 @@ private: ptr->~value_type(); } - void construct(value_type * first, value_type * last, + void construct(value_type * /*first*/, value_type * /*last*/, boost::true_type const& /*has_trivial_constructor*/) + {} + + void construct(value_type * first, value_type * last, + boost::false_type const& /*has_trivial_constructor*/) { value_type * it = first; try @@ -341,10 +345,6 @@ private: } } - void construct(value_type * /*first*/, value_type * /*last*/, - boost::false_type const& /*has_trivial_constructor*/) - {} - Value * ptr(size_type i) { return (reinterpret_cast(m_storage.address()) + i); diff --git a/test/static_vector.cpp b/test/static_vector.cpp index dbd6c854c..b99fbaa64 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -48,6 +48,20 @@ private: int aa; }; +class counting_value +{ +public: + counting_value(int a = 0) : aa(a) { ++c(); } + counting_value(counting_value const& v) : aa(v.aa) { ++c(); } + counting_value & operator=(counting_value const& v) { aa = v.aa; return *this; } + ~counting_value() { --c(); } + bool operator==(counting_value const& v) const { return aa == v.aa; } + static size_t count() { return c(); } +private: + static size_t & c() { static size_t co = 0; return co; } + int aa; +}; + template void test_ctor_ndc() { @@ -215,26 +229,47 @@ void test_copy_and_assign_nd() int test_main(int, char* []) { + BOOST_CHECK(counting_value::count() == 0); + test_ctor_ndc(); test_ctor_ndc(); + test_ctor_ndc(); + BOOST_CHECK(counting_value::count() == 0); + test_ctor_nc(5); test_ctor_nc(5); + test_ctor_nc(5); + BOOST_CHECK(counting_value::count() == 0); + test_ctor_nd(5, 1); test_ctor_nd(5, 1); + test_ctor_nd(5, 1); + BOOST_CHECK(counting_value::count() == 0); test_resize_nc(5); test_resize_nc(5); + test_resize_nc(5); + BOOST_CHECK(counting_value::count() == 0); + test_resize_nd(5, 1); test_resize_nd(5, 1); + test_resize_nd(5, 1); + BOOST_CHECK(counting_value::count() == 0); test_push_back_nd(); test_push_back_nd(); + test_push_back_nd(); + BOOST_CHECK(counting_value::count() == 0); test_pop_back_nd(); test_pop_back_nd(); + test_pop_back_nd(); + BOOST_CHECK(counting_value::count() == 0); test_copy_and_assign_nd(); test_copy_and_assign_nd(); + test_copy_and_assign_nd(); + BOOST_CHECK(counting_value::count() == 0); return 0; } From d55108b720c6ac9b42125ba19cc02f504fd26dda Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 16:30:57 +0000 Subject: [PATCH 218/366] Added ctor and modified assign to static_vector. static_vector(Iter, Iter), assign(Iter, Iter) + separated version for RandomIterators. Private helper methods now are able to take arbitrary type (Iterator, Value). [SVN r81971] --- .../extensions/index/static_vector.hpp | 304 ++++++++++++------ test/static_vector.cpp | 59 +++- 2 files changed, 265 insertions(+), 98 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index ae5a48862..cb04e6cde 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -7,10 +7,16 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include + #include #include +#include +#include +#include +#include + +#include #include #include #include @@ -55,32 +61,38 @@ public: explicit static_vector(size_type s) : m_size(0) { - resize(s); // may throw + resize(s); // may throw } // strong static_vector(size_type s, value_type const& value) : m_size(0) { - resize(s, value); // may throw + resize(s, value); // may throw } // strong static_vector(static_vector const& other) + : m_size(other.m_size) { - //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); + //BOOST_ASSERT_MSG(other.m_size <= Capacity, "size can't exceed the capacity"); + //if ( Capacity <= other.m_size ) throw std::bad_alloc(); - this->uninitialized_copy(other.ptr(0), other.ptr(other.m_size), this->ptr(0), - boost::has_trivial_copy()); - m_size = other.m_size; + this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw + } + + // strong + template + static_vector(Iterator first, Iterator last) + : m_size(0) + { + assign(first, last); // may throw } // basic static_vector & operator=(static_vector const& other) { - //BOOST_ASSERT_MSG(other.m_size <= Capacity, "capacity too small"); - - assign(other.ptr(0), other.ptr(other.m_size)); + assign(other.begin(), other.end()); // may throw return *this; } @@ -88,8 +100,7 @@ public: // nothrow ~static_vector() { - this->destroy(this->ptr(0), this->ptr(m_size), - boost::has_trivial_destructor()); + this->destroy(this->begin(), this->end()); } // strong @@ -97,17 +108,15 @@ public: { if ( s < m_size ) { - this->destroy(this->ptr(s), this->ptr(m_size), - boost::has_trivial_destructor()); - m_size = s; + this->destroy(this->begin() + s, this->end()); } else { BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - this->construct(this->ptr(m_size), this->ptr(s), - boost::has_trivial_constructor()); // may throw - m_size = s; + //if ( Capacity <= s ) throw std::bad_alloc(); + this->construct(this->ptr(m_size), this->ptr(s)); // may throw } + m_size = s; // update end } // strong @@ -115,74 +124,55 @@ public: { if ( s < m_size ) { - this->destroy(this->ptr(s), this->ptr(m_size), - boost::has_trivial_destructor()); - m_size = s; + this->destroy(this->begin() + s, this->end()); } else { BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - std::uninitialized_fill(this->ptr(m_size), this->ptr(s), value); // may throw - m_size = s; + //if ( Capacity <= s ) throw std::bad_alloc(); + std::uninitialized_fill(this->ptr(m_size), this->ptr(s), value); // may throw } + m_size = s; // update end } // nothrow void reserve(size_type BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(s)) { - BOOST_ASSERT_MSG(s <= Capacity, "max capacity reached"); + BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); + //if ( Capacity <= s ) throw std::bad_alloc(); } // strong + //template void push_back(Value const& value) { - BOOST_ASSERT_MSG(m_size < Capacity, "max capacity reached"); - this->uninitialized_copy(this->ptr(m_size), value, - boost::has_trivial_copy()); // may throw - ++m_size; + BOOST_ASSERT_MSG(m_size < Capacity, "size can't exceed the capacity"); + //if ( Capacity <= m_size ) throw std::bad_alloc(); + this->uninitialized_copy(value, this->end()); // may throw + ++m_size; // update end } // nothrow void pop_back() { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - --m_size; - this->destroy(this->ptr(m_size), boost::has_trivial_destructor()); + --m_size; // update end + this->destroy(this->ptr(m_size)); } // basic - void assign(const value_type * first, const value_type * last) + template + void assign(Iterator first, Iterator last) { - size_type s = std::distance(first, last); - - BOOST_ASSERT_MSG(s <= Capacity, "max capacity reached"); - - if ( m_size <= s ) - { - this->copy(first, first + m_size, this->ptr(0), - boost::has_trivial_assign()); // may throw - - this->uninitialized_copy(first + m_size, last, this->ptr(m_size), - boost::has_trivial_copy()); // may throw - m_size = s; - } - else - { - this->copy(first, last, this->ptr(0), - boost::has_trivial_assign()); // may throw - - this->destroy(this->ptr(s), this->ptr(m_size), - boost::has_trivial_destructor()); - m_size = s; - } + typedef typename boost::iterator_traversal::type traversal; + assign_dispatch(first, last, traversal()); // may throw } // nothrow void clear() { - this->destroy(this->ptr(0), this->ptr(m_size), - boost::has_trivial_destructor()); - m_size = 0; + this->destroy(this->ptr(0), this->ptr(m_size)); + m_size = 0; // update end } // strong @@ -219,28 +209,28 @@ public: Value & front() { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(0)); + return *(this->begin()); } // nothrow Value const& front() const { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(0)); + return *(this->begin()); } // nothrow Value & back() { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(m_size - 1)); + return *(this->end() - 1); } // nothrow Value const& back() const { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); - return *(this->ptr(m_size - 1)); + return *(this->end() - 1); } // nothrow @@ -248,9 +238,9 @@ public: const Value * data() const { return this->ptr(0); } // nothrow - iterator begin() { return this->ptr(0); } - const_iterator begin() const { return this->ptr(0); } - const_iterator cbegin() const { return this->ptr(0); } + iterator begin() { return this->ptr(); } + const_iterator begin() const { return this->ptr(); } + const_iterator cbegin() const { return this->ptr(); } iterator end() { return this->ptr(m_size); } const_iterator end() const { return this->ptr(m_size); } const_iterator cend() const { return this->ptr(m_size); } @@ -269,78 +259,202 @@ public: bool empty() const { return 0 == m_size; } private: - void copy(const value_type * first, const value_type * last, value_type * dst, - boost::true_type const& /*has_trivial_assign*/) + + // assign + + template + void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const&) + { + size_type s = std::distance(first, last); + + BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); + //if ( Capacity <= m_size ) throw std::bad_alloc(); + + if ( m_size <= s ) + { + this->copy(first, first + m_size, this->begin()); // may throw + this->uninitialized_copy(first + m_size, last, this->ptr(m_size)); // may throw + } + else + { + this->copy(first, last, this->begin()); // may throw + this->destroy(this->ptr(s), this->ptr(m_size)); + } + m_size = s; // update end + } + + template + void assign_dispatch(Iterator first, Iterator last, Traversal const& /*not_random_access*/) + { + size_t s = 0; + iterator it = this->begin(); + + for ( ; it != this->end() && first != last ; ++it, ++first, ++s ) + *it = *first; // may throw + + this->destroy(it, this->end()); + + try + { + for ( ; first != last ; ++it, ++first, ++s ) + this->uninitialized_copy(*first, it); // may throw + m_size = s; // update end + } + catch(...) + { + this->destroy(this->begin() + m_size, it); + throw; + } + } + + // copy + + template + void copy(Iterator first, Iterator last, iterator dst) + { + typedef typename + mpl::and_< + has_trivial_assign, + mpl::or_< + is_same, + is_same + > + >::type + use_memcpy; + + this->copy_dispatch(first, last, dst, use_memcpy()); // may throw + } + + void copy_dispatch(const value_type * first, const value_type * last, value_type * dst, + boost::mpl::bool_ const& /*use_memcpy*/) { ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); } - void copy(const value_type * first, const value_type * last, value_type * dst, - boost::false_type const& /*has_trivial_assign*/) + template + void copy_dispatch(Iterator first, Iterator last, value_type * dst, + boost::mpl::bool_ const& /*use_memcpy*/) { - std::copy(first, last, dst); // may throw + std::copy(first, last, dst); // may throw } - void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, - boost::true_type const& /*has_trivial_copy*/) + // uninitialized_copy + + template + void uninitialized_copy(Iterator first, Iterator last, iterator dst) + { + typedef typename + mpl::and_< + has_trivial_copy, + mpl::or_< + is_same, + is_same + > + >::type + use_memcpy; + + this->uninitialized_copy_dispatch(first, last, dst, use_memcpy()); // may throw + } + + void uninitialized_copy_dispatch(const value_type * first, const value_type * last, value_type * dst, + boost::mpl::bool_ const& /*use_memcpy*/) { ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); } - void uninitialized_copy(const value_type * first, const value_type * last, value_type * dst, - boost::false_type const& /*has_trivial_copy*/) + template + void uninitialized_copy_dispatch(Iterator first, Iterator last, value_type * dst, + boost::mpl::bool_ const& /*use_memcpy*/) { - std::uninitialized_copy(first, last, dst); // may throw + std::uninitialized_copy(first, last, dst); // may throw } - void uninitialized_copy(value_type * ptr, value_type const& v, - boost::true_type const& /*has_trivial_copy*/) + // uninitialized_copy + + template + void uninitialized_copy(Value const& v, iterator dst) + { + typedef typename + mpl::and_< + has_trivial_copy, + is_same + >::type + use_memcpy; + + uninitialized_copy_dispatch(v, dst, use_memcpy()); // may throw + } + + void uninitialized_copy_dispatch(value_type const& v, value_type * ptr, + boost::mpl::bool_ const& /*use_memcpy*/) { ::memcpy(ptr, &v, sizeof(value_type)); } - void uninitialized_copy(value_type * ptr, value_type const& v, - boost::false_type const& /*has_trivial_copy*/) + template + void uninitialized_copy_dispatch(Value const& v, value_type * ptr, + boost::mpl::bool_ const& /*use_memcpy*/) { new (ptr) value_type(v); // may throw } - void destroy(const value_type * /*first*/, const value_type * /*last*/, - boost::true_type const& /*has_trivial_destructor*/) + // destroy + + void destroy(iterator first, iterator last) + { + this->destroy_dispatch(first, last, has_trivial_destructor()); + } + + void destroy_dispatch(value_type * /*first*/, value_type * /*last*/, + boost::true_type const& /*has_trivial_destructor*/) {} - void destroy(const value_type * first, const value_type * last, - boost::false_type const& /*has_trivial_destructor*/) + void destroy_dispatch(value_type * first, value_type * last, + boost::false_type const& /*has_trivial_destructor*/) { for ( ; first != last ; ++first ) first->~value_type(); } - void destroy(const value_type * /*ptr*/, - boost::true_type const& /*has_trivial_destructor*/) + // destroy + + void destroy(iterator it) + { + this->destroy_dispatch(it, has_trivial_destructor()); + } + + void destroy_dispatch(value_type * /*ptr*/, + boost::true_type const& /*has_trivial_destructor*/) {} - void destroy(const value_type * ptr, boost::false_type const& /*has_trivial_destructor*/) + void destroy_dispatch(value_type * ptr, + boost::false_type const& /*has_trivial_destructor*/) { ptr->~value_type(); } - void construct(value_type * /*first*/, value_type * /*last*/, - boost::true_type const& /*has_trivial_constructor*/) + // construct + + void construct(iterator first, iterator last) + { + this->construct_dispatch(first, last, has_trivial_constructor()); // may throw + } + + void construct_dispatch(value_type * /*first*/, value_type * /*last*/, + boost::true_type const& /*has_trivial_constructor*/) {} - void construct(value_type * first, value_type * last, - boost::false_type const& /*has_trivial_constructor*/) + void construct_dispatch(value_type * first, value_type * last, + boost::false_type const& /*has_trivial_constructor*/) { value_type * it = first; try { for ( ; it != last ; ++it ) - new (it) value_type(); // may throw + new (it) value_type(); // may throw } catch(...) { - this->destroy(first, it, boost::has_trivial_destructor()); + this->destroy(first, it); throw; } } @@ -355,6 +469,16 @@ private: return (reinterpret_cast(m_storage.address()) + i); } + Value * ptr() + { + return (reinterpret_cast(m_storage.address())); + } + + const Value * ptr() const + { + return (reinterpret_cast(m_storage.address())); + } + boost::aligned_storage::value> m_storage; size_type m_size; }; diff --git a/test/static_vector.cpp b/test/static_vector.cpp index b99fbaa64..4e123ddee 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -195,35 +195,78 @@ void test_pop_back_nd() } } +template +void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2) +{ + BOOST_CHECK(std::distance(first1, last1) == std::distance(first2, last2)); + for ( ; first1 != last1 && first2 != last2 ; ++first1, ++first2 ) + BOOST_CHECK(*first1 == *first2); +} + template void test_copy_and_assign_nd() { static_vector s; + std::vector v; + std::list l; for ( size_t i = 0 ; i < N ; ++i ) - s.push_back(i); - + { + s.push_back(i); + v.push_back(i); + l.push_back(i); + } + // copy ctor { static_vector s1(s); BOOST_CHECK(s.size() == s1.size()); - for ( size_t i = 0 ; i < N ; ++i ) - BOOST_CHECK(s[i] == s1[i]) ; + test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); } + // copy assignment { static_vector s1; BOOST_CHECK(0 == s1.size()); s1 = s; BOOST_CHECK(s.size() == s1.size()); - for ( size_t i = 0 ; i < N ; ++i ) - BOOST_CHECK(s[i] == s1[i]) ; + test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); } + // ctor(Iter, Iter) + { + static_vector s1(s.begin(), s.end()); + BOOST_CHECK(s.size() == s1.size()); + test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); + } + { + static_vector s1(v.begin(), v.end()); + BOOST_CHECK(v.size() == s1.size()); + test_compare_ranges(v.begin(), v.end(), s1.begin(), s1.end()); + } + { + static_vector s1(l.begin(), l.end()); + BOOST_CHECK(l.size() == s1.size()); + test_compare_ranges(l.begin(), l.end(), s1.begin(), s1.end()); + } + // assign(Iter, Iter) { static_vector s1; BOOST_CHECK(0 == s1.size()); s1.assign(s.begin(), s.end()); BOOST_CHECK(s.size() == s1.size()); - for ( size_t i = 0 ; i < N ; ++i ) - BOOST_CHECK(s[i] == s1[i]) ; + test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); + } + { + static_vector s1; + BOOST_CHECK(0 == s1.size()); + s1.assign(v.begin(), v.end()); + BOOST_CHECK(v.size() == s1.size()); + test_compare_ranges(v.begin(), v.end(), s1.begin(), s1.end()); + } + { + static_vector s1; + BOOST_CHECK(0 == s1.size()); + s1.assign(l.begin(), l.end()); + BOOST_CHECK(l.size() == s1.size()); + test_compare_ranges(l.begin(), l.end(), s1.begin(), s1.end()); } } From 36f0abc509b1f2271cb936627691ed5c4c4831d5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 16:42:56 +0000 Subject: [PATCH 219/366] Fixed gcc compiler errors. [SVN r81974] --- include/boost/geometry/extensions/index/static_vector.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index cb04e6cde..79098d494 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -371,8 +371,8 @@ private: // uninitialized_copy - template - void uninitialized_copy(Value const& v, iterator dst) + template + void uninitialized_copy(V const& v, iterator dst) { typedef typename mpl::and_< @@ -390,8 +390,8 @@ private: ::memcpy(ptr, &v, sizeof(value_type)); } - template - void uninitialized_copy_dispatch(Value const& v, value_type * ptr, + template + void uninitialized_copy_dispatch(V const& v, value_type * ptr, boost::mpl::bool_ const& /*use_memcpy*/) { new (ptr) value_type(v); // may throw From bed0b92f6e7c4efde17de47455d772729cd0fa0b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 19:31:45 +0000 Subject: [PATCH 220/366] static_vector helper method uninitialized_copy(Val, It) changed to uninitialized_fill(It, Val). [SVN r81977] --- .../extensions/index/static_vector.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 79098d494..5ceadba4f 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -65,6 +65,7 @@ public: } // strong + //template static_vector(size_type s, value_type const& value) : m_size(0) { @@ -120,6 +121,7 @@ public: } // strong + //template void resize(size_type s, value_type const& value) { if ( s < m_size ) @@ -144,11 +146,11 @@ public: // strong //template - void push_back(Value const& value) + void push_back(value_type const& value) { BOOST_ASSERT_MSG(m_size < Capacity, "size can't exceed the capacity"); //if ( Capacity <= m_size ) throw std::bad_alloc(); - this->uninitialized_copy(value, this->end()); // may throw + this->uninitialized_fill(this->end(), value); // may throw ++m_size; // update end } @@ -297,7 +299,7 @@ private: try { for ( ; first != last ; ++it, ++first, ++s ) - this->uninitialized_copy(*first, it); // may throw + this->uninitialized_fill(it, *first); // may throw m_size = s; // update end } catch(...) @@ -369,10 +371,10 @@ private: std::uninitialized_copy(first, last, dst); // may throw } - // uninitialized_copy + // uninitialized_fill template - void uninitialized_copy(V const& v, iterator dst) + void uninitialized_fill(iterator dst, V const& v) { typedef typename mpl::and_< @@ -381,17 +383,17 @@ private: >::type use_memcpy; - uninitialized_copy_dispatch(v, dst, use_memcpy()); // may throw + uninitialized_fill_dispatch(dst, v, use_memcpy()); // may throw } - void uninitialized_copy_dispatch(value_type const& v, value_type * ptr, + void uninitialized_fill_dispatch(value_type * ptr, value_type const& v, boost::mpl::bool_ const& /*use_memcpy*/) { ::memcpy(ptr, &v, sizeof(value_type)); } template - void uninitialized_copy_dispatch(V const& v, value_type * ptr, + void uninitialized_fill_dispatch(value_type * ptr, V const& v, boost::mpl::bool_ const& /*use_memcpy*/) { new (ptr) value_type(v); // may throw From ba031be21ac78824bbba0801bb15e75e2c83ddd8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 20:07:19 +0000 Subject: [PATCH 221/366] Added static_vector::assign(count, value) + test. Added static_vector iterators test. [SVN r81978] --- .../extensions/index/static_vector.hpp | 67 ++++++++++++------- test/static_vector.cpp | 66 +++++++++++++----- 2 files changed, 91 insertions(+), 42 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 5ceadba4f..3a66287aa 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -58,18 +58,17 @@ public: {} // strong - explicit static_vector(size_type s) + explicit static_vector(size_type count) : m_size(0) { - resize(s); // may throw + resize(count); // may throw } // strong - //template - static_vector(size_type s, value_type const& value) + static_vector(size_type count, value_type const& value) : m_size(0) { - resize(s, value); // may throw + resize(count, value); // may throw } // strong @@ -105,47 +104,45 @@ public: } // strong - void resize(size_type s) + void resize(size_type count) { - if ( s < m_size ) + if ( count < m_size ) { - this->destroy(this->begin() + s, this->end()); + this->destroy(this->begin() + count, this->end()); } else { - BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= s ) throw std::bad_alloc(); - this->construct(this->ptr(m_size), this->ptr(s)); // may throw + BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); + //if ( Capacity <= count ) throw std::bad_alloc(); + this->construct(this->ptr(m_size), this->ptr(count)); // may throw } - m_size = s; // update end + m_size = count; // update end } // strong - //template - void resize(size_type s, value_type const& value) + void resize(size_type count, value_type const& value) { - if ( s < m_size ) + if ( count < m_size ) { - this->destroy(this->begin() + s, this->end()); + this->destroy(this->begin() + count, this->end()); } else { - BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= s ) throw std::bad_alloc(); - std::uninitialized_fill(this->ptr(m_size), this->ptr(s), value); // may throw + BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); + //if ( Capacity <= count ) throw std::bad_alloc(); + std::uninitialized_fill(this->ptr(m_size), this->ptr(count), value); // may throw } - m_size = s; // update end + m_size = count; // update end } // nothrow - void reserve(size_type BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(s)) + void reserve(size_type BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(count)) { - BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= s ) throw std::bad_alloc(); + BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); + //if ( Capacity <= count ) throw std::bad_alloc(); } // strong - //template void push_back(value_type const& value) { BOOST_ASSERT_MSG(m_size < Capacity, "size can't exceed the capacity"); @@ -170,6 +167,24 @@ public: assign_dispatch(first, last, traversal()); // may throw } + // basic + void assign(size_type count, value_type const& value) + { + if ( count < m_size ) + { + std::fill_n(this->begin(), count, value); + this->destroy(this->begin() + count, this->end()); + } + else + { + std::fill_n(this->begin(), m_size, value); + BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); + //if ( Capacity <= count ) throw std::bad_alloc(); + std::uninitialized_fill(this->ptr(m_size), this->ptr(count), value); // may throw + } + m_size = count; // update end + } + // nothrow void clear() { @@ -236,8 +251,8 @@ public: } // nothrow - Value * data() { return this->ptr(0); } - const Value * data() const { return this->ptr(0); } + Value * data() { return this->ptr(); } + const Value * data() const { return this->ptr(); } // nothrow iterator begin() { return this->ptr(); } diff --git a/test/static_vector.cpp b/test/static_vector.cpp index 4e123ddee..6e122d9b6 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -17,7 +17,7 @@ using namespace boost::geometry::index; class value_ndc { public: - value_ndc(int a) : aa(a) {} + explicit value_ndc(int a) : aa(a) {} ~value_ndc() {} bool operator==(value_ndc const& v) const { return aa == v.aa; } private: @@ -29,7 +29,7 @@ private: class value_nd { public: - value_nd(int a) : aa(a) {} + explicit value_nd(int a) : aa(a) {} ~value_nd() {} bool operator==(value_nd const& v) const { return aa == v.aa; } private: @@ -39,7 +39,7 @@ private: class value_nc { public: - value_nc(int a = 0) : aa(a) {} + explicit value_nc(int a = 0) : aa(a) {} ~value_nc() {} bool operator==(value_nc const& v) const { return aa == v.aa; } private: @@ -51,7 +51,7 @@ private: class counting_value { public: - counting_value(int a = 0) : aa(a) { ++c(); } + explicit counting_value(int a = 0) : aa(a) { ++c(); } counting_value(counting_value const& v) : aa(v.aa) { ++c(); } counting_value & operator=(counting_value const& v) { aa = v.aa; return *this; } ~counting_value() { --c(); } @@ -181,7 +181,7 @@ void test_pop_back_nd() static_vector s; for ( size_t i = 0 ; i < N ; ++i ) - s.push_back(i); + s.push_back(T(i)); for ( size_t i = N ; i > 1 ; --i ) { @@ -204,7 +204,7 @@ void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2) } template -void test_copy_and_assign_nd() +void test_copy_and_assign_nd(T const& val) { static_vector s; std::vector v; @@ -212,9 +212,9 @@ void test_copy_and_assign_nd() for ( size_t i = 0 ; i < N ; ++i ) { - s.push_back(i); - v.push_back(i); - l.push_back(i); + s.push_back(T(i)); + v.push_back(T(i)); + l.push_back(T(i)); } // copy ctor { @@ -268,6 +268,35 @@ void test_copy_and_assign_nd() BOOST_CHECK(l.size() == s1.size()); test_compare_ranges(l.begin(), l.end(), s1.begin(), s1.end()); } + // assign(N, V) + { + static_vector s1(s); + test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); + std::vector a(N, val); + s1.assign(N, val); + test_compare_ranges(a.begin(), a.end(), s1.begin(), s1.end()); + } +} + +template +void test_iterators_nd() +{ + static_vector s; + std::vector v; + + for ( size_t i = 0 ; i < N ; ++i ) + { + s.push_back(T(i)); + v.push_back(T(i)); + } + + test_compare_ranges(s.begin(), s.end(), v.begin(), v.end()); + test_compare_ranges(s.rbegin(), s.rend(), v.rbegin(), v.rend()); + + s.assign(v.rbegin(), v.rend()); + + test_compare_ranges(s.begin(), s.end(), v.rbegin(), v.rend()); + test_compare_ranges(s.rbegin(), s.rend(), v.begin(), v.end()); } int test_main(int, char* []) @@ -285,8 +314,8 @@ int test_main(int, char* []) BOOST_CHECK(counting_value::count() == 0); test_ctor_nd(5, 1); - test_ctor_nd(5, 1); - test_ctor_nd(5, 1); + test_ctor_nd(5, value_nd(1)); + test_ctor_nd(5, counting_value(1)); BOOST_CHECK(counting_value::count() == 0); test_resize_nc(5); @@ -295,8 +324,8 @@ int test_main(int, char* []) BOOST_CHECK(counting_value::count() == 0); test_resize_nd(5, 1); - test_resize_nd(5, 1); - test_resize_nd(5, 1); + test_resize_nd(5, value_nd(1)); + test_resize_nd(5, counting_value(1)); BOOST_CHECK(counting_value::count() == 0); test_push_back_nd(); @@ -309,9 +338,14 @@ int test_main(int, char* []) test_pop_back_nd(); BOOST_CHECK(counting_value::count() == 0); - test_copy_and_assign_nd(); - test_copy_and_assign_nd(); - test_copy_and_assign_nd(); + test_copy_and_assign_nd(1); + test_copy_and_assign_nd(value_nd(1)); + test_copy_and_assign_nd(counting_value(1)); + BOOST_CHECK(counting_value::count() == 0); + + test_iterators_nd(); + test_iterators_nd(); + test_iterators_nd(); BOOST_CHECK(counting_value::count() == 0); return 0; From b985f5a5615b3445abb26de82ae1dfe42fec34ce Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 20:55:38 +0000 Subject: [PATCH 222/366] Added assertion in static_vector. [SVN r81980] --- include/boost/geometry/extensions/index/static_vector.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 3a66287aa..11599461b 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -314,7 +314,10 @@ private: try { for ( ; first != last ; ++it, ++first, ++s ) + { + BOOST_ASSERT_MSG(s < Capacity, "size can't exceed the capacity"); this->uninitialized_fill(it, *first); // may throw + } m_size = s; // update end } catch(...) From addc5eebcfe9f35fbda07af78802ed8c9db2f9ec Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 23:21:59 +0000 Subject: [PATCH 223/366] Added static_vector::erase() and tests. [SVN r81990] --- .../extensions/index/static_vector.hpp | 46 +++++++++++++++++ test/static_vector.cpp | 49 +++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 11599461b..0e8205040 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -159,6 +159,33 @@ public: this->destroy(this->ptr(m_size)); } + void erase(iterator position) + { + // TODO change name of this macro + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); + BOOST_ASSERT_MSG(0 <= dist && dist < m_size, "invalid iterator"); + + this->move(position + 1, this->end(), position); // may throw + this->destroy(this->end() - 1); + --m_size; + } + + void erase(iterator first, iterator last) + { + // TODO change name of this macro + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type distf = std::distance(this->begin(), first)); + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type distl = std::distance(this->begin(), last)); + BOOST_ASSERT_MSG(0 <= distf && distf < m_size, "invalid iterator"); + BOOST_ASSERT_MSG(0 <= distl && distl < m_size, "invalid iterator"); + + difference_type n = std::distance(first, last); + BOOST_ASSERT_MSG(0 <= n, "invalid iterator"); + + this->move(last, this->end(), first); // may throw + this->destroy(this->end() - n, this->end()); + m_size -= n; + } + // basic template void assign(Iterator first, Iterator last) @@ -358,6 +385,25 @@ private: std::copy(first, last, dst); // may throw } + // move + + void move(iterator first, iterator last, iterator dst) + { + this->move_dispatch(first, last, dst, has_trivial_assign()); // may throw + } + + void move_dispatch(value_type * first, value_type * last, value_type * dst, + boost::true_type const& /*has_trivial_assign*/) + { + ::memmove(dst, first, sizeof(value_type) * std::distance(first, last)); + } + + void move_dispatch(value_type * first, value_type * last, value_type * dst, + boost::false_type const& /*has_trivial_assign*/) + { + std::copy(first, last, dst); // may throw + } + // uninitialized_copy template diff --git a/test/static_vector.cpp b/test/static_vector.cpp index 6e122d9b6..f8107f5c9 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -299,6 +299,50 @@ void test_iterators_nd() test_compare_ranges(s.rbegin(), s.rend(), v.begin(), v.end()); } +template +void test_erase_nd() +{ + static_vector s; + + for ( size_t i = 0 ; i < N ; ++i ) + s.push_back(T(i)); + + { + static_vector s1(s); + + for ( size_t i = 1 ; i < N ; ++i ) + { + BOOST_CHECK(s1.front() == T(i-1)); + s1.erase(s1.begin()); + BOOST_CHECK(s1.front() == T(i)); + } + BOOST_CHECK(s1.size() == 1); + } + + { + static_vector s1(s); + + for ( size_t i = N ; i > 1 ; --i ) + { + BOOST_CHECK(s1.back() == T(i-1)); + s1.erase(s1.end() - 1); + BOOST_CHECK(s1.back() == T(i-2)); + } + BOOST_CHECK(s1.size() == 1); + } + + { + static_vector s1(s); + + for ( size_t i = 1 ; i < N - 2 ; i += 3 ) + { + BOOST_CHECK(s1.front() == T(i-1)); + s1.erase(s1.begin(), s1.begin() + 3); + BOOST_CHECK(s1.front() == T(i+2)); + } + } +} + int test_main(int, char* []) { BOOST_CHECK(counting_value::count() == 0); @@ -348,5 +392,10 @@ int test_main(int, char* []) test_iterators_nd(); BOOST_CHECK(counting_value::count() == 0); + test_erase_nd(); + test_erase_nd(); + test_erase_nd(); + BOOST_CHECK(counting_value::count() == 0); + return 0; } From 20c8e649b7599c32a9dcf61fbfe7397df7e33f57 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 23:41:37 +0000 Subject: [PATCH 224/366] static_vector: fixed wrong assert, removed ptr(i), calls of ptr(i) replaced by methods returning iterators wherever possible. [SVN r81992] --- .../extensions/index/static_vector.hpp | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 0e8205040..78d97a14b 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -114,7 +114,7 @@ public: { BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); //if ( Capacity <= count ) throw std::bad_alloc(); - this->construct(this->ptr(m_size), this->ptr(count)); // may throw + this->construct(this->end(), this->begin() + count); // may throw } m_size = count; // update end } @@ -130,7 +130,7 @@ public: { BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); //if ( Capacity <= count ) throw std::bad_alloc(); - std::uninitialized_fill(this->ptr(m_size), this->ptr(count), value); // may throw + std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw } m_size = count; // update end } @@ -155,8 +155,11 @@ public: void pop_back() { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + //--m_size; // update end + //this->destroy(this->end()); + // safer and more intuitive version + this->destroy(this->end() - 1); --m_size; // update end - this->destroy(this->ptr(m_size)); } void erase(iterator position) @@ -207,7 +210,7 @@ public: std::fill_n(this->begin(), m_size, value); BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); //if ( Capacity <= count ) throw std::bad_alloc(); - std::uninitialized_fill(this->ptr(m_size), this->ptr(count), value); // may throw + std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw } m_size = count; // update end } @@ -215,7 +218,7 @@ public: // nothrow void clear() { - this->destroy(this->ptr(0), this->ptr(m_size)); + this->destroy(this->begin(), this->end()); m_size = 0; // update end } @@ -224,7 +227,7 @@ public: { if ( m_size <= i ) throw std::out_of_range("static_vector element index out of bounds"); - return *(this->ptr(i)); + return *(this->begin() + i); } // strong @@ -232,21 +235,21 @@ public: { if ( m_size <= i ) throw std::out_of_range("static_vector element index out of bounds"); - return *(this->ptr(i)); + return *(this->begin() + i); } // nothrow Value & operator[](size_type i) { - BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); - return *(this->ptr(i)); + BOOST_ASSERT_MSG(i < m_size, "index out of bounds"); + return *(this->begin() + i); } // nothrow Value const& operator[](size_type i) const { - BOOST_ASSERT_MSG(i < Capacity, "index out of bounds"); - return *(this->ptr(i)); + BOOST_ASSERT_MSG(i < m_size, "index out of bounds"); + return *(this->begin() + i); } // nothrow @@ -285,9 +288,9 @@ public: iterator begin() { return this->ptr(); } const_iterator begin() const { return this->ptr(); } const_iterator cbegin() const { return this->ptr(); } - iterator end() { return this->ptr(m_size); } - const_iterator end() const { return this->ptr(m_size); } - const_iterator cend() const { return this->ptr(m_size); } + iterator end() { return this->begin() + m_size; } + const_iterator end() const { return this->begin() + m_size; } + const_iterator cend() const { return this->cbegin() + m_size; } // nothrow reverse_iterator rbegin() { return reverse_iterator(this->end()); } const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); } @@ -317,12 +320,12 @@ private: if ( m_size <= s ) { this->copy(first, first + m_size, this->begin()); // may throw - this->uninitialized_copy(first + m_size, last, this->ptr(m_size)); // may throw + this->uninitialized_copy(first + m_size, last, this->end()); // may throw } else { this->copy(first, last, this->begin()); // may throw - this->destroy(this->ptr(s), this->ptr(m_size)); + this->destroy(this->begin() + s, this->end()); } m_size = s; // update end } @@ -525,16 +528,6 @@ private: } } - Value * ptr(size_type i) - { - return (reinterpret_cast(m_storage.address()) + i); - } - - const Value * ptr(size_type i) const - { - return (reinterpret_cast(m_storage.address()) + i); - } - Value * ptr() { return (reinterpret_cast(m_storage.address())); From 475837cfa6622dcbe596727c50a3948c9079ff9d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 15 Dec 2012 23:51:24 +0000 Subject: [PATCH 225/366] static_vector: types comparison warnings fixed. [SVN r81994] --- include/boost/geometry/extensions/index/static_vector.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 78d97a14b..ae4b24514 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -166,7 +166,7 @@ public: { // TODO change name of this macro BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); - BOOST_ASSERT_MSG(0 <= dist && dist < m_size, "invalid iterator"); + BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)distmove(position + 1, this->end(), position); // may throw this->destroy(this->end() - 1); @@ -178,8 +178,8 @@ public: // TODO change name of this macro BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type distf = std::distance(this->begin(), first)); BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type distl = std::distance(this->begin(), last)); - BOOST_ASSERT_MSG(0 <= distf && distf < m_size, "invalid iterator"); - BOOST_ASSERT_MSG(0 <= distl && distl < m_size, "invalid iterator"); + BOOST_ASSERT_MSG(0 <= distf && (sizeof(distf)<=sizeof(m_size)?((size_type)distf Date: Sun, 16 Dec 2012 00:40:39 +0000 Subject: [PATCH 226/366] implemented static_vector insert(pos, val) [SVN r82000] --- .../extensions/index/static_vector.hpp | 113 ++++++++++++++---- 1 file changed, 92 insertions(+), 21 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index ae4b24514..5226dccaf 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -42,7 +42,6 @@ class static_vector public: typedef Value value_type; typedef size_t size_type; - typedef ptrdiff_t difference_type; typedef Value& reference; typedef Value const& const_reference; typedef Value * pointer; @@ -51,6 +50,7 @@ public: typedef const Value * const_iterator; typedef boost::reverse_iterator reverse_iterator; typedef boost::reverse_iterator const_reverse_iterator; + typedef typename boost::iterator_difference::type difference_type; // nothrow static_vector() @@ -162,6 +162,31 @@ public: --m_size; // update end } + // basic + void insert(iterator position, value_type const& value) + { + // TODO change name of this macro + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); + BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)distend() ) + { + this->uninitialized_fill(position, value); // may throw + ++m_size; // update end + } + else + { + this->uninitialized_fill(this->end(), *(this->end() - 1)); // may throw + ++m_size; // update end + this->move_backward(position + 1, this->end() - 2, this->end() - 1); // may throw + this->fill(position, value); // may throw + } + } + + // basic void erase(iterator position) { // TODO change name of this macro @@ -173,6 +198,7 @@ public: --m_size; } + // basic void erase(iterator first, iterator last) { // TODO change name of this macro @@ -388,25 +414,6 @@ private: std::copy(first, last, dst); // may throw } - // move - - void move(iterator first, iterator last, iterator dst) - { - this->move_dispatch(first, last, dst, has_trivial_assign()); // may throw - } - - void move_dispatch(value_type * first, value_type * last, value_type * dst, - boost::true_type const& /*has_trivial_assign*/) - { - ::memmove(dst, first, sizeof(value_type) * std::distance(first, last)); - } - - void move_dispatch(value_type * first, value_type * last, value_type * dst, - boost::false_type const& /*has_trivial_assign*/) - { - std::copy(first, last, dst); // may throw - } - // uninitialized_copy template @@ -456,7 +463,9 @@ private: void uninitialized_fill_dispatch(value_type * ptr, value_type const& v, boost::mpl::bool_ const& /*use_memcpy*/) { - ::memcpy(ptr, &v, sizeof(value_type)); + // TODO - check if value_type has operator& defined and call this version only if it hasn't + const value_type * vptr = &v; + ::memcpy(ptr, vptr, sizeof(value_type)); } template @@ -466,6 +475,68 @@ private: new (ptr) value_type(v); // may throw } + // move + + void move(iterator first, iterator last, iterator dst) + { + this->move_dispatch(first, last, dst, has_trivial_assign()); // may throw + } + + void move_dispatch(value_type * first, value_type * last, value_type * dst, + boost::true_type const& /*has_trivial_assign*/) + { + ::memmove(dst, first, sizeof(value_type) * std::distance(first, last)); + } + + void move_dispatch(value_type * first, value_type * last, value_type * dst, + boost::false_type const& /*has_trivial_assign*/) + { + std::copy(first, last, dst); // may throw + } + + // move_backward + + void move_backward(iterator first, iterator last, iterator dst) + { + this->move_backward_dispatch(first, last, dst, has_trivial_assign()); // may throw + } + + void move_backward_dispatch(value_type * first, value_type * last, value_type * dst, + boost::true_type const& /*has_trivial_assign*/) + { + difference_type n = std::distance(first, last); + ::memmove(dst - n, first, sizeof(value_type) * n); + } + + void move_backward_dispatch(value_type * first, value_type * last, value_type * dst, + boost::false_type const& /*has_trivial_assign*/) + { + std::copy_backward(first, last, dst); // may throw + } + + // uninitialized_fill + + template + void fill(iterator dst, V const& v) + { + fill_dispatch(dst, v, has_trivial_assign()); // may throw + } + + void fill_dispatch(value_type * ptr, value_type const& v, + boost::true_type const& /*has_trivial_assign*/) + { + // TODO - check if value_type has operator& defined and call this version only if it hasn't + const value_type * vptr = &v; + ::memcpy(ptr, vptr, sizeof(value_type)); + } + + template + void fill_dispatch(value_type * ptr, V const& v, + boost::false_type const& /*has_trivial_assign*/) + { + *ptr = v; // may throw + } + // destroy void destroy(iterator first, iterator last) From 50bb3d9fdf7f7341d25569b5a7c6c6ebea134867 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 00:58:07 +0000 Subject: [PATCH 227/366] Error fixed in static_vector::insert(pos, val). Test added. [SVN r82002] --- .../extensions/index/static_vector.hpp | 2 +- test/static_vector.cpp | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 5226dccaf..5f36514a2 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -181,7 +181,7 @@ public: { this->uninitialized_fill(this->end(), *(this->end() - 1)); // may throw ++m_size; // update end - this->move_backward(position + 1, this->end() - 2, this->end() - 1); // may throw + this->move_backward(position, this->end() - 2, this->end() - 1); // may throw this->fill(position, value); // may throw } } diff --git a/test/static_vector.cpp b/test/static_vector.cpp index f8107f5c9..c2bdf7d87 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -343,6 +343,28 @@ void test_erase_nd() } } +template +void test_insert_nd(T const& v) +{ + size_t h = N/2; + + static_vector s; + + for ( size_t i = 0 ; i < h ; ++i ) + s.push_back(T(i)); + + { + static_vector s1(s); + for ( size_t i = 0 ; i < h ; ++i ) + s1.insert(s1.begin(), v); + BOOST_CHECK(s1.size() == 2*h); + for ( size_t i = 0 ; i < h ; ++i ) + BOOST_CHECK(s1[i] == v); + for ( size_t i = 0 ; i < h ; ++i ) + BOOST_CHECK(s1[i+h] == T(i)); + } +} + int test_main(int, char* []) { BOOST_CHECK(counting_value::count() == 0); @@ -397,5 +419,10 @@ int test_main(int, char* []) test_erase_nd(); BOOST_CHECK(counting_value::count() == 0); + test_insert_nd(50); + test_insert_nd(value_nd(50)); + test_insert_nd(counting_value(50)); + BOOST_CHECK(counting_value::count() == 0); + return 0; } From 8c6d65167605347a55b784239e45d594d68ea475 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 01:02:38 +0000 Subject: [PATCH 228/366] Fixed wrong assert in static_vector::insert(pos, val) Test added. [SVN r82003] --- .../boost/geometry/extensions/index/static_vector.hpp | 2 +- test/static_vector.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 5f36514a2..9a9acf3dc 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -167,7 +167,7 @@ public: { // TODO change name of this macro BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); - BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist s1(s); + for ( size_t i = 0 ; i < h ; ++i ) + s1.insert(s1.end(), v); + BOOST_CHECK(s1.size() == 2*h); + for ( size_t i = 0 ; i < h ; ++i ) + BOOST_CHECK(s1[i] == T(i)); + for ( size_t i = 0 ; i < h ; ++i ) + BOOST_CHECK(s1[i+h] == v); + } } int test_main(int, char* []) From 5c9f96c75040ebb2350ed2e9410c703119b4db88 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 02:40:29 +0000 Subject: [PATCH 229/366] Added static_vector::insert(pos, n, val) + test. [SVN r82008] --- .../extensions/index/static_vector.hpp | 37 +++++++++++++++++++ test/static_vector.cpp | 15 ++++++++ 2 files changed, 52 insertions(+) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 9a9acf3dc..1861a259e 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -186,6 +186,43 @@ public: } } + // basic + void insert(iterator position, size_type count, value_type const& value) + { + // TODO change name of this macro + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); + BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator"); + + BOOST_ASSERT_MSG(m_size + count <= Capacity, "size can't exceed the capacity"); + //if ( Capacity < m_size + count ) throw std::bad_alloc(); + + if ( position == this->end() ) + { + std::uninitialized_fill(position, position + count, value); // may throw + m_size += count; // update end + } + else + { + difference_type to_move = std::distance(position, this->end()); + + if ( count < static_cast(to_move) ) + { + this->uninitialized_copy(this->end() - count, this->end(), this->end()); // may throw + m_size += count; // update end + this->move_backward(position, position + to_move - count, this->end() - count); // may throw + std::fill_n(position, count, value); // may throw + } + else + { + std::uninitialized_fill(this->end(), position + count, value); // may throw + m_size += count - to_move; // update end + this->uninitialized_copy(position, position + to_move, position + count); // may throw + m_size += to_move; // update end + std::fill_n(position, to_move, value); // may throw + } + } + } + // basic void erase(iterator position) { diff --git a/test/static_vector.cpp b/test/static_vector.cpp index 7158f39f3..2a2b90ba1 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -373,6 +373,21 @@ void test_insert_nd(T const& v) for ( size_t i = 0 ; i < h ; ++i ) BOOST_CHECK(s1[i+h] == v); } + + { + size_t n = size_t(h/1.5f); + for ( size_t i = 0 ; i <= h ; ++i ) + { + static_vector s1(s); + s1.insert(s1.begin() + i, n, v); + for ( size_t j = 0 ; j < i ; ++j ) + BOOST_CHECK(s1[j] == T(j)); + for ( size_t j = 0 ; j < n ; ++j ) + BOOST_CHECK(s1[j+i] == v); + for ( size_t j = 0 ; j < h-i ; ++j ) + BOOST_CHECK(s1[j+i+n] == T(j+i)); + } + } } int test_main(int, char* []) From 57c75071f9a53057b206d18c5966227f749a9896 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 02:43:18 +0000 Subject: [PATCH 230/366] Added size() check to the insert test. [SVN r82009] --- test/static_vector.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/static_vector.cpp b/test/static_vector.cpp index 2a2b90ba1..838be61fb 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -380,6 +380,7 @@ void test_insert_nd(T const& v) { static_vector s1(s); s1.insert(s1.begin() + i, n, v); + BOOST_CHECK(s1.size() == h+n); for ( size_t j = 0 ; j < i ; ++j ) BOOST_CHECK(s1[j] == T(j)); for ( size_t j = 0 ; j < n ; ++j ) From 0ae51b1dbc5a85bf04afee91e45326e826bb41d3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 16:09:07 +0000 Subject: [PATCH 231/366] Implemented static_vector::insert(pos, first, last) for random access iterators. Tests added. [SVN r82024] --- .../extensions/index/static_vector.hpp | 69 +++++++++++++++- test/static_vector.cpp | 80 +++++++++++++------ 2 files changed, 123 insertions(+), 26 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 1861a259e..663d11842 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -179,6 +179,8 @@ public: } else { + // TODO - should following lines check for exception and revert to the old size? + this->uninitialized_fill(this->end(), *(this->end() - 1)); // may throw ++m_size; // update end this->move_backward(position, this->end() - 2, this->end() - 1); // may throw @@ -205,6 +207,8 @@ public: { difference_type to_move = std::distance(position, this->end()); + // TODO - should following lines check for exception and revert to the old size? + if ( count < static_cast(to_move) ) { this->uninitialized_copy(this->end() - count, this->end(), this->end()); // may throw @@ -223,6 +227,14 @@ public: } } + // basic + template + void insert(iterator position, Iterator first, Iterator last) + { + typedef typename boost::iterator_traversal::type traversal; + this->insert_dispatch(position, first, last, traversal()); + } + // basic void erase(iterator position) { @@ -257,7 +269,7 @@ public: void assign(Iterator first, Iterator last) { typedef typename boost::iterator_traversal::type traversal; - assign_dispatch(first, last, traversal()); // may throw + this->assign_dispatch(first, last, traversal()); // may throw } // basic @@ -370,10 +382,63 @@ public: private: + // insert + + template + void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&) + { + // TODO change name of this macro + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); + // TODO dist < distance(begin(), end()) + BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator"); + + difference_type count = std::distance(first, last); + + BOOST_ASSERT_MSG(m_size + count <= Capacity, "size can't exceed the capacity"); + //if ( Capacity < m_size + count ) throw std::bad_alloc(); + + if ( position == this->end() ) + { + this->uninitialized_copy(first, last, position); // may throw + m_size += count; // update end + } + else + { + difference_type to_move = std::distance(position, this->end()); + + // TODO - should following lines check for exception and revert to the old size? + + if ( count < to_move ) + { + this->uninitialized_copy(this->end() - count, this->end(), this->end()); // may throw + m_size += count; // update end + this->move_backward(position, position + to_move - count, this->end() - count); // may throw + this->copy(first, last, position); // may throw + } + else + { + this->uninitialized_copy(first + to_move, last, this->end()); // may throw + m_size += count - to_move; // update end + this->uninitialized_copy(position, position + to_move, position + count); // may throw + m_size += to_move; // update end + this->copy(first, first + to_move, position) ; // may throw + } + } + } + + template + void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/) + { + BOOST_MPL_ASSERT_MSG( + (false), + THIS_ITERATOR_IS_NOT_YET_SUPPORTED, + (static_vector)); + } + // assign template - void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const&) + void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const& /*not_random_access*/) { size_type s = std::distance(first, last); diff --git a/test/static_vector.cpp b/test/static_vector.cpp index 838be61fb..b2a519dc3 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -344,47 +344,79 @@ void test_erase_nd() } template -void test_insert_nd(T const& v) +void test_insert_nd(T const& val) { size_t h = N/2; - static_vector s; + static_vector s, ss; + std::vector v; + std::list l; for ( size_t i = 0 ; i < h ; ++i ) + { s.push_back(T(i)); - - { - static_vector s1(s); - for ( size_t i = 0 ; i < h ; ++i ) - s1.insert(s1.begin(), v); - BOOST_CHECK(s1.size() == 2*h); - for ( size_t i = 0 ; i < h ; ++i ) - BOOST_CHECK(s1[i] == v); - for ( size_t i = 0 ; i < h ; ++i ) - BOOST_CHECK(s1[i+h] == T(i)); - } - { - static_vector s1(s); - for ( size_t i = 0 ; i < h ; ++i ) - s1.insert(s1.end(), v); - BOOST_CHECK(s1.size() == 2*h); - for ( size_t i = 0 ; i < h ; ++i ) - BOOST_CHECK(s1[i] == T(i)); - for ( size_t i = 0 ; i < h ; ++i ) - BOOST_CHECK(s1[i+h] == v); + ss.push_back(T(100 + i)); + v.push_back(T(100 + i)); + l.push_back(T(100 + i)); } + // insert(pos, val) + { + for ( size_t i = 0 ; i <= h ; ++i ) + { + static_vector s1(s); + s1.insert(s1.begin() + i, val); + BOOST_CHECK(s1.size() == h+1); + for ( size_t j = 0 ; j < i ; ++j ) + BOOST_CHECK(s1[j] == T(j)); + BOOST_CHECK(s1[i] == val); + for ( size_t j = 0 ; j < h-i ; ++j ) + BOOST_CHECK(s1[j+i+1] == T(j+i)); + } + } + // insert(pos, n, val) { size_t n = size_t(h/1.5f); for ( size_t i = 0 ; i <= h ; ++i ) { static_vector s1(s); - s1.insert(s1.begin() + i, n, v); + s1.insert(s1.begin() + i, n, val); BOOST_CHECK(s1.size() == h+n); for ( size_t j = 0 ; j < i ; ++j ) BOOST_CHECK(s1[j] == T(j)); for ( size_t j = 0 ; j < n ; ++j ) - BOOST_CHECK(s1[j+i] == v); + BOOST_CHECK(s1[j+i] == val); + for ( size_t j = 0 ; j < h-i ; ++j ) + BOOST_CHECK(s1[j+i+n] == T(j+i)); + } + } + // insert(pos, first, last) + { + size_t n = size_t(h/1.5f); + for ( size_t i = 0 ; i <= h ; ++i ) + { + static_vector s1(s); + s1.insert(s1.begin() + i, ss.begin(), ss.begin() + n); + BOOST_CHECK(s1.size() == h+n); + for ( size_t j = 0 ; j < i ; ++j ) + BOOST_CHECK(s1[j] == T(j)); + for ( size_t j = 0 ; j < n ; ++j ) + BOOST_CHECK(s1[j+i] == T(100 + j)); + for ( size_t j = 0 ; j < h-i ; ++j ) + BOOST_CHECK(s1[j+i+n] == T(j+i)); + } + } + { + size_t n = size_t(h/1.5f); + for ( size_t i = 0 ; i <= h ; ++i ) + { + static_vector s1(s); + s1.insert(s1.begin() + i, v.begin(), v.begin() + n); + BOOST_CHECK(s1.size() == h+n); + for ( size_t j = 0 ; j < i ; ++j ) + BOOST_CHECK(s1[j] == T(j)); + for ( size_t j = 0 ; j < n ; ++j ) + BOOST_CHECK(s1[j+i] == T(100 + j)); for ( size_t j = 0 ; j < h-i ; ++j ) BOOST_CHECK(s1[j+i+n] == T(j+i)); } From 7e6f3b197ede32e4dc43e18a1304b52b0fe73500 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 16:13:35 +0000 Subject: [PATCH 232/366] static_vector: assertion moved. [SVN r82025] --- include/boost/geometry/extensions/index/static_vector.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 663d11842..311f7989c 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -114,6 +114,7 @@ public: { BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); //if ( Capacity <= count ) throw std::bad_alloc(); + this->construct(this->end(), this->begin() + count); // may throw } m_size = count; // update end @@ -130,6 +131,7 @@ public: { BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); //if ( Capacity <= count ) throw std::bad_alloc(); + std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw } m_size = count; // update end @@ -147,6 +149,7 @@ public: { BOOST_ASSERT_MSG(m_size < Capacity, "size can't exceed the capacity"); //if ( Capacity <= m_size ) throw std::bad_alloc(); + this->uninitialized_fill(this->end(), value); // may throw ++m_size; // update end } @@ -282,9 +285,10 @@ public: } else { - std::fill_n(this->begin(), m_size, value); BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); //if ( Capacity <= count ) throw std::bad_alloc(); + + std::fill_n(this->begin(), m_size, value); std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw } m_size = count; // update end From 32fbcf66ed7bb4d02e9ffffdc1f86f0fd016a0f9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 18:31:03 +0000 Subject: [PATCH 233/366] Added statid_vector::insert(pos, first, last) for non random access iterators. Added uninitialized_copy_checked() helper method. Added tests. [SVN r82027] --- .../extensions/index/static_vector.hpp | 107 +++++++++++++----- test/static_vector.cpp | 17 +++ 2 files changed, 95 insertions(+), 29 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 311f7989c..ec7ebafbf 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -408,35 +408,64 @@ private: } else { - difference_type to_move = std::distance(position, this->end()); - - // TODO - should following lines check for exception and revert to the old size? - - if ( count < to_move ) - { - this->uninitialized_copy(this->end() - count, this->end(), this->end()); // may throw - m_size += count; // update end - this->move_backward(position, position + to_move - count, this->end() - count); // may throw - this->copy(first, last, position); // may throw - } - else - { - this->uninitialized_copy(first + to_move, last, this->end()); // may throw - m_size += count - to_move; // update end - this->uninitialized_copy(position, position + to_move, position + count); // may throw - m_size += to_move; // update end - this->copy(first, first + to_move, position) ; // may throw - } + this->insert_in_the_middle(position, first, last, count); // may throw } } template void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/) { - BOOST_MPL_ASSERT_MSG( - (false), - THIS_ITERATOR_IS_NOT_YET_SUPPORTED, - (static_vector)); + // TODO change name of this macro + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); + // TODO dist < distance(begin(), end()) + BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator"); + + if ( position == this->end() ) + { + std::pair copy_data = + this->uninitialized_copy_checked(first, last, position, std::distance(position, this->begin() + Capacity)); // may throw + + BOOST_ASSERT_MSG(copy_data.first, "size can't exceed the capacity"); + // eventually throw bad_alloc + + m_size += copy_data.second; + } + else + { + difference_type count = std::distance(first, last); + + BOOST_ASSERT_MSG(m_size + count <= Capacity, "size can't exceed the capacity"); + //if ( Capacity < m_size + count ) throw std::bad_alloc(); + + this->insert_in_the_middle(position, first, last, count); // may throw + } + } + + template + void insert_in_the_middle(iterator position, Iterator first, Iterator last, difference_type count) + { + difference_type to_move = std::distance(position, this->end()); + + // TODO - should following lines check for exception and revert to the old size? + + if ( count < to_move ) + { + this->uninitialized_copy(this->end() - count, this->end(), this->end()); // may throw + m_size += count; // update end + this->move_backward(position, position + to_move - count, this->end() - count); // may throw + this->copy(first, last, position); // may throw + } + else + { + Iterator middle_iter = first; + std::advance(middle_iter, to_move); + + this->uninitialized_copy(middle_iter, last, this->end()); // may throw + m_size += count - to_move; // update end + this->uninitialized_copy(position, position + to_move, position + count); // may throw + m_size += to_move; // update end + this->copy(first, middle_iter, position) ; // may throw + } } // assign @@ -452,6 +481,7 @@ private: if ( m_size <= s ) { this->copy(first, first + m_size, this->begin()); // may throw + // TODO - perform uninitialized_copy first? this->uninitialized_copy(first + m_size, last, this->end()); // may throw } else @@ -465,7 +495,7 @@ private: template void assign_dispatch(Iterator first, Iterator last, Traversal const& /*not_random_access*/) { - size_t s = 0; + size_type s = 0; iterator it = this->begin(); for ( ; it != this->end() && first != last ; ++it, ++first, ++s ) @@ -473,20 +503,39 @@ private: this->destroy(it, this->end()); + std::pair copy_data = + this->uninitialized_copy_checked(first, last, it, std::distance(it, this->begin() + Capacity)); // may throw + s += copy_data.second; + + BOOST_ASSERT_MSG(copy_data.first, "size can't exceed the capacity"); + // eventually throw bad_alloc + + m_size = s; // update end + } + + // uninitialized_copy_checked + + template + std::pair uninitialized_copy_checked(Iterator first, Iterator last, iterator dest, size_type max_count) + { + size_type count = 0; + iterator it = dest; try { - for ( ; first != last ; ++it, ++first, ++s ) + for ( ; first != last ; ++it, ++first, ++count ) { - BOOST_ASSERT_MSG(s < Capacity, "size can't exceed the capacity"); - this->uninitialized_fill(it, *first); // may throw + if ( max_count <= count ) + return std::make_pair(false, count); + + this->uninitialized_fill(it, *first); // may throw } - m_size = s; // update end } catch(...) { - this->destroy(this->begin() + m_size, it); + this->destroy(dest, it); throw; } + return std::make_pair(true, count); } // copy diff --git a/test/static_vector.cpp b/test/static_vector.cpp index b2a519dc3..bc97dda9f 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -421,6 +421,23 @@ void test_insert_nd(T const& val) BOOST_CHECK(s1[j+i+n] == T(j+i)); } } + { + size_t n = size_t(h/1.5f); + for ( size_t i = 0 ; i <= h ; ++i ) + { + static_vector s1(s); + std::list::iterator it = l.begin(); + std::advance(it, n); + s1.insert(s1.begin() + i, l.begin(), it); + BOOST_CHECK(s1.size() == h+n); + for ( size_t j = 0 ; j < i ; ++j ) + BOOST_CHECK(s1[j] == T(j)); + for ( size_t j = 0 ; j < n ; ++j ) + BOOST_CHECK(s1[j+i] == T(100 + j)); + for ( size_t j = 0 ; j < h-i ; ++j ) + BOOST_CHECK(s1[j+i+n] == T(j+i)); + } + } } int test_main(int, char* []) From 24f349839fac72b1368ecd5d7ca7f2ef2ea8055b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 18:45:23 +0000 Subject: [PATCH 234/366] Added templated versions of static_vector copy ctor and assignment. GCC compile error fixed in test. [SVN r82028] --- .../extensions/index/static_vector.hpp | 19 ++++++++++++++++++- test/static_vector.cpp | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index ec7ebafbf..706e240ef 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -75,7 +75,15 @@ public: static_vector(static_vector const& other) : m_size(other.m_size) { - //BOOST_ASSERT_MSG(other.m_size <= Capacity, "size can't exceed the capacity"); + this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw + } + + // strong + template + static_vector(static_vector const& other) + : m_size(other.m_size) + { + BOOST_ASSERT_MSG(other.m_size <= Capacity, "size can't exceed the capacity"); //if ( Capacity <= other.m_size ) throw std::bad_alloc(); this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw @@ -97,6 +105,15 @@ public: return *this; } + // basic + template + static_vector & operator=(static_vector const& other) + { + assign(other.begin(), other.end()); // may throw + + return *this; + } + // nothrow ~static_vector() { diff --git a/test/static_vector.cpp b/test/static_vector.cpp index bc97dda9f..b45ed1a03 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -426,7 +426,7 @@ void test_insert_nd(T const& val) for ( size_t i = 0 ; i <= h ; ++i ) { static_vector s1(s); - std::list::iterator it = l.begin(); + typename std::list::iterator it = l.begin(); std::advance(it, n); s1.insert(s1.begin() + i, l.begin(), it); BOOST_CHECK(s1.size() == h+n); From f43d94fa2932c5ecb5e4f783f2ecb854829e991a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 19:09:10 +0000 Subject: [PATCH 235/366] asserts/checks closed in separate functions: check_capacity() check_empty() check_iterator_end_eq() check_iterator_end_neq() [SVN r82030] --- .../extensions/index/static_vector.hpp | 137 ++++++++++-------- 1 file changed, 74 insertions(+), 63 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 706e240ef..469794e7e 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -83,9 +83,8 @@ public: static_vector(static_vector const& other) : m_size(other.m_size) { - BOOST_ASSERT_MSG(other.m_size <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= other.m_size ) throw std::bad_alloc(); - + check_capacity(other.m_size); + this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw } @@ -129,8 +128,7 @@ public: } else { - BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= count ) throw std::bad_alloc(); + check_capacity(count); this->construct(this->end(), this->begin() + count); // may throw } @@ -146,9 +144,8 @@ public: } else { - BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= count ) throw std::bad_alloc(); - + check_capacity(count); + std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw } m_size = count; // update end @@ -157,16 +154,14 @@ public: // nothrow void reserve(size_type BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(count)) { - BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= count ) throw std::bad_alloc(); + check_capacity(count); } // strong void push_back(value_type const& value) { - BOOST_ASSERT_MSG(m_size < Capacity, "size can't exceed the capacity"); - //if ( Capacity <= m_size ) throw std::bad_alloc(); - + check_capacity(m_size + 1); + this->uninitialized_fill(this->end(), value); // may throw ++m_size; // update end } @@ -174,9 +169,11 @@ public: // nothrow void pop_back() { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + check_empty(); + //--m_size; // update end //this->destroy(this->end()); + // safer and more intuitive version this->destroy(this->end() - 1); --m_size; // update end @@ -185,12 +182,8 @@ public: // basic void insert(iterator position, value_type const& value) { - // TODO change name of this macro - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); - BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator"); - - BOOST_ASSERT_MSG(m_size < Capacity, "size can't exceed the capacity"); - //if ( Capacity <= m_size ) throw std::bad_alloc(); + check_iterator_end_eq(position); + check_capacity(m_size + 1); if ( position == this->end() ) { @@ -211,12 +204,8 @@ public: // basic void insert(iterator position, size_type count, value_type const& value) { - // TODO change name of this macro - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); - BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator"); - - BOOST_ASSERT_MSG(m_size + count <= Capacity, "size can't exceed the capacity"); - //if ( Capacity < m_size + count ) throw std::bad_alloc(); + check_iterator_end_eq(position); + check_capacity(m_size + count); if ( position == this->end() ) { @@ -258,9 +247,7 @@ public: // basic void erase(iterator position) { - // TODO change name of this macro - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); - BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)distmove(position + 1, this->end(), position); // may throw this->destroy(this->end() - 1); @@ -270,14 +257,11 @@ public: // basic void erase(iterator first, iterator last) { - // TODO change name of this macro - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type distf = std::distance(this->begin(), first)); - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type distl = std::distance(this->begin(), last)); - BOOST_ASSERT_MSG(0 <= distf && (sizeof(distf)<=sizeof(m_size)?((size_type)distfmove(last, this->end(), first); // may throw this->destroy(this->end() - n, this->end()); @@ -302,8 +286,7 @@ public: } else { - BOOST_ASSERT_MSG(count <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= count ) throw std::bad_alloc(); + check_capacity(count); std::fill_n(this->begin(), m_size, value); std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw @@ -322,7 +305,7 @@ public: Value & at(size_type i) { if ( m_size <= i ) - throw std::out_of_range("static_vector element index out of bounds"); + throw std::out_of_range("index out of bounds"); return *(this->begin() + i); } @@ -330,7 +313,7 @@ public: Value const& at(size_type i) const { if ( m_size <= i ) - throw std::out_of_range("static_vector element index out of bounds"); + throw std::out_of_range("index out of bounds"); return *(this->begin() + i); } @@ -351,28 +334,28 @@ public: // nothrow Value & front() { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + check_empty(); return *(this->begin()); } // nothrow Value const& front() const { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + check_empty(); return *(this->begin()); } // nothrow Value & back() { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + check_empty(); return *(this->end() - 1); } // nothrow Value const& back() const { - BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + check_empty(); return *(this->end() - 1); } @@ -408,15 +391,11 @@ private: template void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&) { - // TODO change name of this macro - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); - // TODO dist < distance(begin(), end()) - BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator"); - + check_iterator_end_eq(position); + difference_type count = std::distance(first, last); - BOOST_ASSERT_MSG(m_size + count <= Capacity, "size can't exceed the capacity"); - //if ( Capacity < m_size + count ) throw std::bad_alloc(); + check_capacity(m_size + count); if ( position == this->end() ) { @@ -432,18 +411,14 @@ private: template void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/) { - // TODO change name of this macro - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position)); - // TODO dist < distance(begin(), end()) - BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator"); + check_iterator_end_eq(position); if ( position == this->end() ) { std::pair copy_data = this->uninitialized_copy_checked(first, last, position, std::distance(position, this->begin() + Capacity)); // may throw - BOOST_ASSERT_MSG(copy_data.first, "size can't exceed the capacity"); - // eventually throw bad_alloc + check_capacity(copy_data.first ? m_size + copy_data.second : Capacity + 1); m_size += copy_data.second; } @@ -451,8 +426,7 @@ private: { difference_type count = std::distance(first, last); - BOOST_ASSERT_MSG(m_size + count <= Capacity, "size can't exceed the capacity"); - //if ( Capacity < m_size + count ) throw std::bad_alloc(); + check_capacity(m_size + count); this->insert_in_the_middle(position, first, last, count); // may throw } @@ -492,8 +466,7 @@ private: { size_type s = std::distance(first, last); - BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); - //if ( Capacity <= m_size ) throw std::bad_alloc(); + check_capacity(s); if ( m_size <= s ) { @@ -524,8 +497,7 @@ private: this->uninitialized_copy_checked(first, last, it, std::distance(it, this->begin() + Capacity)); // may throw s += copy_data.second; - BOOST_ASSERT_MSG(copy_data.first, "size can't exceed the capacity"); - // eventually throw bad_alloc + check_capacity(copy_data.first ? s : Capacity + 1); m_size = s; // update end } @@ -771,6 +743,45 @@ private: } } + void check_capacity(size_type s) + { + BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); + //if ( Capacity < s ) throw std::bad_alloc(); + } + + void check_empty() + { + BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); + } + + void check_iterator_end_neq(iterator position) + { + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM( + difference_type dist = std::distance(this->begin(), position); + ) + BOOST_ASSERT_MSG( + 0 <= dist && + ( sizeof(dist) <= sizeof(m_size) ? + (static_cast(dist) < m_size) : + ( dist < static_cast(m_size)) + ), "invalid iterator" + ); + } + + void check_iterator_end_eq(iterator position) + { + BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM( + difference_type dist = std::distance(this->begin(), position); + ) + BOOST_ASSERT_MSG( + 0 <= dist && + ( sizeof(dist) <= sizeof(m_size) ? + (static_cast(dist) <= m_size) : + ( dist <= static_cast(m_size)) + ), "invalid iterator" + ); + } + Value * ptr() { return (reinterpret_cast(m_storage.address())); From d96e31bb1bb01a9f8825df0698eac80b7817eb47 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 19:11:26 +0000 Subject: [PATCH 236/366] Compilation error fixed. [SVN r82031] --- include/boost/geometry/extensions/index/static_vector.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 469794e7e..2721fd684 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -152,7 +152,7 @@ public: } // nothrow - void reserve(size_type BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(count)) + void reserve(size_type count) { check_capacity(count); } From c51fbe50b912a66df77e29d976f6d3675f8d9aef Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 19:34:51 +0000 Subject: [PATCH 237/366] Iterators check changed in erase(f, l). Tests upgraded. [SVN r82032] --- .../extensions/index/static_vector.hpp | 20 +++++--- test/static_vector.cpp | 50 ++++++++----------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 2721fd684..1d7d74456 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -257,8 +257,8 @@ public: // basic void erase(iterator first, iterator last) { - check_iterator_end_neq(first); - check_iterator_end_neq(last); + check_iterator_end_eq(first); + check_iterator_end_eq(last); difference_type n = std::distance(first, last); BOOST_ASSERT_MSG(0 <= n, "invalid range"); @@ -754,9 +754,11 @@ private: BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); } - void check_iterator_end_neq(iterator position) + void check_iterator_end_neq(const_iterator position) { - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM( + BOOST_ASSERT_MSG(this->begin() <= position && position < this->end(), "iterator out of bounds"); + + /*BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM( difference_type dist = std::distance(this->begin(), position); ) BOOST_ASSERT_MSG( @@ -765,12 +767,14 @@ private: (static_cast(dist) < m_size) : ( dist < static_cast(m_size)) ), "invalid iterator" - ); + );*/ } - void check_iterator_end_eq(iterator position) + void check_iterator_end_eq(const_iterator position) { - BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM( + BOOST_ASSERT_MSG(this->begin() <= position && position <= this->end(), "iterator out of bounds"); + + /*BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM( difference_type dist = std::distance(this->begin(), position); ) BOOST_ASSERT_MSG( @@ -779,7 +783,7 @@ private: (static_cast(dist) <= m_size) : ( dist <= static_cast(m_size)) ), "invalid iterator" - ); + );*/ } Value * ptr() diff --git a/test/static_vector.cpp b/test/static_vector.cpp index b45ed1a03..9dca95562 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -307,39 +307,33 @@ void test_erase_nd() for ( size_t i = 0 ; i < N ; ++i ) s.push_back(T(i)); + // erase(pos) { - static_vector s1(s); - - for ( size_t i = 1 ; i < N ; ++i ) + for ( size_t i = 0 ; i < N ; ++i ) { - BOOST_CHECK(s1.front() == T(i-1)); - s1.erase(s1.begin()); - BOOST_CHECK(s1.front() == T(i)); - } - BOOST_CHECK(s1.size() == 1); + static_vector s1(s); + s1.erase(s1.begin() + i); + BOOST_CHECK(s1.size() == N - 1); + for ( size_t j = 0 ; j < i ; ++j ) + BOOST_CHECK(s1[j] == T(j)); + for ( size_t j = i+1 ; j < N ; ++j ) + BOOST_CHECK(s1[j-1] == T(j)); + } } - + // erase(first, last) { - static_vector s1(s); - - for ( size_t i = N ; i > 1 ; --i ) + size_t n = N/3; + for ( size_t i = 0 ; i <= N ; ++i ) { - BOOST_CHECK(s1.back() == T(i-1)); - s1.erase(s1.end() - 1); - BOOST_CHECK(s1.back() == T(i-2)); - } - BOOST_CHECK(s1.size() == 1); - } - - { - static_vector s1(s); - - for ( size_t i = 1 ; i < N - 2 ; i += 3 ) - { - BOOST_CHECK(s1.front() == T(i-1)); - s1.erase(s1.begin(), s1.begin() + 3); - BOOST_CHECK(s1.front() == T(i+2)); - } + static_vector s1(s); + size_t removed = i + n < N ? n : N - i; + s1.erase(s1.begin() + i, s1.begin() + i + removed); + BOOST_CHECK(s1.size() == N - removed); + for ( size_t j = 0 ; j < i ; ++j ) + BOOST_CHECK(s1[j] == T(j)); + for ( size_t j = i+n ; j < N ; ++j ) + BOOST_CHECK(s1[j-n] == T(j)); + } } } From b8e533f7bec752ba09809072964e2d44c96ced32 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 16 Dec 2012 22:00:22 +0000 Subject: [PATCH 238/366] static_vector size_t changed to std::size_t. [SVN r82035] --- .../boost/geometry/extensions/index/static_vector.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 1d7d74456..71994f5d4 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -6,6 +6,10 @@ // 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_STATIC_VECTOR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP + +#include #include #include @@ -26,9 +30,6 @@ #include -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP - namespace boost { namespace geometry { namespace index { template @@ -41,7 +42,7 @@ class static_vector public: typedef Value value_type; - typedef size_t size_type; + typedef std::size_t size_type; typedef Value& reference; typedef Value const& const_reference; typedef Value * pointer; From 95f6cf84422836f935644547dcacbafba93094bf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 17 Dec 2012 15:43:27 +0000 Subject: [PATCH 239/366] Some compilation errors corrected in local index::static_vector. [SVN r82048] --- include/boost/geometry/extensions/index/static_vector.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/static_vector.hpp index 71994f5d4..bba47ae1b 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/static_vector.hpp @@ -744,18 +744,18 @@ private: } } - void check_capacity(size_type s) + void check_capacity(size_type s) const { BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); //if ( Capacity < s ) throw std::bad_alloc(); } - void check_empty() + void check_empty() const { BOOST_ASSERT_MSG(0 < m_size, "the container is empty"); } - void check_iterator_end_neq(const_iterator position) + void check_iterator_end_neq(const_iterator position) const { BOOST_ASSERT_MSG(this->begin() <= position && position < this->end(), "iterator out of bounds"); @@ -771,7 +771,7 @@ private: );*/ } - void check_iterator_end_eq(const_iterator position) + void check_iterator_end_eq(const_iterator position) const { BOOST_ASSERT_MSG(this->begin() <= position && position <= this->end(), "iterator out of bounds"); From c8a643a9d7edada87afbc4b1535e7088920ea69d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 18 Dec 2012 13:52:22 +0000 Subject: [PATCH 240/366] Rtree static parameters methods changed to static. [SVN r82079] --- .../geometry/extensions/index/rtree/options.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 0893f65c9..9fdded50c 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -56,8 +56,8 @@ struct linear static const size_t max_elements = MaxElements; static const size_t min_elements = MinElements; - size_t get_max_elements() const { return max_elements; } - size_t get_min_elements() const { return min_elements; } + static size_t get_max_elements() { return MaxElements; } + static size_t get_min_elements() { return MinElements; } }; /*! @@ -72,8 +72,8 @@ struct quadratic static const size_t max_elements = MaxElements; static const size_t min_elements = MinElements; - size_t get_max_elements() const { return max_elements; } - size_t get_min_elements() const { return min_elements; } + static size_t get_max_elements() { return MaxElements; } + static size_t get_min_elements() { return MinElements; } }; namespace options { namespace detail { @@ -108,10 +108,10 @@ struct rstar static const size_t overlap_cost_threshold = OverlapCostThreshold; static const size_t reinserted_elements = ReinsertedElements; - size_t get_max_elements() const { return max_elements; } - size_t get_min_elements() const { return min_elements; } - size_t get_overlap_cost_threshold() const { return overlap_cost_threshold; } - size_t get_reinserted_elements() const { return reinserted_elements; } + static size_t get_max_elements() { return MaxElements; } + static size_t get_min_elements() { return MinElements; } + static size_t get_overlap_cost_threshold() { return OverlapCostThreshold; } + static size_t get_reinserted_elements() { return ReinsertedElements; } }; namespace runtime { From 379166e1f77c00a135ded5ed5ca20337f13fee07 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 30 Dec 2012 01:43:36 +0000 Subject: [PATCH 241/366] Updated info about the R-tree exception safety. [SVN r82281] --- .../r_tree/exception_safety.html | 19 ++++++++++++------- doc/html/index.html | 2 +- doc/rtree/exception_safety.qbk | 13 +++++++------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 43b4b8476..62cfa5669 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -184,7 +184,7 @@

    - basic + not safe [b]

    - basic + not safe

    - basic + not safe

    - basic + not safe

    - basic + not safe

    - basic + not safe

    nothrow or strong - [b] + [c]

    - +

    Last revised: December 14, 2012 at 19:21:38 GMT

    Last revised: December 30, 2012 at 01:43:03 GMT


    diff --git a/doc/rtree/exception_safety.qbk b/doc/rtree/exception_safety.qbk index 7d74ec85a..8f1dbb6af 100644 --- a/doc/rtree/exception_safety.qbk +++ b/doc/rtree/exception_safety.qbk @@ -31,12 +31,13 @@ In order to be exception-safe the __rtree__ requires: [footnote /nothrow/ - if allocators are equal, *strong* - otherwise]]] [[`swap(rtree &)`] [ /nothrow/ ]] [[][]] -[[`insert(__value__)`] [ basic ]] -[[`insert(Iterator, Iterator)`][ basic ]] -[[`insert(Range)`] [ basic ]] -[[`remove(__value__)`] [ basic ]] -[[`remove(Iterator, Iterator)`][ basic ]] -[[`remove(Range)`] [ basic ]] +[[`insert(__value__)`] [ not safe +[footnote If this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.]]] +[[`insert(Iterator, Iterator)`][ not safe ]] +[[`insert(Range)`] [ not safe ]] +[[`remove(__value__)`] [ not safe ]] +[[`remove(Iterator, Iterator)`][ not safe ]] +[[`remove(Range)`] [ not safe ]] [[`clear()`] [ /nothrow/ ]] [[][]] [[`spatial_query(...)`] [ *strong* ]] From 31d95f9ac44cddc5370dab3b4e08ec3428fa933d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 4 Jan 2013 17:38:18 +0000 Subject: [PATCH 242/366] Added number of removed elements returned by rtree::remove(). [SVN r82353] --- .../geometry/extensions/index/rtree/rtree.hpp | 47 ++++++++---- .../index/rtree/visitors/remove.hpp | 6 +- test/rtree/test_rtree.hpp | 76 +++++++++++++++---- 3 files changed, 102 insertions(+), 27 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 142db8bcf..69c62db25 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -373,10 +373,12 @@ public: \note Exception-safety: basic \param value The value which will be removed from the container. + + \return 1 if the value was removed, 0 otherwise. */ - inline void remove(value_type const& value) + inline size_type remove(value_type const& value) { - this->raw_remove(value); + return this->raw_remove(value); } /*! @@ -386,12 +388,16 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. + + \return The number of removed values. */ template - inline void remove(Iterator first, Iterator last) + inline size_type remove(Iterator first, Iterator last) { + size_type result = 0; for ( ; first != last ; ++first ) - this->raw_remove(*first); + result += this->raw_remove(*first); + return result; } /*! @@ -400,13 +406,17 @@ public: \note Exception-safety: basic \param rng The range of values. + + \return The number of removed values. */ template - inline void remove(Range const& rng) + inline size_type remove(Range const& rng) { + size_type result = 0; typedef typename boost::range_const_iterator::type It; for ( It it = boost::const_begin(rng); it != boost::const_end(rng) ; ++it ) - this->raw_remove(*it); + result += this->raw_remove(*it); + return result; } /*! @@ -787,7 +797,7 @@ private: \param value The value which will be removed from the container. */ - inline void raw_remove(value_type const& value) + inline size_type raw_remove(value_type const& value) { // TODO: awulkiew - assert for correct value (indexable) ? BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); @@ -806,6 +816,8 @@ private: // TODO // If exception is thrown, m_values_count may be invalid --m_values_count; + + return remove_v.is_value_removed() ? 1 : 0; } /*! @@ -1005,11 +1017,14 @@ Remove a value from the index. \param tree The spatial index. \param v The value which will be removed from the index. + +\return 1 if value was removed, 0 otherwise. */ template -inline void remove(rtree & tree, Value const& v) +inline typename rtree::size_type +remove(rtree & tree, Value const& v) { - tree.remove(v); + return tree.remove(v); } /*! @@ -1018,11 +1033,14 @@ Remove a range of values from the index. \param tree The spatial index. \param first The beginning of the range of values. \param last The end of the range of values. + +\return The number of removed values. */ template -inline void remove(rtree & tree, Iterator first, Iterator last) +inline typename rtree::size_type +remove(rtree & tree, Iterator first, Iterator last) { - tree.remove(first, last); + return tree.remove(first, last); } /*! @@ -1030,11 +1048,14 @@ Remove a range of values from the index. \param tree The spatial index. \param rng The range of values. + +\return The number of removed values. */ template -inline void remove(rtree & tree, Range const& rng) +inline typename rtree::size_type +remove(rtree & tree, Range const& rng) { - tree.remove(rng); + return tree.remove(rng); } /*! diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index 2f344a922..a11837c19 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -109,7 +109,6 @@ public: else { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); - BOOST_GEOMETRY_INDEX_ASSERT(m_is_value_removed, "value not found"); // reinsert elements from removed nodes (underflows) reinsert_removed_nodes_elements(); // MAY THROW (V, E: alloc, copy, N: alloc) @@ -159,6 +158,11 @@ public: } } + bool is_value_removed() const + { + return m_is_value_removed; + } + private: typedef std::vector< std::pair > UnderflowNodes; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 07c9bc37e..0593c76c1 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -446,6 +446,42 @@ struct generate_input<3> } }; +// generate_value_outside + +template +struct generate_value_outside_impl +{}; + +template +struct generate_value_outside_impl +{ + static Value apply() + { + //TODO - for size > 1 in generate_input<> this won't be outside + return generate_value::apply(13, 26); + } +}; + +template +struct generate_value_outside_impl +{ + static Value apply() + { + //TODO - for size > 1 in generate_input<> this won't be outside + return generate_value::apply(13, 26, 13); + } +}; + +template +inline typename Rtree::value_type +generate_value_outside() +{ + typedef typename Rtree::value_type V; + typedef typename Rtree::indexable_type I; + + return generate_value_outside_impl::value>::apply(); +} + template void generate_rtree(bgi::rtree & tree, std::vector & input, Box & qbox) { @@ -1006,56 +1042,69 @@ void test_remove(bgi::rtree & tree, std::vector const& input std::vector expected_output; tree.spatial_query(bgi::disjoint(qbox), std::back_inserter(expected_output)); + size_t expected_removed_count = values_to_remove.size(); + // Add value which is not stored in the Rtree + Value outsider = generate_value_outside(); + values_to_remove.push_back(outsider); + { T t(tree); + size_t r = 0; BOOST_FOREACH(Value const& v, values_to_remove) - t.remove(v); + r += t.remove(v); + BOOST_CHECK( r == expected_removed_count ); std::vector output; t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); - BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); } { T t(tree); - t.remove(values_to_remove.begin(), values_to_remove.end()); + size_t r = t.remove(values_to_remove.begin(), values_to_remove.end()); + BOOST_CHECK( r == expected_removed_count ); std::vector output; t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); - BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); } { T t(tree); - t.remove(values_to_remove); + size_t r = t.remove(values_to_remove); + BOOST_CHECK( r == expected_removed_count ); std::vector output; t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); - BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); } { T t(tree); + size_t r = 0; BOOST_FOREACH(Value const& v, values_to_remove) - bgi::remove(t, v); + r += bgi::remove(t, v); + BOOST_CHECK( r == expected_removed_count ); std::vector output; bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); - BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); } { T t(tree); - bgi::remove(t, values_to_remove.begin(), values_to_remove.end()); + size_t r = bgi::remove(t, values_to_remove.begin(), values_to_remove.end()); + BOOST_CHECK( r == expected_removed_count ); std::vector output; bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); - BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); } { T t(tree); - bgi::remove(t, values_to_remove); + size_t r = bgi::remove(t, values_to_remove); + BOOST_CHECK( r == expected_removed_count ); std::vector output; bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); - BOOST_CHECK( output.size() == tree.size() - values_to_remove.size() ); + BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); } } @@ -1222,9 +1271,10 @@ void test_count_rtree_values(Parameters const& parameters) BOOST_FOREACH(Value const& v, values_to_remove) { - t.remove(v); + size_t r = t.remove(v); --values_count; + BOOST_CHECK(1 == r); BOOST_CHECK(Value::counter() == values_count); BOOST_CHECK(t.size() + rest_count == values_count); } From 8364fd5adb1a2a137da69ef6d533c80ff04b47c0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 4 Jan 2013 17:56:17 +0000 Subject: [PATCH 243/366] remove() description improved. [SVN r82354] --- .../geometry/extensions/index/rtree/rtree.hpp | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 69c62db25..0778aa1c0 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -368,7 +368,8 @@ public: } /*! - Remove a value from the container. + Remove a value from the container. In contrast to the STL set/map erase() method + this method removes only one value from the container. \note Exception-safety: basic @@ -382,7 +383,10 @@ public: } /*! - Remove a range of values from the container. + Remove a range of values from the container. In contrast to the STL set/map erase() method + it doesn't take iterators pointing to values stored in this container. It removes values equal + to these passed as a range. Furthermore this method removes only one value for each one passed + in the range, not all equal values. \note Exception-safety: basic @@ -401,7 +405,9 @@ public: } /*! - Remove a range of values from the container. + Remove a range of values from the container. In contrast to the STL set/map erase() method + it removes values equal to these passed as a range. Furthermore, this method removes only + one value for each one passed in the range, not all equal values. \note Exception-safety: basic @@ -1013,7 +1019,8 @@ inline void insert(rtree & tree, Range co } /*! -Remove a value from the index. +Remove a value from the container. In contrast to the STL set/map erase() method +this function removes only one value from the container. \param tree The spatial index. \param v The value which will be removed from the index. @@ -1028,7 +1035,10 @@ remove(rtree & tree, Value const& v) } /*! -Remove a range of values from the index. +Remove a range of values from the container. In contrast to the STL set/map erase() method +it doesn't take iterators pointing to values stored in this container. It removes values equal +to these passed as a range. Furthermore this function removes only one value for each one passed +in the range, not all equal values. \param tree The spatial index. \param first The beginning of the range of values. @@ -1044,7 +1054,9 @@ remove(rtree & tree, Iterator first, Iter } /*! -Remove a range of values from the index. +Remove a range of values from the container. In contrast to the STL set/map erase() method +it removes values equal to these passed as a range. Furthermore this method removes only +one value for each one passed in the range, not all equal values. \param tree The spatial index. \param rng The range of values. From dcd4550b4df8cf3e5251af18983974cda37d6825 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 4 Jan 2013 18:13:08 +0000 Subject: [PATCH 244/366] Updated exception-safety description in sources. [SVN r82355] --- .../geometry/extensions/index/rtree/rtree.hpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 0778aa1c0..201c7dcad 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -319,7 +319,8 @@ public: /*! Insert a value to the index. - \note Exception-safety: basic + \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param value The value which will be stored in the container. */ @@ -334,7 +335,8 @@ public: /*! Insert a range of values to the index. - \note Exception-safety: basic + \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param first The beginning of the range of values. \param last The end of the range of values. @@ -352,7 +354,8 @@ public: /*! Insert a range of values to the index. - \note Exception-safety: basic + \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param rng The range of values. */ @@ -371,7 +374,8 @@ public: Remove a value from the container. In contrast to the STL set/map erase() method this method removes only one value from the container. - \note Exception-safety: basic + \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param value The value which will be removed from the container. @@ -388,7 +392,8 @@ public: to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. - \note Exception-safety: basic + \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param first The beginning of the range of values. \param last The end of the range of values. @@ -409,7 +414,8 @@ public: it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values. - \note Exception-safety: basic + \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param rng The range of values. @@ -639,7 +645,8 @@ public: Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned. - \note Exception-safety: nothrow. + \note Exception-safety: nothrow (if Indexable's CoordinateType copy assignment doesn't throw), + strong (if Indexable's CoordinateType copy assignment throws). \return The box containing all values stored in the container or an invalid box if there are no values in the container. From a8b63e76174a05e614006bec3bfeee35246b4c6d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 4 Jan 2013 20:40:36 +0000 Subject: [PATCH 245/366] Added rtree autodoc reference. [SVN r82359] --- doc/Jamfile.v2 | 57 +- doc/html/boost/geometry/index/box.html | 84 ++ doc/html/boost/geometry/index/clear.html | 77 ++ doc/html/boost/geometry/index/empty.html | 84 ++ .../boost/geometry/index/insert_id265665.html | 84 ++ .../boost/geometry/index/insert_id265715.html | 88 ++ .../boost/geometry/index/insert_id265778.html | 84 ++ .../boost/geometry/index/insert_id274403.html | 84 ++ .../boost/geometry/index/insert_id274453.html | 88 ++ .../boost/geometry/index/insert_id274516.html | 84 ++ .../boost/geometry/index/insert_id278981.html | 84 ++ .../boost/geometry/index/insert_id279031.html | 88 ++ .../boost/geometry/index/insert_id279094.html | 84 ++ .../boost/geometry/index/insert_id322710.html | 84 ++ .../boost/geometry/index/insert_id322760.html | 88 ++ .../boost/geometry/index/insert_id322823.html | 84 ++ .../index/nearest_query_id266086.html | 95 ++ .../index/nearest_query_id266152.html | 101 ++ .../index/nearest_query_id266231.html | 100 ++ .../index/nearest_query_id266309.html | 105 ++ .../index/nearest_query_id274824.html | 95 ++ .../index/nearest_query_id274890.html | 101 ++ .../index/nearest_query_id274969.html | 100 ++ .../index/nearest_query_id275047.html | 105 ++ .../index/nearest_query_id279402.html | 95 ++ .../index/nearest_query_id279468.html | 101 ++ .../index/nearest_query_id279547.html | 100 ++ .../index/nearest_query_id279625.html | 105 ++ .../index/nearest_query_id323131.html | 95 ++ .../index/nearest_query_id323197.html | 101 ++ .../index/nearest_query_id323276.html | 100 ++ .../index/nearest_query_id323354.html | 105 ++ .../boost/geometry/index/remove_id265832.html | 92 ++ .../boost/geometry/index/remove_id265888.html | 96 ++ .../boost/geometry/index/remove_id265956.html | 92 ++ .../boost/geometry/index/remove_id274570.html | 92 ++ .../boost/geometry/index/remove_id274626.html | 96 ++ .../boost/geometry/index/remove_id274694.html | 92 ++ .../boost/geometry/index/remove_id279148.html | 92 ++ .../boost/geometry/index/remove_id279204.html | 96 ++ .../boost/geometry/index/remove_id279272.html | 92 ++ .../boost/geometry/index/remove_id322877.html | 92 ++ .../boost/geometry/index/remove_id322933.html | 96 ++ .../boost/geometry/index/remove_id323001.html | 92 ++ doc/html/boost/geometry/index/rtree.html | 1083 +++++++++++++++++ doc/html/boost/geometry/index/size.html | 84 ++ .../boost/geometry/index/spatial_query.html | 95 ++ doc/html/geometry_index/r_tree.html | 7 + .../r_tree/exception_safety.html | 5 +- doc/html/geometry_index/r_tree/index.html | 342 ++++++ doc/html/index.html | 3 +- doc/index.idx | 8 + doc/rtree.qbk | 13 + .../geometry/extensions/index/rtree/rtree.hpp | 194 +-- 54 files changed, 5779 insertions(+), 105 deletions(-) create mode 100644 doc/html/boost/geometry/index/box.html create mode 100644 doc/html/boost/geometry/index/clear.html create mode 100644 doc/html/boost/geometry/index/empty.html create mode 100644 doc/html/boost/geometry/index/insert_id265665.html create mode 100644 doc/html/boost/geometry/index/insert_id265715.html create mode 100644 doc/html/boost/geometry/index/insert_id265778.html create mode 100644 doc/html/boost/geometry/index/insert_id274403.html create mode 100644 doc/html/boost/geometry/index/insert_id274453.html create mode 100644 doc/html/boost/geometry/index/insert_id274516.html create mode 100644 doc/html/boost/geometry/index/insert_id278981.html create mode 100644 doc/html/boost/geometry/index/insert_id279031.html create mode 100644 doc/html/boost/geometry/index/insert_id279094.html create mode 100644 doc/html/boost/geometry/index/insert_id322710.html create mode 100644 doc/html/boost/geometry/index/insert_id322760.html create mode 100644 doc/html/boost/geometry/index/insert_id322823.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id266086.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id266152.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id266231.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id266309.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id274824.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id274890.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id274969.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id275047.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id279402.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id279468.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id279547.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id279625.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id323131.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id323197.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id323276.html create mode 100644 doc/html/boost/geometry/index/nearest_query_id323354.html create mode 100644 doc/html/boost/geometry/index/remove_id265832.html create mode 100644 doc/html/boost/geometry/index/remove_id265888.html create mode 100644 doc/html/boost/geometry/index/remove_id265956.html create mode 100644 doc/html/boost/geometry/index/remove_id274570.html create mode 100644 doc/html/boost/geometry/index/remove_id274626.html create mode 100644 doc/html/boost/geometry/index/remove_id274694.html create mode 100644 doc/html/boost/geometry/index/remove_id279148.html create mode 100644 doc/html/boost/geometry/index/remove_id279204.html create mode 100644 doc/html/boost/geometry/index/remove_id279272.html create mode 100644 doc/html/boost/geometry/index/remove_id322877.html create mode 100644 doc/html/boost/geometry/index/remove_id322933.html create mode 100644 doc/html/boost/geometry/index/remove_id323001.html create mode 100644 doc/html/boost/geometry/index/rtree.html create mode 100644 doc/html/boost/geometry/index/size.html create mode 100644 doc/html/boost/geometry/index/spatial_query.html create mode 100644 doc/html/geometry_index/r_tree/index.html create mode 100644 doc/index.idx diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index b30e99393..94f0c55a1 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -8,18 +8,56 @@ project geometry_index/doc ; +import doxygen ; import boostbook ; import quickbook ; +using auto-index ; + +path-constant images_location : html ; +path-constant here : . ; + +doxygen autodoc + : + [ glob + ../boost/geometry/extensions/index/rtree/rtree.hpp +# ../boost/geometry/extensions/index/predicates.hpp +# ../boost/geometry/extensions/index/distance_predicates.hpp +# ../boost/geometry/extensions/index/inserter.hpp +# ../boost/geometry/extensions/index/adaptors/nearest_query.hpp +# ../boost/geometry/extensions/index/adaptors/spatial_query.hpp +# ../boost/geometry/extensions/index/translator/def.hpp +# ../boost/geometry/extensions/index/translator/index.hpp + ] + : + EXTRACT_ALL=NO + EXTRACT_PRIVATE=NO + HIDE_UNDOC_MEMBERS=YES + HIDE_UNDOC_CLASSES=YES + ENABLE_PREPROCESSING=YES + EXPAND_ONLY_PREDEF=YES + MACRO_EXPANSION=YES + "PREDEFINED=\"BOOST_RV_REF(T)=T &&\" \\ + \"BOOST_RV_REF_BEG=\" \\ + \"BOOST_RV_REF_END=&&\" \\ + \"BOOST_COPY_ASSIGN_REF(T)=const T &\" \\ + \"BOOST_RV_REF_2_TEMPL_ARGS(T,a,b)=T &&\" \\ + \"BOOST_RV_REF_3_TEMPL_ARGS(T,a,b,c)=TT &&\" \\ + \"BOOST_FWD_REF(a)=a &&\"" + "boost.doxygen.reftitle=Header Reference" + ; + +xml index : index.qbk + : + ../../tools/auto_index/include + ; + boostbook geometry_index-doc : - index.qbk + index : Jamfile.v2 -# off -# on -# off -# index.on.type=1 + html pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html chunk.section.depth=2 @@ -28,6 +66,15 @@ boostbook geometry_index-doc toc.max.depth=2 generate.section.toc.level=4 boost.root=http://www.boost.org/doc/libs/release + + autodoc + on + on + pdf:off + html:on + $(here)/index.idx + "$(here)/.." + enable_index $(here) ; diff --git a/doc/html/boost/geometry/index/box.html b/doc/html/boost/geometry/index/box.html new file mode 100644 index 000000000..5d3b98acc --- /dev/null +++ b/doc/html/boost/geometry/index/box.html @@ -0,0 +1,84 @@ + + + +Function template box + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHome +
    +
    +
    +
    +

    Function template box

    +

    boost::geometry::index::box

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  rtree< Value, Options, Translator, Allocator >::box_type 
    +  box(rtree< Value, Options, Translator, Allocator > const & tree);
    +
    +

    Description

    +

    Description: Get the box containing all stored values or an invalid box if the index has no values.

    +

    + +

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

    Parameters:

    ++++ + + + + +

    tree

    The spatial index.

    Returns:

    The box containing all stored values or an invalid box.

    +
    +
    + + + +
    +
    +
    +PrevUpHome +
    + + diff --git a/doc/html/boost/geometry/index/clear.html b/doc/html/boost/geometry/index/clear.html new file mode 100644 index 000000000..ff33614fd --- /dev/null +++ b/doc/html/boost/geometry/index/clear.html @@ -0,0 +1,77 @@ + + + +Function template clear + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template clear

    +

    boost::geometry::index::clear

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  void clear(rtree< Value, Options, Translator, Allocator > & tree);
    +
    +

    Description

    +

    Description: Remove all values from the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

    ++++ + + + + +

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/empty.html b/doc/html/boost/geometry/index/empty.html new file mode 100644 index 000000000..ad69355a4 --- /dev/null +++ b/doc/html/boost/geometry/index/empty.html @@ -0,0 +1,84 @@ + + + +Function template empty + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template empty

    +

    boost::geometry::index::empty

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  bool empty(rtree< Value, Options, Translator, Allocator > const & tree);
    +
    +

    Description

    +

    Description: Query if there are no values stored in the index.

    +

    + +

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

    Parameters:

    ++++ + + + + +

    tree

    The spatial index.

    Returns:

    true if there are no values in the index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id265665.html b/doc/html/boost/geometry/index/insert_id265665.html new file mode 100644 index 000000000..c6a038d1f --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id265665.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Value const & v);
    +
    +

    Description

    +

    Description: Insert a value to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id265715.html b/doc/html/boost/geometry/index/insert_id265715.html new file mode 100644 index 000000000..127367946 --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id265715.html @@ -0,0 +1,88 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id265778.html b/doc/html/boost/geometry/index/insert_id265778.html new file mode 100644 index 000000000..1464dde23 --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id265778.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Range const & rng);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id274403.html b/doc/html/boost/geometry/index/insert_id274403.html new file mode 100644 index 000000000..1a7819d7c --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id274403.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Value const & v);
    +
    +

    Description

    +

    Description: Insert a value to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id274453.html b/doc/html/boost/geometry/index/insert_id274453.html new file mode 100644 index 000000000..e79e1d719 --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id274453.html @@ -0,0 +1,88 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id274516.html b/doc/html/boost/geometry/index/insert_id274516.html new file mode 100644 index 000000000..3afa7785f --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id274516.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Range const & rng);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id278981.html b/doc/html/boost/geometry/index/insert_id278981.html new file mode 100644 index 000000000..63d268a49 --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id278981.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Value const & v);
    +
    +

    Description

    +

    Description: Insert a value to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id279031.html b/doc/html/boost/geometry/index/insert_id279031.html new file mode 100644 index 000000000..24867e2c1 --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id279031.html @@ -0,0 +1,88 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id279094.html b/doc/html/boost/geometry/index/insert_id279094.html new file mode 100644 index 000000000..b3f0756fa --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id279094.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Range const & rng);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id322710.html b/doc/html/boost/geometry/index/insert_id322710.html new file mode 100644 index 000000000..cae00e49e --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id322710.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Value const & v);
    +
    +

    Description

    +

    Description: Insert a value to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id322760.html b/doc/html/boost/geometry/index/insert_id322760.html new file mode 100644 index 000000000..08e77859d --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id322760.html @@ -0,0 +1,88 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/insert_id322823.html b/doc/html/boost/geometry/index/insert_id322823.html new file mode 100644 index 000000000..9baad1c89 --- /dev/null +++ b/doc/html/boost/geometry/index/insert_id322823.html @@ -0,0 +1,84 @@ + + + +Function template insert + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template insert

    +

    boost::geometry::index::insert

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    +              Range const & rng);
    +
    +

    Description

    +

    Description: Insert a range of values to the index.

    +

    +

    +
    ++++ + + + + +

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id266086.html b/doc/html/boost/geometry/index/nearest_query_id266086.html new file mode 100644 index 000000000..441928484 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id266086.html @@ -0,0 +1,95 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id266152.html b/doc/html/boost/geometry/index/nearest_query_id266152.html new file mode 100644 index 000000000..3e6cf22b8 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id266152.html @@ -0,0 +1,101 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, 
    +                       Predicates const & pred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id266231.html b/doc/html/boost/geometry/index/nearest_query_id266231.html new file mode 100644 index 000000000..6f55c6bb0 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id266231.html @@ -0,0 +1,100 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id266309.html b/doc/html/boost/geometry/index/nearest_query_id266309.html new file mode 100644 index 000000000..91e32202b --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id266309.html @@ -0,0 +1,105 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       Predicates const & pred, OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id274824.html b/doc/html/boost/geometry/index/nearest_query_id274824.html new file mode 100644 index 000000000..82b6377eb --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id274824.html @@ -0,0 +1,95 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id274890.html b/doc/html/boost/geometry/index/nearest_query_id274890.html new file mode 100644 index 000000000..858472205 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id274890.html @@ -0,0 +1,101 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, 
    +                       Predicates const & pred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id274969.html b/doc/html/boost/geometry/index/nearest_query_id274969.html new file mode 100644 index 000000000..ba99082f0 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id274969.html @@ -0,0 +1,100 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id275047.html b/doc/html/boost/geometry/index/nearest_query_id275047.html new file mode 100644 index 000000000..4d1773475 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id275047.html @@ -0,0 +1,105 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       Predicates const & pred, OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id279402.html b/doc/html/boost/geometry/index/nearest_query_id279402.html new file mode 100644 index 000000000..23c8db313 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id279402.html @@ -0,0 +1,95 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id279468.html b/doc/html/boost/geometry/index/nearest_query_id279468.html new file mode 100644 index 000000000..25dca712e --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id279468.html @@ -0,0 +1,101 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, 
    +                       Predicates const & pred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id279547.html b/doc/html/boost/geometry/index/nearest_query_id279547.html new file mode 100644 index 000000000..a4140c00e --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id279547.html @@ -0,0 +1,100 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id279625.html b/doc/html/boost/geometry/index/nearest_query_id279625.html new file mode 100644 index 000000000..95752f7be --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id279625.html @@ -0,0 +1,105 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       Predicates const & pred, OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id323131.html b/doc/html/boost/geometry/index/nearest_query_id323131.html new file mode 100644 index 000000000..12f91686b --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id323131.html @@ -0,0 +1,95 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id323197.html b/doc/html/boost/geometry/index/nearest_query_id323197.html new file mode 100644 index 000000000..16abce230 --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id323197.html @@ -0,0 +1,101 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, 
    +                       Predicates const & pred, Value & v);
    +
    +

    Description

    +

    Description: Find the value meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id323276.html b/doc/html/boost/geometry/index/nearest_query_id323276.html new file mode 100644 index 000000000..cdb396b7b --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id323276.html @@ -0,0 +1,100 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/nearest_query_id323354.html b/doc/html/boost/geometry/index/nearest_query_id323354.html new file mode 100644 index 000000000..ac96d5fca --- /dev/null +++ b/doc/html/boost/geometry/index/nearest_query_id323354.html @@ -0,0 +1,105 @@ + + + +Function template nearest_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template nearest_query

    +

    boost::geometry::index::nearest_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename DistancesPredicates, 
    +         typename Predicates, typename OutIter> 
    +  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       DistancesPredicates const & dpred, size_t k, 
    +                       Predicates const & pred, OutIter out_it);
    +
    +

    Description

    +

    Description: Find k values meeting distances and spatial predicates.

    +

    + +

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

    Parameters:

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

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id265832.html b/doc/html/boost/geometry/index/remove_id265832.html new file mode 100644 index 000000000..06ec821a5 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id265832.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Value const & v);
    +
    +

    Description

    +

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    +

    + +

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

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id265888.html b/doc/html/boost/geometry/index/remove_id265888.html new file mode 100644 index 000000000..a4123ae4c --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id265888.html @@ -0,0 +1,96 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id265956.html b/doc/html/boost/geometry/index/remove_id265956.html new file mode 100644 index 000000000..d470b3a05 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id265956.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Range const & rng);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id274570.html b/doc/html/boost/geometry/index/remove_id274570.html new file mode 100644 index 000000000..d995e2ee2 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id274570.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Value const & v);
    +
    +

    Description

    +

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    +

    + +

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

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id274626.html b/doc/html/boost/geometry/index/remove_id274626.html new file mode 100644 index 000000000..e0eb6c289 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id274626.html @@ -0,0 +1,96 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id274694.html b/doc/html/boost/geometry/index/remove_id274694.html new file mode 100644 index 000000000..4940b5ff6 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id274694.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Range const & rng);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id279148.html b/doc/html/boost/geometry/index/remove_id279148.html new file mode 100644 index 000000000..5a5006716 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id279148.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Value const & v);
    +
    +

    Description

    +

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    +

    + +

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

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id279204.html b/doc/html/boost/geometry/index/remove_id279204.html new file mode 100644 index 000000000..f29defa19 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id279204.html @@ -0,0 +1,96 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id279272.html b/doc/html/boost/geometry/index/remove_id279272.html new file mode 100644 index 000000000..2c87e10d2 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id279272.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Range const & rng);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id322877.html b/doc/html/boost/geometry/index/remove_id322877.html new file mode 100644 index 000000000..14c0c65c3 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id322877.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Value const & v);
    +
    +

    Description

    +

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    +

    + +

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

    Parameters:

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

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id322933.html b/doc/html/boost/geometry/index/remove_id322933.html new file mode 100644 index 000000000..8ffa40f33 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id322933.html @@ -0,0 +1,96 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Iterator> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Iterator first, Iterator last);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/remove_id323001.html b/doc/html/boost/geometry/index/remove_id323001.html new file mode 100644 index 000000000..91f526b02 --- /dev/null +++ b/doc/html/boost/geometry/index/remove_id323001.html @@ -0,0 +1,92 @@ + + + +Function template remove + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template remove

    +

    boost::geometry::index::remove

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Range> 
    +  rtree< Value, Options, Translator, Allocator >::size_type 
    +  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    +         Range const & rng);
    +
    +

    Description

    +

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    +

    + +

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

    Parameters:

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

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/rtree.html b/doc/html/boost/geometry/index/rtree.html new file mode 100644 index 000000000..72105ae76 --- /dev/null +++ b/doc/html/boost/geometry/index/rtree.html @@ -0,0 +1,1083 @@ + + + +Class template rtree + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Class template rtree

    +

    boost::geometry::index::rtree

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +template<typename Value, typename Parameters, 
    +         typename Translator = translator::def<Value>, 
    +         typename Allocator = std::allocator<Value> > 
    +class rtree {
    +public:
    +  // types
    +  typedef Value                                           value_type;     
    +  typedef Parameters                                      parameters_type;
    +  typedef Translator                                      translator_type;
    +  typedef Allocator                                       allocator_type; 
    +  typedef allocator_type::size_type                       size_type;      
    +  typedef translator::indexable_type< Translator >::type  indexable_type; 
    +  typedef index::default_box_type< indexable_type >::type box_type;       
    +
    +  // construct/copy/destruct
    +  explicit rtree(Parameters = Parameters(), 
    +                 translator_type const & = translator_type(), 
    +                 Allocator = Allocator());
    +  template<typename Iterator> 
    +    rtree(Iterator, Iterator, Parameters = Parameters(), 
    +          translator_type const & = translator_type(), 
    +          Allocator = std::allocator< value_type >());
    +  template<typename Range> 
    +    rtree(Range const &, Parameters = Parameters(), 
    +          translator_type const & = translator_type(), 
    +          Allocator = std::allocator< value_type >());
    +  rtree(rtree const &);
    +  rtree(rtree const &, Allocator const &);
    +  rtree(rtree &&);
    +  rtree& operator=(const rtree &);
    +  rtree& operator=(rtree &&);
    +  ~rtree();
    +
    +  // public member functions
    +  void swap(rtree &);
    +  void insert(value_type const &);
    +  template<typename Iterator> void insert(Iterator, Iterator);
    +  template<typename Range> void insert(Range const &);
    +  size_type remove(value_type const &);
    +  template<typename Iterator> size_type remove(Iterator, Iterator);
    +  template<typename Range> size_type remove(Range const &);
    +  template<typename Predicates, typename OutIter> 
    +    size_type spatial_query(Predicates const &, OutIter) const;
    +  template<typename DistancesPredicates> 
    +    size_type nearest_query(DistancesPredicates const &, value_type &) const;
    +  template<typename DistancesPredicates, typename Predicates> 
    +    size_type nearest_query(DistancesPredicates const &, Predicates const &, 
    +                            value_type &) const;
    +  template<typename DistancesPredicates, typename OutIter> 
    +    size_type nearest_query(DistancesPredicates const &, size_t, OutIter) const;
    +  template<typename DistancesPredicates, typename Predicates, 
    +           typename OutIter> 
    +    size_type nearest_query(DistancesPredicates const &, size_t, 
    +                            Predicates const &, OutIter) const;
    +  size_type size() const;
    +  bool empty() const;
    +  void clear();
    +  box_type box() const;
    +  template<typename ValueOrIndexable> 
    +    size_type count(ValueOrIndexable const &) const;
    +  parameters_type const & parameters() const;
    +  translator_type const & translator() const;
    +  allocator_type get_allocator() const;
    +
    +  // private member functions
    +  template<typename Visitor> void apply_visitor(Visitor &) const;
    +  size_type values_count() const;
    +  size_type depth() const;
    +  void raw_insert(value_type const &);
    +  size_type raw_remove(value_type const &);
    +  void raw_create();
    +  void raw_destroy(rtree &);
    +  void raw_copy(rtree const &, rtree &, bool) const;
    +  template<typename DistancesPredicates, typename Predicates> 
    +    size_type raw_nearest_one(DistancesPredicates const &, Predicates const &, 
    +                              value_type &) const;
    +  template<typename DistancesPredicates, typename Predicates, 
    +           typename OutIter> 
    +    size_type raw_nearest_k(DistancesPredicates const &, size_t, 
    +                            Predicates const &, OutIter) const;
    +};
    +
    +

    Description

    +

    The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms.

    +

    +

    +
    +

    Template Parameters

    +
      +
    1. +
      typename Value
      +

      The type of objects stored in the container.

      +
    2. +
    3. +
      typename Parameters
      +

      Compile-time parameters. The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with compile-time parameters like min and max number of elements in node. Predefined Algorithms/Parameters are: bgi::linear<MinElements, MaxElements>, bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements * 0.3>.

      +
    4. +
    5. +
      typename Translator = translator::def<Value>
      +

      The type of the translator which translates from Value to Indexable. This translation is done each time the r-tree wants to know Value's Indexable. Default translator can translate all types adapted to Point or Box concepts (which are Indexables). It also handles std::pair<Indexable, T>, pointers, smart pointers, and iterators. E.g. If std::pair<Box, int> is stored, the default translator translates from std::pair<Box, int> const& to Box const&.

      +
    6. +
    7. +
      typename Allocator = std::allocator<Value>
      +

      The allocator.

      +
    8. +
    +
    +
    +

    +rtree + public + construct/copy/destruct

    +
      +
    1. +
      explicit rtree(Parameters parameters = Parameters(), 
      +               translator_type const & translator = translator_type(), 
      +               Allocator allocator = Allocator());
      +

      Description: The constructor.

      +

      Exception-safety: nothrow

      +

      +

      +
      ++++ + + + + +

      Parameters:

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

      allocator

      The allocator object.

      parameters

      The parameters object.

      translator

      The translator object.

      +
    2. +
    3. +
      template<typename Iterator> 
      +  rtree(Iterator first, Iterator last, Parameters parameters = Parameters(), 
      +        translator_type const & translator = translator_type(), 
      +        Allocator allocator = std::allocator< value_type >());
      +

      Description: The constructor.

      +

      Exception-safety: strong

      +

      +

      +
      ++++ + + + + +

      Parameters:

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

      allocator

      The allocator object.

      first

      The beginning of the range of Values.

      last

      The end of the range of Values.

      parameters

      The parameters object.

      translator

      The translator object.

      +
    4. +
    5. +
      template<typename Range> 
      +  rtree(Range const & rng, Parameters parameters = Parameters(), 
      +        translator_type const & translator = translator_type(), 
      +        Allocator allocator = std::allocator< value_type >());
      +

      Description: The constructor.

      +

      Exception-safety: strong

      +

      +

      +
      ++++ + + + + +

      Parameters:

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

      allocator

      The allocator object.

      parameters

      The parameters object.

      rng

      The range of Values.

      translator

      The translator object.

      +
    6. +
    7. +
      rtree(rtree const & src);
      +

      Description: The copy constructor.

      +

      Exception-safety: strong

      +
    8. +
    9. +
      rtree(rtree const & src, Allocator const & allocator);
      +

      Description: The copy constructor.

      +

      Exception-safety: strong

      +
    10. +
    11. +
      rtree(rtree && src);
      +

      Description: The moving constructor.

      +

      Exception-safety: nothrow

      +
    12. +
    13. +
      rtree& operator=(const rtree & src);
      +

      Description: The assignment operator.

      +

      Exception-safety: strong

      +
    14. +
    15. +
      rtree& operator=(rtree && src);
      +

      Description: The moving assignment.

      +

      Exception-safety: nothrow (if allocators are equal), strong (if allocators aren't equal)

      +
    16. +
    17. +
      ~rtree();
      +

      Description: The destructor.

      +

      Exception-safety: nothrow

      +
    18. +
    +
    +
    +

    +rtree public member functions

    +
      +
    1. +
      void swap(rtree & other);
      +

      Description: Swaps two rtrees.

      +

      Exception-safety: nothrow

      +

      +

      +
      ++++ + + + + +

      Parameters:

      ++++ + + + + +

      other

      The other rtree.

      +
    2. +
    3. +
      void insert(value_type const & value);
      +

      Description: Insert a value to the index.

      +

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      +

      +

      +
      ++++ + + + + +

      Parameters:

      ++++ + + + + +

      value

      The value which will be stored in the container.

      +
    4. +
    5. +
      template<typename Iterator> void insert(Iterator first, Iterator last);
      +

      Description: Insert a range of values to the index.

      +

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      +

      +

      +
      ++++ + + + + +

      Parameters:

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

      first

      The beginning of the range of values.

      last

      The end of the range of values.

      +
    6. +
    7. +
      template<typename Range> void insert(Range const & rng);
      +

      Description: Insert a range of values to the index.

      +

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      +

      +

      +
      ++++ + + + + +

      Parameters:

      ++++ + + + + +

      rng

      The range of values.

      +
    8. +
    9. +
      size_type remove(value_type const & value);
      +

      Description: Remove a value from the container. In contrast to the STL set/map erase() method this method removes only one value from the container.

      +

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      +

      + +

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

      Parameters:

      ++++ + + + + +

      value

      The value which will be removed from the container.

      Returns:

      1 if the value was removed, 0 otherwise.

      +
    10. +
    11. +
      template<typename Iterator> size_type remove(Iterator first, Iterator last);
      +

      Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

      +

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      +

      + +

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

      Parameters:

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

      first

      The beginning of the range of values.

      last

      The end of the range of values.

      Returns:

      The number of removed values.

      +
    12. +
    13. +
      template<typename Range> size_type remove(Range const & rng);
      +

      Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.

      +

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      +

      + +

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

      Parameters:

      ++++ + + + + +

      rng

      The range of values.

      Returns:

      The number of removed values.

      +
    14. +
    15. +
      template<typename Predicates, typename OutIter> 
      +  size_type spatial_query(Predicates const & pred, OutIter out_it) const;
      +

      Description: Finds values meeting spatial predicates, e.g. intersecting some box.

      +

      Exception-safety: strong

      +

      + +

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

      Parameters:

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

      out_it

      The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container)

      pred

      The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

      Returns:

      The number of values found.

      +
    16. +
    17. +
      template<typename DistancesPredicates> 
      +  size_type nearest_query(DistancesPredicates const & dpred, value_type & v) const;
      +

      Description: Finds one value meeting distances predicates, e.g. nearest to some point.

      +

      Exception-safety: strong

      +

      + +

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

      Parameters:

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

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      v

      The reference to the object which will contain the result.

      Returns:

      The number of values found.

      +
    18. +
    19. +
      template<typename DistancesPredicates, typename Predicates> 
      +  size_type nearest_query(DistancesPredicates const & dpred, 
      +                          Predicates const & pred, value_type & v) const;
      +

      Description: Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some point and intersecting some box.

      +

      Exception-safety: strong

      +

      + +

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

      Parameters:

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

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      pred

      The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

      v

      The reference to the object which will contain the result.

      Returns:

      The number of values found.

      +
    20. +
    21. +
      template<typename DistancesPredicates, typename OutIter> 
      +  size_type nearest_query(DistancesPredicates const & dpred, size_t k, 
      +                          OutIter out_it) const;
      +

      Description: Finds k values meeting distances predicates, e.g. k nearest values to some point.

      +

      Exception-safety: strong

      +

      + +

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

      Parameters:

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

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      k

      The max number of values.

      out_it

      The output iterator of the result range. E.g. a back_insert_iterator.

      Returns:

      The number of values found.

      +
    22. +
    23. +
      template<typename DistancesPredicates, typename Predicates, typename OutIter> 
      +  size_type nearest_query(DistancesPredicates const & dpred, size_t k, 
      +                          Predicates const & pred, OutIter out_it) const;
      +

      Description: Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some point and intersecting some box.

      +

      Exception-safety: strong

      +

      + +

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

      Parameters:

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

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      k

      The max number of values.

      out_it

      The output iterator of the result range. E.g. a back_insert_iterator.

      pred

      The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

      Returns:

      The number of values found.

      +
    24. +
    25. +
      size_type size() const;
      +

      Description: Returns the number of stored values.

      +

      Exception-safety: nothrow

      +

      +

      +
      ++++ + + + + +

      Returns:

      The number of stored values.

      +
    26. +
    27. +
      bool empty() const;
      +

      Description: Query if the container is empty.

      +

      Exception-safety: nothrow

      +

      +

      +
      ++++ + + + + +

      Returns:

      true if the container is empty.

      +
    28. +
    29. +
      void clear();
      +

      Description: Removes all values stored in the container.

      +

      Exception-safety: nothrow.

      +
    30. +
    31. +
      box_type box() const;
      +

      Description: Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.

      +

      Exception-safety: nothrow (if Indexable's CoordinateType copy assignment doesn't throw), strong (if Indexable's CoordinateType copy assignment throws).

      +

      +

      +
      ++++ + + + + +

      Returns:

      The box containing all values stored in the container or an invalid box if there are no values in the container.

      +
    32. +
    33. +
      template<typename ValueOrIndexable> 
      +  size_type count(ValueOrIndexable const & vori) const;
      +

      Description: For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter.

      +

      Exception-safety: nothrow.

      +

      + +

      +
      ++++ + + + + +

      Returns:

      The number of values found.

      +
    34. +
    35. +
      parameters_type const & parameters() const;
      +

      Description: Returns parameters.

      +

      Exception-safety: nothrow.

      +

      +

      +
      ++++ + + + + +

      Returns:

      The parameters object.

      +
    36. +
    37. +
      translator_type const & translator() const;
      +

      Description: Returns the translator object.

      +

      Exception-safety: nothrow.

      +

      +

      +
      ++++ + + + + +

      Returns:

      The translator object.

      +
    38. +
    39. +
      allocator_type get_allocator() const;
      +

      Description: Returns allocator used by the rtree.

      +

      Exception-safety: nothrow

      +

      +

      +
      ++++ + + + + +

      Returns:

      The allocator.

      +
    40. +
    +
    +
    +

    +rtree private member functions

    +
      +
    1. +
      template<typename Visitor> void apply_visitor(Visitor & visitor) const;
      +

      Description: Apply a visitor to the nodes structure in order to perform some operator. This function is not a part of the 'official' interface. However it makes possible e.g. to pass a visitor drawing the tree structure.

      +

      Exception-safety: the same as Visitor::operator().

      +

      +

      +
      ++++ + + + + +

      Parameters:

      ++++ + + + + +

      visitor

      The visitor object.

      +
    2. +
    3. +
      size_type values_count() const;
      +

      Description: Returns the number of stored objects. Same as size() This function is not a part of the 'official' interface.

      +

      Exception-safety: nothrow

      +

      +

      +
      ++++ + + + + +

      Returns:

      The number of stored objects.

      +
    4. +
    5. +
      size_type depth() const;
      +

      Description: Returns the depth of the R-tree. This function is not a part of the 'official' interface.

      +

      Exception-safety: nothrow.

      +

      +

      +
      ++++ + + + + +

      Returns:

      The depth of the R-tree.

      +
    6. +
    7. +
      void raw_insert(value_type const & value);
      +

      Description: Insert a value to the index. Root node must exist.

      +

      Exception-safety: basic

      +

      +

      +
      ++++ + + + + +

      Parameters:

      ++++ + + + + +

      value

      The value which will be stored in the container.

      +
    8. +
    9. +
      size_type raw_remove(value_type const & value);
      +

      Description: Remove the value from the container.

      +

      Exception-safety: basic

      +

      +

      +
      ++++ + + + + +

      Parameters:

      ++++ + + + + +

      value

      The value which will be removed from the container.

      +
    10. +
    11. +
      void raw_create();
      +

      Description: Create an empty R-tree i.e. new empty root node and clear other attributes.

      +

      Exception-safety: strong.

      +
    12. +
    13. +
      void raw_destroy(rtree & t);
      +

      Description: Destroy the R-tree i.e. all nodes and clear attributes.

      +

      Exception-safety: nothrow.

      +

      +

      +
      ++++ + + + + +

      Parameters:

      ++++ + + + + +

      t

      The container which is going to be destroyed.

      +
    14. +
    15. +
      void raw_copy(rtree const & src, rtree & dst, bool copy_all_internals) const;
      +

      Description: Copy the R-tree i.e. whole nodes structure, values and other attributes. It uses destination's allocators to create the new structure.

      +

      Exception-safety: strong.

      +

      +

      +
      ++++ + + + + +

      Parameters:

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

      dst

      The destination R-tree.

      src

      The source R-tree.

      +
    16. +
    17. +
      template<typename DistancesPredicates, typename Predicates> 
      +  size_type raw_nearest_one(DistancesPredicates const & dpred, 
      +                            Predicates const & pred, value_type & v) const;
      +

      Description: Find one value meeting distances and spatial predicates.

      +

      Exception-safety: strong.

      +
    18. +
    19. +
      template<typename DistancesPredicates, typename Predicates, typename OutIter> 
      +  size_type raw_nearest_k(DistancesPredicates const & dpred, size_t k, 
      +                          Predicates const & pred, OutIter out_it) const;
      +

      Description: Find k values meeting distances and spatial predicates.

      +

      Exception-safety: strong.

      +
    20. +
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/size.html b/doc/html/boost/geometry/index/size.html new file mode 100644 index 000000000..438fb4196 --- /dev/null +++ b/doc/html/boost/geometry/index/size.html @@ -0,0 +1,84 @@ + + + +Function template size + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template size

    +

    boost::geometry::index::size

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator> 
    +  size_t size(rtree< Value, Options, Translator, Allocator > const & tree);
    +
    +

    Description

    +

    Description: Get the number of values stored in the index.

    +

    + +

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

    Parameters:

    ++++ + + + + +

    tree

    The spatial index.

    Returns:

    The number of values stored in the index.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/boost/geometry/index/spatial_query.html b/doc/html/boost/geometry/index/spatial_query.html new file mode 100644 index 000000000..08cc2392e --- /dev/null +++ b/doc/html/boost/geometry/index/spatial_query.html @@ -0,0 +1,95 @@ + + + +Function template spatial_query + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    +
    +
    +

    Function template spatial_query

    +

    boost::geometry::index::spatial_query

    +
    +

    Synopsis

    +
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    +
    +
    +template<typename Value, typename Options, typename Translator, 
    +         typename Allocator, typename Predicates, typename OutIter> 
    +  size_t spatial_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    +                       Predicates const & pred, OutIter out_it);
    +
    +

    Description

    +

    Description: Find values meeting spatial predicates.

    +

    + +

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

    Parameters:

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

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 42ae4edb7..0583a142b 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -75,6 +75,13 @@ spatial predicates
    Exception safety
    +
    Reference
    +
    +
    Class Index
    +
    Typedef Index
    +
    Function Index
    +
    Header Reference
    +
    diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index 62cfa5669..fd669c9c6 100644 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ b/doc/html/geometry_index/r_tree/exception_safety.html @@ -7,6 +7,7 @@ +
    @@ -19,7 +20,7 @@

    -PrevUpHome +PrevUpHomeNext

    @@ -417,7 +418,7 @@


    -PrevUpHome +PrevUpHomeNext
    diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html new file mode 100644 index 000000000..71f7a654b --- /dev/null +++ b/doc/html/geometry_index/r_tree/index.html @@ -0,0 +1,342 @@ + + + +Reference + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + + +
    +

    +Class Index

    +

    R

    +
    +
    +R +
    +
    +
    +
    +
    +

    +Typedef Index

    +

    A B I P S T V

    +
    +
    +A +
    +
    +
    +B +
    +
    +
    +I +
    +
    +
    +P +
    +
    +
    +S +
    +
    +
    +T +
    +
    +
    +V +
    +
    +
    +
    +
    +

    +Function Index

    +

    B C E I N R S

    +
    +
    +B +
    +
    +
    +C +
    +
    +
    +E +
    +
    +
    +I +
    +
    +
    +N +
    +
    +
    +R +
    +
    +
    +S +
    +
    +
    +
    +
    +

    +Header Reference

    + +
    + +
    namespace boost {
    +  namespace geometry {
    +    namespace index {
    +      template<typename Value, typename Parameters, 
    +               typename Translator = translator::def<Value>, 
    +               typename Allocator = std::allocator<Value> > 
    +        class rtree;
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator> 
    +        void insert(rtree< Value, Options, Translator, Allocator > &, 
    +                    Value const &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename Iterator> 
    +        void insert(rtree< Value, Options, Translator, Allocator > &, 
    +                    Iterator, Iterator);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename Range> 
    +        void insert(rtree< Value, Options, Translator, Allocator > &, 
    +                    Range const &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator> 
    +        rtree< Value, Options, Translator, Allocator >::size_type 
    +        remove(rtree< Value, Options, Translator, Allocator > &, 
    +               Value const &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename Iterator> 
    +        rtree< Value, Options, Translator, Allocator >::size_type 
    +        remove(rtree< Value, Options, Translator, Allocator > &, Iterator, 
    +               Iterator);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename Range> 
    +        rtree< Value, Options, Translator, Allocator >::size_type 
    +        remove(rtree< Value, Options, Translator, Allocator > &, 
    +               Range const &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename Predicates, typename OutIter> 
    +        size_t spatial_query(rtree< Value, Options, Translator, Allocator > const &, 
    +                             Predicates const &, OutIter);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename DistancesPredicates> 
    +        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    +                             DistancesPredicates const &, Value &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename DistancesPredicates, 
    +               typename Predicates> 
    +        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    +                             DistancesPredicates const &, Predicates const &, 
    +                             Value &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename DistancesPredicates, 
    +               typename OutIter> 
    +        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    +                             DistancesPredicates const &, size_t, OutIter);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator, typename DistancesPredicates, 
    +               typename Predicates, typename OutIter> 
    +        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    +                             DistancesPredicates const &, size_t, 
    +                             Predicates const &, OutIter);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator> 
    +        void clear(rtree< Value, Options, Translator, Allocator > &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator> 
    +        size_t size(rtree< Value, Options, Translator, Allocator > const &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator> 
    +        bool empty(rtree< Value, Options, Translator, Allocator > const &);
    +      template<typename Value, typename Options, typename Translator, 
    +               typename Allocator> 
    +        rtree< Value, Options, Translator, Allocator >::box_type 
    +        box(rtree< Value, Options, Translator, Allocator > const &);
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/index.html b/doc/html/index.html index 2db321f3a..4f963ee4f 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,12 +51,13 @@
    Nearest neighbours queries
    Exception safety
    +
    Reference
    - +

    Last revised: December 30, 2012 at 01:43:03 GMT

    Last revised: January 04, 2013 at 20:20:05 GMT


    diff --git a/doc/index.idx b/doc/index.idx new file mode 100644 index 000000000..b0cffe44e --- /dev/null +++ b/doc/index.idx @@ -0,0 +1,8 @@ +!scan "boost/geometry/extensions/index/rtree/rtree.hpp" +!scan "boost/geometry/extensions/index/predicates.hpp" +!scan "boost/geometry/extensions/index/distance_predicates.hpp" +!scan "boost/geometry/extensions/index/inserter.hpp" +!scan "boost/geometry/extensions/index/adaptors/nearest_query.hpp" +!scan "boost/geometry/extensions/index/adaptors/spatial_query.hpp" +!scan "boost/geometry/extensions/index/translator/def.hpp" +!scan "boost/geometry/extensions/index/translator/index.hpp" diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 4fe958312..a837ee4e2 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -17,4 +17,17 @@ [include rtree/nearest_query.qbk] [include rtree/exception_safety.qbk] +[include auto_index_helpers.qbk] + +[section:index Reference] + +[named_index class_name Class Index] +[named_index typedef_name Typedef Index] +[named_index function_name Function Index] +[/named_index macro_name Macro Index] +[/index] +[xinclude autodoc.xml] + +[endsect] + [endsect] diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 201c7dcad..b39c1fa63 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -104,9 +104,9 @@ private: public: /*! - The constructor. + Description: The constructor. - \note Exception-safety: nothrow + Exception-safety: nothrow \param parameters The parameters object. \param translator The translator object. @@ -122,9 +122,9 @@ public: {} /*! - The constructor. + Description: The constructor. - \note Exception-safety: strong + Exception-safety: strong \param first The beginning of the range of Values. \param last The end of the range of Values. @@ -153,9 +153,9 @@ public: } /*! - The constructor. + Description: The constructor. - \note Exception-safety: strong + Exception-safety: strong \param rng The range of Values. \param parameters The parameters object. @@ -183,9 +183,9 @@ public: } /*! - The destructor. + Description: The destructor. - \note Exception-safety: nothrow + Exception-safety: nothrow */ inline ~rtree() { @@ -193,9 +193,9 @@ public: } /*! - The copy constructor. + Description: The copy constructor. - \note Exception-safety: strong + Exception-safety: strong */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -211,9 +211,9 @@ public: } /*! - The copy constructor. + Description: The copy constructor. - \note Exception-safety: strong + Exception-safety: strong */ inline rtree(rtree const& src, Allocator const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -227,9 +227,9 @@ public: } /*! - The moving constructor. + Description: The moving constructor. - \note Exception-safety: nothrow + Exception-safety: nothrow */ inline rtree(BOOST_RV_REF(rtree) src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -245,9 +245,9 @@ public: } /*! - The assignment operator. + Description: The assignment operator. - \note Exception-safety: strong + Exception-safety: strong */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -263,9 +263,9 @@ public: } /*! - The moving assignment. + Description: The moving assignment. - \note Exception-safety: nothrow (if allocators are equal), + Exception-safety: nothrow (if allocators are equal), strong (if allocators aren't equal) */ inline rtree & operator=(BOOST_RV_REF(rtree) src) @@ -299,9 +299,9 @@ public: } /*! - Swaps two rtrees. + Description: Swaps two rtrees. - \note Exception-safety: nothrow + Exception-safety: nothrow \param other The other rtree. */ @@ -317,9 +317,9 @@ public: } /*! - Insert a value to the index. + Description: Insert a value to the index. - \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param value The value which will be stored in the container. @@ -333,9 +333,9 @@ public: } /*! - Insert a range of values to the index. + Description: Insert a range of values to the index. - \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param first The beginning of the range of values. @@ -352,9 +352,9 @@ public: } /*! - Insert a range of values to the index. + Description: Insert a range of values to the index. - \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param rng The range of values. @@ -371,10 +371,10 @@ public: } /*! - Remove a value from the container. In contrast to the STL set/map erase() method + Description: Remove a value from the container. In contrast to the STL set/map erase() method this method removes only one value from the container. - \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param value The value which will be removed from the container. @@ -387,12 +387,12 @@ public: } /*! - Remove a range of values from the container. In contrast to the STL set/map erase() method + Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. - \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param first The beginning of the range of values. @@ -410,11 +410,11 @@ public: } /*! - Remove a range of values from the container. In contrast to the STL set/map erase() method + Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values. - \note Exception-safety: not safe - if this operation throws, the R-tree may be left in + Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param rng The range of values. @@ -431,10 +431,10 @@ public: return result; } - /*! + /* Assign new elements to the rtree. This method replaces the content of the rtree. - \note Exception-safety: strong + Exception-safety: strong \param first The beginning of the range of values. \param last The end of the range of values. @@ -446,10 +446,10 @@ public: this->swap(foo); }*/ - /*! + /* Assign new elements to the rtree. This method replaces the content of the rtree. - \note Exception-safety: strong + Exception-safety: strong \param rng The range of values. */ @@ -461,9 +461,9 @@ public: }*/ /*! - Find values meeting spatial predicates, e.g. intersecting some box. + Description: Finds values meeting spatial predicates, e.g. intersecting some box. - \note Exception-safety: strong + Exception-safety: strong \param pred The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), @@ -493,9 +493,9 @@ public: } /*! - Find one value meeting distances predicates, e.g. nearest to some point. + Description: Finds one value meeting distances predicates, e.g. nearest to some point. - \note Exception-safety: strong + Exception-safety: strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -518,10 +518,10 @@ public: } /*! - Find one value meeting distances predicates and spatial predicates, + Description: Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some point and intersecting some box. - \note Exception-safety: strong + Exception-safety: strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -550,9 +550,9 @@ public: } /*! - Find k values meeting distances predicates, e.g. k nearest values to some point. + Description: Finds k values meeting distances predicates, e.g. k nearest values to some point. - \note Exception-safety: strong + Exception-safety: strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -575,10 +575,10 @@ public: } /*! - Find k values meeting distances predicates and spatial predicates, + Description: Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some point and intersecting some box. - \note Exception-safety: strong + Exception-safety: strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -608,9 +608,9 @@ public: } /*! - Returns the number of stored values. + Description: Returns the number of stored values. - \note Exception-safety: nothrow + Exception-safety: nothrow \return The number of stored values. */ @@ -620,9 +620,9 @@ public: } /*! - Query if the container is empty. + Description: Query if the container is empty. - \note Exception-safety: nothrow + Exception-safety: nothrow \return true if the container is empty. */ @@ -632,9 +632,9 @@ public: } /*! - Removes all values stored in the container. + Description: Removes all values stored in the container. - \note Exception-safety: nothrow. + Exception-safety: nothrow. */ inline void clear() { @@ -642,10 +642,10 @@ public: } /*! - Returns the box containing all values stored in the container. + Description: Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned. - \note Exception-safety: nothrow (if Indexable's CoordinateType copy assignment doesn't throw), + Exception-safety: nothrow (if Indexable's CoordinateType copy assignment doesn't throw), strong (if Indexable's CoordinateType copy assignment throws). \return The box containing all values stored in the container or an invalid box if @@ -669,10 +669,10 @@ public: } /*! - For indexable_type it returns the number of values which indexables equals the parameter. + Description: For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter. - \note Exception-safety: nothrow. + Exception-safety: nothrow. \param The value or indexable which will be counted. @@ -693,9 +693,9 @@ public: } /*! - Returns parameters. + Description: Returns parameters. - \note Exception-safety: nothrow. + Exception-safety: nothrow. \return The parameters object. */ @@ -705,9 +705,9 @@ public: } /*! - Returns the translator object. + Description: Returns the translator object. - \note Exception-safety: nothrow. + Exception-safety: nothrow. \return The translator object. */ @@ -717,9 +717,9 @@ public: } /*! - Returns allocator used by the rtree. + Description: Returns allocator used by the rtree. - \note Exception-safety: nothrow + Exception-safety: nothrow \return The allocator. */ @@ -732,11 +732,11 @@ public: private: #endif /*! - Apply a visitor to the nodes structure in order to perform some operator. + Description: Apply a visitor to the nodes structure in order to perform some operator. This function is not a part of the 'official' interface. However it makes possible e.g. to pass a visitor drawing the tree structure. - \note Exception-safety: the same as Visitor::operator(). + Exception-safety: the same as Visitor::operator(). \param visitor The visitor object. */ @@ -748,10 +748,10 @@ private: } /*! - Returns the number of stored objects. Same as size() + Description: Returns the number of stored objects. Same as size() This function is not a part of the 'official' interface. - \note Exception-safety: nothrow + Exception-safety: nothrow \return The number of stored objects. */ @@ -761,10 +761,10 @@ private: } /*! - Returns the depth of the R-tree. + Description: Returns the depth of the R-tree. This function is not a part of the 'official' interface. - \note Exception-safety: nothrow. + Exception-safety: nothrow. \return The depth of the R-tree. */ @@ -775,9 +775,9 @@ private: private: /*! - Insert a value to the index. Root node must exist. + Description: Insert a value to the index. Root node must exist. - \note Exception-safety: basic + Exception-safety: basic \param value The value which will be stored in the container. */ @@ -804,9 +804,9 @@ private: } /*! - Remove the value from the container. + Description: Remove the value from the container. - \note Exception-safety: basic + Exception-safety: basic \param value The value which will be removed from the container. */ @@ -834,9 +834,9 @@ private: } /*! - Create an empty R-tree i.e. new empty root node and clear other attributes. + Description: Create an empty R-tree i.e. new empty root node and clear other attributes. - \note Exception-safety: strong. + Exception-safety: strong. */ inline void raw_create() { @@ -848,9 +848,9 @@ private: } /*! - Destroy the R-tree i.e. all nodes and clear attributes. + Description: Destroy the R-tree i.e. all nodes and clear attributes. - \note Exception-safety: nothrow. + Exception-safety: nothrow. \param t The container which is going to be destroyed. */ @@ -868,10 +868,10 @@ private: } /*! - Copy the R-tree i.e. whole nodes structure, values and other attributes. + Description: 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. + Exception-safety: strong. \param src The source R-tree. \param dst The destination R-tree. @@ -904,9 +904,9 @@ private: } /*! - Find one value meeting distances and spatial predicates. + Description: Find one value meeting distances and spatial predicates. - \note Exception-safety: strong. + Exception-safety: strong. */ template inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -942,9 +942,9 @@ private: } /*! - Find k values meeting distances and spatial predicates. + Description: Find k values meeting distances and spatial predicates. - \note Exception-safety: strong. + Exception-safety: strong. */ template inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const @@ -989,7 +989,7 @@ private: }; /*! -Insert a value to the index. +Description: Insert a value to the index. \param tree The spatial index. \param v The value which will be stored in the index. @@ -1001,7 +1001,7 @@ inline void insert(rtree & tree, Value co } /*! -Insert a range of values to the index. +Description: Insert a range of values to the index. \param tree The spatial index. \param first The beginning of the range of values. @@ -1014,7 +1014,7 @@ inline void insert(rtree & tree, Iterator } /*! -Insert a range of values to the index. +Description: Insert a range of values to the index. \param tree The spatial index. \param rng The range of values. @@ -1026,7 +1026,7 @@ inline void insert(rtree & tree, Range co } /*! -Remove a value from the container. In contrast to the STL set/map erase() method +Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container. \param tree The spatial index. @@ -1042,7 +1042,7 @@ remove(rtree & tree, Value const& v) } /*! -Remove a range of values from the container. In contrast to the STL set/map erase() method +Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. @@ -1061,7 +1061,7 @@ remove(rtree & tree, Iterator first, Iter } /*! -Remove a range of values from the container. In contrast to the STL set/map erase() method +Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. @@ -1078,7 +1078,7 @@ remove(rtree & tree, Range const& rng) } /*! -Find values meeting spatial predicates. +Description: Find values meeting spatial predicates. \param tree The spatial index. \param pred The spatial predicates. @@ -1093,7 +1093,7 @@ inline size_t spatial_query(rtree const& } /*! -Find the value meeting distances predicates. +Description: Find the value meeting distances predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1108,7 +1108,7 @@ inline size_t nearest_query(rtree const& } /*! -Find the value meeting distances and spatial predicates. +Description: Find the value meeting distances and spatial predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1124,7 +1124,7 @@ inline size_t nearest_query(rtree const& } /*! -Find k values meeting distances predicates. +Description: Find k values meeting distances predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1140,7 +1140,7 @@ inline size_t nearest_query(rtree const& } /*! -Find k values meeting distances and spatial predicates. +Description: Find k values meeting distances and spatial predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1157,7 +1157,7 @@ inline size_t nearest_query(rtree const& } /*! -Remove all values from the index. +Description: Remove all values from the index. \param tree The spatial index. */ @@ -1168,7 +1168,7 @@ inline void clear(rtree & tree) } /*! -Get the number of values stored in the index. +Description: Get the number of values stored in the index. \param tree The spatial index. @@ -1181,7 +1181,7 @@ inline size_t size(rtree const& tree) } /*! -Query if there are no values stored in the index. +Description: Query if there are no values stored in the index. \param tree The spatial index. @@ -1194,7 +1194,7 @@ inline bool empty(rtree const& tree) } /*! -Get the box containing all stored values or an invalid box if the index has no values. +Description: Get the box containing all stored values or an invalid box if the index has no values. \param tree The spatial index. From fa55322ddc5b0449f02e7f23889ec959e7931c84 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 6 Jan 2013 00:58:54 +0000 Subject: [PATCH 246/366] Fixed error in nearest_query() - for Iterator which is not an inserter - operator++ call added. [SVN r82371] --- .../geometry/extensions/index/rtree/rtree.hpp | 9 ++++---- .../index/rtree/visitors/nearest_query.hpp | 22 +++++++++---------- test/rtree/test_rtree.hpp | 6 +++++ tests/additional_speed.cpp | 18 ++++++++++++++- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index b39c1fa63..42d93477c 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -938,7 +938,7 @@ private: detail::rtree::apply_visitor(nearest_v, *m_root); - return result.get(v); + return result.finish(); } /*! @@ -958,10 +958,11 @@ private: typedef detail::rtree::visitors::nearest_query_result_k< value_type, translator_type, - point_type + point_type, + OutIter > result_type; - result_type result(k); + result_type result(k, out_it); detail::rtree::visitors::nearest_query< value_type, @@ -976,7 +977,7 @@ private: detail::rtree::apply_visitor(nearest_v, *m_root); - return result.get(out_it); + return result.finish(); } translator_type m_translator; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp index b48aac667..e269fa1ce 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp @@ -33,7 +33,7 @@ public: typename translator::indexable_type::type >::type distance_type; - inline nearest_query_result_one(Value const& value) + inline nearest_query_result_one(Value & value) : m_value(value) , m_comp_dist((std::numeric_limits::max)()) {} @@ -57,18 +57,17 @@ public: return m_comp_dist; } - inline size_t get(Value & v) + inline size_t finish() { - v = m_value; return is_comparable_distance_valid() ? 1 : 0; } private: - Value m_value; + Value & m_value; distance_type m_comp_dist; }; -template +template struct nearest_query_result_k { public: @@ -77,8 +76,8 @@ public: typename translator::indexable_type::type >::type distance_type; - inline explicit nearest_query_result_k(size_t k) - : m_count(k) + inline explicit nearest_query_result_k(size_t k, OutIt out_it) + : m_count(k), m_out_it(out_it) { BOOST_GEOMETRY_INDEX_ASSERT(0 < m_count, "Number of neighbors should be greater than 0"); @@ -122,12 +121,11 @@ public: : m_neighbors.front().first; } - template - inline size_t get(OutIter & out_it) + inline size_t finish() { typedef typename std::vector< std::pair >::const_iterator neighbors_iterator; - for ( neighbors_iterator it = m_neighbors.begin() ; it != m_neighbors.end() ; ++it ) - *out_it = it->second; + for ( neighbors_iterator it = m_neighbors.begin() ; it != m_neighbors.end() ; ++it, ++m_out_it ) + *m_out_it = it->second; return m_neighbors.size(); } @@ -141,6 +139,8 @@ private: } size_t m_count; + OutIt m_out_it; + std::vector< std::pair > m_neighbors; distance_type m_biggest_comp_dist; }; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 0593c76c1..12a18be8e 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -857,6 +857,12 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P } test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::nearest_queried(pt, k)); + + std::vector output2(k, generate_value_default::apply()); + size_t found_count = rtree.nearest_query(pt, k, output2.begin()); + output2.resize(found_count, generate_value_default::apply()); + + test_exactly_the_same_outputs(rtree, output, output2); } // rtree nearest not found diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 623a7b57e..5ed9f558d 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -94,6 +94,7 @@ int main() std::vector result; result.reserve(100); + B result_one; // query test { @@ -117,7 +118,7 @@ int main() // searching test { - std::cout << "nearest 5 searching time test... (" + std::cout << "nearest 10 searching time test... (" << queries_count / 10 << ")\n"; tim.restart(); size_t temp = 0; @@ -131,6 +132,21 @@ int main() std::cout << "time: " << tim.elapsed() << "s\n"; std::cout << "found: " << temp << "\n"; } + + { + std::cout << "nearest 1 searching time test... (" + << queries_count / 10 << ")\n"; + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + temp += t.nearest_query(P(x, y), result_one); + } + std::cout << "time: " << tim.elapsed() << "s\n"; + std::cout << "found: " << temp << "\n"; + } } return 0; From 1f3612c9e4eb901dcf782907a4dbe8b766ec590e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 01:00:02 +0000 Subject: [PATCH 247/366] doxygen_xml2qbk used to build the rtree reference [SVN r82379] --- doc/Doxyfile | 1826 +++++++++++++++++ doc/Jamfile.v2 | 56 +- doc/html/boost/geometry/index/box.html | 84 - doc/html/boost/geometry/index/clear.html | 77 - doc/html/boost/geometry/index/empty.html | 84 - .../boost/geometry/index/insert_id265665.html | 84 - .../boost/geometry/index/insert_id265715.html | 88 - .../boost/geometry/index/insert_id265778.html | 84 - .../boost/geometry/index/insert_id274403.html | 84 - .../boost/geometry/index/insert_id274453.html | 88 - .../boost/geometry/index/insert_id274516.html | 84 - .../boost/geometry/index/insert_id278981.html | 84 - .../boost/geometry/index/insert_id279031.html | 88 - .../boost/geometry/index/insert_id279094.html | 84 - .../boost/geometry/index/insert_id322710.html | 84 - .../boost/geometry/index/insert_id322760.html | 88 - .../boost/geometry/index/insert_id322823.html | 84 - .../index/nearest_query_id266086.html | 95 - .../index/nearest_query_id266152.html | 101 - .../index/nearest_query_id266231.html | 100 - .../index/nearest_query_id266309.html | 105 - .../index/nearest_query_id274824.html | 95 - .../index/nearest_query_id274890.html | 101 - .../index/nearest_query_id274969.html | 100 - .../index/nearest_query_id275047.html | 105 - .../index/nearest_query_id279402.html | 95 - .../index/nearest_query_id279468.html | 101 - .../index/nearest_query_id279547.html | 100 - .../index/nearest_query_id279625.html | 105 - .../index/nearest_query_id323131.html | 95 - .../index/nearest_query_id323197.html | 101 - .../index/nearest_query_id323276.html | 100 - .../index/nearest_query_id323354.html | 105 - .../boost/geometry/index/remove_id265832.html | 92 - .../boost/geometry/index/remove_id265888.html | 96 - .../boost/geometry/index/remove_id265956.html | 92 - .../boost/geometry/index/remove_id274570.html | 92 - .../boost/geometry/index/remove_id274626.html | 96 - .../boost/geometry/index/remove_id274694.html | 92 - .../boost/geometry/index/remove_id279148.html | 92 - .../boost/geometry/index/remove_id279204.html | 96 - .../boost/geometry/index/remove_id279272.html | 92 - .../boost/geometry/index/remove_id322877.html | 92 - .../boost/geometry/index/remove_id322933.html | 96 - .../boost/geometry/index/remove_id323001.html | 92 - doc/html/boost/geometry/index/rtree.html | 1083 ---------- doc/html/boost/geometry/index/size.html | 84 - .../boost/geometry/index/spatial_query.html | 95 - doc/html/geometry_index/r_tree.html | 7 +- doc/html/geometry_index/r_tree/index.html | 1318 +++++++++--- doc/html/index.html | 2 +- doc/index.idx | 8 - doc/make_qbk.py | 21 + doc/rtree.qbk | 9 +- .../geometry/extensions/index/rtree/rtree.hpp | 196 +- 55 files changed, 2972 insertions(+), 5726 deletions(-) create mode 100644 doc/Doxyfile delete mode 100644 doc/html/boost/geometry/index/box.html delete mode 100644 doc/html/boost/geometry/index/clear.html delete mode 100644 doc/html/boost/geometry/index/empty.html delete mode 100644 doc/html/boost/geometry/index/insert_id265665.html delete mode 100644 doc/html/boost/geometry/index/insert_id265715.html delete mode 100644 doc/html/boost/geometry/index/insert_id265778.html delete mode 100644 doc/html/boost/geometry/index/insert_id274403.html delete mode 100644 doc/html/boost/geometry/index/insert_id274453.html delete mode 100644 doc/html/boost/geometry/index/insert_id274516.html delete mode 100644 doc/html/boost/geometry/index/insert_id278981.html delete mode 100644 doc/html/boost/geometry/index/insert_id279031.html delete mode 100644 doc/html/boost/geometry/index/insert_id279094.html delete mode 100644 doc/html/boost/geometry/index/insert_id322710.html delete mode 100644 doc/html/boost/geometry/index/insert_id322760.html delete mode 100644 doc/html/boost/geometry/index/insert_id322823.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id266086.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id266152.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id266231.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id266309.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id274824.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id274890.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id274969.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id275047.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id279402.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id279468.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id279547.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id279625.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id323131.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id323197.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id323276.html delete mode 100644 doc/html/boost/geometry/index/nearest_query_id323354.html delete mode 100644 doc/html/boost/geometry/index/remove_id265832.html delete mode 100644 doc/html/boost/geometry/index/remove_id265888.html delete mode 100644 doc/html/boost/geometry/index/remove_id265956.html delete mode 100644 doc/html/boost/geometry/index/remove_id274570.html delete mode 100644 doc/html/boost/geometry/index/remove_id274626.html delete mode 100644 doc/html/boost/geometry/index/remove_id274694.html delete mode 100644 doc/html/boost/geometry/index/remove_id279148.html delete mode 100644 doc/html/boost/geometry/index/remove_id279204.html delete mode 100644 doc/html/boost/geometry/index/remove_id279272.html delete mode 100644 doc/html/boost/geometry/index/remove_id322877.html delete mode 100644 doc/html/boost/geometry/index/remove_id322933.html delete mode 100644 doc/html/boost/geometry/index/remove_id323001.html delete mode 100644 doc/html/boost/geometry/index/rtree.html delete mode 100644 doc/html/boost/geometry/index/size.html delete mode 100644 doc/html/boost/geometry/index/spatial_query.html delete mode 100644 doc/index.idx create mode 100755 doc/make_qbk.py diff --git a/doc/Doxyfile b/doc/Doxyfile new file mode 100644 index 000000000..80d257bf0 --- /dev/null +++ b/doc/Doxyfile @@ -0,0 +1,1826 @@ +# Doxyfile 1.8.1.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../boost/geometry/extensions/index/rtree/rtree.hpp + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html_by_doxygen + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# style sheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = YES + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50% before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 94f0c55a1..8df28439c 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -8,56 +8,16 @@ project geometry_index/doc ; -import doxygen ; import boostbook ; import quickbook ; -using auto-index ; - -path-constant images_location : html ; -path-constant here : . ; - -doxygen autodoc - : - [ glob - ../boost/geometry/extensions/index/rtree/rtree.hpp -# ../boost/geometry/extensions/index/predicates.hpp -# ../boost/geometry/extensions/index/distance_predicates.hpp -# ../boost/geometry/extensions/index/inserter.hpp -# ../boost/geometry/extensions/index/adaptors/nearest_query.hpp -# ../boost/geometry/extensions/index/adaptors/spatial_query.hpp -# ../boost/geometry/extensions/index/translator/def.hpp -# ../boost/geometry/extensions/index/translator/index.hpp - ] - : - EXTRACT_ALL=NO - EXTRACT_PRIVATE=NO - HIDE_UNDOC_MEMBERS=YES - HIDE_UNDOC_CLASSES=YES - ENABLE_PREPROCESSING=YES - EXPAND_ONLY_PREDEF=YES - MACRO_EXPANSION=YES - "PREDEFINED=\"BOOST_RV_REF(T)=T &&\" \\ - \"BOOST_RV_REF_BEG=\" \\ - \"BOOST_RV_REF_END=&&\" \\ - \"BOOST_COPY_ASSIGN_REF(T)=const T &\" \\ - \"BOOST_RV_REF_2_TEMPL_ARGS(T,a,b)=T &&\" \\ - \"BOOST_RV_REF_3_TEMPL_ARGS(T,a,b,c)=TT &&\" \\ - \"BOOST_FWD_REF(a)=a &&\"" - "boost.doxygen.reftitle=Header Reference" - ; - -xml index : index.qbk - : - ../../tools/auto_index/include - ; - boostbook geometry_index-doc : - index + index.qbk : Jamfile.v2 - + generated/rtree.qbk + html pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html chunk.section.depth=2 @@ -66,15 +26,7 @@ boostbook geometry_index-doc toc.max.depth=2 generate.section.toc.level=4 boost.root=http://www.boost.org/doc/libs/release - - autodoc - on - on - pdf:off - html:on - $(here)/index.idx - "$(here)/.." - + enable_index $(here) ; diff --git a/doc/html/boost/geometry/index/box.html b/doc/html/boost/geometry/index/box.html deleted file mode 100644 index 5d3b98acc..000000000 --- a/doc/html/boost/geometry/index/box.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template box - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHome -
    -
    -
    -
    -

    Function template box

    -

    boost::geometry::index::box

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  rtree< Value, Options, Translator, Allocator >::box_type 
    -  box(rtree< Value, Options, Translator, Allocator > const & tree);
    -
    -

    Description

    -

    Description: Get the box containing all stored values or an invalid box if the index has no values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - -

    tree

    The spatial index.

    Returns:

    The box containing all stored values or an invalid box.

    -
    -
    - - - -
    -
    -
    -PrevUpHome -
    - - diff --git a/doc/html/boost/geometry/index/clear.html b/doc/html/boost/geometry/index/clear.html deleted file mode 100644 index ff33614fd..000000000 --- a/doc/html/boost/geometry/index/clear.html +++ /dev/null @@ -1,77 +0,0 @@ - - - -Function template clear - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template clear

    -

    boost::geometry::index::clear

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  void clear(rtree< Value, Options, Translator, Allocator > & tree);
    -
    -

    Description

    -

    Description: Remove all values from the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - -

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/empty.html b/doc/html/boost/geometry/index/empty.html deleted file mode 100644 index ad69355a4..000000000 --- a/doc/html/boost/geometry/index/empty.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template empty - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template empty

    -

    boost::geometry::index::empty

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  bool empty(rtree< Value, Options, Translator, Allocator > const & tree);
    -
    -

    Description

    -

    Description: Query if there are no values stored in the index.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - -

    tree

    The spatial index.

    Returns:

    true if there are no values in the index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id265665.html b/doc/html/boost/geometry/index/insert_id265665.html deleted file mode 100644 index c6a038d1f..000000000 --- a/doc/html/boost/geometry/index/insert_id265665.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Value const & v);
    -
    -

    Description

    -

    Description: Insert a value to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id265715.html b/doc/html/boost/geometry/index/insert_id265715.html deleted file mode 100644 index 127367946..000000000 --- a/doc/html/boost/geometry/index/insert_id265715.html +++ /dev/null @@ -1,88 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id265778.html b/doc/html/boost/geometry/index/insert_id265778.html deleted file mode 100644 index 1464dde23..000000000 --- a/doc/html/boost/geometry/index/insert_id265778.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Range const & rng);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id274403.html b/doc/html/boost/geometry/index/insert_id274403.html deleted file mode 100644 index 1a7819d7c..000000000 --- a/doc/html/boost/geometry/index/insert_id274403.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Value const & v);
    -
    -

    Description

    -

    Description: Insert a value to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id274453.html b/doc/html/boost/geometry/index/insert_id274453.html deleted file mode 100644 index e79e1d719..000000000 --- a/doc/html/boost/geometry/index/insert_id274453.html +++ /dev/null @@ -1,88 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id274516.html b/doc/html/boost/geometry/index/insert_id274516.html deleted file mode 100644 index 3afa7785f..000000000 --- a/doc/html/boost/geometry/index/insert_id274516.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Range const & rng);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id278981.html b/doc/html/boost/geometry/index/insert_id278981.html deleted file mode 100644 index 63d268a49..000000000 --- a/doc/html/boost/geometry/index/insert_id278981.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Value const & v);
    -
    -

    Description

    -

    Description: Insert a value to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id279031.html b/doc/html/boost/geometry/index/insert_id279031.html deleted file mode 100644 index 24867e2c1..000000000 --- a/doc/html/boost/geometry/index/insert_id279031.html +++ /dev/null @@ -1,88 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id279094.html b/doc/html/boost/geometry/index/insert_id279094.html deleted file mode 100644 index b3f0756fa..000000000 --- a/doc/html/boost/geometry/index/insert_id279094.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Range const & rng);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id322710.html b/doc/html/boost/geometry/index/insert_id322710.html deleted file mode 100644 index cae00e49e..000000000 --- a/doc/html/boost/geometry/index/insert_id322710.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Value const & v);
    -
    -

    Description

    -

    Description: Insert a value to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be stored in the index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id322760.html b/doc/html/boost/geometry/index/insert_id322760.html deleted file mode 100644 index 08e77859d..000000000 --- a/doc/html/boost/geometry/index/insert_id322760.html +++ /dev/null @@ -1,88 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/insert_id322823.html b/doc/html/boost/geometry/index/insert_id322823.html deleted file mode 100644 index 9baad1c89..000000000 --- a/doc/html/boost/geometry/index/insert_id322823.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template insert - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template insert

    -

    boost::geometry::index::insert

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  void insert(rtree< Value, Options, Translator, Allocator > & tree, 
    -              Range const & rng);
    -
    -

    Description

    -

    Description: Insert a range of values to the index.

    -

    -

    -
    ---- - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id266086.html b/doc/html/boost/geometry/index/nearest_query_id266086.html deleted file mode 100644 index 441928484..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id266086.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id266152.html b/doc/html/boost/geometry/index/nearest_query_id266152.html deleted file mode 100644 index 3e6cf22b8..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id266152.html +++ /dev/null @@ -1,101 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, 
    -                       Predicates const & pred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id266231.html b/doc/html/boost/geometry/index/nearest_query_id266231.html deleted file mode 100644 index 6f55c6bb0..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id266231.html +++ /dev/null @@ -1,100 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id266309.html b/doc/html/boost/geometry/index/nearest_query_id266309.html deleted file mode 100644 index 91e32202b..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id266309.html +++ /dev/null @@ -1,105 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       Predicates const & pred, OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id274824.html b/doc/html/boost/geometry/index/nearest_query_id274824.html deleted file mode 100644 index 82b6377eb..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id274824.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id274890.html b/doc/html/boost/geometry/index/nearest_query_id274890.html deleted file mode 100644 index 858472205..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id274890.html +++ /dev/null @@ -1,101 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, 
    -                       Predicates const & pred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id274969.html b/doc/html/boost/geometry/index/nearest_query_id274969.html deleted file mode 100644 index ba99082f0..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id274969.html +++ /dev/null @@ -1,100 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id275047.html b/doc/html/boost/geometry/index/nearest_query_id275047.html deleted file mode 100644 index 4d1773475..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id275047.html +++ /dev/null @@ -1,105 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       Predicates const & pred, OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id279402.html b/doc/html/boost/geometry/index/nearest_query_id279402.html deleted file mode 100644 index 23c8db313..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id279402.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id279468.html b/doc/html/boost/geometry/index/nearest_query_id279468.html deleted file mode 100644 index 25dca712e..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id279468.html +++ /dev/null @@ -1,101 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, 
    -                       Predicates const & pred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id279547.html b/doc/html/boost/geometry/index/nearest_query_id279547.html deleted file mode 100644 index a4140c00e..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id279547.html +++ /dev/null @@ -1,100 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id279625.html b/doc/html/boost/geometry/index/nearest_query_id279625.html deleted file mode 100644 index 95752f7be..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id279625.html +++ /dev/null @@ -1,105 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       Predicates const & pred, OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id323131.html b/doc/html/boost/geometry/index/nearest_query_id323131.html deleted file mode 100644 index 12f91686b..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id323131.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id323197.html b/doc/html/boost/geometry/index/nearest_query_id323197.html deleted file mode 100644 index 16abce230..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id323197.html +++ /dev/null @@ -1,101 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, 
    -                       Predicates const & pred, Value & v);
    -
    -

    Description

    -

    Description: Find the value meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    pred

    The spatial predicates.

    tree

    The spatial index.

    v

    The result.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id323276.html b/doc/html/boost/geometry/index/nearest_query_id323276.html deleted file mode 100644 index cdb396b7b..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id323276.html +++ /dev/null @@ -1,100 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/nearest_query_id323354.html b/doc/html/boost/geometry/index/nearest_query_id323354.html deleted file mode 100644 index ac96d5fca..000000000 --- a/doc/html/boost/geometry/index/nearest_query_id323354.html +++ /dev/null @@ -1,105 +0,0 @@ - - - -Function template nearest_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template nearest_query

    -

    boost::geometry::index::nearest_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename DistancesPredicates, 
    -         typename Predicates, typename OutIter> 
    -  size_t nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       DistancesPredicates const & dpred, size_t k, 
    -                       Predicates const & pred, OutIter out_it);
    -
    -

    Description

    -

    Description: Find k values meeting distances and spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - - - - - - - - - -

    dpred

    The distances predicates.

    k

    The max number of values.

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id265832.html b/doc/html/boost/geometry/index/remove_id265832.html deleted file mode 100644 index 06ec821a5..000000000 --- a/doc/html/boost/geometry/index/remove_id265832.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Value const & v);
    -
    -

    Description

    -

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id265888.html b/doc/html/boost/geometry/index/remove_id265888.html deleted file mode 100644 index a4123ae4c..000000000 --- a/doc/html/boost/geometry/index/remove_id265888.html +++ /dev/null @@ -1,96 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id265956.html b/doc/html/boost/geometry/index/remove_id265956.html deleted file mode 100644 index d470b3a05..000000000 --- a/doc/html/boost/geometry/index/remove_id265956.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Range const & rng);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id274570.html b/doc/html/boost/geometry/index/remove_id274570.html deleted file mode 100644 index d995e2ee2..000000000 --- a/doc/html/boost/geometry/index/remove_id274570.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Value const & v);
    -
    -

    Description

    -

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id274626.html b/doc/html/boost/geometry/index/remove_id274626.html deleted file mode 100644 index e0eb6c289..000000000 --- a/doc/html/boost/geometry/index/remove_id274626.html +++ /dev/null @@ -1,96 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id274694.html b/doc/html/boost/geometry/index/remove_id274694.html deleted file mode 100644 index 4940b5ff6..000000000 --- a/doc/html/boost/geometry/index/remove_id274694.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Range const & rng);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id279148.html b/doc/html/boost/geometry/index/remove_id279148.html deleted file mode 100644 index 5a5006716..000000000 --- a/doc/html/boost/geometry/index/remove_id279148.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Value const & v);
    -
    -

    Description

    -

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id279204.html b/doc/html/boost/geometry/index/remove_id279204.html deleted file mode 100644 index f29defa19..000000000 --- a/doc/html/boost/geometry/index/remove_id279204.html +++ /dev/null @@ -1,96 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id279272.html b/doc/html/boost/geometry/index/remove_id279272.html deleted file mode 100644 index 2c87e10d2..000000000 --- a/doc/html/boost/geometry/index/remove_id279272.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Range const & rng);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id322877.html b/doc/html/boost/geometry/index/remove_id322877.html deleted file mode 100644 index 14c0c65c3..000000000 --- a/doc/html/boost/geometry/index/remove_id322877.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Value const & v);
    -
    -

    Description

    -

    Description: Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    tree

    The spatial index.

    v

    The value which will be removed from the index.

    Returns:

    1 if value was removed, 0 otherwise.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id322933.html b/doc/html/boost/geometry/index/remove_id322933.html deleted file mode 100644 index 8ffa40f33..000000000 --- a/doc/html/boost/geometry/index/remove_id322933.html +++ /dev/null @@ -1,96 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Iterator> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Iterator first, Iterator last);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    first

    The beginning of the range of values.

    last

    The end of the range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/remove_id323001.html b/doc/html/boost/geometry/index/remove_id323001.html deleted file mode 100644 index 91f526b02..000000000 --- a/doc/html/boost/geometry/index/remove_id323001.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Function template remove - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template remove

    -

    boost::geometry::index::remove

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Range> 
    -  rtree< Value, Options, Translator, Allocator >::size_type 
    -  remove(rtree< Value, Options, Translator, Allocator > & tree, 
    -         Range const & rng);
    -
    -

    Description

    -

    Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - -

    rng

    The range of values.

    tree

    The spatial index.

    Returns:

    The number of removed values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/rtree.html b/doc/html/boost/geometry/index/rtree.html deleted file mode 100644 index 72105ae76..000000000 --- a/doc/html/boost/geometry/index/rtree.html +++ /dev/null @@ -1,1083 +0,0 @@ - - - -Class template rtree - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Class template rtree

    -

    boost::geometry::index::rtree

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -template<typename Value, typename Parameters, 
    -         typename Translator = translator::def<Value>, 
    -         typename Allocator = std::allocator<Value> > 
    -class rtree {
    -public:
    -  // types
    -  typedef Value                                           value_type;     
    -  typedef Parameters                                      parameters_type;
    -  typedef Translator                                      translator_type;
    -  typedef Allocator                                       allocator_type; 
    -  typedef allocator_type::size_type                       size_type;      
    -  typedef translator::indexable_type< Translator >::type  indexable_type; 
    -  typedef index::default_box_type< indexable_type >::type box_type;       
    -
    -  // construct/copy/destruct
    -  explicit rtree(Parameters = Parameters(), 
    -                 translator_type const & = translator_type(), 
    -                 Allocator = Allocator());
    -  template<typename Iterator> 
    -    rtree(Iterator, Iterator, Parameters = Parameters(), 
    -          translator_type const & = translator_type(), 
    -          Allocator = std::allocator< value_type >());
    -  template<typename Range> 
    -    rtree(Range const &, Parameters = Parameters(), 
    -          translator_type const & = translator_type(), 
    -          Allocator = std::allocator< value_type >());
    -  rtree(rtree const &);
    -  rtree(rtree const &, Allocator const &);
    -  rtree(rtree &&);
    -  rtree& operator=(const rtree &);
    -  rtree& operator=(rtree &&);
    -  ~rtree();
    -
    -  // public member functions
    -  void swap(rtree &);
    -  void insert(value_type const &);
    -  template<typename Iterator> void insert(Iterator, Iterator);
    -  template<typename Range> void insert(Range const &);
    -  size_type remove(value_type const &);
    -  template<typename Iterator> size_type remove(Iterator, Iterator);
    -  template<typename Range> size_type remove(Range const &);
    -  template<typename Predicates, typename OutIter> 
    -    size_type spatial_query(Predicates const &, OutIter) const;
    -  template<typename DistancesPredicates> 
    -    size_type nearest_query(DistancesPredicates const &, value_type &) const;
    -  template<typename DistancesPredicates, typename Predicates> 
    -    size_type nearest_query(DistancesPredicates const &, Predicates const &, 
    -                            value_type &) const;
    -  template<typename DistancesPredicates, typename OutIter> 
    -    size_type nearest_query(DistancesPredicates const &, size_t, OutIter) const;
    -  template<typename DistancesPredicates, typename Predicates, 
    -           typename OutIter> 
    -    size_type nearest_query(DistancesPredicates const &, size_t, 
    -                            Predicates const &, OutIter) const;
    -  size_type size() const;
    -  bool empty() const;
    -  void clear();
    -  box_type box() const;
    -  template<typename ValueOrIndexable> 
    -    size_type count(ValueOrIndexable const &) const;
    -  parameters_type const & parameters() const;
    -  translator_type const & translator() const;
    -  allocator_type get_allocator() const;
    -
    -  // private member functions
    -  template<typename Visitor> void apply_visitor(Visitor &) const;
    -  size_type values_count() const;
    -  size_type depth() const;
    -  void raw_insert(value_type const &);
    -  size_type raw_remove(value_type const &);
    -  void raw_create();
    -  void raw_destroy(rtree &);
    -  void raw_copy(rtree const &, rtree &, bool) const;
    -  template<typename DistancesPredicates, typename Predicates> 
    -    size_type raw_nearest_one(DistancesPredicates const &, Predicates const &, 
    -                              value_type &) const;
    -  template<typename DistancesPredicates, typename Predicates, 
    -           typename OutIter> 
    -    size_type raw_nearest_k(DistancesPredicates const &, size_t, 
    -                            Predicates const &, OutIter) const;
    -};
    -
    -

    Description

    -

    The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms.

    -

    -

    -
    -

    Template Parameters

    -
      -
    1. -
      typename Value
      -

      The type of objects stored in the container.

      -
    2. -
    3. -
      typename Parameters
      -

      Compile-time parameters. The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with compile-time parameters like min and max number of elements in node. Predefined Algorithms/Parameters are: bgi::linear<MinElements, MaxElements>, bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements * 0.3>.

      -
    4. -
    5. -
      typename Translator = translator::def<Value>
      -

      The type of the translator which translates from Value to Indexable. This translation is done each time the r-tree wants to know Value's Indexable. Default translator can translate all types adapted to Point or Box concepts (which are Indexables). It also handles std::pair<Indexable, T>, pointers, smart pointers, and iterators. E.g. If std::pair<Box, int> is stored, the default translator translates from std::pair<Box, int> const& to Box const&.

      -
    6. -
    7. -
      typename Allocator = std::allocator<Value>
      -

      The allocator.

      -
    8. -
    -
    -
    -

    -rtree - public - construct/copy/destruct

    -
      -
    1. -
      explicit rtree(Parameters parameters = Parameters(), 
      -               translator_type const & translator = translator_type(), 
      -               Allocator allocator = Allocator());
      -

      Description: The constructor.

      -

      Exception-safety: nothrow

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - - - - - - - - - - - -

      allocator

      The allocator object.

      parameters

      The parameters object.

      translator

      The translator object.

      -
    2. -
    3. -
      template<typename Iterator> 
      -  rtree(Iterator first, Iterator last, Parameters parameters = Parameters(), 
      -        translator_type const & translator = translator_type(), 
      -        Allocator allocator = std::allocator< value_type >());
      -

      Description: The constructor.

      -

      Exception-safety: strong

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - - - - - - - - - - - - - - - - - - - -

      allocator

      The allocator object.

      first

      The beginning of the range of Values.

      last

      The end of the range of Values.

      parameters

      The parameters object.

      translator

      The translator object.

      -
    4. -
    5. -
      template<typename Range> 
      -  rtree(Range const & rng, Parameters parameters = Parameters(), 
      -        translator_type const & translator = translator_type(), 
      -        Allocator allocator = std::allocator< value_type >());
      -

      Description: The constructor.

      -

      Exception-safety: strong

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - - - - - - - - - - - - - - - -

      allocator

      The allocator object.

      parameters

      The parameters object.

      rng

      The range of Values.

      translator

      The translator object.

      -
    6. -
    7. -
      rtree(rtree const & src);
      -

      Description: The copy constructor.

      -

      Exception-safety: strong

      -
    8. -
    9. -
      rtree(rtree const & src, Allocator const & allocator);
      -

      Description: The copy constructor.

      -

      Exception-safety: strong

      -
    10. -
    11. -
      rtree(rtree && src);
      -

      Description: The moving constructor.

      -

      Exception-safety: nothrow

      -
    12. -
    13. -
      rtree& operator=(const rtree & src);
      -

      Description: The assignment operator.

      -

      Exception-safety: strong

      -
    14. -
    15. -
      rtree& operator=(rtree && src);
      -

      Description: The moving assignment.

      -

      Exception-safety: nothrow (if allocators are equal), strong (if allocators aren't equal)

      -
    16. -
    17. -
      ~rtree();
      -

      Description: The destructor.

      -

      Exception-safety: nothrow

      -
    18. -
    -
    -
    -

    -rtree public member functions

    -
      -
    1. -
      void swap(rtree & other);
      -

      Description: Swaps two rtrees.

      -

      Exception-safety: nothrow

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - -

      other

      The other rtree.

      -
    2. -
    3. -
      void insert(value_type const & value);
      -

      Description: Insert a value to the index.

      -

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - -

      value

      The value which will be stored in the container.

      -
    4. -
    5. -
      template<typename Iterator> void insert(Iterator first, Iterator last);
      -

      Description: Insert a range of values to the index.

      -

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - - - - - - - -

      first

      The beginning of the range of values.

      last

      The end of the range of values.

      -
    6. -
    7. -
      template<typename Range> void insert(Range const & rng);
      -

      Description: Insert a range of values to the index.

      -

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - -

      rng

      The range of values.

      -
    8. -
    9. -
      size_type remove(value_type const & value);
      -

      Description: Remove a value from the container. In contrast to the STL set/map erase() method this method removes only one value from the container.

      -

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - -

      value

      The value which will be removed from the container.

      Returns:

      1 if the value was removed, 0 otherwise.

      -
    10. -
    11. -
      template<typename Iterator> size_type remove(Iterator first, Iterator last);
      -

      Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

      -

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - - - - - - - -

      first

      The beginning of the range of values.

      last

      The end of the range of values.

      Returns:

      The number of removed values.

      -
    12. -
    13. -
      template<typename Range> size_type remove(Range const & rng);
      -

      Description: Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.

      -

      Exception-safety: not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - -

      rng

      The range of values.

      Returns:

      The number of removed values.

      -
    14. -
    15. -
      template<typename Predicates, typename OutIter> 
      -  size_type spatial_query(Predicates const & pred, OutIter out_it) const;
      -

      Description: Finds values meeting spatial predicates, e.g. intersecting some box.

      -

      Exception-safety: strong

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - - - - - - - -

      out_it

      The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container)

      pred

      The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

      Returns:

      The number of values found.

      -
    16. -
    17. -
      template<typename DistancesPredicates> 
      -  size_type nearest_query(DistancesPredicates const & dpred, value_type & v) const;
      -

      Description: Finds one value meeting distances predicates, e.g. nearest to some point.

      -

      Exception-safety: strong

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - - - - - - - -

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      v

      The reference to the object which will contain the result.

      Returns:

      The number of values found.

      -
    18. -
    19. -
      template<typename DistancesPredicates, typename Predicates> 
      -  size_type nearest_query(DistancesPredicates const & dpred, 
      -                          Predicates const & pred, value_type & v) const;
      -

      Description: Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some point and intersecting some box.

      -

      Exception-safety: strong

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - - - - - - - - - - - -

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      pred

      The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

      v

      The reference to the object which will contain the result.

      Returns:

      The number of values found.

      -
    20. -
    21. -
      template<typename DistancesPredicates, typename OutIter> 
      -  size_type nearest_query(DistancesPredicates const & dpred, size_t k, 
      -                          OutIter out_it) const;
      -

      Description: Finds k values meeting distances predicates, e.g. k nearest values to some point.

      -

      Exception-safety: strong

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - - - - - - - - - - - -

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      k

      The max number of values.

      out_it

      The output iterator of the result range. E.g. a back_insert_iterator.

      Returns:

      The number of values found.

      -
    22. -
    23. -
      template<typename DistancesPredicates, typename Predicates, typename OutIter> 
      -  size_type nearest_query(DistancesPredicates const & dpred, size_t k, 
      -                          Predicates const & pred, OutIter out_it) const;
      -

      Description: Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some point and intersecting some box.

      -

      Exception-safety: strong

      -

      - -

      -
      ---- - - - - - - - - - - -

      Parameters:

      ---- - - - - - - - - - - - - - - - - - - -

      dpred

      The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

      k

      The max number of values.

      out_it

      The output iterator of the result range. E.g. a back_insert_iterator.

      pred

      The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

      Returns:

      The number of values found.

      -
    24. -
    25. -
      size_type size() const;
      -

      Description: Returns the number of stored values.

      -

      Exception-safety: nothrow

      -

      -

      -
      ---- - - - - -

      Returns:

      The number of stored values.

      -
    26. -
    27. -
      bool empty() const;
      -

      Description: Query if the container is empty.

      -

      Exception-safety: nothrow

      -

      -

      -
      ---- - - - - -

      Returns:

      true if the container is empty.

      -
    28. -
    29. -
      void clear();
      -

      Description: Removes all values stored in the container.

      -

      Exception-safety: nothrow.

      -
    30. -
    31. -
      box_type box() const;
      -

      Description: Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.

      -

      Exception-safety: nothrow (if Indexable's CoordinateType copy assignment doesn't throw), strong (if Indexable's CoordinateType copy assignment throws).

      -

      -

      -
      ---- - - - - -

      Returns:

      The box containing all values stored in the container or an invalid box if there are no values in the container.

      -
    32. -
    33. -
      template<typename ValueOrIndexable> 
      -  size_type count(ValueOrIndexable const & vori) const;
      -

      Description: For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter.

      -

      Exception-safety: nothrow.

      -

      - -

      -
      ---- - - - - -

      Returns:

      The number of values found.

      -
    34. -
    35. -
      parameters_type const & parameters() const;
      -

      Description: Returns parameters.

      -

      Exception-safety: nothrow.

      -

      -

      -
      ---- - - - - -

      Returns:

      The parameters object.

      -
    36. -
    37. -
      translator_type const & translator() const;
      -

      Description: Returns the translator object.

      -

      Exception-safety: nothrow.

      -

      -

      -
      ---- - - - - -

      Returns:

      The translator object.

      -
    38. -
    39. -
      allocator_type get_allocator() const;
      -

      Description: Returns allocator used by the rtree.

      -

      Exception-safety: nothrow

      -

      -

      -
      ---- - - - - -

      Returns:

      The allocator.

      -
    40. -
    -
    -
    -

    -rtree private member functions

    -
      -
    1. -
      template<typename Visitor> void apply_visitor(Visitor & visitor) const;
      -

      Description: Apply a visitor to the nodes structure in order to perform some operator. This function is not a part of the 'official' interface. However it makes possible e.g. to pass a visitor drawing the tree structure.

      -

      Exception-safety: the same as Visitor::operator().

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - -

      visitor

      The visitor object.

      -
    2. -
    3. -
      size_type values_count() const;
      -

      Description: Returns the number of stored objects. Same as size() This function is not a part of the 'official' interface.

      -

      Exception-safety: nothrow

      -

      -

      -
      ---- - - - - -

      Returns:

      The number of stored objects.

      -
    4. -
    5. -
      size_type depth() const;
      -

      Description: Returns the depth of the R-tree. This function is not a part of the 'official' interface.

      -

      Exception-safety: nothrow.

      -

      -

      -
      ---- - - - - -

      Returns:

      The depth of the R-tree.

      -
    6. -
    7. -
      void raw_insert(value_type const & value);
      -

      Description: Insert a value to the index. Root node must exist.

      -

      Exception-safety: basic

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - -

      value

      The value which will be stored in the container.

      -
    8. -
    9. -
      size_type raw_remove(value_type const & value);
      -

      Description: Remove the value from the container.

      -

      Exception-safety: basic

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - -

      value

      The value which will be removed from the container.

      -
    10. -
    11. -
      void raw_create();
      -

      Description: Create an empty R-tree i.e. new empty root node and clear other attributes.

      -

      Exception-safety: strong.

      -
    12. -
    13. -
      void raw_destroy(rtree & t);
      -

      Description: Destroy the R-tree i.e. all nodes and clear attributes.

      -

      Exception-safety: nothrow.

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - -

      t

      The container which is going to be destroyed.

      -
    14. -
    15. -
      void raw_copy(rtree const & src, rtree & dst, bool copy_all_internals) const;
      -

      Description: Copy the R-tree i.e. whole nodes structure, values and other attributes. It uses destination's allocators to create the new structure.

      -

      Exception-safety: strong.

      -

      -

      -
      ---- - - - - -

      Parameters:

      ---- - - - - - - - - - - -

      dst

      The destination R-tree.

      src

      The source R-tree.

      -
    16. -
    17. -
      template<typename DistancesPredicates, typename Predicates> 
      -  size_type raw_nearest_one(DistancesPredicates const & dpred, 
      -                            Predicates const & pred, value_type & v) const;
      -

      Description: Find one value meeting distances and spatial predicates.

      -

      Exception-safety: strong.

      -
    18. -
    19. -
      template<typename DistancesPredicates, typename Predicates, typename OutIter> 
      -  size_type raw_nearest_k(DistancesPredicates const & dpred, size_t k, 
      -                          Predicates const & pred, OutIter out_it) const;
      -

      Description: Find k values meeting distances and spatial predicates.

      -

      Exception-safety: strong.

      -
    20. -
    -
    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/size.html b/doc/html/boost/geometry/index/size.html deleted file mode 100644 index 438fb4196..000000000 --- a/doc/html/boost/geometry/index/size.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -Function template size - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template size

    -

    boost::geometry::index::size

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator> 
    -  size_t size(rtree< Value, Options, Translator, Allocator > const & tree);
    -
    -

    Description

    -

    Description: Get the number of values stored in the index.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - -

    tree

    The spatial index.

    Returns:

    The number of values stored in the index.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/boost/geometry/index/spatial_query.html b/doc/html/boost/geometry/index/spatial_query.html deleted file mode 100644 index 08cc2392e..000000000 --- a/doc/html/boost/geometry/index/spatial_query.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Function template spatial_query - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Function template spatial_query

    -

    boost::geometry::index::spatial_query

    -
    -

    Synopsis

    -
    // In header: <boost/geometry/extensions/index/rtree/rtree.hpp>
    -
    -
    -template<typename Value, typename Options, typename Translator, 
    -         typename Allocator, typename Predicates, typename OutIter> 
    -  size_t spatial_query(rtree< Value, Options, Translator, Allocator > const & tree, 
    -                       Predicates const & pred, OutIter out_it);
    -
    -

    Description

    -

    Description: Find values meeting spatial predicates.

    -

    - -

    -
    ---- - - - - - - - - - - -

    Parameters:

    ---- - - - - - - - - - - - - - - -

    out_it

    The output iterator of the result range.

    pred

    The spatial predicates.

    tree

    The spatial index.

    Returns:

    The number of found values.

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 0583a142b..7c2eedefc 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -76,12 +76,7 @@
    Exception safety
    Reference
    -
    -
    Class Index
    -
    Typedef Index
    -
    Function Index
    -
    Header Reference
    -
    +
    boost::geometry::index::rtree
    diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 71f7a654b..8457c9107 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -7,7 +7,6 @@ -
    @@ -20,310 +19,1031 @@

    -PrevUpHomeNext +PrevUpHome
    - +

    -Class Index

    -

    R

    -
    -
    -R -
    -
    -
    -
    -
    -

    -Typedef Index

    -

    A B I P S T V

    -
    -
    -A -
    -
    -
    -B -
    -
    -
    -I -
    -
    -
    -P -
    -
    -
    -S -
    -
    -
    -T -
    -
    -
    -V -
    -
    -
    -
    -
    -

    -Function Index

    -

    B C E I N R S

    -
    -
    -B -
    -
    -
    -C -
    -
    -
    -E -
    -
    -
    -I -
    -
    -
    -N -
    -
    -
    -R -
    -
    -
    -S -
    -
    -
    -
    -
    -

    -Header Reference

    - -
    - -
    namespace boost {
    -  namespace geometry {
    -    namespace index {
    -      template<typename Value, typename Parameters, 
    -               typename Translator = translator::def<Value>, 
    -               typename Allocator = std::allocator<Value> > 
    -        class rtree;
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator> 
    -        void insert(rtree< Value, Options, Translator, Allocator > &, 
    -                    Value const &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename Iterator> 
    -        void insert(rtree< Value, Options, Translator, Allocator > &, 
    -                    Iterator, Iterator);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename Range> 
    -        void insert(rtree< Value, Options, Translator, Allocator > &, 
    -                    Range const &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator> 
    -        rtree< Value, Options, Translator, Allocator >::size_type 
    -        remove(rtree< Value, Options, Translator, Allocator > &, 
    -               Value const &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename Iterator> 
    -        rtree< Value, Options, Translator, Allocator >::size_type 
    -        remove(rtree< Value, Options, Translator, Allocator > &, Iterator, 
    -               Iterator);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename Range> 
    -        rtree< Value, Options, Translator, Allocator >::size_type 
    -        remove(rtree< Value, Options, Translator, Allocator > &, 
    -               Range const &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename Predicates, typename OutIter> 
    -        size_t spatial_query(rtree< Value, Options, Translator, Allocator > const &, 
    -                             Predicates const &, OutIter);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename DistancesPredicates> 
    -        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    -                             DistancesPredicates const &, Value &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename DistancesPredicates, 
    -               typename Predicates> 
    -        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    -                             DistancesPredicates const &, Predicates const &, 
    -                             Value &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename DistancesPredicates, 
    -               typename OutIter> 
    -        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    -                             DistancesPredicates const &, size_t, OutIter);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator, typename DistancesPredicates, 
    -               typename Predicates, typename OutIter> 
    -        size_t nearest_query(rtree< Value, Options, Translator, Allocator > const &, 
    -                             DistancesPredicates const &, size_t, 
    -                             Predicates const &, OutIter);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator> 
    -        void clear(rtree< Value, Options, Translator, Allocator > &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator> 
    -        size_t size(rtree< Value, Options, Translator, Allocator > const &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator> 
    -        bool empty(rtree< Value, Options, Translator, Allocator > const &);
    -      template<typename Value, typename Options, typename Translator, 
    -               typename Allocator> 
    -        rtree< Value, Options, Translator, Allocator >::box_type 
    -        box(rtree< Value, Options, Translator, Allocator > const &);
    -    }
    -  }
    -}
    -
    +boost::geometry::index::rtree +
    +

    + +

    +
    + + Description +
    +

    + The R-tree spatial index. This is self-balancing spatial index capable + to store various types of Values and balancing algorithms. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value, typename Parameters, typename Translator, typename Allocator>
    +class boost::geometry::index::rtree
    +{
    +  // ...
    +};
    +
    +

    +

    +
    + + Template + parameter(s) +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Default +

    +
    +

    + Description +

    +
    +

    + typename Value +

    +
    + +

    + The type of objects stored in the container. +

    +
    +

    + typename Parameters +

    +
    + +

    + Compile-time parameters. The user must pass a type defining the + Parameters which will be used in rtree creation process. This + type is used e.g. to specify balancing algorithm with compile-time + parameters like min and max number of elements in node. Predefined + Algorithms/Parameters are: bgi::linear<MinElements, MaxElements>, + bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, + MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements + * 0.3>. +

    +
    +

    + typename Translator +

    +
    +

    + translator::def<Value> +

    +
    +

    + The type of the translator which translates from Value to Indexable. + This translation is done each time the r-tree wants to know Value's + Indexable. Default translator can translate all types adapted + to Point or Box concepts (which are Indexables). It also handles + std::pair<Indexable, T>, pointers, smart pointers, and + iterators. E.g. If std::pair<Box, int> is stored, the default + translator translates from std::pair<Box, int> const& + to Box const&. +

    +
    +

    + typename Allocator +

    +
    +

    + std::allocator<Value> +

    +
    +

    + The allocator. +

    +
    +
    + + Constructor(s) +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Function +

    +
    +

    + Description +

    +
    +

    + Parameters +

    +
    +

    +

    +
    rtree(Parameters parameters = Parameters(), translator_type const & translator = translator_type(), Allocator allocator = Allocator())
    +

    +

    +
    +

    + The constructor. +

    +
    +

    + Parameters: parameters: + The parameters object. +

    +

    + translator_type const &: + translator: The translator object. +

    +

    + Allocator: allocator: + The allocator object. +

    +
    +

    +

    +
    template<typename Iterator>
    +rtree(Iterator first, Iterator last, Parameters parameters = Parameters(), translator_type const & translator = translator_type(), Allocator allocator = std::allocator< value_type >())
    +

    +

    +
    +

    + The constructor. +

    +
    +

    + Iterator: first: + The beginning of the range of Values. +

    +

    + Iterator: last: + The end of the range of Values. +

    +

    + Parameters: parameters: + The parameters object. +

    +

    + translator_type const &: + translator: The translator object. +

    +

    + Allocator: allocator: + The allocator object. +

    +
    +

    +

    +
    template<typename Range>
    +rtree(Range const & rng, Parameters parameters = Parameters(), translator_type const & translator = translator_type(), Allocator allocator = std::allocator< value_type >())
    +

    +

    +
    +

    + The constructor. +

    +
    +

    + Range const &: rng: + The range of Values. +

    +

    + Parameters: parameters: + The parameters object. +

    +

    + translator_type const &: + translator: The translator object. +

    +

    + Allocator: allocator: + The allocator object. +

    +
    +

    +

    +
    rtree(rtree const & src)
    +

    +

    +
    +

    + The copy constructor. +

    +
    +

    + rtree const &: src: +

    +
    +

    +

    +
    rtree(rtree const & src, Allocator const & allocator)
    +

    +

    +
    +

    + The copy constructor. +

    +
    +

    + rtree const &: src: +

    +

    + Allocator const &: allocator: +

    +
    +

    +

    +
    rtree(BOOST_RV_REF(rtree) src)
    +

    +

    +
    +

    + The moving constructor. +

    +
    +

    + BOOST_RV_REF(rtree): src: +

    +
    +
    + + Member + Function(s) +
    +
    ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Function +

    +
    +

    + Description +

    +
    +

    + Parameters +

    +
    +

    + Returns +

    +
    +

    +

    +
    ~rtree()
    +

    +

    +
    +

    + The destructor. +

    +
    +  
    +

    +

    +
    rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src)
    +

    +

    +
    +

    + The assignment operator. +

    +
    +

    + BOOST_COPY_ASSIGN_REF(rtree): + src: +

    +
     
    +

    +

    +
    rtree & operator=(BOOST_RV_REF(rtree) src)
    +

    +

    +
    +

    + The moving assignment. +

    +
    +

    + BOOST_RV_REF(rtree): src: +

    +
     
    +

    +

    +
    void swap(rtree & other)
    +

    +

    +
    +

    + Swaps two rtrees. +

    +
    +

    + rtree &: other: + The other rtree. +

    +
     
    +

    +

    +
    void insert(value_type const & value)
    +

    +

    +
    +

    + Insert a value to the index. +

    +
    +

    + value_type const &: value: + The value which will be stored in the container. +

    +
     
    +

    +

    +
    template<typename Iterator>
    +void insert(Iterator first, Iterator last)
    +

    +

    +
    +

    + Insert a range of values to the index. +

    +
    +

    + Iterator: first: + The beginning of the range of values. +

    +

    + Iterator: last: + The end of the range of values. +

    +
     
    +

    +

    +
    template<typename Range>
    +void insert(Range const & rng)
    +

    +

    +
    +

    + Insert a range of values to the index. +

    +
    +

    + Range const &: rng: + The range of values. +

    +
     
    +

    +

    +
    size_type remove(value_type const & value)
    +

    +

    +
    +

    + Remove a value from the container. In contrast to the STL set/map + erase() method this method removes only one value from the container. +

    +
    +

    + value_type const &: value: + The value which will be removed from the container. +

    +
    +

    + 1 if the value was removed, 0 otherwise. +

    +
    +

    +

    +
    template<typename Iterator>
    +size_type remove(Iterator first, Iterator last)
    +

    +

    +
    +

    + Remove a range of values from the container. In contrast to the + STL set/map erase() method it doesn't take iterators pointing + to values stored in this container. It removes values equal to + these passed as a range. Furthermore this method removes only + one value for each one passed in the range, not all equal values. +

    +
    +

    + Iterator: first: + The beginning of the range of values. +

    +

    + Iterator: last: + The end of the range of values. +

    +
    +

    + The number of removed values. +

    +
    +

    +

    +
    template<typename Range>
    +size_type remove(Range const & rng)
    +

    +

    +
    +

    + Remove a range of values from the container. In contrast to the + STL set/map erase() method it removes values equal to these passed + as a range. Furthermore, this method removes only one value for + each one passed in the range, not all equal values. +

    +
    +

    + Range const &: rng: + The range of values. +

    +
    +

    + The number of removed values. +

    +
    +

    +

    +
    template<typename Predicates, typename OutIter>
    +size_type spatial_query(Predicates const & pred, OutIter out_it)
    +

    +

    +
    +

    + Finds values meeting spatial predicates, e.g. intersecting some + box. +

    +
    +

    + Predicates const &: pred: + The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together + in std::pair or boost::tuple. +

    +

    + OutIter: out_it: + The output iterator of the result range. E.g. an iterator generated + by std::back_inserter(container) +

    +
    +

    + The number of values found. +

    +
    +

    +

    +
    template<typename DistancesPredicates>
    +size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
    +

    +

    +
    +

    + Finds one value meeting distances predicates, e.g. nearest to + some point. +

    +
    +

    + DistancesPredicates const &: + dpred: The distances predicates. May be + a Point. This is default case where Value which nearest point + is closest to Point is returned. May be a PointRelation which + define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that + some distance must be between min_distance and max_distance. + This may be generated by bgi::unbounded(PointRelation) - default + case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, + MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated + by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + value_type &: v: + The reference to the object which will contain the result. +

    +
    +

    + The number of values found. +

    +
    +

    +

    +
    template<typename DistancesPredicates, typename Predicates>
    +size_type nearest_query(DistancesPredicates const & dpred, Predicates const & pred, value_type & v)
    +

    +

    +
    +

    + Finds one value meeting distances predicates and spatial predicates, + e.g. nearest to some point and intersecting some box. +

    +
    +

    + DistancesPredicates const &: + dpred: The distances predicates. May be + a Point. This is default case where Value which nearest point + is closest to Point is returned. May be a PointRelation which + define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that + some distance must be between min_distance and max_distance. + This may be generated by bgi::unbounded(PointRelation) - default + case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, + MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated + by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + Predicates const &: pred: + The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together + in std::pair or boost::tuple. +

    +

    + value_type &: v: + The reference to the object which will contain the result. +

    +
    +

    + The number of values found. +

    +
    +

    +

    +
    template<typename DistancesPredicates, typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred, size_t k, OutIter out_it)
    +

    +

    +
    +

    + Finds k values meeting distances predicates, e.g. k nearest values + to some point. +

    +
    +

    + DistancesPredicates const &: + dpred: The distances predicates. May be + a Point. This is default case where Value which nearest point + is closest to Point is returned. May be a PointRelation which + define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that + some distance must be between min_distance and max_distance. + This may be generated by bgi::unbounded(PointRelation) - default + case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, + MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated + by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + size_t: k: + The max number of values. +

    +

    + OutIter: out_it: + The output iterator of the result range. E.g. a back_insert_iterator. +

    +
    +

    + The number of values found. +

    +
    +

    +

    +
    template<typename DistancesPredicates, typename Predicates, typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred, size_t k, Predicates const & pred, OutIter out_it)
    +

    +

    +
    +

    + Finds k values meeting distances predicates and spatial predicates, + e.g. k nearest values to some point and intersecting some box. +

    +
    +

    + DistancesPredicates const &: + dpred: The distances predicates. May be + a Point. This is default case where Value which nearest point + is closest to Point is returned. May be a PointRelation which + define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that + some distance must be between min_distance and max_distance. + This may be generated by bgi::unbounded(PointRelation) - default + case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, + MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated + by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + size_t: k: + The max number of values. +

    +

    + Predicates const &: pred: + The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together + in std::pair or boost::tuple. +

    +

    + OutIter: out_it: + The output iterator of the result range. E.g. a back_insert_iterator. +

    +
    +

    + The number of values found. +

    +
    +

    +

    +
    size_type size()
    +

    +

    +
    +

    + Returns the number of stored values. +

    +
    + +

    + The number of stored values. +

    +
    +

    +

    +
    bool empty()
    +

    +

    +
    +

    + Query if the container is empty. +

    +
    + +

    + true if the container is empty. +

    +
    +

    +

    +
    void clear()
    +

    +

    +
    +

    + Removes all values stored in the container. +

    +
    +  
    +

    +

    +
    box_type box()
    +

    +

    +
    +

    + Returns the box containing all values stored in the container. + If the container is empty the result of geometry::assign_inverse() + is returned. +

    +
    + +

    + The box containing all values stored in the container or an invalid + box if there are no values in the container. +

    +
    +

    +

    +
    template<typename ValueOrIndexable>
    +size_type count(ValueOrIndexable const & vori)
    +

    +

    +
    +

    + For indexable_type it returns the number of values which indexables + equals the parameter. For value_type it returns the number of + values which equals the parameter. +

    +
    +

    + ValueOrIndexable const &: + vori: The value or indexable which will + be counted. +

    +
    +

    + The number of values found. +

    +
    +

    +

    +
    parameters_type const & parameters()
    +

    +

    +
    +

    + Returns parameters. +

    +
    + +

    + The parameters object. +

    +
    +

    +

    +
    translator_type const & translator()
    +

    +

    +
    +

    + Returns the translator object. +

    +
    + +

    + The translator object. +

    +
    +

    +

    +
    allocator_type get_allocator()
    +

    +

    +
    +

    + Returns allocator used by the rtree. +

    +
    + +

    + The allocator. +

    +
    +
    + + Header +
    +

    + #include <.hpp> +

    @@ -336,7 +1056,7 @@

    -PrevUpHomeNext +PrevUpHome
    diff --git a/doc/html/index.html b/doc/html/index.html index 4f963ee4f..4d7c77ec2 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@ - +

    Last revised: January 04, 2013 at 20:20:05 GMT

    Last revised: January 07, 2013 at 00:54:35 GMT


    diff --git a/doc/index.idx b/doc/index.idx deleted file mode 100644 index b0cffe44e..000000000 --- a/doc/index.idx +++ /dev/null @@ -1,8 +0,0 @@ -!scan "boost/geometry/extensions/index/rtree/rtree.hpp" -!scan "boost/geometry/extensions/index/predicates.hpp" -!scan "boost/geometry/extensions/index/distance_predicates.hpp" -!scan "boost/geometry/extensions/index/inserter.hpp" -!scan "boost/geometry/extensions/index/adaptors/nearest_query.hpp" -!scan "boost/geometry/extensions/index/adaptors/spatial_query.hpp" -!scan "boost/geometry/extensions/index/translator/def.hpp" -!scan "boost/geometry/extensions/index/translator/index.hpp" diff --git a/doc/make_qbk.py b/doc/make_qbk.py new file mode 100755 index 000000000..0434b678a --- /dev/null +++ b/doc/make_qbk.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# =========================================================================== +# Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt)9 +# ============================================================================ + +import os, sys + +cmd = "doxygen_xml2qbk" +cmd = cmd + " --xml xml/%s.xml" +cmd = cmd + " --start_include ." +cmd = cmd + " > generated/%s.qbk" + +os.system("doxygen Doxyfile") +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "rtree")) + +os.system("b2") diff --git a/doc/rtree.qbk b/doc/rtree.qbk index a837ee4e2..2cd050894 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -17,16 +17,9 @@ [include rtree/nearest_query.qbk] [include rtree/exception_safety.qbk] -[include auto_index_helpers.qbk] - [section:index Reference] -[named_index class_name Class Index] -[named_index typedef_name Typedef Index] -[named_index function_name Function Index] -[/named_index macro_name Macro Index] -[/index] -[xinclude autodoc.xml] +[include generated/rtree.qbk] [endsect] diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 42d93477c..a55890dbf 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -104,15 +104,17 @@ private: public: /*! - Description: The constructor. + \brief The constructor. - Exception-safety: nothrow + \exception 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()) + inline explicit rtree(Parameters parameters = Parameters(), + translator_type const& translator = translator_type(), + Allocator allocator = Allocator()) : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) @@ -122,9 +124,9 @@ public: {} /*! - Description: The constructor. + \brief The constructor. - Exception-safety: strong + \exception strong \param first The beginning of the range of Values. \param last The end of the range of Values. @@ -153,9 +155,9 @@ public: } /*! - Description: The constructor. + \brief The constructor. - Exception-safety: strong + \exception strong \param rng The range of Values. \param parameters The parameters object. @@ -183,9 +185,9 @@ public: } /*! - Description: The destructor. + \brief The destructor. - Exception-safety: nothrow + \exception nothrow */ inline ~rtree() { @@ -193,9 +195,9 @@ public: } /*! - Description: The copy constructor. + \brief The copy constructor. - Exception-safety: strong + \exception strong */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -211,9 +213,9 @@ public: } /*! - Description: The copy constructor. + \brief The copy constructor. - Exception-safety: strong + \exception strong */ inline rtree(rtree const& src, Allocator const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -227,9 +229,9 @@ public: } /*! - Description: The moving constructor. + \brief The moving constructor. - Exception-safety: nothrow + \exception nothrow */ inline rtree(BOOST_RV_REF(rtree) src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -245,9 +247,9 @@ public: } /*! - Description: The assignment operator. + \brief The assignment operator. - Exception-safety: strong + \exception strong */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -263,9 +265,9 @@ public: } /*! - Description: The moving assignment. + \brief The moving assignment. - Exception-safety: nothrow (if allocators are equal), + \exception nothrow (if allocators are equal), strong (if allocators aren't equal) */ inline rtree & operator=(BOOST_RV_REF(rtree) src) @@ -299,9 +301,9 @@ public: } /*! - Description: Swaps two rtrees. + \brief Swaps two rtrees. - Exception-safety: nothrow + \exception nothrow \param other The other rtree. */ @@ -317,9 +319,9 @@ public: } /*! - Description: Insert a value to the index. + \brief Insert a value to the index. - Exception-safety: not safe - if this operation throws, the R-tree may be left in + \exception not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param value The value which will be stored in the container. @@ -333,9 +335,9 @@ public: } /*! - Description: Insert a range of values to the index. + \brief Insert a range of values to the index. - Exception-safety: not safe - if this operation throws, the R-tree may be left in + \exception not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param first The beginning of the range of values. @@ -352,9 +354,9 @@ public: } /*! - Description: Insert a range of values to the index. + \brief Insert a range of values to the index. - Exception-safety: not safe - if this operation throws, the R-tree may be left in + \exception not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param rng The range of values. @@ -371,10 +373,10 @@ public: } /*! - Description: Remove a value from the container. In contrast to the STL set/map erase() method + \brief Remove a value from the container. In contrast to the STL set/map erase() method this method removes only one value from the container. - Exception-safety: not safe - if this operation throws, the R-tree may be left in + \exception not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param value The value which will be removed from the container. @@ -387,12 +389,12 @@ public: } /*! - Description: Remove a range of values from the container. In contrast to the STL set/map erase() method + \brief Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. - Exception-safety: not safe - if this operation throws, the R-tree may be left in + \exception not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param first The beginning of the range of values. @@ -410,11 +412,11 @@ public: } /*! - Description: Remove a range of values from the container. In contrast to the STL set/map erase() method + \brief Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values. - Exception-safety: not safe - if this operation throws, the R-tree may be left in + \exception not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. \param rng The range of values. @@ -434,7 +436,7 @@ public: /* Assign new elements to the rtree. This method replaces the content of the rtree. - Exception-safety: strong + \exception strong \param first The beginning of the range of values. \param last The end of the range of values. @@ -449,7 +451,7 @@ public: /* Assign new elements to the rtree. This method replaces the content of the rtree. - Exception-safety: strong + \exception strong \param rng The range of values. */ @@ -461,9 +463,9 @@ public: }*/ /*! - Description: Finds values meeting spatial predicates, e.g. intersecting some box. + \brief Finds values meeting spatial predicates, e.g. intersecting some box. - Exception-safety: strong + \exception strong \param pred The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), @@ -493,9 +495,9 @@ public: } /*! - Description: Finds one value meeting distances predicates, e.g. nearest to some point. + \brief Finds one value meeting distances predicates, e.g. nearest to some point. - Exception-safety: strong + \exception strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -518,10 +520,10 @@ public: } /*! - Description: Finds one value meeting distances predicates and spatial predicates, + \brief Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some point and intersecting some box. - Exception-safety: strong + \exception strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -550,9 +552,9 @@ public: } /*! - Description: Finds k values meeting distances predicates, e.g. k nearest values to some point. + \brief Finds k values meeting distances predicates, e.g. k nearest values to some point. - Exception-safety: strong + \exception strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -575,10 +577,10 @@ public: } /*! - Description: Finds k values meeting distances predicates and spatial predicates, + \brief Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some point and intersecting some box. - Exception-safety: strong + \exception strong \param dpred The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define @@ -608,9 +610,9 @@ public: } /*! - Description: Returns the number of stored values. + \brief Returns the number of stored values. - Exception-safety: nothrow + \exception nothrow \return The number of stored values. */ @@ -620,9 +622,9 @@ public: } /*! - Description: Query if the container is empty. + \brief Query if the container is empty. - Exception-safety: nothrow + \exception nothrow \return true if the container is empty. */ @@ -632,9 +634,9 @@ public: } /*! - Description: Removes all values stored in the container. + \brief Removes all values stored in the container. - Exception-safety: nothrow. + \exception nothrow. */ inline void clear() { @@ -642,10 +644,10 @@ public: } /*! - Description: Returns the box containing all values stored in the container. + \brief Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned. - Exception-safety: nothrow (if Indexable's CoordinateType copy assignment doesn't throw), + \exception nothrow (if Indexable's CoordinateType copy assignment doesn't throw), strong (if Indexable's CoordinateType copy assignment throws). \return The box containing all values stored in the container or an invalid box if @@ -669,12 +671,12 @@ public: } /*! - Description: For indexable_type it returns the number of values which indexables equals the parameter. + \brief For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter. - Exception-safety: nothrow. + \exception nothrow. - \param The value or indexable which will be counted. + \param vori The value or indexable which will be counted. \return The number of values found. */ @@ -693,9 +695,9 @@ public: } /*! - Description: Returns parameters. + \brief Returns parameters. - Exception-safety: nothrow. + \exception nothrow. \return The parameters object. */ @@ -705,9 +707,9 @@ public: } /*! - Description: Returns the translator object. + \brief Returns the translator object. - Exception-safety: nothrow. + \exception nothrow. \return The translator object. */ @@ -717,9 +719,9 @@ public: } /*! - Description: Returns allocator used by the rtree. + \brief Returns allocator used by the rtree. - Exception-safety: nothrow + \exception nothrow \return The allocator. */ @@ -732,11 +734,11 @@ public: private: #endif /*! - Description: Apply a visitor to the nodes structure in order to perform some operator. + \brief Apply a visitor to the nodes structure in order to perform some operator. This function is not a part of the 'official' interface. However it makes possible e.g. to pass a visitor drawing the tree structure. - Exception-safety: the same as Visitor::operator(). + \exception the same as Visitor::operator(). \param visitor The visitor object. */ @@ -748,10 +750,10 @@ private: } /*! - Description: Returns the number of stored objects. Same as size() + \brief Returns the number of stored objects. Same as size() This function is not a part of the 'official' interface. - Exception-safety: nothrow + \exception nothrow \return The number of stored objects. */ @@ -761,10 +763,10 @@ private: } /*! - Description: Returns the depth of the R-tree. + \brief Returns the depth of the R-tree. This function is not a part of the 'official' interface. - Exception-safety: nothrow. + \exception nothrow. \return The depth of the R-tree. */ @@ -775,9 +777,9 @@ private: private: /*! - Description: Insert a value to the index. Root node must exist. + \brief Insert a value to the index. Root node must exist. - Exception-safety: basic + \exception basic \param value The value which will be stored in the container. */ @@ -804,9 +806,9 @@ private: } /*! - Description: Remove the value from the container. + \brief Remove the value from the container. - Exception-safety: basic + \exception basic \param value The value which will be removed from the container. */ @@ -834,9 +836,9 @@ private: } /*! - Description: Create an empty R-tree i.e. new empty root node and clear other attributes. + \brief Create an empty R-tree i.e. new empty root node and clear other attributes. - Exception-safety: strong. + \exception strong. */ inline void raw_create() { @@ -848,9 +850,9 @@ private: } /*! - Description: Destroy the R-tree i.e. all nodes and clear attributes. + \brief Destroy the R-tree i.e. all nodes and clear attributes. - Exception-safety: nothrow. + \exception nothrow. \param t The container which is going to be destroyed. */ @@ -868,10 +870,10 @@ private: } /*! - Description: Copy the R-tree i.e. whole nodes structure, values and other attributes. + \brief Copy the R-tree i.e. whole nodes structure, values and other attributes. It uses destination's allocators to create the new structure. - Exception-safety: strong. + \exception strong. \param src The source R-tree. \param dst The destination R-tree. @@ -904,9 +906,9 @@ private: } /*! - Description: Find one value meeting distances and spatial predicates. + \brief Find one value meeting distances and spatial predicates. - Exception-safety: strong. + \exception strong. */ template inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -942,9 +944,9 @@ private: } /*! - Description: Find k values meeting distances and spatial predicates. + \brief Find k values meeting distances and spatial predicates. - Exception-safety: strong. + \exception strong. */ template inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const @@ -990,7 +992,7 @@ private: }; /*! -Description: Insert a value to the index. +\brief Insert a value to the index. \param tree The spatial index. \param v The value which will be stored in the index. @@ -1002,7 +1004,7 @@ inline void insert(rtree & tree, Value co } /*! -Description: Insert a range of values to the index. +\brief Insert a range of values to the index. \param tree The spatial index. \param first The beginning of the range of values. @@ -1015,7 +1017,7 @@ inline void insert(rtree & tree, Iterator } /*! -Description: Insert a range of values to the index. +\brief Insert a range of values to the index. \param tree The spatial index. \param rng The range of values. @@ -1027,7 +1029,7 @@ inline void insert(rtree & tree, Range co } /*! -Description: Remove a value from the container. In contrast to the STL set/map erase() method +\brief Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container. \param tree The spatial index. @@ -1043,7 +1045,7 @@ remove(rtree & tree, Value const& v) } /*! -Description: Remove a range of values from the container. In contrast to the STL set/map erase() method +\brief Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. @@ -1062,7 +1064,7 @@ remove(rtree & tree, Iterator first, Iter } /*! -Description: Remove a range of values from the container. In contrast to the STL set/map erase() method +\brief Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. @@ -1079,7 +1081,7 @@ remove(rtree & tree, Range const& rng) } /*! -Description: Find values meeting spatial predicates. +\brief Find values meeting spatial predicates. \param tree The spatial index. \param pred The spatial predicates. @@ -1094,7 +1096,7 @@ inline size_t spatial_query(rtree const& } /*! -Description: Find the value meeting distances predicates. +\brief Find the value meeting distances predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1109,7 +1111,7 @@ inline size_t nearest_query(rtree const& } /*! -Description: Find the value meeting distances and spatial predicates. +\brief Find the value meeting distances and spatial predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1125,7 +1127,7 @@ inline size_t nearest_query(rtree const& } /*! -Description: Find k values meeting distances predicates. +\brief Find k values meeting distances predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1141,7 +1143,7 @@ inline size_t nearest_query(rtree const& } /*! -Description: Find k values meeting distances and spatial predicates. +\brief Find k values meeting distances and spatial predicates. \param tree The spatial index. \param dpred The distances predicates. @@ -1158,7 +1160,7 @@ inline size_t nearest_query(rtree const& } /*! -Description: Remove all values from the index. +\brief Remove all values from the index. \param tree The spatial index. */ @@ -1169,7 +1171,7 @@ inline void clear(rtree & tree) } /*! -Description: Get the number of values stored in the index. +\brief Get the number of values stored in the index. \param tree The spatial index. @@ -1182,7 +1184,7 @@ inline size_t size(rtree const& tree) } /*! -Description: Query if there are no values stored in the index. +\brief Query if there are no values stored in the index. \param tree The spatial index. @@ -1195,7 +1197,7 @@ inline bool empty(rtree const& tree) } /*! -Description: Get the box containing all stored values or an invalid box if the index has no values. +\brief Get the box containing all stored values or an invalid box if the index has no values. \param tree The spatial index. From 1257977a04cdb25c3d0df08f7f60813394919aa2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 01:50:29 +0000 Subject: [PATCH 248/366] R-tree docs improved [SVN r82380] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 ++--- .../r_tree/exception_safety.html | 16 +++---- doc/html/geometry_index/r_tree/index.html | 43 ++++++++++++------- .../geometry_index/r_tree/introduction.html | 20 ++++----- .../r_tree/nearest_neighbours_queries.html | 2 +- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../geometry/extensions/index/rtree/rtree.hpp | 36 +++++++++++----- 11 files changed, 83 insertions(+), 58 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 7c2eedefc..ab7a739c4 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 a79271bfb..300395d3a 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index fd669c9c6..a374ee31d 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 - + @@ -29,7 +29,7 @@

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

                    -
                      +
                      • exception-safe copy constructor and copy assignment of the Value.
                      • @@ -155,7 +155,7 @@

    nothrow or strong - [a] + [a]

    - not safe [b] + not safe [b]

    nothrow or strong - [c] + [c]

    -

    [a] +

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

    -

    [b] +

    [b] If this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

    -

    [c] +

    [c] nothrow - if CoordinateType has nonthrowing copy constructor, strong - otherwise diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 8457c9107..909d846be 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -3,7 +3,7 @@ Reference - + @@ -31,11 +31,11 @@ boost::geometry::index::rtree

    - +

    - Description + Description

    The R-tree spatial index. This is self-balancing spatial index capable @@ -43,7 +43,7 @@

    - Synopsis + Synopsis

    @@ -57,7 +57,7 @@

    - Template + Template parameter(s)
    @@ -164,7 +164,7 @@
    - Constructor(s) + Constructor(s)
    @@ -298,12 +298,14 @@ @@ -317,15 +319,18 @@ @@ -339,12 +344,14 @@ @@ -352,7 +359,7 @@

    - The copy constructor. + The copy constructor. It uses parameters, translator and allocator + from the source tree.

    rtree const &: src: + The rtree which content will be copied.

    - The copy constructor. + The copy constructor. It uses Parameters and translator from + the source tree.

    rtree const &: src: + The rtree which content will be copied.

    Allocator const &: allocator: + The allocator which will be used.

    - The moving constructor. + The moving constructor. It uses parameters, translator and allocator + from the source tree.

    BOOST_RV_REF(rtree): src: + The rtree which content will be moved.

    - Member + Member Function(s)
    @@ -412,13 +419,14 @@ @@ -433,12 +441,14 @@ @@ -453,13 +463,14 @@ @@ -1039,7 +1050,7 @@

    - The assignment operator. + The assignment operator. It uses parameters and translator from + the source tree.

    BOOST_COPY_ASSIGN_REF(rtree): - src: + src: The rtree which content will be copied.

     

    - The moving assignment. + The moving assignment. It uses parameters and translator from + the source tree.

    BOOST_RV_REF(rtree): src: + The rtree which content will be moved.

     

    - Swaps two rtrees. + Swaps contents of two rtrees. Parameters, translator and allocators + are swapped as well.

    rtree &: other: - The other rtree. + The rtree which content will be swapped with this rtree content.

     
    - Header + Header

    #include <.hpp> diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 89d93898c..b0b2ee116 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

    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 + 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 [2]. + close to some point in space [2].

    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

    -
      +
      • capable to store arbitrary Value type,
      • @@ -201,20 +201,20 @@
      -

      -

      [1] +


      +

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

      -

      [2] +

      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

      -

      [3] +

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

      -

      [4] +

      [4] 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 390fe04c5..341fd302b 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 9ec8f8b5c..2e4bf7514 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 - + @@ -150,7 +150,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 dc19fd16b..7fee097e3 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 4d7c77ec2..da79de784 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -57,7 +57,7 @@

      - +

      Last revised: January 07, 2013 at 00:54:35 GMT

      Last revised: January 07, 2013 at 01:46:17 GMT


      diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index a55890dbf..965781bb5 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -195,9 +195,11 @@ public: } /*! - \brief The copy constructor. + \brief The copy constructor. It uses parameters, translator and allocator from the source tree. \exception strong + + \param src The rtree which content will be copied. */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -213,9 +215,12 @@ public: } /*! - \brief The copy constructor. + \brief The copy constructor. It uses Parameters and translator from the source tree. \exception strong + + \param src The rtree which content will be copied. + \param allocator The allocator which will be used. */ inline rtree(rtree const& src, Allocator const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -229,12 +234,15 @@ public: } /*! - \brief The moving constructor. + \brief The moving constructor. It uses parameters, translator and allocator from the source tree. \exception nothrow + + \param src The rtree which content will be moved. */ inline rtree(BOOST_RV_REF(rtree) src) - : m_translator(src.m_translator) // SHOULDN'T THROW +// TODO - use boost::move() + : m_translator(src.m_translator) // SHOULDN'T THROW , m_parameters(src.m_parameters) , m_allocators(src.m_allocators) , m_values_count(src.m_values_count) @@ -247,9 +255,11 @@ public: } /*! - \brief The assignment operator. + \brief The assignment operator. It uses parameters and translator from the source tree. \exception strong + + \param src The rtree which content will be copied. */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -265,20 +275,22 @@ public: } /*! - \brief The moving assignment. + \brief The moving assignment. It uses parameters and translator from the source tree. - \exception nothrow (if allocators are equal), - strong (if allocators aren't equal) + \exception nothrow (if allocators are equal), strong (if allocators aren't equal) + + \param src The rtree which content will be moved. */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { if ( this == &src ) return *this; - //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment +//TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment if ( m_allocators.allocator == src.m_allocators.allocator ) { +// TODO - use boost::move() m_translator = src.m_translator; // SHOULDN'T THROW m_parameters = src.m_parameters; //m_allocators = src.m_allocators; @@ -301,14 +313,16 @@ public: } /*! - \brief Swaps two rtrees. + \brief Swaps contents of two rtrees. Parameters, translator and allocators are swapped as well. \exception nothrow - \param other The other rtree. + \param other The rtree which content will be swapped with this rtree content. */ void swap(rtree & other) { +// TODO - use boost::move? +// TODO - allocators may throw in copy/move std::swap(m_translator, other.m_translator); // SHOULDN'T THROW std::swap(m_parameters, other.m_parameters); std::swap(m_allocators, other.m_allocators); From 15342d7207c331b171dbb176b1876a58a2f82b67 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 03:22:24 +0000 Subject: [PATCH 249/366] Docs improved [SVN r82381] --- doc/Doxyfile | 9 +- doc/html/geometry_index/r_tree/index.html | 110 +++++++++++++++------- doc/html/index.html | 2 +- 3 files changed, 81 insertions(+), 40 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 80d257bf0..36e493d78 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -898,7 +898,7 @@ IGNORE_PREFIX = # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. -GENERATE_HTML = YES +GENERATE_HTML = NO # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be @@ -1511,13 +1511,13 @@ ENABLE_PREPROCESSING = YES # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. -EXPAND_ONLY_PREDEF = NO +EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. @@ -1545,7 +1545,8 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = +PREDEFINED = "BOOST_RV_REF(T)=T &&" \ + "BOOST_COPY_ASSIGN_REF(T)=const T &" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 909d846be..0942d1db1 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,7 @@ boost::geometry::index::rtree

      - +

      @@ -47,7 +47,10 @@

      -
      template<typename Value, typename Parameters, typename Translator, typename Allocator>
      +
      template<typename Value,
      +         typename Parameters,
      +         typename Translator,
      +         typename Allocator>
       class boost::geometry::index::rtree
       {
         // ...
      @@ -87,7 +90,9 @@
       

    - typename Value +

    +
    Value
    +

    @@ -101,7 +106,9 @@

    - typename Parameters +

    +
    Parameters
    +

    @@ -122,12 +129,16 @@

    - typename Translator +

    +
    Translator
    +

    - translator::def<Value> +

    +
    translator::def<Value>
    +

    @@ -146,12 +157,16 @@

    - typename Allocator +

    +
    Allocator
    +

    - std::allocator<Value> +

    +
    std::allocator<Value>
    +

    @@ -194,7 +209,9 @@

    -
    rtree(Parameters parameters = Parameters(), translator_type const & translator = translator_type(), Allocator allocator = Allocator())
    +
    rtree(parameters_type parameters = parameters_type(),
    +      translator_type const & translator = translator_type(),
    +      allocator_type allocator = allocator_type())

    - Parameters: parameters: + parameters_type: parameters: The parameters object.

    @@ -213,7 +230,7 @@ translator: The translator object.

    - Allocator: allocator: + allocator_type: allocator: The allocator object.

    -
    rtree(rtree const & src, Allocator const & allocator)
    +
    rtree(rtree const & src, allocator_type const & allocator)

    -
    rtree(BOOST_RV_REF(rtree) src)
    +
    rtree(rtree && src)

    - BOOST_RV_REF(rtree): src: + rtree &&: src: The rtree which content will be moved.

    -
    rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src)
    +
    rtree & operator=(const rtree & src)

    - BOOST_COPY_ASSIGN_REF(rtree): - src: The rtree which content will be copied. + const rtree &: src: + The rtree which content will be copied.

     

    -
    rtree & operator=(BOOST_RV_REF(rtree) src)
    +
    rtree & operator=(rtree && src)

    - BOOST_RV_REF(rtree): src: + rtree &&: src: The rtree which content will be moved.

    -
    template<typename DistancesPredicates, typename Predicates, typename OutIter>
    -size_type nearest_query(DistancesPredicates const & dpred, size_t k, Predicates const & pred, OutIter out_it)
    +
    template<typename DistancesPredicates,
    +         typename Predicates,
    +         typename OutIter>
    +size_type
    +nearest_query(DistancesPredicates const & dpred,
    +              size_t k,
    +              Predicates const & pred,
    +              OutIter out_it)

    - +

    Last revised: January 07, 2013 at 01:46:17 GMT

    Last revised: January 07, 2013 at 03:21:24 GMT


    From 2d57d5e7249077ff88b2e42e57df80de799a4384 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 04:43:51 +0000 Subject: [PATCH 250/366] Details removed from brief [SVN r82382] --- doc/html/geometry_index/r_tree/index.html | 122 ++++------------------ doc/html/index.html | 2 +- 2 files changed, 23 insertions(+), 101 deletions(-) diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 0942d1db1..544fcc982 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,8 @@ boost::geometry::index::rtree

    - + +The R-tree spatial index.

    @@ -322,8 +323,7 @@

    - The copy constructor. It uses parameters, translator and allocator - from the source tree. + The copy constructor.

    @@ -368,8 +368,7 @@

    - The moving constructor. It uses parameters, translator and allocator - from the source tree. + The moving constructor.

    @@ -443,8 +442,7 @@

    - The assignment operator. It uses parameters and translator from - the source tree. + The assignment operator.

    @@ -465,8 +463,7 @@

    - The moving assignment. It uses parameters and translator from - the source tree. + The moving assignment.

    @@ -487,8 +484,7 @@

    - Swaps contents of two rtrees. Parameters, translator and allocators - are swapped as well. + Swaps contents of two rtrees.

    @@ -579,8 +575,7 @@

    - Remove a value from the container. In contrast to the STL set/map - erase() method this method removes only one value from the container. + Remove a value from the container.

    @@ -607,11 +602,7 @@

    - Remove a range of values from the container. In contrast to the - STL set/map erase() method it doesn't take iterators pointing - to values stored in this container. It removes values equal to - these passed as a range. Furthermore this method removes only - one value for each one passed in the range, not all equal values. + Remove a range of values from the container.

    @@ -641,10 +632,7 @@

    - Remove a range of values from the container. In contrast to the - STL set/map erase() method it removes values equal to these passed - as a range. Furthermore, this method removes only one value for - each one passed in the range, not all equal values. + Remove a range of values from the container.

    @@ -672,19 +660,13 @@

    Finds values meeting spatial predicates, e.g. intersecting some - box. + Box.

    Predicates const &: pred: - The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together - in std::pair or boost::tuple. + The spatial predicates or a Geometry.

    OutIter: out_it: @@ -711,25 +693,13 @@

    Finds one value meeting distances predicates, e.g. nearest to - some point. + some Point.

    DistancesPredicates const &: - dpred: The distances predicates. May be - a Point. This is default case where Value which nearest point - is closest to Point is returned. May be a PointRelation which - define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that - some distance must be between min_distance and max_distance. - This may be generated by bgi::unbounded(PointRelation) - default - case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, - MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated - by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + dpred: The distances predicates or a Point.

    value_type &: v: @@ -757,35 +727,17 @@

    Finds one value meeting distances predicates and spatial predicates, - e.g. nearest to some point and intersecting some box. + e.g. nearest to some Point and intersecting some Box.

    DistancesPredicates const &: - dpred: The distances predicates. May be - a Point. This is default case where Value which nearest point - is closest to Point is returned. May be a PointRelation which - define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that - some distance must be between min_distance and max_distance. - This may be generated by bgi::unbounded(PointRelation) - default - case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, - MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated - by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + dpred: The distances predicates or a Point.

    Predicates const &: pred: - The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together - in std::pair or boost::tuple. + The spatial predicates or a Geometry

    value_type &: v: @@ -813,25 +765,13 @@

    Finds k values meeting distances predicates, e.g. k nearest values - to some point. + to some Point.

    DistancesPredicates const &: - dpred: The distances predicates. May be - a Point. This is default case where Value which nearest point - is closest to Point is returned. May be a PointRelation which - define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that - some distance must be between min_distance and max_distance. - This may be generated by bgi::unbounded(PointRelation) - default - case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, - MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated - by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + dpred: The distances predicates or a Point.

    size_t: k: @@ -866,25 +806,13 @@

    Finds k values meeting distances predicates and spatial predicates, - e.g. k nearest values to some point and intersecting some box. + e.g. k nearest values to some Point and intersecting some Box.

    DistancesPredicates const &: - dpred: The distances predicates. May be - a Point. This is default case where Value which nearest point - is closest to Point is returned. May be a PointRelation which - define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that - some distance must be between min_distance and max_distance. - This may be generated by bgi::unbounded(PointRelation) - default - case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, - MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated - by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + dpred: The distances predicates or a Point

    size_t: k: @@ -892,13 +820,7 @@

    Predicates const &: pred: - The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together - in std::pair or boost::tuple. + The spatial predicates or a Geometry.

    OutIter: out_it: diff --git a/doc/html/index.html b/doc/html/index.html index a5aed9f76..7abb14091 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@ - +

    Last revised: January 07, 2013 at 03:21:24 GMT

    Last revised: January 07, 2013 at 04:43:31 GMT


    From 0870399a283bb4c11447ed49c6821a83b2d7947c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 18:04:20 +0000 Subject: [PATCH 251/366] rtree methods info/definition improved [SVN r82386] --- .../geometry/extensions/index/rtree/rtree.hpp | 198 +++++++++++------- 1 file changed, 120 insertions(+), 78 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 965781bb5..cb4d7c09a 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -53,6 +53,8 @@ namespace boost { namespace geometry { namespace index { /*! +\brief The R-tree spatial index. + The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. @@ -112,9 +114,9 @@ public: \param translator The translator object. \param allocator The allocator object. */ - inline explicit rtree(Parameters parameters = Parameters(), + inline explicit rtree(parameters_type parameters = parameters_type(), translator_type const& translator = translator_type(), - Allocator allocator = Allocator()) + allocator_type allocator = allocator_type()) : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) @@ -135,7 +137,10 @@ public: \param allocator The allocator object. */ template - inline rtree(Iterator first, Iterator last, Parameters parameters = Parameters(), translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) + inline rtree(Iterator first, Iterator last, + parameters_type parameters = parameters_type(), + translator_type const& translator = translator_type(), + allocator_type allocator = allocator_type()) : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) @@ -165,7 +170,10 @@ public: \param allocator The allocator object. */ template - inline rtree(Range const& rng, Parameters parameters = Parameters(), translator_type const& translator = translator_type(), Allocator allocator = std::allocator()) + inline rtree(Range const& rng, + parameters_type parameters = parameters_type(), + translator_type const& translator = translator_type(), + allocator_type allocator = allocator_type()) : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) @@ -195,7 +203,9 @@ public: } /*! - \brief The copy constructor. It uses parameters, translator and allocator from the source tree. + \brief The copy constructor. + + The copy constructor. It uses parameters, translator and allocator from the source tree. \exception strong @@ -222,7 +232,7 @@ public: \param src The rtree which content will be copied. \param allocator The allocator which will be used. */ - inline rtree(rtree const& src, Allocator const& allocator) + inline rtree(rtree const& src, allocator_type const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW , m_parameters(src.m_parameters) , m_allocators(allocator) @@ -234,7 +244,9 @@ public: } /*! - \brief The moving constructor. It uses parameters, translator and allocator from the source tree. + \brief The moving constructor. + + The moving constructor. It uses parameters, translator and allocator from the source tree. \exception nothrow @@ -255,7 +267,9 @@ public: } /*! - \brief The assignment operator. It uses parameters and translator from the source tree. + \brief The assignment operator. + + The assignment operator. It uses parameters and translator from the source tree. \exception strong @@ -275,7 +289,9 @@ public: } /*! - \brief The moving assignment. It uses parameters and translator from the source tree. + \brief The moving assignment. + + The moving assignment. It uses parameters and translator from the source tree. \exception nothrow (if allocators are equal), strong (if allocators aren't equal) @@ -313,7 +329,9 @@ public: } /*! - \brief Swaps contents of two rtrees. Parameters, translator and allocators are swapped as well. + \brief Swaps contents of two rtrees. + + Swaps contents of two rtrees. Parameters, translator and allocators are swapped as well. \exception nothrow @@ -387,7 +405,9 @@ public: } /*! - \brief Remove a value from the container. In contrast to the STL set/map erase() method + \brief Remove a value from the container. + + In contrast to the STL set/map erase() method this method removes only one value from the container. \exception not safe - if this operation throws, the R-tree may be left in @@ -403,7 +423,9 @@ public: } /*! - \brief Remove a range of values from the container. In contrast to the STL set/map erase() method + \brief Remove a range of values from the container. + + In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. @@ -426,7 +448,9 @@ public: } /*! - \brief Remove a range of values from the container. In contrast to the STL set/map erase() method + \brief Remove a range of values from the container. + + In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values. @@ -477,18 +501,19 @@ public: }*/ /*! - \brief Finds values meeting spatial predicates, e.g. intersecting some box. + \brief Finds values meeting spatial predicates, e.g. intersecting some Box. + + Spatial predicates may be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together in std::pair + or boost::tuple. \exception strong - \param pred The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together in std::pair - or boost::tuple. - + \param pred The spatial predicates or a Geometry. \param out_it The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container) @@ -509,19 +534,21 @@ public: } /*! - \brief Finds one value meeting distances predicates, e.g. nearest to some point. + \brief Finds one value meeting distances predicates, e.g. nearest to some Point. + + The distances predicates may be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \exception strong - \param dpred The distances predicates. May be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + \param dpred The distances predicates or a Point. \param v The reference to the object which will contain the result. @@ -535,26 +562,30 @@ public: /*! \brief Finds one value meeting distances predicates and spatial predicates, - e.g. nearest to some point and intersecting some box. + e.g. nearest to some Point and intersecting some Box. + + The distances predicates may be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + + The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together in std::pair + or boost::tuple. \exception strong - \param dpred The distances predicates. May be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). - \param pred The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together in std::pair - or boost::tuple. + \param dpred The distances predicates or a Point. + \param pred The spatial predicates or a Geometry \param v The reference to the object which will contain the result. \return The number of values found. @@ -566,19 +597,21 @@ public: } /*! - \brief Finds k values meeting distances predicates, e.g. k nearest values to some point. + \brief Finds k values meeting distances predicates, e.g. k nearest values to some Point. + + The distances predicates. May be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). \exception strong - \param dpred The distances predicates. May be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + \param dpred The distances predicates or a Point. \param k The max number of values. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. @@ -592,27 +625,31 @@ public: /*! \brief Finds k values meeting distances predicates and spatial predicates, - e.g. k nearest values to some point and intersecting some box. + e.g. k nearest values to some Point and intersecting some Box. + + The distances predicates may be a Point. This is default case where Value which + nearest point is closest to Point is returned. May be a PointRelation which define + how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances + bounds. E.g. that some distance must be between min_distance and max_distance. This may + be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), + bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). + MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), + bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + + The spatial predicates. May be a Geometry (in this case default + predicate - intersects is used) or generated by bgi::covered_by(geometry), + bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), + bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), + !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) + or bgi::value(func). Those predicates may be passed together in std::pair + or boost::tuple. \exception strong - \param dpred The distances predicates. May be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + \param dpred The distances predicates or a Point \param k The max number of values. - \param pred The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together in std::pair - or boost::tuple. + \param pred The spatial predicates or a Geometry. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. \return The number of values found. @@ -749,6 +786,7 @@ private: #endif /*! \brief Apply a visitor to the nodes structure in order to perform some operator. + This function is not a part of the 'official' interface. However it makes possible e.g. to pass a visitor drawing the tree structure. @@ -764,7 +802,8 @@ private: } /*! - \brief Returns the number of stored objects. Same as size() + \brief Returns the number of stored objects. Same as size(). + This function is not a part of the 'official' interface. \exception nothrow @@ -778,6 +817,7 @@ private: /*! \brief Returns the depth of the R-tree. + This function is not a part of the 'official' interface. \exception nothrow. @@ -791,7 +831,9 @@ private: private: /*! - \brief Insert a value to the index. Root node must exist. + \pre Root node must exist - m_root != 0. + + \brief Insert a value to the index. \exception basic From c06e6efc981f4dc4c9fb0d6f6036ad59207a0f01 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 21:08:48 +0000 Subject: [PATCH 252/366] R-tree docs improved. [SVN r82387] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../r_tree/exception_safety.html | 16 +- doc/html/geometry_index/r_tree/index.html | 740 +++++------------- .../geometry_index/r_tree/introduction.html | 20 +- .../r_tree/nearest_neighbours_queries.html | 2 +- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../geometry/extensions/index/rtree/rtree.hpp | 68 +- 11 files changed, 289 insertions(+), 581 deletions(-) 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 ab7a739c4..7c2eedefc 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 300395d3a..a79271bfb 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index a374ee31d..fd669c9c6 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 - + @@ -29,7 +29,7 @@

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

                    -
                      +
                      • exception-safe copy constructor and copy assignment of the Value.
                      • @@ -155,7 +155,7 @@

    nothrow or strong - [a] + [a]

    - not safe [b] + not safe [b]

    nothrow or strong - [c] + [c]

    -

    [a] +

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

    -

    [b] +

    [b] If this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

    -

    [c] +

    [c] nothrow - if CoordinateType has nonthrowing copy constructor, strong - otherwise diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 544fcc982..f6f3893e6 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -3,7 +3,7 @@ Reference - + @@ -31,28 +31,48 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    - Description + Description

    The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms.

    +

    + The user must pass a type defining the Parameters which will be used in + rtree creation process. This type is used e.g. to specify balancing algorithm + with specific parameters like min and max number of elements in node. Predefined + algorithms with compile-time parameters are: bgi::linear<MinElements, + MaxElements>, bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, + MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements + * 0.3>. Predefined algorithms with run-time parameters are: bgi::runtime::linear, + bgi::runtime::quadratic, bgi::runtime::rstar. +

    +

    + The Translator translates from Value to Indexable each time r-tree requires + it. Which means that this operation is done for each Value access. Therefore + the Translator should return the Indexable by const reference instead of + a value. Default translator can translate all types adapted to Point or + Box concepts (which are Indexables). It also handles std::pair<Indexable, + T>, pointers, smart pointers, and iterators. E.g. If std::pair<Box, + int> is stored, the default translator translates from std::pair<Box, + int> const& to Box const&. +

    - Synopsis + Synopsis

    template<typename Value,
              typename Parameters,
    -         typename Translator,
    -         typename Allocator>
    -class boost::geometry::index::rtree
    +         typename Translator = translator::def<Value>,
    +         typename Allocator = std::allocator<Value>>
    +class rtree
     {
       // ...
     };
    @@ -61,14 +81,13 @@ The R-tree spatial index.
             

    - Template + Template parameter(s)
    - - - - - - @@ -180,12 +155,120 @@ The R-tree spatial index.
    @@ -76,11 +95,6 @@ The R-tree spatial index. Parameter

    -

    - Default -

    -

    Description @@ -91,13 +105,9 @@ The R-tree spatial index.

    -

    -
    Value
    -

    + Value

    -

    The type of objects stored in the container. @@ -107,72 +117,37 @@ The R-tree spatial index.

    -

    -
    Parameters
    -

    + Parameters

    -

    - Compile-time parameters. The user must pass a type defining the - Parameters which will be used in rtree creation process. This - type is used e.g. to specify balancing algorithm with compile-time - parameters like min and max number of elements in node. Predefined - Algorithms/Parameters are: bgi::linear<MinElements, MaxElements>, - bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, - MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements - * 0.3>. + Compile-time parameters.

    -

    -
    Translator
    -

    -

    -
    -

    -

    -
    translator::def<Value>
    -

    + Translator

    The type of the translator which translates from Value to Indexable. - This translation is done each time the r-tree wants to know Value's - Indexable. Default translator can translate all types adapted - to Point or Box concepts (which are Indexables). It also handles - std::pair<Indexable, T>, pointers, smart pointers, and - iterators. E.g. If std::pair<Box, int> is stored, the default - translator translates from std::pair<Box, int> const& - to Box const&.

    -

    -
    Allocator
    -

    + Allocator

    -

    -
    std::allocator<Value>
    -

    -

    -
    -

    - The allocator. + The allocator used to allocate/deallocate memory, construct/destroy + nodes and Values.

    - Constructor(s) + Typedef(s)
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Description +

    +
    +

    + value_type +

    +
    +

    + The type of Value stored in the container. +

    +
    +

    + parameters_type +

    +
    +

    + R-tree parameters type. +

    +
    +

    + translator_type +

    +
    +

    + Value to Indexable Translator type. +

    +
    +

    + allocator_type +

    +
    +

    + The type of allocator used by the container. +

    +
    +

    + size_type +

    +
    +

    + Unsigned integral type used by the container. +

    +
    +

    + indexable_type +

    +
    +

    + The Indexable type to which Value is translated. +

    +
    +

    + box_type +

    +
    +

    + The Box type used by the R-tree. +

    +
    +
    + + Constructor(s) + and destructor +
    +
    ++ @@ -199,21 +282,12 @@ The R-tree spatial index. Description

    - - - + + + - - -
    -

    - Parameters -

    -

    -

    -
    rtree(parameters_type parameters = parameters_type(),
    -      translator_type const & translator = translator_type(),
    -      allocator_type allocator = allocator_type())
    -

    + rtree()

    @@ -221,32 +295,12 @@ The R-tree spatial index. The constructor.

    -

    - parameters_type: parameters: - The parameters object. -

    -

    - translator_type const &: - translator: The translator object. -

    -

    - allocator_type: allocator: - The allocator object. -

    -

    -

    -
    template<typename Iterator>
    -rtree(Iterator first,
    -      Iterator last,
    -      parameters_type parameters = parameters_type(),
    -      translator_type const & translator = translator_type(),
    -      allocator_type allocator = allocator_type())
    -

    + rtree(Iterator, + Iterator)

    @@ -254,39 +308,12 @@ The R-tree spatial index. The constructor.

    -

    - Iterator: first: - The beginning of the range of Values. -

    -

    - Iterator: last: - The end of the range of Values. -

    -

    - parameters_type: parameters: - The parameters object. -

    -

    - translator_type const &: - translator: The translator object. -

    -

    - allocator_type: allocator: - The allocator object. -

    -

    -

    -
    template<typename Range>
    -rtree(Range const & rng,
    -      parameters_type parameters = parameters_type(),
    -      translator_type const & translator = translator_type(),
    -      allocator_type allocator = allocator_type())
    -

    + rtree(Range const + &)

    @@ -294,31 +321,24 @@ The R-tree spatial index. The constructor.

    - Range const &: rng: - The range of Values. + ~rtree()

    +

    - parameters_type: parameters: - The parameters object. -

    -

    - translator_type const &: - translator: The translator object. -

    -

    - allocator_type: allocator: - The allocator object. + The destructor.

    -

    -
    rtree(rtree const & src)
    -

    + rtree(rtree const + &)

    @@ -326,19 +346,13 @@ The R-tree spatial index. The copy constructor.

    -

    - rtree const &: src: - The rtree which content will be copied. -

    -

    -

    -
    rtree(rtree const & src, allocator_type const & allocator)
    -

    + rtree(rtree const + &, allocator_type + const &)

    @@ -347,23 +361,11 @@ The R-tree spatial index. the source tree.

    -

    - rtree const &: src: - The rtree which content will be copied. -

    -

    - allocator_type const &: - allocator: The allocator which will be used. -

    -

    -

    -
    rtree(rtree && src)
    -

    + rtree(rtree &&)

    @@ -371,26 +373,17 @@ The R-tree spatial index. The moving constructor.

    -

    - rtree &&: src: - The rtree which content will be moved. -

    -
    - - Member - Function(s) + + Member(s)
    -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @@ -403,41 +396,13 @@ The R-tree spatial index. Description

    -

    - Parameters -

    -
    -

    - Returns -

    -

    -

    -
    ~rtree()
    -

    -

    -
    -

    - The destructor. -

    -
    -  
    -

    -

    -
    rtree & operator=(const rtree & src)
    -

    + operator=(const rtree + &)

    @@ -445,20 +410,11 @@ The R-tree spatial index. The assignment operator.

    -

    - const rtree &: src: - The rtree which content will be copied. -

    -
     

    -

    -
    rtree & operator=(rtree && src)
    -

    + operator=(rtree &&)

    @@ -466,20 +422,11 @@ The R-tree spatial index. The moving assignment.

    -

    - rtree &&: src: - The rtree which content will be moved. -

    -
     

    -

    -
    void swap(rtree & other)
    -

    + swap(rtree &)

    @@ -487,20 +434,12 @@ The R-tree spatial index. Swaps contents of two rtrees.

    -

    - rtree &: other: - The rtree which content will be swapped with this rtree content. -

    -
     

    -

    -
    void insert(value_type const & value)
    -

    + insert(value_type const + &)

    @@ -508,22 +447,12 @@ The R-tree spatial index. Insert a value to the index.

    -

    - value_type const &: value: - The value which will be stored in the container. -

    -
     

    -

    -
    template<typename Iterator>
    -void
    -insert(Iterator first, Iterator last)
    -

    + insert(Iterator, + Iterator)

    @@ -531,25 +460,12 @@ The R-tree spatial index. Insert a range of values to the index.

    -

    - Iterator: first: - The beginning of the range of values. -

    -

    - Iterator: last: - The end of the range of values. -

    -
     

    -

    -
    template<typename Range>
    -void insert(Range const & rng)
    -

    + insert(Range const + &)

    @@ -557,20 +473,12 @@ The R-tree spatial index. Insert a range of values to the index.

    -

    - Range const &: rng: - The range of values. -

    -
     

    -

    -
    size_type remove(value_type const & value)
    -

    + remove(value_type const + &)

    @@ -578,26 +486,12 @@ The R-tree spatial index. Remove a value from the container.

    -

    - value_type const &: value: - The value which will be removed from the container. -

    -
    -

    - 1 if the value was removed, 0 otherwise. -

    -

    -

    -
    template<typename Iterator>
    -size_type
    -remove(Iterator first, Iterator last)
    -

    + remove(Iterator, + Iterator)

    @@ -605,29 +499,12 @@ The R-tree spatial index. Remove a range of values from the container.

    -

    - Iterator: first: - The beginning of the range of values. -

    -

    - Iterator: last: - The end of the range of values. -

    -
    -

    - The number of removed values. -

    -

    -

    -
    template<typename Range>
    -size_type remove(Range const & rng)
    -

    + remove(Range const + &)

    @@ -635,26 +512,13 @@ The R-tree spatial index. Remove a range of values from the container.

    -

    - Range const &: rng: - The range of values. -

    -
    -

    - The number of removed values. -

    -

    -

    -
    template<typename Predicates, typename OutIter>
    -size_type
    -spatial_query(Predicates const & pred, OutIter out_it)
    -

    + spatial_query(Predicates + const &, + OutIter)

    @@ -663,31 +527,13 @@ The R-tree spatial index. Box.

    -

    - Predicates const &: pred: - The spatial predicates or a Geometry. -

    -

    - OutIter: out_it: - The output iterator of the result range. E.g. an iterator generated - by std::back_inserter(container) -

    -
    -

    - The number of values found. -

    -

    -

    -
    template<typename DistancesPredicates>
    -size_type
    -nearest_query(DistancesPredicates const & dpred, value_type & v)
    -

    + nearest_query(DistancesPredicates + const &, + value_type &)

    @@ -696,32 +542,15 @@ The R-tree spatial index. some Point.

    -

    - DistancesPredicates const &: - dpred: The distances predicates or a Point. -

    -

    - value_type &: v: - The reference to the object which will contain the result. -

    -
    -

    - The number of values found. -

    -

    -

    -
    template<typename DistancesPredicates, typename Predicates>
    -size_type
    -nearest_query(DistancesPredicates const & dpred,
    -              Predicates const & pred,
    -              value_type & v)
    -

    + nearest_query(DistancesPredicates + const &, + Predicates const + &, value_type + &)

    @@ -730,36 +559,14 @@ The R-tree spatial index. e.g. nearest to some Point and intersecting some Box.

    -

    - DistancesPredicates const &: - dpred: The distances predicates or a Point. -

    -

    - Predicates const &: pred: - The spatial predicates or a Geometry -

    -

    - value_type &: v: - The reference to the object which will contain the result. -

    -
    -

    - The number of values found. -

    -

    -

    -
    template<typename DistancesPredicates, typename OutIter>
    -size_type
    -nearest_query(DistancesPredicates const & dpred,
    -              size_t k,
    -              OutIter out_it)
    -

    + nearest_query(DistancesPredicates + const &, + size_t, + OutIter)

    @@ -768,39 +575,15 @@ The R-tree spatial index. to some Point.

    -

    - DistancesPredicates const &: - dpred: The distances predicates or a Point. -

    -

    - size_t: k: - The max number of values. -

    -

    - OutIter: out_it: - The output iterator of the result range. E.g. a back_insert_iterator. -

    -
    -

    - The number of values found. -

    -

    -

    -
    template<typename DistancesPredicates,
    -         typename Predicates,
    -         typename OutIter>
    -size_type
    -nearest_query(DistancesPredicates const & dpred,
    -              size_t k,
    -              Predicates const & pred,
    -              OutIter out_it)
    -

    + nearest_query(DistancesPredicates + const &, + size_t, + Predicates const + &, OutIter)

    @@ -809,36 +592,11 @@ The R-tree spatial index. e.g. k nearest values to some Point and intersecting some Box.

    -

    - DistancesPredicates const &: - dpred: The distances predicates or a Point -

    -

    - size_t: k: - The max number of values. -

    -

    - Predicates const &: pred: - The spatial predicates or a Geometry. -

    -

    - OutIter: out_it: - The output iterator of the result range. E.g. a back_insert_iterator. -

    -
    -

    - The number of values found. -

    -

    -

    -
    size_type size()
    -

    + size()

    @@ -846,20 +604,11 @@ The R-tree spatial index. Returns the number of stored values.

    - -

    - The number of stored values. -

    -

    -

    -
    bool empty()
    -

    + empty()

    @@ -867,20 +616,11 @@ The R-tree spatial index. Query if the container is empty.

    - -

    - true if the container is empty. -

    -

    -

    -
    void clear()
    -

    + clear()

    @@ -888,69 +628,36 @@ The R-tree spatial index. Removes all values stored in the container.

    -  

    -

    -
    box_type box()
    -

    + box()

    Returns the box containing all values stored in the container. - If the container is empty the result of geometry::assign_inverse() - is returned. -

    -
    - -

    - The box containing all values stored in the container or an invalid - box if there are no values in the container.

    -

    -
    template<typename ValueOrIndexable>
    -size_type count(ValueOrIndexable const & vori)
    -

    + count(ValueOrIndexable const + &)

    - For indexable_type it returns the number of values which indexables - equals the parameter. For value_type it returns the number of - values which equals the parameter. -

    -
    -

    - ValueOrIndexable const &: - vori: The value or indexable which will - be counted. -

    -
    -

    - The number of values found. + Count Values or Indexables stored in the container.

    -

    -
    parameters_type const & parameters()
    -

    + parameters()

    @@ -958,20 +665,11 @@ The R-tree spatial index. Returns parameters.

    - -

    - The parameters object. -

    -

    -

    -
    translator_type const & translator()
    -

    + translator()

    @@ -979,20 +677,11 @@ The R-tree spatial index. Returns the translator object.

    - -

    - The translator object. -

    -

    -

    -
    allocator_type get_allocator()
    -

    + get_allocator()

    @@ -1000,19 +689,12 @@ The R-tree spatial index. Returns allocator used by the rtree.

    - -

    - The allocator. -

    -
    - - Header + + Header

    #include <.hpp> diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index b0b2ee116..89d93898c 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

    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 + 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 [2]. + close to some point in space [2].

    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

    -
      +
      • capable to store arbitrary Value type,
      • @@ -201,20 +201,20 @@
      -

      -

      [1] +


      +

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

      -

      [2] +

      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

      -

      [3] +

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

      -

      [4] +

      [4] 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 341fd302b..390fe04c5 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 2e4bf7514..9ec8f8b5c 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 - + @@ -150,7 +150,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 7fee097e3..dc19fd16b 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 7abb14091..ab342f9bd 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -57,7 +57,7 @@

      - +

      Last revised: January 07, 2013 at 04:43:31 GMT

      Last revised: January 07, 2013 at 21:06:41 GMT


      diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index cb4d7c09a..49c9054aa 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -58,20 +58,29 @@ namespace boost { namespace geometry { namespace index { The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. +The user must pass a type defining the Parameters which will +be used in rtree creation process. This type is used e.g. to specify balancing algorithm +with specific parameters like min and max number of elements in node. +Predefined algorithms with compile-time parameters are: +bgi::linear, +bgi::quadratic, +bgi::rstar. +Predefined algorithms with run-time parameters are: +bgi::runtime::linear, +bgi::runtime::quadratic, +bgi::runtime::rstar. + +The Translator translates from Value to Indexable each time r-tree requires it. Which means that this +operation is done for each Value access. Therefore the Translator should return the Indexable by +const reference instead of a value. Default translator can translate all types adapted to Point +or Box concepts (which are Indexables). It also handles std::pair, pointers, smart pointers, +and iterators. E.g. If std::pair is stored, the default translator translates from +std::pair const& to Box const&. + \tparam Value The type of objects stored in the container. -\tparam Parameters Compile-time parameters. The user must pass a type defining the Parameters which will - be used in rtree creation process. This type is used e.g. to specify balancing algorithm - with compile-time parameters like min and max number of elements in node. - Predefined Algorithms/Parameters are: - bgi::linear, - bgi::quadratic, - bgi::rstar. -\tparam Translator The type of the translator which translates from Value to Indexable. This translation is done each time - the r-tree wants to know Value's Indexable. Default translator can translate all types adapted to Point - or Box concepts (which are Indexables). It also handles std::pair, pointers, smart pointers, - and iterators. E.g. If std::pair is stored, the default translator translates from - std::pair const& to Box const&. -\tparam Allocator The allocator. +\tparam Parameters Compile-time parameters. +\tparam Translator The type of the translator which translates from Value to Indexable. +\tparam Allocator The allocator used to allocate/deallocate memory, construct/destroy nodes and Values. */ template < typename Value, @@ -84,13 +93,20 @@ class rtree BOOST_COPYABLE_AND_MOVABLE(rtree) public: + /*! \brief The type of Value stored in the container. */ typedef Value value_type; + /*! \brief R-tree parameters type. */ typedef Parameters parameters_type; + /*! \brief Value to Indexable Translator type. */ typedef Translator translator_type; + /*! \brief The type of allocator used by the container. */ typedef Allocator allocator_type; + /*! \brief Unsigned integral type used by the container. */ typedef typename allocator_type::size_type size_type; + /*! \brief The Indexable type to which Value is translated. */ typedef typename translator::indexable_type::type indexable_type; + /*! \brief The Box type used by the R-tree. */ typedef typename index::default_box_type::type box_type; #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) @@ -170,10 +186,10 @@ public: \param allocator The allocator object. */ template - inline rtree(Range const& rng, - parameters_type parameters = parameters_type(), - translator_type const& translator = translator_type(), - allocator_type allocator = allocator_type()) + inline explicit rtree(Range const& rng, + parameters_type parameters = parameters_type(), + translator_type const& translator = translator_type(), + allocator_type allocator = allocator_type()) : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) @@ -696,6 +712,8 @@ public: /*! \brief Returns the box containing all values stored in the container. + + Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned. \exception nothrow (if Indexable's CoordinateType copy assignment doesn't throw), @@ -722,7 +740,9 @@ public: } /*! - \brief For indexable_type it returns the number of values which indexables equals the parameter. + \brief Count Values or Indexables stored in the container. + + For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter. \exception nothrow. @@ -1085,7 +1105,9 @@ inline void insert(rtree & tree, Range co } /*! -\brief Remove a value from the container. In contrast to the STL set/map erase() method +\brief Remove a value from the container. + +Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container. \param tree The spatial index. @@ -1101,7 +1123,9 @@ remove(rtree & tree, Value const& v) } /*! -\brief Remove a range of values from the container. In contrast to the STL set/map erase() method +\brief Remove a range of values from the container. + +Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. @@ -1120,7 +1144,9 @@ remove(rtree & tree, Iterator first, Iter } /*! -\brief Remove a range of values from the container. In contrast to the STL set/map erase() method +\brief Remove a range of values from the container. + +Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. From 200a6131399a51d231427508bdc974bbd9df01e8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 23:15:57 +0000 Subject: [PATCH 253/366] Docs improved. Added alternative version of doxygen_xml2qbk. [SVN r82393] --- doc/Jamfile.v2 | 2 +- doc/html/geometry_index/r_tree/index.html | 2186 +++++++++++++- doc/html/index.html | 2 +- doc/src/tools/doxygen_xml2qbk/Jamfile.v2 | 30 + .../tools/doxygen_xml2qbk/configuration.hpp | 33 + .../contrib/rapidxml-1.13/license.txt | 52 + .../contrib/rapidxml-1.13/manual.html | 406 +++ .../contrib/rapidxml-1.13/rapidxml.hpp | 2596 +++++++++++++++++ .../rapidxml-1.13/rapidxml_iterators.hpp | 174 ++ .../contrib/rapidxml-1.13/rapidxml_print.hpp | 421 +++ .../contrib/rapidxml-1.13/rapidxml_utils.hpp | 122 + .../tools/doxygen_xml2qbk/contrib/readme.txt | 5 + .../doxygen_xml2qbk/doxygen_elements.hpp | 166 ++ .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 190 ++ .../tools/doxygen_xml2qbk/doxygen_xml2qbk.suo | Bin 0 -> 22528 bytes .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 596 ++++ .../tools/doxygen_xml2qbk/file_to_string.hpp | 35 + .../doxygen_xml2qbk/parameter_predicates.hpp | 60 + .../doxygen_xml2qbk/quickbook_output.hpp | 899 ++++++ .../tools/doxygen_xml2qbk/rapidxml_util.hpp | 68 + 20 files changed, 8031 insertions(+), 12 deletions(-) create mode 100644 doc/src/tools/doxygen_xml2qbk/Jamfile.v2 create mode 100644 doc/src/tools/doxygen_xml2qbk/configuration.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/license.txt create mode 100644 doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html create mode 100644 doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_iterators.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_print.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_utils.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/contrib/readme.txt create mode 100644 doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp create mode 100644 doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.suo create mode 100644 doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/file_to_string.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/parameter_predicates.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp create mode 100644 doc/src/tools/doxygen_xml2qbk/rapidxml_util.hpp diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 8df28439c..e6f507006 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -24,7 +24,7 @@ boostbook geometry_index-doc chunk.first.sections=1 toc.section.depth=3 toc.max.depth=2 - generate.section.toc.level=4 + generate.section.toc.level=2 boost.root=http://www.boost.org/doc/libs/release enable_index diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index f6f3893e6..e547169c6 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,7 @@ boost::geometry::index::rtree

      - + The R-tree spatial index.

      @@ -64,6 +64,13 @@ The R-tree spatial index.

      + Header +
      +

      + #include <.hpp> +

      +
      + Synopsis

      @@ -80,7 +87,7 @@ The R-tree spatial index.

      - + Template parameter(s)
      @@ -154,7 +161,7 @@ The R-tree spatial index.
    - + Typedef(s)
    @@ -262,7 +269,7 @@ The R-tree spatial index.
    - + Constructor(s) and destructor
    @@ -377,7 +384,7 @@ The R-tree spatial index.
    - + Member(s)
    @@ -692,13 +699,2172 @@ The R-tree spatial index.
    +
    +
    - - Header -
    + + Synopsis +

    - #include <.hpp> -

    +

    +
    rtree(parameters_type parameters = parameters_type(),
    +      translator_type const & translator = translator_type(),
    +      allocator_type allocator = allocator_type())
    +

    +

    +
    + + Description +
    +

    + The constructor. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + parameters_type +

    +
    +

    + 'parameters' +

    +
    +

    + The parameters object. +

    +
    +

    + translator_type const & +

    +
    +

    + 'translator' +

    +
    +

    + The translator object. +

    +
    +

    + allocator_type +

    +
    +

    + 'allocator' +

    +
    +

    + The allocator object. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename Iterator>
    +rtree(Iterator first,
    +      Iterator last,
    +      parameters_type parameters = parameters_type(),
    +      translator_type const & translator = translator_type(),
    +      allocator_type allocator = allocator_type())
    +

    +

    +
    + + Description +
    +

    + The constructor. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Iterator +

    +
    +

    + 'first' +

    +
    +

    + The beginning of the range of Values. +

    +
    +

    + Iterator +

    +
    +

    + 'last' +

    +
    +

    + The end of the range of Values. +

    +
    +

    + parameters_type +

    +
    +

    + 'parameters' +

    +
    +

    + The parameters object. +

    +
    +

    + translator_type const & +

    +
    +

    + 'translator' +

    +
    +

    + The translator object. +

    +
    +

    + allocator_type +

    +
    +

    + 'allocator' +

    +
    +

    + The allocator object. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename Range>
    +rtree(Range const & rng,
    +      parameters_type parameters = parameters_type(),
    +      translator_type const & translator = translator_type(),
    +      allocator_type allocator = allocator_type())
    +

    +

    +
    + + Description +
    +

    + The constructor. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Range const & +

    +
    +

    + 'rng' +

    +
    +

    + The range of Values. +

    +
    +

    + parameters_type +

    +
    +

    + 'parameters' +

    +
    +

    + The parameters object. +

    +
    +

    + translator_type const & +

    +
    +

    + 'translator' +

    +
    +

    + The translator object. +

    +
    +

    + allocator_type +

    +
    +

    + 'allocator' +

    +
    +

    + The allocator object. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    ~rtree()
    +

    +

    +
    + + Description +
    +

    + The destructor. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    rtree(rtree const & src)
    +

    +

    +
    + + Description +
    +

    + The copy constructor. It uses parameters, translator and allocator from + the source tree. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree const & +

    +
    +

    + 'src' +

    +
    +

    + The rtree which content will be copied. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    rtree(rtree const & src, allocator_type const & allocator)
    +

    +

    +
    + + Description +
    +

    + The copy constructor. It uses Parameters and translator from the source + tree. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree const & +

    +
    +

    + 'src' +

    +
    +

    + The rtree which content will be copied. +

    +
    +

    + allocator_type const & +

    +
    +

    + 'allocator' +

    +
    +

    + The allocator which will be used. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    rtree(rtree && src)
    +

    +

    +
    + + Description +
    +

    + The moving constructor. It uses parameters, translator and allocator + from the source tree. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree && +

    +
    +

    + 'src' +

    +
    +

    + The rtree which content will be moved. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    rtree & operator=(const rtree & src)
    +

    +

    +
    + + Description +
    +

    + The assignment operator. It uses parameters and translator from the source + tree. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + const rtree & +

    +
    +

    + 'src' +

    +
    +

    + The rtree which content will be copied. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    rtree & operator=(rtree && src)
    +

    +

    +
    + + Description +
    +

    + The moving assignment. It uses parameters and translator from the source + tree. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree && +

    +
    +

    + 'src' +

    +
    +

    + The rtree which content will be moved. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    void swap(rtree & other)
    +

    +

    +
    + + Description +
    +

    + Swaps contents of two rtrees. Parameters, translator and allocators are + swapped as well. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree & +

    +
    +

    + 'other' +

    +
    +

    + The rtree which content will be swapped with this rtree content. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    void insert(value_type const & value)
    +

    +

    +
    + + Description +
    +

    + Insert a value to the index. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + value_type const & +

    +
    +

    + 'value' +

    +
    +

    + The value which will be stored in the container. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename Iterator>
    +void insert(Iterator first, Iterator last)
    +

    +

    +
    + + Description +
    +

    + Insert a range of values to the index. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Iterator +

    +
    +

    + 'first' +

    +
    +

    + The beginning of the range of values. +

    +
    +

    + Iterator +

    +
    +

    + 'last' +

    +
    +

    + The end of the range of values. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename Range>
    +void insert(Range const & rng)
    +

    +

    +
    + + Description +
    +

    + Insert a range of values to the index. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Range const & +

    +
    +

    + 'rng' +

    +
    +

    + The range of values. +

    +
    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    size_type remove(value_type const & value)
    +

    +

    +
    + + Description +
    +

    + In contrast to the STL set/map erase() method this method removes only + one value from the container. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + value_type const & +

    +
    +

    + 'value' +

    +
    +

    + The value which will be removed from the container. +

    +
    +
    + + Returns +
    +

    + 1 if the value was removed, 0 otherwise. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename Iterator>
    +size_type remove(Iterator first, Iterator last)
    +

    +

    +
    + + Description +
    +

    + In contrast to the STL set/map erase() method it doesn't take iterators + pointing to values stored in this container. It removes values equal + to these passed as a range. Furthermore this method removes only one + value for each one passed in the range, not all equal values. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Iterator +

    +
    +

    + 'first' +

    +
    +

    + The beginning of the range of values. +

    +
    +

    + Iterator +

    +
    +

    + 'last' +

    +
    +

    + The end of the range of values. +

    +
    +
    + + Returns +
    +

    + The number of removed values. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename Range>
    +size_type remove(Range const & rng)
    +

    +

    +
    + + Description +
    +

    + In contrast to the STL set/map erase() method it removes values equal + to these passed as a range. Furthermore, this method removes only one + value for each one passed in the range, not all equal values. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Range const & +

    +
    +

    + 'rng' +

    +
    +

    + The range of values. +

    +
    +
    + + Returns +
    +

    + The number of removed values. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename Predicates, typename OutIter>
    +size_type spatial_query(Predicates const & pred, OutIter out_it)
    +

    +

    +
    + + Description +
    +

    + Spatial predicates may be a Geometry (in this case default predicate + - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), + bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), + !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), + !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). + Those predicates may be passed together in std::pair or boost::tuple. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Predicates const & +

    +
    +

    + 'pred' +

    +
    +

    + The spatial predicates or a Geometry. +

    +
    +

    + OutIter +

    +
    +

    + 'out_it' +

    +
    +

    + The output iterator of the result range. E.g. an iterator generated + by std::back_inserter(container) +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates>
    +size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
    +

    +

    +
    + + Description +
    +

    + The distances predicates may be a Point. This is default case where Value + which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates const & +

    +
    +

    + 'dpred' +

    +
    +

    + The distances predicates or a Point. +

    +
    +

    + value_type & +

    +
    +

    + 'v' +

    +
    +

    + The reference to the object which will contain the result. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates, typename Predicates>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        Predicates const & pred,
    +                        value_type & v)
    +

    +

    +
    + + Description +
    +

    + The distances predicates may be a Point. This is default case where Value + which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + The spatial predicates. May be a Geometry (in this case default predicate + - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), + bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), + !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), + !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). + Those predicates may be passed together in std::pair or boost::tuple. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates const & +

    +
    +

    + 'dpred' +

    +
    +

    + The distances predicates or a Point. +

    +
    +

    + Predicates const & +

    +
    +

    + 'pred' +

    +
    +

    + The spatial predicates or a Geometry +

    +
    +

    + value_type & +

    +
    +

    + 'v' +

    +
    +

    + The reference to the object which will contain the result. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates, typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        size_t k,
    +                        OutIter out_it)
    +

    +

    +
    + + Description +
    +

    + The distances predicates. May be a Point. This is default case where + Value which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates const & +

    +
    +

    + 'dpred' +

    +
    +

    + The distances predicates or a Point. +

    +
    +

    + size_t +

    +
    +

    + 'k' +

    +
    +

    + The max number of values. +

    +
    +

    + OutIter +

    +
    +

    + 'out_it' +

    +
    +

    + The output iterator of the result range. E.g. a back_insert_iterator. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates,
    +         typename Predicates,
    +         typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        size_t k,
    +                        Predicates const & pred,
    +                        OutIter out_it)
    +

    +

    +
    + + Description +
    +

    + The distances predicates may be a Point. This is default case where Value + which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + The spatial predicates. May be a Geometry (in this case default predicate + - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), + bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), + !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), + !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). + Those predicates may be passed together in std::pair or boost::tuple. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates const & +

    +
    +

    + 'dpred' +

    +
    +

    + The distances predicates or a Point +

    +
    +

    + size_t +

    +
    +

    + 'k' +

    +
    +

    + The max number of values. +

    +
    +

    + Predicates const & +

    +
    +

    + 'pred' +

    +
    +

    + The spatial predicates or a Geometry. +

    +
    +

    + OutIter +

    +
    +

    + 'out_it' +

    +
    +

    + The output iterator of the result range. E.g. a back_insert_iterator. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    +
    +
    +size() +
    +
    + + Synopsis +
    +

    +

    +
    size_type size()
    +

    +

    +
    + + Description +
    +

    + Returns the number of stored values. +

    +
    + + Returns +
    +

    + The number of stored values. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    bool empty()
    +

    +

    +
    + + Description +
    +

    + Query if the container is empty. +

    +
    + + Returns +
    +

    + true if the container is empty. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    void clear()
    +

    +

    +
    + + Description +
    +

    + Removes all values stored in the container. +

    +
    +
    +
    +box() +
    +
    + + Synopsis +
    +

    +

    +
    box_type box()
    +

    +

    +
    + + Description +
    +

    + Returns the box containing all values stored in the container. If the + container is empty the result of geometry::assign_inverse() is returned. +

    +
    + + Returns +
    +

    + The box containing all values stored in the container or an invalid box + if there are no values in the container. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    template<typename ValueOrIndexable>
    +size_type count(ValueOrIndexable const & vori)
    +

    +

    +
    + + Description +
    +

    + For indexable_type it returns the number of values which indexables equals + the parameter. For value_type it returns the number of values which equals + the parameter. +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + ValueOrIndexable const & +

    +
    +

    + 'vori' +

    +
    +

    + The value or indexable which will be counted. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    parameters_type const & parameters()
    +

    +

    +
    + + Description +
    +

    + Returns parameters. +

    +
    + + Returns +
    +

    + The parameters object. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    translator_type const & translator()
    +

    +

    +
    + + Description +
    +

    + Returns the translator object. +

    +
    + + Returns +
    +

    + The translator object. +

    +
    +
    + +
    + + Synopsis +
    +

    +

    +
    allocator_type get_allocator()
    +

    +

    +
    + + Description +
    +

    + Returns allocator used by the rtree. +

    +
    + + Returns +
    +

    + The allocator. +

    +
    diff --git a/doc/html/index.html b/doc/html/index.html index ab342f9bd..5aa48c722 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@
    - +

    Last revised: January 07, 2013 at 21:06:41 GMT

    Last revised: January 07, 2013 at 23:08:40 GMT


    diff --git a/doc/src/tools/doxygen_xml2qbk/Jamfile.v2 b/doc/src/tools/doxygen_xml2qbk/Jamfile.v2 new file mode 100644 index 000000000..97b408f23 --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/Jamfile.v2 @@ -0,0 +1,30 @@ +# Boost.Geometry (aka GGL, Generic Geometry Library) +# Doxygen XML to QuickBook +# +# Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2010-2012 Mateusz Loskot, London, UK. + +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +project doxygen_xml2qbk + : requirements + . + contrib/rapidxml-1.13 + ../../../../../libs/program_options/build//boost_program_options + static + ; + +exe doxygen_xml2qbk : doxygen_xml2qbk.cpp ; + +install dist-bin + : + doxygen_xml2qbk + : + EXE + ../../../../../dist/bin + : + release + ; diff --git a/doc/src/tools/doxygen_xml2qbk/configuration.hpp b/doc/src/tools/doxygen_xml2qbk/configuration.hpp new file mode 100644 index 000000000..96cf8104c --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/configuration.hpp @@ -0,0 +1,33 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +#ifndef CONFIGURATION_HPP +#define CONFIGURATION_HPP + + +#include +#include + + +struct configuration +{ + // To transfer e.g. c:/_svn/boost/trunk/boost/geometry/algorithms/area.hpp + // to #include + // We need to find the position where the include path should start, + // so fill out "boost" here, or "boost/geometry" (it uses rfind) + std::string start_include; + + // Convenience headers (headefiles with solely purpose of including others + std::string convenience_header_path; + std::vector convenience_headers; + + std::string skip_namespace; +}; + + +#endif // CONFIGURATION_HPP diff --git a/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/license.txt b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/license.txt new file mode 100644 index 000000000..140983180 --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/license.txt @@ -0,0 +1,52 @@ +Use of this software is granted under one of the following two licenses, +to be chosen freely by the user. + +1. Boost Software License - Version 1.0 - August 17th, 2003 +=============================================================================== + +Copyright (c) 2006, 2007 Marcin Kalicinski + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +2. The MIT License +=============================================================================== + +Copyright (c) 2006, 2007 Marcin Kalicinski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html new file mode 100644 index 000000000..2c422703f --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/manual.html @@ -0,0 +1,406 @@ +

    RAPIDXML Manual

    Version 1.13

    Copyright (C) 2006, 2009 Marcin Kalicinski
    See accompanying file license.txt for license information.

    Table of Contents

    1. What is RapidXml?
    1.1 Dependencies And Compatibility
    1.2 Character Types And Encodings
    1.3 Error Handling
    1.4 Memory Allocation
    1.5 W3C Compliance
    1.6 API Design
    1.7 Reliability
    1.8 Acknowledgements
    2. Two Minute Tutorial
    2.1 Parsing
    2.2 Accessing The DOM Tree
    2.3 Modifying The DOM Tree
    2.4 Printing XML
    3. Differences From Regular XML Parsers
    3.1 Lifetime Of Source Text
    3.2 Ownership Of Strings
    3.3 Destructive Vs Non-Destructive Mode
    4. Performance
    4.1 Comparison With Other Parsers
    5. Reference

    1. What is RapidXml?

    RapidXml is an attempt to create the fastest XML DOM parser possible, while retaining useability, portability and reasonable W3C compatibility. It is an in-situ parser written in C++, with parsing speed approaching that of strlen() function executed on the same data.

    + Entire parser is contained in a single header file, so no building or linking is neccesary. To use it you just need to copy rapidxml.hpp file to a convenient place (such as your project directory), and include it where needed. You may also want to use printing functions contained in header rapidxml_print.hpp.

    1.1 Dependencies And Compatibility

    RapidXml has no dependencies other than a very small subset of standard C++ library (<cassert>, <cstdlib>, <new> and <exception>, unless exceptions are disabled). It should compile on any reasonably conformant compiler, and was tested on Visual C++ 2003, Visual C++ 2005, Visual C++ 2008, gcc 3, gcc 4, and Comeau 4.3.3. Care was taken that no warnings are produced on these compilers, even with highest warning levels enabled.

    1.2 Character Types And Encodings

    RapidXml is character type agnostic, and can work both with narrow and wide characters. Current version does not fully support UTF-16 or UTF-32, so use of wide characters is somewhat incapacitated. However, it should succesfully parse wchar_t strings containing UTF-16 or UTF-32 if endianness of the data matches that of the machine. UTF-8 is fully supported, including all numeric character references, which are expanded into appropriate UTF-8 byte sequences (unless you enable parse_no_utf8 flag).

    + Note that RapidXml performs no decoding - strings returned by name() and value() functions will contain text encoded using the same encoding as source file. Rapidxml understands and expands the following character references: &apos; &amp; &quot; &lt; &gt; &#...; Other character references are not expanded.

    1.3 Error Handling

    By default, RapidXml uses C++ exceptions to report errors. If this behaviour is undesirable, RAPIDXML_NO_EXCEPTIONS can be defined to suppress exception code. See parse_error class and parse_error_handler() function for more information.

    1.4 Memory Allocation

    RapidXml uses a special memory pool object to allocate nodes and attributes, because direct allocation using new operator would be far too slow. Underlying memory allocations performed by the pool can be customized by use of memory_pool::set_allocator() function. See class memory_pool for more information.

    1.5 W3C Compliance

    RapidXml is not a W3C compliant parser, primarily because it ignores DOCTYPE declarations. There is a number of other, minor incompatibilities as well. Still, it can successfully parse and produce complete trees of all valid XML files in W3C conformance suite (over 1000 files specially designed to find flaws in XML processors). In destructive mode it performs whitespace normalization and character entity substitution for a small set of built-in entities.

    1.6 API Design

    RapidXml API is minimalistic, to reduce code size as much as possible, and facilitate use in embedded environments. Additional convenience functions are provided in separate headers: rapidxml_utils.hpp and rapidxml_print.hpp. Contents of these headers is not an essential part of the library, and is currently not documented (otherwise than with comments in code).

    1.7 Reliability

    RapidXml is very robust and comes with a large harness of unit tests. Special care has been taken to ensure stability of the parser no matter what source text is thrown at it. One of the unit tests produces 100,000 randomly corrupted variants of XML document, which (when uncorrupted) contains all constructs recognized by RapidXml. RapidXml passes this test when it correctly recognizes that errors have been introduced, and does not crash or loop indefinitely.

    + Another unit test puts RapidXml head-to-head with another, well estabilished XML parser, and verifies that their outputs match across a wide variety of small and large documents.

    + Yet another test feeds RapidXml with over 1000 test files from W3C compliance suite, and verifies that correct results are obtained. There are also additional tests that verify each API function separately, and test that various parsing modes work as expected.

    1.8 Acknowledgements

    I would like to thank Arseny Kapoulkine for his work on pugixml, which was an inspiration for this project. Additional thanks go to Kristen Wegner for creating pugxml, from which pugixml was derived. Janusz Wohlfeil kindly ran RapidXml speed tests on hardware that I did not have access to, allowing me to expand performance comparison table.

    2. Two Minute Tutorial

    2.1 Parsing

    The following code causes RapidXml to parse a zero-terminated string named text:
    using namespace rapidxml;
    +xml_document<> doc;    // character type defaults to char
    +doc.parse<0>(text);    // 0 means default parse flags
    +
    doc object is now a root of DOM tree containing representation of the parsed XML. Because all RapidXml interface is contained inside namespace rapidxml, users must either bring contents of this namespace into scope, or fully qualify all the names. Class xml_document represents a root of the DOM hierarchy. By means of public inheritance, it is also an xml_node and a memory_pool. Template parameter of xml_document::parse() function is used to specify parsing flags, with which you can fine-tune behaviour of the parser. Note that flags must be a compile-time constant.

    2.2 Accessing The DOM Tree

    To access the DOM tree, use methods of xml_node and xml_attribute classes:
    cout << "Name of my first node is: " << doc.first_node()->name() << "\n";
    +xml_node<> *node = doc.first_node("foobar");
    +cout << "Node foobar has value " << node->value() << "\n";
    +for (xml_attribute<> *attr = node->first_attribute();
    +     attr; attr = attr->next_attribute())
    +{
    +    cout << "Node foobar has attribute " << attr->name() << " ";
    +    cout << "with value " << attr->value() << "\n";
    +}
    +

    2.3 Modifying The DOM Tree

    DOM tree produced by the parser is fully modifiable. Nodes and attributes can be added/removed, and their contents changed. The below example creates a HTML document, whose sole contents is a link to google.com website:
    xml_document<> doc;
    +xml_node<> *node = doc.allocate_node(node_element, "a", "Google");
    +doc.append_node(node);
    +xml_attribute<> *attr = doc.allocate_attribute("href", "google.com");
    +node->append_attribute(attr);
    +
    One quirk is that nodes and attributes do not own the text of their names and values. This is because normally they only store pointers to the source text. So, when assigning a new name or value to the node, care must be taken to ensure proper lifetime of the string. The easiest way to achieve it is to allocate the string from the xml_document memory pool. In the above example this is not necessary, because we are only assigning character constants. But the code below uses memory_pool::allocate_string() function to allocate node name (which will have the same lifetime as the document), and assigns it to a new node:
    xml_document<> doc;
    +char *node_name = doc.allocate_string(name);        // Allocate string and copy name into it
    +xml_node<> *node = doc.allocate_node(node_element, node_name);  // Set node name to node_name
    +
    Check Reference section for description of the entire interface.

    2.4 Printing XML

    You can print xml_document and xml_node objects into an XML string. Use print() function or operator <<, which are defined in rapidxml_print.hpp header.
    using namespace rapidxml;
    +xml_document<> doc;    // character type defaults to char
    +// ... some code to fill the document
    +
    +// Print to stream using operator <<
    +std::cout << doc;   
    +
    +// Print to stream using print function, specifying printing flags
    +print(std::cout, doc, 0);   // 0 means default printing flags
    +
    +// Print to string using output iterator
    +std::string s;
    +print(std::back_inserter(s), doc, 0);
    +
    +// Print to memory buffer using output iterator
    +char buffer[4096];                      // You are responsible for making the buffer large enough!
    +char *end = print(buffer, doc, 0);      // end contains pointer to character after last printed character
    +*end = 0;                               // Add string terminator after XML
    +

    3. Differences From Regular XML Parsers

    RapidXml is an in-situ parser, which allows it to achieve very high parsing speed. In-situ means that parser does not make copies of strings. Instead, it places pointers to the source text in the DOM hierarchy.

    3.1 Lifetime Of Source Text

    In-situ parsing requires that source text lives at least as long as the document object. If source text is destroyed, names and values of nodes in DOM tree will become destroyed as well. Additionally, whitespace processing, character entity translation, and zero-termination of strings require that source text be modified during parsing (but see non-destructive mode). This makes the text useless for further processing once it was parsed by RapidXml.

    + In many cases however, these are not serious issues.

    3.2 Ownership Of Strings

    Nodes and attributes produced by RapidXml do not own their name and value strings. They merely hold the pointers to them. This means you have to be careful when setting these values manually, by using xml_base::name(const Ch *) or xml_base::value(const Ch *) functions. Care must be taken to ensure that lifetime of the string passed is at least as long as lifetime of the node/attribute. The easiest way to achieve it is to allocate the string from memory_pool owned by the document. Use memory_pool::allocate_string() function for this purpose.

    3.3 Destructive Vs Non-Destructive Mode

    By default, the parser modifies source text during the parsing process. This is required to achieve character entity translation, whitespace normalization, and zero-termination of strings.

    + In some cases this behaviour may be undesirable, for example if source text resides in read only memory, or is mapped to memory directly from file. By using appropriate parser flags (parse_non_destructive), source text modifications can be disabled. However, because RapidXml does in-situ parsing, it obviously has the following side-effects:

    4. Performance

    RapidXml achieves its speed through use of several techniques:
    • In-situ parsing. When building DOM tree, RapidXml does not make copies of string data, such as node names and values. Instead, it stores pointers to interior of the source text.
    • Use of template metaprogramming techniques. This allows it to move much of the work to compile time. Through magic of the templates, C++ compiler generates a separate copy of parsing code for any combination of parser flags you use. In each copy, all possible decisions are made at compile time and all unused code is omitted.
    • Extensive use of lookup tables for parsing.
    • Hand-tuned C++ with profiling done on several most popular CPUs.
    This results in a very small and fast code: a parser which is custom tailored to exact needs with each invocation.

    4.1 Comparison With Other Parsers

    The table below compares speed of RapidXml to some other parsers, and to strlen() function executed on the same data. On a modern CPU (as of 2007), you can expect parsing throughput to be close to 1 GB/s. As a rule of thumb, parsing speed is about 50-100x faster than Xerces DOM, 30-60x faster than TinyXml, 3-12x faster than pugxml, and about 5% - 30% faster than pugixml, the fastest XML parser I know of.
    • The test file is a real-world, 50kB large, moderately dense XML file.
    • All timing is done by using RDTSC instruction present in Pentium-compatible CPUs.
    • No profile-guided optimizations are used.
    • All parsers are running in their fastest modes.
    • The results are given in CPU cycles per character, so frequency of CPUs is irrelevant.
    • The results are minimum values from a large number of runs, to minimize effects of operating system activity, task switching, interrupt handling etc.
    • A single parse of the test file takes about 1/10th of a millisecond, so with large number of runs there is a good chance of hitting at least one no-interrupt streak, and obtaining undisturbed results.
    Platform
    Compiler
    strlen() RapidXml pugixml 0.3 pugxml TinyXml
    Pentium 4
    MSVC 8.0
    2.5
    5.4
    7.0
    61.7
    298.8
    Pentium 4
    gcc 4.1.1
    0.8
    6.1
    9.5
    67.0
    413.2
    Core 2
    MSVC 8.0
    1.0
    4.5
    5.0
    24.6
    154.8
    Core 2
    gcc 4.1.1
    0.6
    4.6
    5.4
    28.3
    229.3
    Athlon XP
    MSVC 8.0
    3.1
    7.7
    8.0
    25.5
    182.6
    Athlon XP
    gcc 4.1.1
    0.9
    8.2
    9.2
    33.7
    265.2
    Pentium 3
    MSVC 8.0
    2.0
    6.3
    7.0
    30.9
    211.9
    Pentium 3
    gcc 4.1.1
    1.0
    6.7
    8.9
    35.3
    316.0
    (*) All results are in CPU cycles per character of source text

    5. Reference

    This section lists all classes, functions, constants etc. and describes them in detail.
    class + template + rapidxml::memory_pool
    + constructor + memory_pool()
    + destructor + ~memory_pool()
    function allocate_node(node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
    function allocate_attribute(const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
    function allocate_string(const Ch *source=0, std::size_t size=0)
    function clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0)
    function clear()
    function set_allocator(alloc_func *af, free_func *ff)

    class rapidxml::parse_error
    + constructor + parse_error(const char *what, void *where)
    function what() const
    function where() const

    class + template + rapidxml::xml_attribute
    + constructor + xml_attribute()
    function document() const
    function previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
    function next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const

    class + template + rapidxml::xml_base
    + constructor + xml_base()
    function name() const
    function name_size() const
    function value() const
    function value_size() const
    function name(const Ch *name, std::size_t size)
    function name(const Ch *name)
    function value(const Ch *value, std::size_t size)
    function value(const Ch *value)
    function parent() const

    class + template + rapidxml::xml_document
    + constructor + xml_document()
    function parse(Ch *text)
    function clear()

    class + template + rapidxml::xml_node
    + constructor + xml_node(node_type type)
    function type() const
    function document() const
    function first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
    function last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
    function previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
    function next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
    function first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
    function last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
    function type(node_type type)
    function prepend_node(xml_node< Ch > *child)
    function append_node(xml_node< Ch > *child)
    function insert_node(xml_node< Ch > *where, xml_node< Ch > *child)
    function remove_first_node()
    function remove_last_node()
    function remove_node(xml_node< Ch > *where)
    function remove_all_nodes()
    function prepend_attribute(xml_attribute< Ch > *attribute)
    function append_attribute(xml_attribute< Ch > *attribute)
    function insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute)
    function remove_first_attribute()
    function remove_last_attribute()
    function remove_attribute(xml_attribute< Ch > *where)
    function remove_all_attributes()

    namespace rapidxml
    enum node_type
    function parse_error_handler(const char *what, void *where)
    function print(OutIt out, const xml_node< Ch > &node, int flags=0)
    function print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0)
    function operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node)
    + constant + parse_no_data_nodes
    + constant + parse_no_element_values
    + constant + parse_no_string_terminators
    + constant + parse_no_entity_translation
    + constant + parse_no_utf8
    + constant + parse_declaration_node
    + constant + parse_comment_nodes
    + constant + parse_doctype_node
    + constant + parse_pi_nodes
    + constant + parse_validate_closing_tags
    + constant + parse_trim_whitespace
    + constant + parse_normalize_whitespace
    + constant + parse_default
    + constant + parse_non_destructive
    + constant + parse_fastest
    + constant + parse_full
    + constant + print_no_indenting


    class + template + rapidxml::memory_pool

    + + Defined in rapidxml.hpp
    + Base class for + xml_document

    Description

    This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation. In most cases, you will not need to use this class directly. However, if you need to create nodes manually or modify names/values of nodes, you are encouraged to use memory_pool of relevant xml_document to allocate the memory. Not only is this faster than allocating them by using new operator, but also their lifetime will be tied to the lifetime of document, possibly simplyfing memory management.

    + Call allocate_node() or allocate_attribute() functions to obtain new nodes or attributes from the pool. You can also call allocate_string() function to allocate strings. Such strings can then be used as names or values of nodes without worrying about their lifetime. Note that there is no free() function -- all allocations are freed at once when clear() function is called, or when the pool is destroyed.

    + It is also possible to create a standalone memory_pool, and use it to allocate nodes, whose lifetime will not be tied to any document.

    + Pool maintains RAPIDXML_STATIC_POOL_SIZE bytes of statically allocated memory. Until static memory is exhausted, no dynamic memory allocations are done. When static memory is exhausted, pool allocates additional blocks of memory of size RAPIDXML_DYNAMIC_POOL_SIZE each, by using global new[] and delete[] operators. This behaviour can be changed by setting custom allocation routines. Use set_allocator() function to set them.

    + Allocations for nodes, attributes and strings are aligned at RAPIDXML_ALIGNMENT bytes. This value defaults to the size of pointer on target architecture.

    + To obtain absolutely top performance from the parser, it is important that all nodes are allocated from a single, contiguous block of memory. Otherwise, cache misses when jumping between two (or more) disjoint blocks of memory can slow down parsing quite considerably. If required, you can tweak RAPIDXML_STATIC_POOL_SIZE, RAPIDXML_DYNAMIC_POOL_SIZE and RAPIDXML_ALIGNMENT to obtain best wasted memory to performance compromise. To do it, define their values before rapidxml.hpp file is included.

    Parameters

    Ch
    Character type of created nodes.

    + constructor + memory_pool::memory_pool

    Synopsis

    memory_pool(); +

    Description

    Constructs empty pool with default allocator functions.

    + destructor + memory_pool::~memory_pool

    Synopsis

    ~memory_pool(); +

    Description

    Destroys pool and frees all the memory. This causes memory occupied by nodes allocated by the pool to be freed. Nodes allocated from the pool are no longer valid.

    function memory_pool::allocate_node

    Synopsis

    xml_node<Ch>* allocate_node(node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0); +

    Description

    Allocates a new node from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

    Parameters

    type
    Type of node to create.
    name
    Name to assign to the node, or 0 to assign no name.
    value
    Value to assign to the node, or 0 to assign no value.
    name_size
    Size of name to assign, or 0 to automatically calculate size from name string.
    value_size
    Size of value to assign, or 0 to automatically calculate size from value string.

    Returns

    Pointer to allocated node. This pointer will never be NULL.

    function memory_pool::allocate_attribute

    Synopsis

    xml_attribute<Ch>* allocate_attribute(const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0); +

    Description

    Allocates a new attribute from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

    Parameters

    name
    Name to assign to the attribute, or 0 to assign no name.
    value
    Value to assign to the attribute, or 0 to assign no value.
    name_size
    Size of name to assign, or 0 to automatically calculate size from name string.
    value_size
    Size of value to assign, or 0 to automatically calculate size from value string.

    Returns

    Pointer to allocated attribute. This pointer will never be NULL.

    function memory_pool::allocate_string

    Synopsis

    Ch* allocate_string(const Ch *source=0, std::size_t size=0); +

    Description

    Allocates a char array of given size from the pool, and optionally copies a given string to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

    Parameters

    source
    String to initialize the allocated memory with, or 0 to not initialize it.
    size
    Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated.

    Returns

    Pointer to allocated char array. This pointer will never be NULL.

    function memory_pool::clone_node

    Synopsis

    xml_node<Ch>* clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0); +

    Description

    Clones an xml_node and its hierarchy of child nodes and attributes. Nodes and attributes are allocated from this memory pool. Names and values are not cloned, they are shared between the clone and the source. Result node can be optionally specified as a second parameter, in which case its contents will be replaced with cloned source node. This is useful when you want to clone entire document.

    Parameters

    source
    Node to clone.
    result
    Node to put results in, or 0 to automatically allocate result node

    Returns

    Pointer to cloned node. This pointer will never be NULL.

    function memory_pool::clear

    Synopsis

    void clear(); +

    Description

    Clears the pool. This causes memory occupied by nodes allocated by the pool to be freed. Any nodes or strings allocated from the pool will no longer be valid.

    function memory_pool::set_allocator

    Synopsis

    void set_allocator(alloc_func *af, free_func *ff); +

    Description

    Sets or resets the user-defined memory allocation functions for the pool. This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. Allocation function must not return invalid pointer on failure. It should either throw, stop the program, or use longjmp() function to pass control to other place of program. If it returns invalid pointer, results are undefined.

    + User defined allocation functions must have the following forms:

    +void *allocate(std::size_t size);
    +void free(void *pointer);

    Parameters

    af
    Allocation function, or 0 to restore default function
    ff
    Free function, or 0 to restore default function

    class rapidxml::parse_error

    + + Defined in rapidxml.hpp

    Description

    Parse error exception. This exception is thrown by the parser when an error occurs. Use what() function to get human-readable error message. Use where() function to get a pointer to position within source text where error was detected.

    + If throwing exceptions by the parser is undesirable, it can be disabled by defining RAPIDXML_NO_EXCEPTIONS macro before rapidxml.hpp is included. This will cause the parser to call rapidxml::parse_error_handler() function instead of throwing an exception. This function must be defined by the user.

    + This class derives from std::exception class.

    + constructor + parse_error::parse_error

    Synopsis

    parse_error(const char *what, void *where); +

    Description

    Constructs parse error.

    function parse_error::what

    Synopsis

    virtual const char* what() const; +

    Description

    Gets human readable description of error.

    Returns

    Pointer to null terminated description of the error.

    function parse_error::where

    Synopsis

    Ch* where() const; +

    Description

    Gets pointer to character data where error happened. Ch should be the same as char type of xml_document that produced the error.

    Returns

    Pointer to location within the parsed string where error occured.

    class + template + rapidxml::xml_attribute

    + + Defined in rapidxml.hpp
    + Inherits from + xml_base

    Description

    Class representing attribute node of XML document. Each attribute has name and value strings, which are available through name() and value() functions (inherited from xml_base). Note that after parse, both name and value of attribute will point to interior of source text used for parsing. Thus, this text must persist in memory for the lifetime of attribute.

    Parameters

    Ch
    Character type to use.

    + constructor + xml_attribute::xml_attribute

    Synopsis

    xml_attribute(); +

    Description

    Constructs an empty attribute with the specified type. Consider using memory_pool of appropriate xml_document if allocating attributes manually.

    function xml_attribute::document

    Synopsis

    xml_document<Ch>* document() const; +

    Description

    Gets document of which attribute is a child.

    Returns

    Pointer to document that contains this attribute, or 0 if there is no parent document.

    function xml_attribute::previous_attribute

    Synopsis

    xml_attribute<Ch>* previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets previous attribute, optionally matching attribute name.

    Parameters

    name
    Name of attribute to find, or 0 to return previous attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found attribute, or 0 if not found.

    function xml_attribute::next_attribute

    Synopsis

    xml_attribute<Ch>* next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets next attribute, optionally matching attribute name.

    Parameters

    name
    Name of attribute to find, or 0 to return next attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found attribute, or 0 if not found.

    class + template + rapidxml::xml_base

    + + Defined in rapidxml.hpp
    + Base class for + xml_attribute xml_node

    Description

    Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().

    Parameters

    Ch
    Character type to use

    + constructor + xml_base::xml_base

    Synopsis

    xml_base(); +

    function xml_base::name

    Synopsis

    Ch* name() const; +

    Description

    Gets name of the node. Interpretation of name depends on type of node. Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.

    + Use name_size() function to determine length of the name.

    Returns

    Name of node, or empty string if node has no name.

    function xml_base::name_size

    Synopsis

    std::size_t name_size() const; +

    Description

    Gets size of node name, not including terminator character. This function works correctly irrespective of whether name is or is not zero terminated.

    Returns

    Size of node name, in characters.

    function xml_base::value

    Synopsis

    Ch* value() const; +

    Description

    Gets value of node. Interpretation of value depends on type of node. Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.

    + Use value_size() function to determine length of the value.

    Returns

    Value of node, or empty string if node has no value.

    function xml_base::value_size

    Synopsis

    std::size_t value_size() const; +

    Description

    Gets size of node value, not including terminator character. This function works correctly irrespective of whether value is or is not zero terminated.

    Returns

    Size of node value, in characters.

    function xml_base::name

    Synopsis

    void name(const Ch *name, std::size_t size); +

    Description

    Sets name of node to a non zero-terminated string. See Ownership Of Strings .

    + Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.

    + Size of name must be specified separately, because name does not have to be zero terminated. Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated).

    Parameters

    name
    Name of node to set. Does not have to be zero terminated.
    size
    Size of name, in characters. This does not include zero terminator, if one is present.

    function xml_base::name

    Synopsis

    void name(const Ch *name); +

    Description

    Sets name of node to a zero-terminated string. See also Ownership Of Strings and xml_node::name(const Ch *, std::size_t).

    Parameters

    name
    Name of node to set. Must be zero terminated.

    function xml_base::value

    Synopsis

    void value(const Ch *value, std::size_t size); +

    Description

    Sets value of node to a non zero-terminated string. See Ownership Of Strings .

    + Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.

    + Size of value must be specified separately, because it does not have to be zero terminated. Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated).

    + If an element has a child node of type node_data, it will take precedence over element value when printing. If you want to manipulate data of elements using values, use parser flag rapidxml::parse_no_data_nodes to prevent creation of data nodes by the parser.

    Parameters

    value
    value of node to set. Does not have to be zero terminated.
    size
    Size of value, in characters. This does not include zero terminator, if one is present.

    function xml_base::value

    Synopsis

    void value(const Ch *value); +

    Description

    Sets value of node to a zero-terminated string. See also Ownership Of Strings and xml_node::value(const Ch *, std::size_t).

    Parameters

    value
    Vame of node to set. Must be zero terminated.

    function xml_base::parent

    Synopsis

    xml_node<Ch>* parent() const; +

    Description

    Gets node parent.

    Returns

    Pointer to parent node, or 0 if there is no parent.

    class + template + rapidxml::xml_document

    + + Defined in rapidxml.hpp
    + Inherits from + xml_node memory_pool

    Description

    This class represents root of the DOM hierarchy. It is also an xml_node and a memory_pool through public inheritance. Use parse() function to build a DOM tree from a zero-terminated XML text string. parse() function allocates memory for nodes and attributes by using functions of xml_document, which are inherited from memory_pool. To access root node of the document, use the document itself, as if it was an xml_node.

    Parameters

    Ch
    Character type to use.

    + constructor + xml_document::xml_document

    Synopsis

    xml_document(); +

    Description

    Constructs empty XML document.

    function xml_document::parse

    Synopsis

    void parse(Ch *text); +

    Description

    Parses zero-terminated XML string according to given flags. Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used. The string must persist for the lifetime of the document. In case of error, rapidxml::parse_error exception will be thrown.

    + If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning. Make sure that data is zero-terminated.

    + Document can be parsed into multiple times. Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool.

    Parameters

    text
    XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser.

    function xml_document::clear

    Synopsis

    void clear(); +

    Description

    Clears the document by deleting all nodes and clearing the memory pool. All nodes owned by document pool are destroyed.

    class + template + rapidxml::xml_node

    + + Defined in rapidxml.hpp
    + Inherits from + xml_base
    + Base class for + xml_document

    Description

    Class representing a node of XML document. Each node may have associated name and value strings, which are available through name() and value() functions. Interpretation of name and value depends on type of the node. Type of node can be determined by using type() function.

    + Note that after parse, both name and value of node, if any, will point interior of source text used for parsing. Thus, this text must persist in the memory for the lifetime of node.

    Parameters

    Ch
    Character type to use.

    + constructor + xml_node::xml_node

    Synopsis

    xml_node(node_type type); +

    Description

    Constructs an empty node with the specified type. Consider using memory_pool of appropriate document to allocate nodes manually.

    Parameters

    type
    Type of node to construct.

    function xml_node::type

    Synopsis

    node_type type() const; +

    Description

    Gets type of node.

    Returns

    Type of node.

    function xml_node::document

    Synopsis

    xml_document<Ch>* document() const; +

    Description

    Gets document of which node is a child.

    Returns

    Pointer to document that contains this node, or 0 if there is no parent document.

    function xml_node::first_node

    Synopsis

    xml_node<Ch>* first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets first child node, optionally matching node name.

    Parameters

    name
    Name of child to find, or 0 to return first child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found child, or 0 if not found.

    function xml_node::last_node

    Synopsis

    xml_node<Ch>* last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets last child node, optionally matching node name. Behaviour is undefined if node has no children. Use first_node() to test if node has children.

    Parameters

    name
    Name of child to find, or 0 to return last child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found child, or 0 if not found.

    function xml_node::previous_sibling

    Synopsis

    xml_node<Ch>* previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets previous sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.

    Parameters

    name
    Name of sibling to find, or 0 to return previous sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found sibling, or 0 if not found.

    function xml_node::next_sibling

    Synopsis

    xml_node<Ch>* next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets next sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.

    Parameters

    name
    Name of sibling to find, or 0 to return next sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found sibling, or 0 if not found.

    function xml_node::first_attribute

    Synopsis

    xml_attribute<Ch>* first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets first attribute of node, optionally matching attribute name.

    Parameters

    name
    Name of attribute to find, or 0 to return first attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found attribute, or 0 if not found.

    function xml_node::last_attribute

    Synopsis

    xml_attribute<Ch>* last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

    Description

    Gets last attribute of node, optionally matching attribute name.

    Parameters

    name
    Name of attribute to find, or 0 to return last attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
    name_size
    Size of name, in characters, or 0 to have size calculated automatically from string
    case_sensitive
    Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

    Returns

    Pointer to found attribute, or 0 if not found.

    function xml_node::type

    Synopsis

    void type(node_type type); +

    Description

    Sets type of node.

    Parameters

    type
    Type of node to set.

    function xml_node::prepend_node

    Synopsis

    void prepend_node(xml_node< Ch > *child); +

    Description

    Prepends a new child node. The prepended child becomes the first child, and all existing children are moved one position back.

    Parameters

    child
    Node to prepend.

    function xml_node::append_node

    Synopsis

    void append_node(xml_node< Ch > *child); +

    Description

    Appends a new child node. The appended child becomes the last child.

    Parameters

    child
    Node to append.

    function xml_node::insert_node

    Synopsis

    void insert_node(xml_node< Ch > *where, xml_node< Ch > *child); +

    Description

    Inserts a new child node at specified place inside the node. All children after and including the specified node are moved one position back.

    Parameters

    where
    Place where to insert the child, or 0 to insert at the back.
    child
    Node to insert.

    function xml_node::remove_first_node

    Synopsis

    void remove_first_node(); +

    Description

    Removes first child node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

    function xml_node::remove_last_node

    Synopsis

    void remove_last_node(); +

    Description

    Removes last child of the node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

    function xml_node::remove_node

    Synopsis

    void remove_node(xml_node< Ch > *where); +

    Description

    Removes specified child from the node.

    function xml_node::remove_all_nodes

    Synopsis

    void remove_all_nodes(); +

    Description

    Removes all child nodes (but not attributes).

    function xml_node::prepend_attribute

    Synopsis

    void prepend_attribute(xml_attribute< Ch > *attribute); +

    Description

    Prepends a new attribute to the node.

    Parameters

    attribute
    Attribute to prepend.

    function xml_node::append_attribute

    Synopsis

    void append_attribute(xml_attribute< Ch > *attribute); +

    Description

    Appends a new attribute to the node.

    Parameters

    attribute
    Attribute to append.

    function xml_node::insert_attribute

    Synopsis

    void insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute); +

    Description

    Inserts a new attribute at specified place inside the node. All attributes after and including the specified attribute are moved one position back.

    Parameters

    where
    Place where to insert the attribute, or 0 to insert at the back.
    attribute
    Attribute to insert.

    function xml_node::remove_first_attribute

    Synopsis

    void remove_first_attribute(); +

    Description

    Removes first attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

    function xml_node::remove_last_attribute

    Synopsis

    void remove_last_attribute(); +

    Description

    Removes last attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

    function xml_node::remove_attribute

    Synopsis

    void remove_attribute(xml_attribute< Ch > *where); +

    Description

    Removes specified attribute from node.

    Parameters

    where
    Pointer to attribute to be removed.

    function xml_node::remove_all_attributes

    Synopsis

    void remove_all_attributes(); +

    Description

    Removes all attributes of node.

    enum node_type

    Description

    Enumeration listing all node types produced by the parser. Use xml_node::type() function to query node type.

    Values

    node_document
    A document node. Name and value are empty.
    node_element
    An element node. Name contains element name. Value contains text of first data node.
    node_data
    A data node. Name is empty. Value contains data text.
    node_cdata
    A CDATA node. Name is empty. Value contains data text.
    node_comment
    A comment node. Name is empty. Value contains comment text.
    node_declaration
    A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalone) are in node attributes.
    node_doctype
    A DOCTYPE node. Name is empty. Value contains DOCTYPE text.
    node_pi
    A PI node. Name contains target. Value contains instructions.

    function parse_error_handler

    Synopsis

    void rapidxml::parse_error_handler(const char *what, void *where); +

    Description

    When exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function is called to notify user about the error. It must be defined by the user.

    + This function cannot return. If it does, the results are undefined.

    + A very simple definition might look like that: + void rapidxml::parse_error_handler(const char *what, void *where) + { + std::cout << "Parse error: " << what << "\n"; + std::abort(); + } +

    Parameters

    what
    Human readable description of the error.
    where
    Pointer to character data where error was detected.

    function print

    Synopsis

    OutIt rapidxml::print(OutIt out, const xml_node< Ch > &node, int flags=0); +

    Description

    Prints XML to given output iterator.

    Parameters

    out
    Output iterator to print to.
    node
    Node to be printed. Pass xml_document to print entire document.
    flags
    Flags controlling how XML is printed.

    Returns

    Output iterator pointing to position immediately after last character of printed text.

    function print

    Synopsis

    std::basic_ostream<Ch>& rapidxml::print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0); +

    Description

    Prints XML to given output stream.

    Parameters

    out
    Output stream to print to.
    node
    Node to be printed. Pass xml_document to print entire document.
    flags
    Flags controlling how XML is printed.

    Returns

    Output stream.

    function operator<<

    Synopsis

    std::basic_ostream<Ch>& rapidxml::operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node); +

    Description

    Prints formatted XML to given output stream. Uses default printing flags. Use print() function to customize printing process.

    Parameters

    out
    Output stream to print to.
    node
    Node to be printed.

    Returns

    Output stream.

    + constant + parse_no_data_nodes

    Synopsis

    const int parse_no_data_nodes + = 0x1; +

    Description

    Parse flag instructing the parser to not create data nodes. Text of first data node will still be placed in value of parent element, unless rapidxml::parse_no_element_values flag is also specified. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_no_element_values

    Synopsis

    const int parse_no_element_values + = 0x2; +

    Description

    Parse flag instructing the parser to not use text of first data node as a value of parent element. Can be combined with other flags by use of | operator. Note that child data nodes of element node take precendence over its value when printing. That is, if element has one or more child data nodes and a value, the value will be ignored. Use rapidxml::parse_no_data_nodes flag to prevent creation of data nodes if you want to manipulate data using values of elements.

    + See xml_document::parse() function.

    + constant + parse_no_string_terminators

    Synopsis

    const int parse_no_string_terminators + = 0x4; +

    Description

    Parse flag instructing the parser to not place zero terminators after strings in the source text. By default zero terminators are placed, modifying source text. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_no_entity_translation

    Synopsis

    const int parse_no_entity_translation + = 0x8; +

    Description

    Parse flag instructing the parser to not translate entities in the source text. By default entities are translated, modifying source text. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_no_utf8

    Synopsis

    const int parse_no_utf8 + = 0x10; +

    Description

    Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters. By default, UTF-8 handling is enabled. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_declaration_node

    Synopsis

    const int parse_declaration_node + = 0x20; +

    Description

    Parse flag instructing the parser to create XML declaration node. By default, declaration node is not created. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_comment_nodes

    Synopsis

    const int parse_comment_nodes + = 0x40; +

    Description

    Parse flag instructing the parser to create comments nodes. By default, comment nodes are not created. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_doctype_node

    Synopsis

    const int parse_doctype_node + = 0x80; +

    Description

    Parse flag instructing the parser to create DOCTYPE node. By default, doctype node is not created. Although W3C specification allows at most one DOCTYPE node, RapidXml will silently accept documents with more than one. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_pi_nodes

    Synopsis

    const int parse_pi_nodes + = 0x100; +

    Description

    Parse flag instructing the parser to create PI nodes. By default, PI nodes are not created. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_validate_closing_tags

    Synopsis

    const int parse_validate_closing_tags + = 0x200; +

    Description

    Parse flag instructing the parser to validate closing tag names. If not set, name inside closing tag is irrelevant to the parser. By default, closing tags are not validated. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_trim_whitespace

    Synopsis

    const int parse_trim_whitespace + = 0x400; +

    Description

    Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes. By default, whitespace is not trimmed. This flag does not cause the parser to modify source text. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_normalize_whitespace

    Synopsis

    const int parse_normalize_whitespace + = 0x800; +

    Description

    Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character. Trimming of leading and trailing whitespace of data is controlled by rapidxml::parse_trim_whitespace flag. By default, whitespace is not normalized. If this flag is specified, source text will be modified. Can be combined with other flags by use of | operator.

    + See xml_document::parse() function.

    + constant + parse_default

    Synopsis

    const int parse_default + = 0; +

    Description

    Parse flags which represent default behaviour of the parser. This is always equal to 0, so that all other flags can be simply ored together. Normally there is no need to inconveniently disable flags by anding with their negated (~) values. This also means that meaning of each flag is a negation of the default setting. For example, if flag name is rapidxml::parse_no_utf8, it means that utf-8 is enabled by default, and using the flag will disable it.

    + See xml_document::parse() function.

    + constant + parse_non_destructive

    Synopsis

    const int parse_non_destructive + = parse_no_string_terminators | parse_no_entity_translation; +

    Description

    A combination of parse flags that forbids any modifications of the source text. This also results in faster parsing. However, note that the following will occur:
    • names and values of nodes will not be zero terminated, you have to use xml_base::name_size() and xml_base::value_size() functions to determine where name and value ends
    • entities will not be translated
    • whitespace will not be normalized
    +See xml_document::parse() function.

    + constant + parse_fastest

    Synopsis

    const int parse_fastest + = parse_non_destructive | parse_no_data_nodes; +

    Description

    A combination of parse flags resulting in fastest possible parsing, without sacrificing important data.

    + See xml_document::parse() function.

    + constant + parse_full

    Synopsis

    const int parse_full + = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags; +

    Description

    A combination of parse flags resulting in largest amount of data being extracted. This usually results in slowest parsing.

    + See xml_document::parse() function.

    + constant + print_no_indenting

    Synopsis

    const int print_no_indenting + = 0x1; +

    Description

    Printer flag instructing the printer to suppress indenting of XML. See print() function.

    \ No newline at end of file diff --git a/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml.hpp b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml.hpp new file mode 100644 index 000000000..ae91e081d --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml.hpp @@ -0,0 +1,2596 @@ +#ifndef RAPIDXML_HPP_INCLUDED +#define RAPIDXML_HPP_INCLUDED + +// Copyright (C) 2006, 2009 Marcin Kalicinski +// Version 1.13 +// Revision $DateTime: 2009/05/13 01:46:17 $ +//! \file rapidxml.hpp This file contains rapidxml parser and DOM implementation + +// If standard library is disabled, user must provide implementations of required functions and typedefs +#if !defined(RAPIDXML_NO_STDLIB) + #include // For std::size_t + #include // For assert + #include // For placement new +#endif + +// On MSVC, disable "conditional expression is constant" warning (level 4). +// This warning is almost impossible to avoid with certain types of templated code +#ifdef _MSC_VER + #pragma warning(push) + #pragma warning(disable:4127) // Conditional expression is constant +#endif + +/////////////////////////////////////////////////////////////////////////// +// RAPIDXML_PARSE_ERROR + +#if defined(RAPIDXML_NO_EXCEPTIONS) + +#define RAPIDXML_PARSE_ERROR(what, where) { parse_error_handler(what, where); assert(0); } + +namespace rapidxml +{ + //! When exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, + //! this function is called to notify user about the error. + //! It must be defined by the user. + //!

    + //! This function cannot return. If it does, the results are undefined. + //!

    + //! A very simple definition might look like that: + //!

    +    //! void %rapidxml::%parse_error_handler(const char *what, void *where)
    +    //! {
    +    //!     std::cout << "Parse error: " << what << "\n";
    +    //!     std::abort();
    +    //! }
    +    //! 
    + //! \param what Human readable description of the error. + //! \param where Pointer to character data where error was detected. + void parse_error_handler(const char *what, void *where); +} + +#else + +#include // For std::exception + +#define RAPIDXML_PARSE_ERROR(what, where) throw parse_error(what, where) + +namespace rapidxml +{ + + //! Parse error exception. + //! This exception is thrown by the parser when an error occurs. + //! Use what() function to get human-readable error message. + //! Use where() function to get a pointer to position within source text where error was detected. + //!

    + //! If throwing exceptions by the parser is undesirable, + //! it can be disabled by defining RAPIDXML_NO_EXCEPTIONS macro before rapidxml.hpp is included. + //! This will cause the parser to call rapidxml::parse_error_handler() function instead of throwing an exception. + //! This function must be defined by the user. + //!

    + //! This class derives from std::exception class. + class parse_error: public std::exception + { + + public: + + //! Constructs parse error + parse_error(const char *what, void *where) + : m_what(what) + , m_where(where) + { + } + + //! Gets human readable description of error. + //! \return Pointer to null terminated description of the error. + virtual const char *what() const throw() + { + return m_what; + } + + //! Gets pointer to character data where error happened. + //! Ch should be the same as char type of xml_document that produced the error. + //! \return Pointer to location within the parsed string where error occured. + template + Ch *where() const + { + return reinterpret_cast(m_where); + } + + private: + + const char *m_what; + void *m_where; + + }; +} + +#endif + +/////////////////////////////////////////////////////////////////////////// +// Pool sizes + +#ifndef RAPIDXML_STATIC_POOL_SIZE + // Size of static memory block of memory_pool. + // Define RAPIDXML_STATIC_POOL_SIZE before including rapidxml.hpp if you want to override the default value. + // No dynamic memory allocations are performed by memory_pool until static memory is exhausted. + #define RAPIDXML_STATIC_POOL_SIZE (64 * 1024) +#endif + +#ifndef RAPIDXML_DYNAMIC_POOL_SIZE + // Size of dynamic memory block of memory_pool. + // Define RAPIDXML_DYNAMIC_POOL_SIZE before including rapidxml.hpp if you want to override the default value. + // After the static block is exhausted, dynamic blocks with approximately this size are allocated by memory_pool. + #define RAPIDXML_DYNAMIC_POOL_SIZE (64 * 1024) +#endif + +#ifndef RAPIDXML_ALIGNMENT + // Memory allocation alignment. + // Define RAPIDXML_ALIGNMENT before including rapidxml.hpp if you want to override the default value, which is the size of pointer. + // All memory allocations for nodes, attributes and strings will be aligned to this value. + // This must be a power of 2 and at least 1, otherwise memory_pool will not work. + #define RAPIDXML_ALIGNMENT sizeof(void *) +#endif + +namespace rapidxml +{ + // Forward declarations + template class xml_node; + template class xml_attribute; + template class xml_document; + + //! Enumeration listing all node types produced by the parser. + //! Use xml_node::type() function to query node type. + enum node_type + { + node_document, //!< A document node. Name and value are empty. + node_element, //!< An element node. Name contains element name. Value contains text of first data node. + node_data, //!< A data node. Name is empty. Value contains data text. + node_cdata, //!< A CDATA node. Name is empty. Value contains data text. + node_comment, //!< A comment node. Name is empty. Value contains comment text. + node_declaration, //!< A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalone) are in node attributes. + node_doctype, //!< A DOCTYPE node. Name is empty. Value contains DOCTYPE text. + node_pi //!< A PI node. Name contains target. Value contains instructions. + }; + + /////////////////////////////////////////////////////////////////////// + // Parsing flags + + //! Parse flag instructing the parser to not create data nodes. + //! Text of first data node will still be placed in value of parent element, unless rapidxml::parse_no_element_values flag is also specified. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_no_data_nodes = 0x1; + + //! Parse flag instructing the parser to not use text of first data node as a value of parent element. + //! Can be combined with other flags by use of | operator. + //! Note that child data nodes of element node take precendence over its value when printing. + //! That is, if element has one or more child data nodes and a value, the value will be ignored. + //! Use rapidxml::parse_no_data_nodes flag to prevent creation of data nodes if you want to manipulate data using values of elements. + //!

    + //! See xml_document::parse() function. + const int parse_no_element_values = 0x2; + + //! Parse flag instructing the parser to not place zero terminators after strings in the source text. + //! By default zero terminators are placed, modifying source text. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_no_string_terminators = 0x4; + + //! Parse flag instructing the parser to not translate entities in the source text. + //! By default entities are translated, modifying source text. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_no_entity_translation = 0x8; + + //! Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters. + //! By default, UTF-8 handling is enabled. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_no_utf8 = 0x10; + + //! Parse flag instructing the parser to create XML declaration node. + //! By default, declaration node is not created. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_declaration_node = 0x20; + + //! Parse flag instructing the parser to create comments nodes. + //! By default, comment nodes are not created. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_comment_nodes = 0x40; + + //! Parse flag instructing the parser to create DOCTYPE node. + //! By default, doctype node is not created. + //! Although W3C specification allows at most one DOCTYPE node, RapidXml will silently accept documents with more than one. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_doctype_node = 0x80; + + //! Parse flag instructing the parser to create PI nodes. + //! By default, PI nodes are not created. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_pi_nodes = 0x100; + + //! Parse flag instructing the parser to validate closing tag names. + //! If not set, name inside closing tag is irrelevant to the parser. + //! By default, closing tags are not validated. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_validate_closing_tags = 0x200; + + //! Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes. + //! By default, whitespace is not trimmed. + //! This flag does not cause the parser to modify source text. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_trim_whitespace = 0x400; + + //! Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character. + //! Trimming of leading and trailing whitespace of data is controlled by rapidxml::parse_trim_whitespace flag. + //! By default, whitespace is not normalized. + //! If this flag is specified, source text will be modified. + //! Can be combined with other flags by use of | operator. + //!

    + //! See xml_document::parse() function. + const int parse_normalize_whitespace = 0x800; + + // Compound flags + + //! Parse flags which represent default behaviour of the parser. + //! This is always equal to 0, so that all other flags can be simply ored together. + //! Normally there is no need to inconveniently disable flags by anding with their negated (~) values. + //! This also means that meaning of each flag is a negation of the default setting. + //! For example, if flag name is rapidxml::parse_no_utf8, it means that utf-8 is enabled by default, + //! and using the flag will disable it. + //!

    + //! See xml_document::parse() function. + const int parse_default = 0; + + //! A combination of parse flags that forbids any modifications of the source text. + //! This also results in faster parsing. However, note that the following will occur: + //!
      + //!
    • names and values of nodes will not be zero terminated, you have to use xml_base::name_size() and xml_base::value_size() functions to determine where name and value ends
    • + //!
    • entities will not be translated
    • + //!
    • whitespace will not be normalized
    • + //!
    + //! See xml_document::parse() function. + const int parse_non_destructive = parse_no_string_terminators | parse_no_entity_translation; + + //! A combination of parse flags resulting in fastest possible parsing, without sacrificing important data. + //!

    + //! See xml_document::parse() function. + const int parse_fastest = parse_non_destructive | parse_no_data_nodes; + + //! A combination of parse flags resulting in largest amount of data being extracted. + //! This usually results in slowest parsing. + //!

    + //! See xml_document::parse() function. + const int parse_full = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags; + + /////////////////////////////////////////////////////////////////////// + // Internals + + //! \cond internal + namespace internal + { + + // Struct that contains lookup tables for the parser + // It must be a template to allow correct linking (because it has static data members, which are defined in a header file). + template + struct lookup_tables + { + static const unsigned char lookup_whitespace[256]; // Whitespace table + static const unsigned char lookup_node_name[256]; // Node name table + static const unsigned char lookup_text[256]; // Text table + static const unsigned char lookup_text_pure_no_ws[256]; // Text table + static const unsigned char lookup_text_pure_with_ws[256]; // Text table + static const unsigned char lookup_attribute_name[256]; // Attribute name table + static const unsigned char lookup_attribute_data_1[256]; // Attribute data table with single quote + static const unsigned char lookup_attribute_data_1_pure[256]; // Attribute data table with single quote + static const unsigned char lookup_attribute_data_2[256]; // Attribute data table with double quotes + static const unsigned char lookup_attribute_data_2_pure[256]; // Attribute data table with double quotes + static const unsigned char lookup_digits[256]; // Digits + static const unsigned char lookup_upcase[256]; // To uppercase conversion table for ASCII characters + }; + + // Find length of the string + template + inline std::size_t measure(const Ch *p) + { + const Ch *tmp = p; + while (*tmp) + ++tmp; + return tmp - p; + } + + // Compare strings for equality + template + inline bool compare(const Ch *p1, std::size_t size1, const Ch *p2, std::size_t size2, bool case_sensitive) + { + if (size1 != size2) + return false; + if (case_sensitive) + { + for (const Ch *end = p1 + size1; p1 < end; ++p1, ++p2) + if (*p1 != *p2) + return false; + } + else + { + for (const Ch *end = p1 + size1; p1 < end; ++p1, ++p2) + if (lookup_tables<0>::lookup_upcase[static_cast(*p1)] != lookup_tables<0>::lookup_upcase[static_cast(*p2)]) + return false; + } + return true; + } + } + //! \endcond + + /////////////////////////////////////////////////////////////////////// + // Memory pool + + //! This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation. + //! In most cases, you will not need to use this class directly. + //! However, if you need to create nodes manually or modify names/values of nodes, + //! you are encouraged to use memory_pool of relevant xml_document to allocate the memory. + //! Not only is this faster than allocating them by using new operator, + //! but also their lifetime will be tied to the lifetime of document, + //! possibly simplyfing memory management. + //!

    + //! Call allocate_node() or allocate_attribute() functions to obtain new nodes or attributes from the pool. + //! You can also call allocate_string() function to allocate strings. + //! Such strings can then be used as names or values of nodes without worrying about their lifetime. + //! Note that there is no free() function -- all allocations are freed at once when clear() function is called, + //! or when the pool is destroyed. + //!

    + //! It is also possible to create a standalone memory_pool, and use it + //! to allocate nodes, whose lifetime will not be tied to any document. + //!

    + //! Pool maintains RAPIDXML_STATIC_POOL_SIZE bytes of statically allocated memory. + //! Until static memory is exhausted, no dynamic memory allocations are done. + //! When static memory is exhausted, pool allocates additional blocks of memory of size RAPIDXML_DYNAMIC_POOL_SIZE each, + //! by using global new[] and delete[] operators. + //! This behaviour can be changed by setting custom allocation routines. + //! Use set_allocator() function to set them. + //!

    + //! Allocations for nodes, attributes and strings are aligned at RAPIDXML_ALIGNMENT bytes. + //! This value defaults to the size of pointer on target architecture. + //!

    + //! To obtain absolutely top performance from the parser, + //! it is important that all nodes are allocated from a single, contiguous block of memory. + //! Otherwise, cache misses when jumping between two (or more) disjoint blocks of memory can slow down parsing quite considerably. + //! If required, you can tweak RAPIDXML_STATIC_POOL_SIZE, RAPIDXML_DYNAMIC_POOL_SIZE and RAPIDXML_ALIGNMENT + //! to obtain best wasted memory to performance compromise. + //! To do it, define their values before rapidxml.hpp file is included. + //! \param Ch Character type of created nodes. + template + class memory_pool + { + + public: + + //! \cond internal + typedef void *(alloc_func)(std::size_t); // Type of user-defined function used to allocate memory + typedef void (free_func)(void *); // Type of user-defined function used to free memory + //! \endcond + + //! Constructs empty pool with default allocator functions. + memory_pool() + : m_alloc_func(0) + , m_free_func(0) + { + init(); + } + + //! Destroys pool and frees all the memory. + //! This causes memory occupied by nodes allocated by the pool to be freed. + //! Nodes allocated from the pool are no longer valid. + ~memory_pool() + { + clear(); + } + + //! Allocates a new node from the pool, and optionally assigns name and value to it. + //! If the allocation request cannot be accomodated, this function will throw std::bad_alloc. + //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function + //! will call rapidxml::parse_error_handler() function. + //! \param type Type of node to create. + //! \param name Name to assign to the node, or 0 to assign no name. + //! \param value Value to assign to the node, or 0 to assign no value. + //! \param name_size Size of name to assign, or 0 to automatically calculate size from name string. + //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string. + //! \return Pointer to allocated node. This pointer will never be NULL. + xml_node *allocate_node(node_type type, + const Ch *name = 0, const Ch *value = 0, + std::size_t name_size = 0, std::size_t value_size = 0) + { + void *memory = allocate_aligned(sizeof(xml_node)); + xml_node *node = new(memory) xml_node(type); + if (name) + { + if (name_size > 0) + node->name(name, name_size); + else + node->name(name); + } + if (value) + { + if (value_size > 0) + node->value(value, value_size); + else + node->value(value); + } + return node; + } + + //! Allocates a new attribute from the pool, and optionally assigns name and value to it. + //! If the allocation request cannot be accomodated, this function will throw std::bad_alloc. + //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function + //! will call rapidxml::parse_error_handler() function. + //! \param name Name to assign to the attribute, or 0 to assign no name. + //! \param value Value to assign to the attribute, or 0 to assign no value. + //! \param name_size Size of name to assign, or 0 to automatically calculate size from name string. + //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string. + //! \return Pointer to allocated attribute. This pointer will never be NULL. + xml_attribute *allocate_attribute(const Ch *name = 0, const Ch *value = 0, + std::size_t name_size = 0, std::size_t value_size = 0) + { + void *memory = allocate_aligned(sizeof(xml_attribute)); + xml_attribute *attribute = new(memory) xml_attribute; + if (name) + { + if (name_size > 0) + attribute->name(name, name_size); + else + attribute->name(name); + } + if (value) + { + if (value_size > 0) + attribute->value(value, value_size); + else + attribute->value(value); + } + return attribute; + } + + //! Allocates a char array of given size from the pool, and optionally copies a given string to it. + //! If the allocation request cannot be accomodated, this function will throw std::bad_alloc. + //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function + //! will call rapidxml::parse_error_handler() function. + //! \param source String to initialize the allocated memory with, or 0 to not initialize it. + //! \param size Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated. + //! \return Pointer to allocated char array. This pointer will never be NULL. + Ch *allocate_string(const Ch *source = 0, std::size_t size = 0) + { + assert(source || size); // Either source or size (or both) must be specified + if (size == 0) + size = internal::measure(source) + 1; + Ch *result = static_cast(allocate_aligned(size * sizeof(Ch))); + if (source) + for (std::size_t i = 0; i < size; ++i) + result[i] = source[i]; + return result; + } + + //! Clones an xml_node and its hierarchy of child nodes and attributes. + //! Nodes and attributes are allocated from this memory pool. + //! Names and values are not cloned, they are shared between the clone and the source. + //! Result node can be optionally specified as a second parameter, + //! in which case its contents will be replaced with cloned source node. + //! This is useful when you want to clone entire document. + //! \param source Node to clone. + //! \param result Node to put results in, or 0 to automatically allocate result node + //! \return Pointer to cloned node. This pointer will never be NULL. + xml_node *clone_node(const xml_node *source, xml_node *result = 0) + { + // Prepare result node + if (result) + { + result->remove_all_attributes(); + result->remove_all_nodes(); + result->type(source->type()); + } + else + result = allocate_node(source->type()); + + // Clone name and value + result->name(source->name(), source->name_size()); + result->value(source->value(), source->value_size()); + + // Clone child nodes and attributes + for (xml_node *child = source->first_node(); child; child = child->next_sibling()) + result->append_node(clone_node(child)); + for (xml_attribute *attr = source->first_attribute(); attr; attr = attr->next_attribute()) + result->append_attribute(allocate_attribute(attr->name(), attr->value(), attr->name_size(), attr->value_size())); + + return result; + } + + //! Clears the pool. + //! This causes memory occupied by nodes allocated by the pool to be freed. + //! Any nodes or strings allocated from the pool will no longer be valid. + void clear() + { + while (m_begin != m_static_memory) + { + char *previous_begin = reinterpret_cast
    (align(m_begin))->previous_begin; + if (m_free_func) + m_free_func(m_begin); + else + delete[] m_begin; + m_begin = previous_begin; + } + init(); + } + + //! Sets or resets the user-defined memory allocation functions for the pool. + //! This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. + //! Allocation function must not return invalid pointer on failure. It should either throw, + //! stop the program, or use longjmp() function to pass control to other place of program. + //! If it returns invalid pointer, results are undefined. + //!

    + //! User defined allocation functions must have the following forms: + //!
    + //!
    void *allocate(std::size_t size); + //!
    void free(void *pointer); + //!

    + //! \param af Allocation function, or 0 to restore default function + //! \param ff Free function, or 0 to restore default function + void set_allocator(alloc_func *af, free_func *ff) + { + assert(m_begin == m_static_memory && m_ptr == align(m_begin)); // Verify that no memory is allocated yet + m_alloc_func = af; + m_free_func = ff; + } + + private: + + struct header + { + char *previous_begin; + }; + + void init() + { + m_begin = m_static_memory; + m_ptr = align(m_begin); + m_end = m_static_memory + sizeof(m_static_memory); + } + + char *align(char *ptr) + { + std::size_t alignment = ((RAPIDXML_ALIGNMENT - (std::size_t(ptr) & (RAPIDXML_ALIGNMENT - 1))) & (RAPIDXML_ALIGNMENT - 1)); + return ptr + alignment; + } + + char *allocate_raw(std::size_t size) + { + // Allocate + void *memory; + if (m_alloc_func) // Allocate memory using either user-specified allocation function or global operator new[] + { + memory = m_alloc_func(size); + assert(memory); // Allocator is not allowed to return 0, on failure it must either throw, stop the program or use longjmp + } + else + { + memory = new char[size]; +#ifdef RAPIDXML_NO_EXCEPTIONS + if (!memory) // If exceptions are disabled, verify memory allocation, because new will not be able to throw bad_alloc + RAPIDXML_PARSE_ERROR("out of memory", 0); +#endif + } + return static_cast(memory); + } + + void *allocate_aligned(std::size_t size) + { + // Calculate aligned pointer + char *result = align(m_ptr); + + // If not enough memory left in current pool, allocate a new pool + if (result + size > m_end) + { + // Calculate required pool size (may be bigger than RAPIDXML_DYNAMIC_POOL_SIZE) + std::size_t pool_size = RAPIDXML_DYNAMIC_POOL_SIZE; + if (pool_size < size) + pool_size = size; + + // Allocate + std::size_t alloc_size = sizeof(header) + (2 * RAPIDXML_ALIGNMENT - 2) + pool_size; // 2 alignments required in worst case: one for header, one for actual allocation + char *raw_memory = allocate_raw(alloc_size); + + // Setup new pool in allocated memory + char *pool = align(raw_memory); + header *new_header = reinterpret_cast
    (pool); + new_header->previous_begin = m_begin; + m_begin = raw_memory; + m_ptr = pool + sizeof(header); + m_end = raw_memory + alloc_size; + + // Calculate aligned pointer again using new pool + result = align(m_ptr); + } + + // Update pool and return aligned pointer + m_ptr = result + size; + return result; + } + + char *m_begin; // Start of raw memory making up current pool + char *m_ptr; // First free byte in current pool + char *m_end; // One past last available byte in current pool + char m_static_memory[RAPIDXML_STATIC_POOL_SIZE]; // Static raw memory + alloc_func *m_alloc_func; // Allocator function, or 0 if default is to be used + free_func *m_free_func; // Free function, or 0 if default is to be used + }; + + /////////////////////////////////////////////////////////////////////////// + // XML base + + //! Base class for xml_node and xml_attribute implementing common functions: + //! name(), name_size(), value(), value_size() and parent(). + //! \param Ch Character type to use + template + class xml_base + { + + public: + + /////////////////////////////////////////////////////////////////////////// + // Construction & destruction + + // Construct a base with empty name, value and parent + xml_base() + : m_name(0) + , m_value(0) + , m_parent(0) + { + } + + /////////////////////////////////////////////////////////////////////////// + // Node data access + + //! Gets name of the node. + //! Interpretation of name depends on type of node. + //! Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse. + //!

    + //! Use name_size() function to determine length of the name. + //! \return Name of node, or empty string if node has no name. + Ch *name() const + { + return m_name ? m_name : nullstr(); + } + + //! Gets size of node name, not including terminator character. + //! This function works correctly irrespective of whether name is or is not zero terminated. + //! \return Size of node name, in characters. + std::size_t name_size() const + { + return m_name ? m_name_size : 0; + } + + //! Gets value of node. + //! Interpretation of value depends on type of node. + //! Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse. + //!

    + //! Use value_size() function to determine length of the value. + //! \return Value of node, or empty string if node has no value. + Ch *value() const + { + return m_value ? m_value : nullstr(); + } + + //! Gets size of node value, not including terminator character. + //! This function works correctly irrespective of whether value is or is not zero terminated. + //! \return Size of node value, in characters. + std::size_t value_size() const + { + return m_value ? m_value_size : 0; + } + + /////////////////////////////////////////////////////////////////////////// + // Node modification + + //! Sets name of node to a non zero-terminated string. + //! See \ref ownership_of_strings. + //!

    + //! Note that node does not own its name or value, it only stores a pointer to it. + //! It will not delete or otherwise free the pointer on destruction. + //! It is reponsibility of the user to properly manage lifetime of the string. + //! The easiest way to achieve it is to use memory_pool of the document to allocate the string - + //! on destruction of the document the string will be automatically freed. + //!

    + //! Size of name must be specified separately, because name does not have to be zero terminated. + //! Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated). + //! \param name Name of node to set. Does not have to be zero terminated. + //! \param size Size of name, in characters. This does not include zero terminator, if one is present. + void name(const Ch *name, std::size_t size) + { + m_name = const_cast(name); + m_name_size = size; + } + + //! Sets name of node to a zero-terminated string. + //! See also \ref ownership_of_strings and xml_node::name(const Ch *, std::size_t). + //! \param name Name of node to set. Must be zero terminated. + void name(const Ch *name) + { + this->name(name, internal::measure(name)); + } + + //! Sets value of node to a non zero-terminated string. + //! See \ref ownership_of_strings. + //!

    + //! Note that node does not own its name or value, it only stores a pointer to it. + //! It will not delete or otherwise free the pointer on destruction. + //! It is reponsibility of the user to properly manage lifetime of the string. + //! The easiest way to achieve it is to use memory_pool of the document to allocate the string - + //! on destruction of the document the string will be automatically freed. + //!

    + //! Size of value must be specified separately, because it does not have to be zero terminated. + //! Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated). + //!

    + //! If an element has a child node of type node_data, it will take precedence over element value when printing. + //! If you want to manipulate data of elements using values, use parser flag rapidxml::parse_no_data_nodes to prevent creation of data nodes by the parser. + //! \param value value of node to set. Does not have to be zero terminated. + //! \param size Size of value, in characters. This does not include zero terminator, if one is present. + void value(const Ch *value, std::size_t size) + { + m_value = const_cast(value); + m_value_size = size; + } + + //! Sets value of node to a zero-terminated string. + //! See also \ref ownership_of_strings and xml_node::value(const Ch *, std::size_t). + //! \param value Vame of node to set. Must be zero terminated. + void value(const Ch *value) + { + this->value(value, internal::measure(value)); + } + + /////////////////////////////////////////////////////////////////////////// + // Related nodes access + + //! Gets node parent. + //! \return Pointer to parent node, or 0 if there is no parent. + xml_node *parent() const + { + return m_parent; + } + + protected: + + // Return empty string + static Ch *nullstr() + { + static Ch zero = Ch('\0'); + return &zero; + } + + Ch *m_name; // Name of node, or 0 if no name + Ch *m_value; // Value of node, or 0 if no value + std::size_t m_name_size; // Length of node name, or undefined of no name + std::size_t m_value_size; // Length of node value, or undefined if no value + xml_node *m_parent; // Pointer to parent node, or 0 if none + + }; + + //! Class representing attribute node of XML document. + //! Each attribute has name and value strings, which are available through name() and value() functions (inherited from xml_base). + //! Note that after parse, both name and value of attribute will point to interior of source text used for parsing. + //! Thus, this text must persist in memory for the lifetime of attribute. + //! \param Ch Character type to use. + template + class xml_attribute: public xml_base + { + + friend class xml_node; + + public: + + /////////////////////////////////////////////////////////////////////////// + // Construction & destruction + + //! Constructs an empty attribute with the specified type. + //! Consider using memory_pool of appropriate xml_document if allocating attributes manually. + xml_attribute() + { + } + + /////////////////////////////////////////////////////////////////////////// + // Related nodes access + + //! Gets document of which attribute is a child. + //! \return Pointer to document that contains this attribute, or 0 if there is no parent document. + xml_document *document() const + { + if (xml_node *node = this->parent()) + { + while (node->parent()) + node = node->parent(); + return node->type() == node_document ? static_cast *>(node) : 0; + } + else + return 0; + } + + //! Gets previous attribute, optionally matching attribute name. + //! \param name Name of attribute to find, or 0 to return previous attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found attribute, or 0 if not found. + xml_attribute *previous_attribute(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_attribute *attribute = m_prev_attribute; attribute; attribute = attribute->m_prev_attribute) + if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive)) + return attribute; + return 0; + } + else + return this->m_parent ? m_prev_attribute : 0; + } + + //! Gets next attribute, optionally matching attribute name. + //! \param name Name of attribute to find, or 0 to return next attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found attribute, or 0 if not found. + xml_attribute *next_attribute(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_attribute *attribute = m_next_attribute; attribute; attribute = attribute->m_next_attribute) + if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive)) + return attribute; + return 0; + } + else + return this->m_parent ? m_next_attribute : 0; + } + + private: + + xml_attribute *m_prev_attribute; // Pointer to previous sibling of attribute, or 0 if none; only valid if parent is non-zero + xml_attribute *m_next_attribute; // Pointer to next sibling of attribute, or 0 if none; only valid if parent is non-zero + + }; + + /////////////////////////////////////////////////////////////////////////// + // XML node + + //! Class representing a node of XML document. + //! Each node may have associated name and value strings, which are available through name() and value() functions. + //! Interpretation of name and value depends on type of the node. + //! Type of node can be determined by using type() function. + //!

    + //! Note that after parse, both name and value of node, if any, will point interior of source text used for parsing. + //! Thus, this text must persist in the memory for the lifetime of node. + //! \param Ch Character type to use. + template + class xml_node: public xml_base + { + + public: + + /////////////////////////////////////////////////////////////////////////// + // Construction & destruction + + //! Constructs an empty node with the specified type. + //! Consider using memory_pool of appropriate document to allocate nodes manually. + //! \param type Type of node to construct. + xml_node(node_type type) + : m_type(type) + , m_first_node(0) + , m_first_attribute(0) + { + } + + /////////////////////////////////////////////////////////////////////////// + // Node data access + + //! Gets type of node. + //! \return Type of node. + node_type type() const + { + return m_type; + } + + /////////////////////////////////////////////////////////////////////////// + // Related nodes access + + //! Gets document of which node is a child. + //! \return Pointer to document that contains this node, or 0 if there is no parent document. + xml_document *document() const + { + xml_node *node = const_cast *>(this); + while (node->parent()) + node = node->parent(); + return node->type() == node_document ? static_cast *>(node) : 0; + } + + //! Gets first child node, optionally matching node name. + //! \param name Name of child to find, or 0 to return first child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found child, or 0 if not found. + xml_node *first_node(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_node *child = m_first_node; child; child = child->next_sibling()) + if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive)) + return child; + return 0; + } + else + return m_first_node; + } + + //! Gets last child node, optionally matching node name. + //! Behaviour is undefined if node has no children. + //! Use first_node() to test if node has children. + //! \param name Name of child to find, or 0 to return last child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found child, or 0 if not found. + xml_node *last_node(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + assert(m_first_node); // Cannot query for last child if node has no children + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_node *child = m_last_node; child; child = child->previous_sibling()) + if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive)) + return child; + return 0; + } + else + return m_last_node; + } + + //! Gets previous sibling node, optionally matching node name. + //! Behaviour is undefined if node has no parent. + //! Use parent() to test if node has a parent. + //! \param name Name of sibling to find, or 0 to return previous sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found sibling, or 0 if not found. + xml_node *previous_sibling(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + assert(this->m_parent); // Cannot query for siblings if node has no parent + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_node *sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling) + if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive)) + return sibling; + return 0; + } + else + return m_prev_sibling; + } + + //! Gets next sibling node, optionally matching node name. + //! Behaviour is undefined if node has no parent. + //! Use parent() to test if node has a parent. + //! \param name Name of sibling to find, or 0 to return next sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found sibling, or 0 if not found. + xml_node *next_sibling(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + assert(this->m_parent); // Cannot query for siblings if node has no parent + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_node *sibling = m_next_sibling; sibling; sibling = sibling->m_next_sibling) + if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive)) + return sibling; + return 0; + } + else + return m_next_sibling; + } + + //! Gets first attribute of node, optionally matching attribute name. + //! \param name Name of attribute to find, or 0 to return first attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found attribute, or 0 if not found. + xml_attribute *first_attribute(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_attribute *attribute = m_first_attribute; attribute; attribute = attribute->m_next_attribute) + if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive)) + return attribute; + return 0; + } + else + return m_first_attribute; + } + + //! Gets last attribute of node, optionally matching attribute name. + //! \param name Name of attribute to find, or 0 to return last attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero + //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string + //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters + //! \return Pointer to found attribute, or 0 if not found. + xml_attribute *last_attribute(const Ch *name = 0, std::size_t name_size = 0, bool case_sensitive = true) const + { + if (name) + { + if (name_size == 0) + name_size = internal::measure(name); + for (xml_attribute *attribute = m_last_attribute; attribute; attribute = attribute->m_prev_attribute) + if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive)) + return attribute; + return 0; + } + else + return m_first_attribute ? m_last_attribute : 0; + } + + /////////////////////////////////////////////////////////////////////////// + // Node modification + + //! Sets type of node. + //! \param type Type of node to set. + void type(node_type type) + { + m_type = type; + } + + /////////////////////////////////////////////////////////////////////////// + // Node manipulation + + //! Prepends a new child node. + //! The prepended child becomes the first child, and all existing children are moved one position back. + //! \param child Node to prepend. + void prepend_node(xml_node *child) + { + assert(child && !child->parent() && child->type() != node_document); + if (first_node()) + { + child->m_next_sibling = m_first_node; + m_first_node->m_prev_sibling = child; + } + else + { + child->m_next_sibling = 0; + m_last_node = child; + } + m_first_node = child; + child->m_parent = this; + child->m_prev_sibling = 0; + } + + //! Appends a new child node. + //! The appended child becomes the last child. + //! \param child Node to append. + void append_node(xml_node *child) + { + assert(child && !child->parent() && child->type() != node_document); + if (first_node()) + { + child->m_prev_sibling = m_last_node; + m_last_node->m_next_sibling = child; + } + else + { + child->m_prev_sibling = 0; + m_first_node = child; + } + m_last_node = child; + child->m_parent = this; + child->m_next_sibling = 0; + } + + //! Inserts a new child node at specified place inside the node. + //! All children after and including the specified node are moved one position back. + //! \param where Place where to insert the child, or 0 to insert at the back. + //! \param child Node to insert. + void insert_node(xml_node *where, xml_node *child) + { + assert(!where || where->parent() == this); + assert(child && !child->parent() && child->type() != node_document); + if (where == m_first_node) + prepend_node(child); + else if (where == 0) + append_node(child); + else + { + child->m_prev_sibling = where->m_prev_sibling; + child->m_next_sibling = where; + where->m_prev_sibling->m_next_sibling = child; + where->m_prev_sibling = child; + child->m_parent = this; + } + } + + //! Removes first child node. + //! If node has no children, behaviour is undefined. + //! Use first_node() to test if node has children. + void remove_first_node() + { + assert(first_node()); + xml_node *child = m_first_node; + m_first_node = child->m_next_sibling; + if (child->m_next_sibling) + child->m_next_sibling->m_prev_sibling = 0; + else + m_last_node = 0; + child->m_parent = 0; + } + + //! Removes last child of the node. + //! If node has no children, behaviour is undefined. + //! Use first_node() to test if node has children. + void remove_last_node() + { + assert(first_node()); + xml_node *child = m_last_node; + if (child->m_prev_sibling) + { + m_last_node = child->m_prev_sibling; + child->m_prev_sibling->m_next_sibling = 0; + } + else + m_first_node = 0; + child->m_parent = 0; + } + + //! Removes specified child from the node + // \param where Pointer to child to be removed. + void remove_node(xml_node *where) + { + assert(where && where->parent() == this); + assert(first_node()); + if (where == m_first_node) + remove_first_node(); + else if (where == m_last_node) + remove_last_node(); + else + { + where->m_prev_sibling->m_next_sibling = where->m_next_sibling; + where->m_next_sibling->m_prev_sibling = where->m_prev_sibling; + where->m_parent = 0; + } + } + + //! Removes all child nodes (but not attributes). + void remove_all_nodes() + { + for (xml_node *node = first_node(); node; node = node->m_next_sibling) + node->m_parent = 0; + m_first_node = 0; + } + + //! Prepends a new attribute to the node. + //! \param attribute Attribute to prepend. + void prepend_attribute(xml_attribute *attribute) + { + assert(attribute && !attribute->parent()); + if (first_attribute()) + { + attribute->m_next_attribute = m_first_attribute; + m_first_attribute->m_prev_attribute = attribute; + } + else + { + attribute->m_next_attribute = 0; + m_last_attribute = attribute; + } + m_first_attribute = attribute; + attribute->m_parent = this; + attribute->m_prev_attribute = 0; + } + + //! Appends a new attribute to the node. + //! \param attribute Attribute to append. + void append_attribute(xml_attribute *attribute) + { + assert(attribute && !attribute->parent()); + if (first_attribute()) + { + attribute->m_prev_attribute = m_last_attribute; + m_last_attribute->m_next_attribute = attribute; + } + else + { + attribute->m_prev_attribute = 0; + m_first_attribute = attribute; + } + m_last_attribute = attribute; + attribute->m_parent = this; + attribute->m_next_attribute = 0; + } + + //! Inserts a new attribute at specified place inside the node. + //! All attributes after and including the specified attribute are moved one position back. + //! \param where Place where to insert the attribute, or 0 to insert at the back. + //! \param attribute Attribute to insert. + void insert_attribute(xml_attribute *where, xml_attribute *attribute) + { + assert(!where || where->parent() == this); + assert(attribute && !attribute->parent()); + if (where == m_first_attribute) + prepend_attribute(attribute); + else if (where == 0) + append_attribute(attribute); + else + { + attribute->m_prev_attribute = where->m_prev_attribute; + attribute->m_next_attribute = where; + where->m_prev_attribute->m_next_attribute = attribute; + where->m_prev_attribute = attribute; + attribute->m_parent = this; + } + } + + //! Removes first attribute of the node. + //! If node has no attributes, behaviour is undefined. + //! Use first_attribute() to test if node has attributes. + void remove_first_attribute() + { + assert(first_attribute()); + xml_attribute *attribute = m_first_attribute; + if (attribute->m_next_attribute) + { + attribute->m_next_attribute->m_prev_attribute = 0; + } + else + m_last_attribute = 0; + attribute->m_parent = 0; + m_first_attribute = attribute->m_next_attribute; + } + + //! Removes last attribute of the node. + //! If node has no attributes, behaviour is undefined. + //! Use first_attribute() to test if node has attributes. + void remove_last_attribute() + { + assert(first_attribute()); + xml_attribute *attribute = m_last_attribute; + if (attribute->m_prev_attribute) + { + attribute->m_prev_attribute->m_next_attribute = 0; + m_last_attribute = attribute->m_prev_attribute; + } + else + m_first_attribute = 0; + attribute->m_parent = 0; + } + + //! Removes specified attribute from node. + //! \param where Pointer to attribute to be removed. + void remove_attribute(xml_attribute *where) + { + assert(first_attribute() && where->parent() == this); + if (where == m_first_attribute) + remove_first_attribute(); + else if (where == m_last_attribute) + remove_last_attribute(); + else + { + where->m_prev_attribute->m_next_attribute = where->m_next_attribute; + where->m_next_attribute->m_prev_attribute = where->m_prev_attribute; + where->m_parent = 0; + } + } + + //! Removes all attributes of node. + void remove_all_attributes() + { + for (xml_attribute *attribute = first_attribute(); attribute; attribute = attribute->m_next_attribute) + attribute->m_parent = 0; + m_first_attribute = 0; + } + + private: + + /////////////////////////////////////////////////////////////////////////// + // Restrictions + + // No copying + xml_node(const xml_node &); + void operator =(const xml_node &); + + /////////////////////////////////////////////////////////////////////////// + // Data members + + // Note that some of the pointers below have UNDEFINED values if certain other pointers are 0. + // This is required for maximum performance, as it allows the parser to omit initialization of + // unneded/redundant values. + // + // The rules are as follows: + // 1. first_node and first_attribute contain valid pointers, or 0 if node has no children/attributes respectively + // 2. last_node and last_attribute are valid only if node has at least one child/attribute respectively, otherwise they contain garbage + // 3. prev_sibling and next_sibling are valid only if node has a parent, otherwise they contain garbage + + node_type m_type; // Type of node; always valid + xml_node *m_first_node; // Pointer to first child node, or 0 if none; always valid + xml_node *m_last_node; // Pointer to last child node, or 0 if none; this value is only valid if m_first_node is non-zero + xml_attribute *m_first_attribute; // Pointer to first attribute of node, or 0 if none; always valid + xml_attribute *m_last_attribute; // Pointer to last attribute of node, or 0 if none; this value is only valid if m_first_attribute is non-zero + xml_node *m_prev_sibling; // Pointer to previous sibling of node, or 0 if none; this value is only valid if m_parent is non-zero + xml_node *m_next_sibling; // Pointer to next sibling of node, or 0 if none; this value is only valid if m_parent is non-zero + + }; + + /////////////////////////////////////////////////////////////////////////// + // XML document + + //! This class represents root of the DOM hierarchy. + //! It is also an xml_node and a memory_pool through public inheritance. + //! Use parse() function to build a DOM tree from a zero-terminated XML text string. + //! parse() function allocates memory for nodes and attributes by using functions of xml_document, + //! which are inherited from memory_pool. + //! To access root node of the document, use the document itself, as if it was an xml_node. + //! \param Ch Character type to use. + template + class xml_document: public xml_node, public memory_pool + { + + public: + + //! Constructs empty XML document + xml_document() + : xml_node(node_document) + { + } + + //! Parses zero-terminated XML string according to given flags. + //! Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used. + //! The string must persist for the lifetime of the document. + //! In case of error, rapidxml::parse_error exception will be thrown. + //!

    + //! If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning. + //! Make sure that data is zero-terminated. + //!

    + //! Document can be parsed into multiple times. + //! Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool. + //! \param text XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser. + template + void parse(Ch *text) + { + assert(text); + + // Remove current contents + this->remove_all_nodes(); + this->remove_all_attributes(); + + // Parse BOM, if any + parse_bom(text); + + // Parse children + while (1) + { + // Skip whitespace before node + skip(text); + if (*text == 0) + break; + + // Parse and append new child + if (*text == Ch('<')) + { + ++text; // Skip '<' + if (xml_node *node = parse_node(text)) + this->append_node(node); + } + else + RAPIDXML_PARSE_ERROR("expected <", text); + } + + } + + //! Clears the document by deleting all nodes and clearing the memory pool. + //! All nodes owned by document pool are destroyed. + void clear() + { + this->remove_all_nodes(); + this->remove_all_attributes(); + memory_pool::clear(); + } + + private: + + /////////////////////////////////////////////////////////////////////// + // Internal character utility functions + + // Detect whitespace character + struct whitespace_pred + { + static unsigned char test(Ch ch) + { + return internal::lookup_tables<0>::lookup_whitespace[static_cast(ch)]; + } + }; + + // Detect node name character + struct node_name_pred + { + static unsigned char test(Ch ch) + { + return internal::lookup_tables<0>::lookup_node_name[static_cast(ch)]; + } + }; + + // Detect attribute name character + struct attribute_name_pred + { + static unsigned char test(Ch ch) + { + return internal::lookup_tables<0>::lookup_attribute_name[static_cast(ch)]; + } + }; + + // Detect text character (PCDATA) + struct text_pred + { + static unsigned char test(Ch ch) + { + return internal::lookup_tables<0>::lookup_text[static_cast(ch)]; + } + }; + + // Detect text character (PCDATA) that does not require processing + struct text_pure_no_ws_pred + { + static unsigned char test(Ch ch) + { + return internal::lookup_tables<0>::lookup_text_pure_no_ws[static_cast(ch)]; + } + }; + + // Detect text character (PCDATA) that does not require processing + struct text_pure_with_ws_pred + { + static unsigned char test(Ch ch) + { + return internal::lookup_tables<0>::lookup_text_pure_with_ws[static_cast(ch)]; + } + }; + + // Detect attribute value character + template + struct attribute_value_pred + { + static unsigned char test(Ch ch) + { + if (Quote == Ch('\'')) + return internal::lookup_tables<0>::lookup_attribute_data_1[static_cast(ch)]; + if (Quote == Ch('\"')) + return internal::lookup_tables<0>::lookup_attribute_data_2[static_cast(ch)]; + return 0; // Should never be executed, to avoid warnings on Comeau + } + }; + + // Detect attribute value character + template + struct attribute_value_pure_pred + { + static unsigned char test(Ch ch) + { + if (Quote == Ch('\'')) + return internal::lookup_tables<0>::lookup_attribute_data_1_pure[static_cast(ch)]; + if (Quote == Ch('\"')) + return internal::lookup_tables<0>::lookup_attribute_data_2_pure[static_cast(ch)]; + return 0; // Should never be executed, to avoid warnings on Comeau + } + }; + + // Insert coded character, using UTF8 or 8-bit ASCII + template + static void insert_coded_character(Ch *&text, unsigned long code) + { + if (Flags & parse_no_utf8) + { + // Insert 8-bit ASCII character + // Todo: possibly verify that code is less than 256 and use replacement char otherwise? + text[0] = static_cast(code); + text += 1; + } + else + { + // Insert UTF8 sequence + if (code < 0x80) // 1 byte sequence + { + text[0] = static_cast(code); + text += 1; + } + else if (code < 0x800) // 2 byte sequence + { + text[1] = static_cast((code | 0x80) & 0xBF); code >>= 6; + text[0] = static_cast(code | 0xC0); + text += 2; + } + else if (code < 0x10000) // 3 byte sequence + { + text[2] = static_cast((code | 0x80) & 0xBF); code >>= 6; + text[1] = static_cast((code | 0x80) & 0xBF); code >>= 6; + text[0] = static_cast(code | 0xE0); + text += 3; + } + else if (code < 0x110000) // 4 byte sequence + { + text[3] = static_cast((code | 0x80) & 0xBF); code >>= 6; + text[2] = static_cast((code | 0x80) & 0xBF); code >>= 6; + text[1] = static_cast((code | 0x80) & 0xBF); code >>= 6; + text[0] = static_cast(code | 0xF0); + text += 4; + } + else // Invalid, only codes up to 0x10FFFF are allowed in Unicode + { + RAPIDXML_PARSE_ERROR("invalid numeric character entity", text); + } + } + } + + // Skip characters until predicate evaluates to true + template + static void skip(Ch *&text) + { + Ch *tmp = text; + while (StopPred::test(*tmp)) + ++tmp; + text = tmp; + } + + // Skip characters until predicate evaluates to true while doing the following: + // - replacing XML character entity references with proper characters (' & " < > &#...;) + // - condensing whitespace sequences to single space character + template + static Ch *skip_and_expand_character_refs(Ch *&text) + { + // If entity translation, whitespace condense and whitespace trimming is disabled, use plain skip + if (Flags & parse_no_entity_translation && + !(Flags & parse_normalize_whitespace) && + !(Flags & parse_trim_whitespace)) + { + skip(text); + return text; + } + + // Use simple skip until first modification is detected + skip(text); + + // Use translation skip + Ch *src = text; + Ch *dest = src; + while (StopPred::test(*src)) + { + // If entity translation is enabled + if (!(Flags & parse_no_entity_translation)) + { + // Test if replacement is needed + if (src[0] == Ch('&')) + { + switch (src[1]) + { + + // & ' + case Ch('a'): + if (src[2] == Ch('m') && src[3] == Ch('p') && src[4] == Ch(';')) + { + *dest = Ch('&'); + ++dest; + src += 5; + continue; + } + if (src[2] == Ch('p') && src[3] == Ch('o') && src[4] == Ch('s') && src[5] == Ch(';')) + { + *dest = Ch('\''); + ++dest; + src += 6; + continue; + } + break; + + // " + case Ch('q'): + if (src[2] == Ch('u') && src[3] == Ch('o') && src[4] == Ch('t') && src[5] == Ch(';')) + { + *dest = Ch('"'); + ++dest; + src += 6; + continue; + } + break; + + // > + case Ch('g'): + if (src[2] == Ch('t') && src[3] == Ch(';')) + { + *dest = Ch('>'); + ++dest; + src += 4; + continue; + } + break; + + // < + case Ch('l'): + if (src[2] == Ch('t') && src[3] == Ch(';')) + { + *dest = Ch('<'); + ++dest; + src += 4; + continue; + } + break; + + // &#...; - assumes ASCII + case Ch('#'): + if (src[2] == Ch('x')) + { + unsigned long code = 0; + src += 3; // Skip &#x + while (1) + { + unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast(*src)]; + if (digit == 0xFF) + break; + code = code * 16 + digit; + ++src; + } + insert_coded_character(dest, code); // Put character in output + } + else + { + unsigned long code = 0; + src += 2; // Skip &# + while (1) + { + unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast(*src)]; + if (digit == 0xFF) + break; + code = code * 10 + digit; + ++src; + } + insert_coded_character(dest, code); // Put character in output + } + if (*src == Ch(';')) + ++src; + else + RAPIDXML_PARSE_ERROR("expected ;", src); + continue; + + // Something else + default: + // Ignore, just copy '&' verbatim + break; + + } + } + } + + // If whitespace condensing is enabled + if (Flags & parse_normalize_whitespace) + { + // Test if condensing is needed + if (whitespace_pred::test(*src)) + { + *dest = Ch(' '); ++dest; // Put single space in dest + ++src; // Skip first whitespace char + // Skip remaining whitespace chars + while (whitespace_pred::test(*src)) + ++src; + continue; + } + } + + // No replacement, only copy character + *dest++ = *src++; + + } + + // Return new end + text = src; + return dest; + + } + + /////////////////////////////////////////////////////////////////////// + // Internal parsing functions + + // Parse BOM, if any + template + void parse_bom(Ch *&text) + { + // UTF-8? + if (static_cast(text[0]) == 0xEF && + static_cast(text[1]) == 0xBB && + static_cast(text[2]) == 0xBF) + { + text += 3; // Skup utf-8 bom + } + } + + // Parse XML declaration ( + xml_node *parse_xml_declaration(Ch *&text) + { + // If parsing of declaration is disabled + if (!(Flags & parse_declaration_node)) + { + // Skip until end of declaration + while (text[0] != Ch('?') || text[1] != Ch('>')) + { + if (!text[0]) + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + ++text; + } + text += 2; // Skip '?>' + return 0; + } + + // Create declaration + xml_node *declaration = this->allocate_node(node_declaration); + + // Skip whitespace before attributes or ?> + skip(text); + + // Parse declaration attributes + parse_node_attributes(text, declaration); + + // Skip ?> + if (text[0] != Ch('?') || text[1] != Ch('>')) + RAPIDXML_PARSE_ERROR("expected ?>", text); + text += 2; + + return declaration; + } + + // Parse XML comment (' + return 0; // Do not produce comment node + } + + // Remember value start + Ch *value = text; + + // Skip until end of comment + while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>')) + { + if (!text[0]) + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + ++text; + } + + // Create comment node + xml_node *comment = this->allocate_node(node_comment); + comment->value(value, text - value); + + // Place zero terminator after comment value + if (!(Flags & parse_no_string_terminators)) + *text = Ch('\0'); + + text += 3; // Skip '-->' + return comment; + } + + // Parse DOCTYPE + template + xml_node *parse_doctype(Ch *&text) + { + // Remember value start + Ch *value = text; + + // Skip to > + while (*text != Ch('>')) + { + // Determine character type + switch (*text) + { + + // If '[' encountered, scan for matching ending ']' using naive algorithm with depth + // This works for all W3C test files except for 2 most wicked + case Ch('['): + { + ++text; // Skip '[' + int depth = 1; + while (depth > 0) + { + switch (*text) + { + case Ch('['): ++depth; break; + case Ch(']'): --depth; break; + case 0: RAPIDXML_PARSE_ERROR("unexpected end of data", text); + } + ++text; + } + break; + } + + // Error on end of text + case Ch('\0'): + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + + // Other character, skip it + default: + ++text; + + } + } + + // If DOCTYPE nodes enabled + if (Flags & parse_doctype_node) + { + // Create a new doctype node + xml_node *doctype = this->allocate_node(node_doctype); + doctype->value(value, text - value); + + // Place zero terminator after value + if (!(Flags & parse_no_string_terminators)) + *text = Ch('\0'); + + text += 1; // skip '>' + return doctype; + } + else + { + text += 1; // skip '>' + return 0; + } + + } + + // Parse PI + template + xml_node *parse_pi(Ch *&text) + { + // If creation of PI nodes is enabled + if (Flags & parse_pi_nodes) + { + // Create pi node + xml_node *pi = this->allocate_node(node_pi); + + // Extract PI target name + Ch *name = text; + skip(text); + if (text == name) + RAPIDXML_PARSE_ERROR("expected PI target", text); + pi->name(name, text - name); + + // Skip whitespace between pi target and pi + skip(text); + + // Remember start of pi + Ch *value = text; + + // Skip to '?>' + while (text[0] != Ch('?') || text[1] != Ch('>')) + { + if (*text == Ch('\0')) + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + ++text; + } + + // Set pi value (verbatim, no entity expansion or whitespace normalization) + pi->value(value, text - value); + + // Place zero terminator after name and value + if (!(Flags & parse_no_string_terminators)) + { + pi->name()[pi->name_size()] = Ch('\0'); + pi->value()[pi->value_size()] = Ch('\0'); + } + + text += 2; // Skip '?>' + return pi; + } + else + { + // Skip to '?>' + while (text[0] != Ch('?') || text[1] != Ch('>')) + { + if (*text == Ch('\0')) + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + ++text; + } + text += 2; // Skip '?>' + return 0; + } + } + + // Parse and append data + // Return character that ends data. + // This is necessary because this character might have been overwritten by a terminating 0 + template + Ch parse_and_append_data(xml_node *node, Ch *&text, Ch *contents_start) + { + // Backup to contents start if whitespace trimming is disabled + if (!(Flags & parse_trim_whitespace)) + text = contents_start; + + // Skip until end of data + Ch *value = text, *end; + if (Flags & parse_normalize_whitespace) + end = skip_and_expand_character_refs(text); + else + end = skip_and_expand_character_refs(text); + + // Trim trailing whitespace if flag is set; leading was already trimmed by whitespace skip after > + if (Flags & parse_trim_whitespace) + { + if (Flags & parse_normalize_whitespace) + { + // Whitespace is already condensed to single space characters by skipping function, so just trim 1 char off the end + if (*(end - 1) == Ch(' ')) + --end; + } + else + { + // Backup until non-whitespace character is found + while (whitespace_pred::test(*(end - 1))) + --end; + } + } + + // If characters are still left between end and value (this test is only necessary if normalization is enabled) + // Create new data node + if (!(Flags & parse_no_data_nodes)) + { + xml_node *data = this->allocate_node(node_data); + data->value(value, end - value); + node->append_node(data); + } + + // Add data to parent node if no data exists yet + if (!(Flags & parse_no_element_values)) + if (*node->value() == Ch('\0')) + node->value(value, end - value); + + // Place zero terminator after value + if (!(Flags & parse_no_string_terminators)) + { + Ch ch = *text; + *end = Ch('\0'); + return ch; // Return character that ends data; this is required because zero terminator overwritten it + } + + // Return character that ends data + return *text; + } + + // Parse CDATA + template + xml_node *parse_cdata(Ch *&text) + { + // If CDATA is disabled + if (Flags & parse_no_data_nodes) + { + // Skip until end of cdata + while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>')) + { + if (!text[0]) + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + ++text; + } + text += 3; // Skip ]]> + return 0; // Do not produce CDATA node + } + + // Skip until end of cdata + Ch *value = text; + while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>')) + { + if (!text[0]) + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + ++text; + } + + // Create new cdata node + xml_node *cdata = this->allocate_node(node_cdata); + cdata->value(value, text - value); + + // Place zero terminator after value + if (!(Flags & parse_no_string_terminators)) + *text = Ch('\0'); + + text += 3; // Skip ]]> + return cdata; + } + + // Parse element node + template + xml_node *parse_element(Ch *&text) + { + // Create element node + xml_node *element = this->allocate_node(node_element); + + // Extract element name + Ch *name = text; + skip(text); + if (text == name) + RAPIDXML_PARSE_ERROR("expected element name", text); + element->name(name, text - name); + + // Skip whitespace between element name and attributes or > + skip(text); + + // Parse attributes, if any + parse_node_attributes(text, element); + + // Determine ending type + if (*text == Ch('>')) + { + ++text; + parse_node_contents(text, element); + } + else if (*text == Ch('/')) + { + ++text; + if (*text != Ch('>')) + RAPIDXML_PARSE_ERROR("expected >", text); + ++text; + } + else + RAPIDXML_PARSE_ERROR("expected >", text); + + // Place zero terminator after name + if (!(Flags & parse_no_string_terminators)) + element->name()[element->name_size()] = Ch('\0'); + + // Return parsed element + return element; + } + + // Determine node type, and parse it + template + xml_node *parse_node(Ch *&text) + { + // Parse proper node type + switch (text[0]) + { + + // <... + default: + // Parse and append element node + return parse_element(text); + + // (text); + } + else + { + // Parse PI + return parse_pi(text); + } + + // (text); + } + break; + + // (text); + } + break; + + // (text); + } + + } // switch + + // Attempt to skip other, unrecognized node types starting with ')) + { + if (*text == 0) + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + ++text; + } + ++text; // Skip '>' + return 0; // No node recognized + + } + } + + // Parse contents of the node - children, data etc. + template + void parse_node_contents(Ch *&text, xml_node *node) + { + // For all children and text + while (1) + { + // Skip whitespace between > and node contents + Ch *contents_start = text; // Store start of node contents before whitespace is skipped + skip(text); + Ch next_char = *text; + + // After data nodes, instead of continuing the loop, control jumps here. + // This is because zero termination inside parse_and_append_data() function + // would wreak havoc with the above code. + // Also, skipping whitespace after data nodes is unnecessary. + after_data_node: + + // Determine what comes next: node closing, child node, data node, or 0? + switch (next_char) + { + + // Node closing or child node + case Ch('<'): + if (text[1] == Ch('/')) + { + // Node closing + text += 2; // Skip '(text); + if (!internal::compare(node->name(), node->name_size(), closing_name, text - closing_name, true)) + RAPIDXML_PARSE_ERROR("invalid closing tag name", text); + } + else + { + // No validation, just skip name + skip(text); + } + // Skip remaining whitespace after node name + skip(text); + if (*text != Ch('>')) + RAPIDXML_PARSE_ERROR("expected >", text); + ++text; // Skip '>' + return; // Node closed, finished parsing contents + } + else + { + // Child node + ++text; // Skip '<' + if (xml_node *child = parse_node(text)) + node->append_node(child); + } + break; + + // End of data - error + case Ch('\0'): + RAPIDXML_PARSE_ERROR("unexpected end of data", text); + + // Data node + default: + next_char = parse_and_append_data(node, text, contents_start); + goto after_data_node; // Bypass regular processing after data nodes + + } + } + } + + // Parse XML attributes of the node + template + void parse_node_attributes(Ch *&text, xml_node *node) + { + // For all attributes + while (attribute_name_pred::test(*text)) + { + // Extract attribute name + Ch *name = text; + ++text; // Skip first character of attribute name + skip(text); + if (text == name) + RAPIDXML_PARSE_ERROR("expected attribute name", name); + + // Create new attribute + xml_attribute *attribute = this->allocate_attribute(); + attribute->name(name, text - name); + node->append_attribute(attribute); + + // Skip whitespace after attribute name + skip(text); + + // Skip = + if (*text != Ch('=')) + RAPIDXML_PARSE_ERROR("expected =", text); + ++text; + + // Add terminating zero after name + if (!(Flags & parse_no_string_terminators)) + attribute->name()[attribute->name_size()] = 0; + + // Skip whitespace after = + skip(text); + + // Skip quote and remember if it was ' or " + Ch quote = *text; + if (quote != Ch('\'') && quote != Ch('"')) + RAPIDXML_PARSE_ERROR("expected ' or \"", text); + ++text; + + // Extract attribute value and expand char refs in it + Ch *value = text, *end; + const int AttFlags = Flags & ~parse_normalize_whitespace; // No whitespace normalization in attributes + if (quote == Ch('\'')) + end = skip_and_expand_character_refs, attribute_value_pure_pred, AttFlags>(text); + else + end = skip_and_expand_character_refs, attribute_value_pure_pred, AttFlags>(text); + + // Set attribute value + attribute->value(value, end - value); + + // Make sure that end quote is present + if (*text != quote) + RAPIDXML_PARSE_ERROR("expected ' or \"", text); + ++text; // Skip quote + + // Add terminating zero after value + if (!(Flags & parse_no_string_terminators)) + attribute->value()[attribute->value_size()] = 0; + + // Skip whitespace after attribute value + skip(text); + } + } + + }; + + //! \cond internal + namespace internal + { + + // Whitespace (space \n \r \t) + template + const unsigned char lookup_tables::lookup_whitespace[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, // 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1 + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 4 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 5 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // C + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // F + }; + + // Node name (anything but space \n \r \t / > ? \0) + template + const unsigned char lookup_tables::lookup_node_name[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Text (i.e. PCDATA) (anything but < \0) + template + const unsigned char lookup_tables::lookup_text[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Text (i.e. PCDATA) that does not require processing when ws normalization is disabled + // (anything but < \0 &) + template + const unsigned char lookup_tables::lookup_text_pure_no_ws[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Text (i.e. PCDATA) that does not require processing when ws normalizationis is enabled + // (anything but < \0 & space \n \r \t) + template + const unsigned char lookup_tables::lookup_text_pure_with_ws[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Attribute name (anything but space \n \r \t / < > = ? ! \0) + template + const unsigned char lookup_tables::lookup_attribute_name[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Attribute data with single quote (anything but ' \0) + template + const unsigned char lookup_tables::lookup_attribute_data_1[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Attribute data with single quote that does not require processing (anything but ' \0 &) + template + const unsigned char lookup_tables::lookup_attribute_data_1_pure[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Attribute data with double quote (anything but " \0) + template + const unsigned char lookup_tables::lookup_attribute_data_2[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Attribute data with double quote that does not require processing (anything but " \0 &) + template + const unsigned char lookup_tables::lookup_attribute_data_2_pure[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F + }; + + // Digits (dec and hex, 255 denotes end of numeric character reference) + template + const unsigned char lookup_tables::lookup_digits[256] = + { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 0 + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 1 + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 2 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,255,255,255,255,255,255, // 3 + 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255, // 4 + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 5 + 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255, // 6 + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 7 + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 8 + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 9 + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // A + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // B + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // C + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // D + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // E + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 // F + }; + + // Upper case conversion + template + const unsigned char lookup_tables::lookup_upcase[256] = + { + // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A B C D E F + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2 + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3 + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4 + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5 + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 6 + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123,124,125,126,127, // 7 + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, // 8 + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, // 9 + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, // A + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, // B + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, // C + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, // D + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, // E + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 // F + }; + } + //! \endcond + +} + +// Undefine internal macros +#undef RAPIDXML_PARSE_ERROR + +// On MSVC, restore warnings state +#ifdef _MSC_VER + #pragma warning(pop) +#endif + +#endif diff --git a/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_iterators.hpp b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_iterators.hpp new file mode 100644 index 000000000..52ebc298a --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_iterators.hpp @@ -0,0 +1,174 @@ +#ifndef RAPIDXML_ITERATORS_HPP_INCLUDED +#define RAPIDXML_ITERATORS_HPP_INCLUDED + +// Copyright (C) 2006, 2009 Marcin Kalicinski +// Version 1.13 +// Revision $DateTime: 2009/05/13 01:46:17 $ +//! \file rapidxml_iterators.hpp This file contains rapidxml iterators + +#include "rapidxml.hpp" + +namespace rapidxml +{ + + //! Iterator of child nodes of xml_node + template + class node_iterator + { + + public: + + typedef typename xml_node value_type; + typedef typename xml_node &reference; + typedef typename xml_node *pointer; + typedef std::ptrdiff_t difference_type; + typedef std::bidirectional_iterator_tag iterator_category; + + node_iterator() + : m_node(0) + { + } + + node_iterator(xml_node *node) + : m_node(node->first_node()) + { + } + + reference operator *() const + { + assert(m_node); + return *m_node; + } + + pointer operator->() const + { + assert(m_node); + return m_node; + } + + node_iterator& operator++() + { + assert(m_node); + m_node = m_node->next_sibling(); + return *this; + } + + node_iterator operator++(int) + { + node_iterator tmp = *this; + ++this; + return tmp; + } + + node_iterator& operator--() + { + assert(m_node && m_node->previous_sibling()); + m_node = m_node->previous_sibling(); + return *this; + } + + node_iterator operator--(int) + { + node_iterator tmp = *this; + ++this; + return tmp; + } + + bool operator ==(const node_iterator &rhs) + { + return m_node == rhs.m_node; + } + + bool operator !=(const node_iterator &rhs) + { + return m_node != rhs.m_node; + } + + private: + + xml_node *m_node; + + }; + + //! Iterator of child attributes of xml_node + template + class attribute_iterator + { + + public: + + typedef typename xml_attribute value_type; + typedef typename xml_attribute &reference; + typedef typename xml_attribute *pointer; + typedef std::ptrdiff_t difference_type; + typedef std::bidirectional_iterator_tag iterator_category; + + attribute_iterator() + : m_attribute(0) + { + } + + attribute_iterator(xml_node *node) + : m_attribute(node->first_attribute()) + { + } + + reference operator *() const + { + assert(m_attribute); + return *m_attribute; + } + + pointer operator->() const + { + assert(m_attribute); + return m_attribute; + } + + attribute_iterator& operator++() + { + assert(m_attribute); + m_attribute = m_attribute->next_attribute(); + return *this; + } + + attribute_iterator operator++(int) + { + attribute_iterator tmp = *this; + ++this; + return tmp; + } + + attribute_iterator& operator--() + { + assert(m_attribute && m_attribute->previous_attribute()); + m_attribute = m_attribute->previous_attribute(); + return *this; + } + + attribute_iterator operator--(int) + { + attribute_iterator tmp = *this; + ++this; + return tmp; + } + + bool operator ==(const attribute_iterator &rhs) + { + return m_attribute == rhs.m_attribute; + } + + bool operator !=(const attribute_iterator &rhs) + { + return m_attribute != rhs.m_attribute; + } + + private: + + xml_attribute *m_attribute; + + }; + +} + +#endif diff --git a/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_print.hpp b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_print.hpp new file mode 100644 index 000000000..0ae2b14fa --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_print.hpp @@ -0,0 +1,421 @@ +#ifndef RAPIDXML_PRINT_HPP_INCLUDED +#define RAPIDXML_PRINT_HPP_INCLUDED + +// Copyright (C) 2006, 2009 Marcin Kalicinski +// Version 1.13 +// Revision $DateTime: 2009/05/13 01:46:17 $ +//! \file rapidxml_print.hpp This file contains rapidxml printer implementation + +#include "rapidxml.hpp" + +// Only include streams if not disabled +#ifndef RAPIDXML_NO_STREAMS + #include + #include +#endif + +namespace rapidxml +{ + + /////////////////////////////////////////////////////////////////////// + // Printing flags + + const int print_no_indenting = 0x1; //!< Printer flag instructing the printer to suppress indenting of XML. See print() function. + + /////////////////////////////////////////////////////////////////////// + // Internal + + //! \cond internal + namespace internal + { + + /////////////////////////////////////////////////////////////////////////// + // Internal character operations + + // Copy characters from given range to given output iterator + template + inline OutIt copy_chars(const Ch *begin, const Ch *end, OutIt out) + { + while (begin != end) + *out++ = *begin++; + return out; + } + + // Copy characters from given range to given output iterator and expand + // characters into references (< > ' " &) + template + inline OutIt copy_and_expand_chars(const Ch *begin, const Ch *end, Ch noexpand, OutIt out) + { + while (begin != end) + { + if (*begin == noexpand) + { + *out++ = *begin; // No expansion, copy character + } + else + { + switch (*begin) + { + case Ch('<'): + *out++ = Ch('&'); *out++ = Ch('l'); *out++ = Ch('t'); *out++ = Ch(';'); + break; + case Ch('>'): + *out++ = Ch('&'); *out++ = Ch('g'); *out++ = Ch('t'); *out++ = Ch(';'); + break; + case Ch('\''): + *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('p'); *out++ = Ch('o'); *out++ = Ch('s'); *out++ = Ch(';'); + break; + case Ch('"'): + *out++ = Ch('&'); *out++ = Ch('q'); *out++ = Ch('u'); *out++ = Ch('o'); *out++ = Ch('t'); *out++ = Ch(';'); + break; + case Ch('&'): + *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('m'); *out++ = Ch('p'); *out++ = Ch(';'); + break; + default: + *out++ = *begin; // No expansion, copy character + } + } + ++begin; // Step to next character + } + return out; + } + + // Fill given output iterator with repetitions of the same character + template + inline OutIt fill_chars(OutIt out, int n, Ch ch) + { + for (int i = 0; i < n; ++i) + *out++ = ch; + return out; + } + + // Find character + template + inline bool find_char(const Ch *begin, const Ch *end) + { + while (begin != end) + if (*begin++ == ch) + return true; + return false; + } + + /////////////////////////////////////////////////////////////////////////// + // Internal printing operations + + // Print node + template + inline OutIt print_node(OutIt out, const xml_node *node, int flags, int indent) + { + // Print proper node type + switch (node->type()) + { + + // Document + case node_document: + out = print_children(out, node, flags, indent); + break; + + // Element + case node_element: + out = print_element_node(out, node, flags, indent); + break; + + // Data + case node_data: + out = print_data_node(out, node, flags, indent); + break; + + // CDATA + case node_cdata: + out = print_cdata_node(out, node, flags, indent); + break; + + // Declaration + case node_declaration: + out = print_declaration_node(out, node, flags, indent); + break; + + // Comment + case node_comment: + out = print_comment_node(out, node, flags, indent); + break; + + // Doctype + case node_doctype: + out = print_doctype_node(out, node, flags, indent); + break; + + // Pi + case node_pi: + out = print_pi_node(out, node, flags, indent); + break; + + // Unknown + default: + assert(0); + break; + } + + // If indenting not disabled, add line break after node + if (!(flags & print_no_indenting)) + *out = Ch('\n'), ++out; + + // Return modified iterator + return out; + } + + // Print children of the node + template + inline OutIt print_children(OutIt out, const xml_node *node, int flags, int indent) + { + for (xml_node *child = node->first_node(); child; child = child->next_sibling()) + out = print_node(out, child, flags, indent); + return out; + } + + // Print attributes of the node + template + inline OutIt print_attributes(OutIt out, const xml_node *node, int flags) + { + for (xml_attribute *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute()) + { + if (attribute->name() && attribute->value()) + { + // Print attribute name + *out = Ch(' '), ++out; + out = copy_chars(attribute->name(), attribute->name() + attribute->name_size(), out); + *out = Ch('='), ++out; + // Print attribute value using appropriate quote type + if (find_char(attribute->value(), attribute->value() + attribute->value_size())) + { + *out = Ch('\''), ++out; + out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('"'), out); + *out = Ch('\''), ++out; + } + else + { + *out = Ch('"'), ++out; + out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('\''), out); + *out = Ch('"'), ++out; + } + } + } + return out; + } + + // Print data node + template + inline OutIt print_data_node(OutIt out, const xml_node *node, int flags, int indent) + { + assert(node->type() == node_data); + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out); + return out; + } + + // Print data node + template + inline OutIt print_cdata_node(OutIt out, const xml_node *node, int flags, int indent) + { + assert(node->type() == node_cdata); + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + *out = Ch('<'); ++out; + *out = Ch('!'); ++out; + *out = Ch('['); ++out; + *out = Ch('C'); ++out; + *out = Ch('D'); ++out; + *out = Ch('A'); ++out; + *out = Ch('T'); ++out; + *out = Ch('A'); ++out; + *out = Ch('['); ++out; + out = copy_chars(node->value(), node->value() + node->value_size(), out); + *out = Ch(']'); ++out; + *out = Ch(']'); ++out; + *out = Ch('>'); ++out; + return out; + } + + // Print element node + template + inline OutIt print_element_node(OutIt out, const xml_node *node, int flags, int indent) + { + assert(node->type() == node_element); + + // Print element name and attributes, if any + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + *out = Ch('<'), ++out; + out = copy_chars(node->name(), node->name() + node->name_size(), out); + out = print_attributes(out, node, flags); + + // If node is childless + if (node->value_size() == 0 && !node->first_node()) + { + // Print childless node tag ending + *out = Ch('/'), ++out; + *out = Ch('>'), ++out; + } + else + { + // Print normal node tag ending + *out = Ch('>'), ++out; + + // Test if node contains a single data node only (and no other nodes) + xml_node *child = node->first_node(); + if (!child) + { + // If node has no children, only print its value without indenting + out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out); + } + else if (child->next_sibling() == 0 && child->type() == node_data) + { + // If node has a sole data child, only print its value without indenting + out = copy_and_expand_chars(child->value(), child->value() + child->value_size(), Ch(0), out); + } + else + { + // Print all children with full indenting + if (!(flags & print_no_indenting)) + *out = Ch('\n'), ++out; + out = print_children(out, node, flags, indent + 1); + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + } + + // Print node end + *out = Ch('<'), ++out; + *out = Ch('/'), ++out; + out = copy_chars(node->name(), node->name() + node->name_size(), out); + *out = Ch('>'), ++out; + } + return out; + } + + // Print declaration node + template + inline OutIt print_declaration_node(OutIt out, const xml_node *node, int flags, int indent) + { + // Print declaration start + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + *out = Ch('<'), ++out; + *out = Ch('?'), ++out; + *out = Ch('x'), ++out; + *out = Ch('m'), ++out; + *out = Ch('l'), ++out; + + // Print attributes + out = print_attributes(out, node, flags); + + // Print declaration end + *out = Ch('?'), ++out; + *out = Ch('>'), ++out; + + return out; + } + + // Print comment node + template + inline OutIt print_comment_node(OutIt out, const xml_node *node, int flags, int indent) + { + assert(node->type() == node_comment); + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + *out = Ch('<'), ++out; + *out = Ch('!'), ++out; + *out = Ch('-'), ++out; + *out = Ch('-'), ++out; + out = copy_chars(node->value(), node->value() + node->value_size(), out); + *out = Ch('-'), ++out; + *out = Ch('-'), ++out; + *out = Ch('>'), ++out; + return out; + } + + // Print doctype node + template + inline OutIt print_doctype_node(OutIt out, const xml_node *node, int flags, int indent) + { + assert(node->type() == node_doctype); + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + *out = Ch('<'), ++out; + *out = Ch('!'), ++out; + *out = Ch('D'), ++out; + *out = Ch('O'), ++out; + *out = Ch('C'), ++out; + *out = Ch('T'), ++out; + *out = Ch('Y'), ++out; + *out = Ch('P'), ++out; + *out = Ch('E'), ++out; + *out = Ch(' '), ++out; + out = copy_chars(node->value(), node->value() + node->value_size(), out); + *out = Ch('>'), ++out; + return out; + } + + // Print pi node + template + inline OutIt print_pi_node(OutIt out, const xml_node *node, int flags, int indent) + { + assert(node->type() == node_pi); + if (!(flags & print_no_indenting)) + out = fill_chars(out, indent, Ch('\t')); + *out = Ch('<'), ++out; + *out = Ch('?'), ++out; + out = copy_chars(node->name(), node->name() + node->name_size(), out); + *out = Ch(' '), ++out; + out = copy_chars(node->value(), node->value() + node->value_size(), out); + *out = Ch('?'), ++out; + *out = Ch('>'), ++out; + return out; + } + + } + //! \endcond + + /////////////////////////////////////////////////////////////////////////// + // Printing + + //! Prints XML to given output iterator. + //! \param out Output iterator to print to. + //! \param node Node to be printed. Pass xml_document to print entire document. + //! \param flags Flags controlling how XML is printed. + //! \return Output iterator pointing to position immediately after last character of printed text. + template + inline OutIt print(OutIt out, const xml_node &node, int flags = 0) + { + return internal::print_node(out, &node, flags, 0); + } + +#ifndef RAPIDXML_NO_STREAMS + + //! Prints XML to given output stream. + //! \param out Output stream to print to. + //! \param node Node to be printed. Pass xml_document to print entire document. + //! \param flags Flags controlling how XML is printed. + //! \return Output stream. + template + inline std::basic_ostream &print(std::basic_ostream &out, const xml_node &node, int flags = 0) + { + print(std::ostream_iterator(out), node, flags); + return out; + } + + //! Prints formatted XML to given output stream. Uses default printing flags. Use print() function to customize printing process. + //! \param out Output stream to print to. + //! \param node Node to be printed. + //! \return Output stream. + template + inline std::basic_ostream &operator <<(std::basic_ostream &out, const xml_node &node) + { + return print(out, node); + } + +#endif + +} + +#endif diff --git a/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_utils.hpp b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_utils.hpp new file mode 100644 index 000000000..37c29535f --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/contrib/rapidxml-1.13/rapidxml_utils.hpp @@ -0,0 +1,122 @@ +#ifndef RAPIDXML_UTILS_HPP_INCLUDED +#define RAPIDXML_UTILS_HPP_INCLUDED + +// Copyright (C) 2006, 2009 Marcin Kalicinski +// Version 1.13 +// Revision $DateTime: 2009/05/13 01:46:17 $ +//! \file rapidxml_utils.hpp This file contains high-level rapidxml utilities that can be useful +//! in certain simple scenarios. They should probably not be used if maximizing performance is the main objective. + +#include "rapidxml.hpp" +#include +#include +#include +#include + +namespace rapidxml +{ + + //! Represents data loaded from a file + template + class file + { + + public: + + //! Loads file into the memory. Data will be automatically destroyed by the destructor. + //! \param filename Filename to load. + file(const char *filename) + { + using namespace std; + + // Open stream + basic_ifstream stream(filename, ios::binary); + if (!stream) + throw runtime_error(string("cannot open file ") + filename); + stream.unsetf(ios::skipws); + + // Determine stream size + stream.seekg(0, ios::end); + size_t size = stream.tellg(); + stream.seekg(0); + + // Load data and add terminating 0 + m_data.resize(size + 1); + stream.read(&m_data.front(), static_cast(size)); + m_data[size] = 0; + } + + //! Loads file into the memory. Data will be automatically destroyed by the destructor + //! \param stream Stream to load from + file(std::basic_istream &stream) + { + using namespace std; + + // Load data and add terminating 0 + stream.unsetf(ios::skipws); + m_data.assign(istreambuf_iterator(stream), istreambuf_iterator()); + if (stream.fail() || stream.bad()) + throw runtime_error("error reading stream"); + m_data.push_back(0); + } + + //! Gets file data. + //! \return Pointer to data of file. + Ch *data() + { + return &m_data.front(); + } + + //! Gets file data. + //! \return Pointer to data of file. + const Ch *data() const + { + return &m_data.front(); + } + + //! Gets file data size. + //! \return Size of file data, in characters. + std::size_t size() const + { + return m_data.size(); + } + + private: + + std::vector m_data; // File data + + }; + + //! Counts children of node. Time complexity is O(n). + //! \return Number of children of node + template + inline std::size_t count_children(xml_node *node) + { + xml_node *child = node->first_node(); + std::size_t count = 0; + while (child) + { + ++count; + child = child->next_sibling(); + } + return count; + } + + //! Counts attributes of node. Time complexity is O(n). + //! \return Number of attributes of node + template + inline std::size_t count_attributes(xml_node *node) + { + xml_attribute *attr = node->first_attribute(); + std::size_t count = 0; + while (attr) + { + ++count; + attr = attr->next_attribute(); + } + return count; + } + +} + +#endif diff --git a/doc/src/tools/doxygen_xml2qbk/contrib/readme.txt b/doc/src/tools/doxygen_xml2qbk/contrib/readme.txt new file mode 100644 index 000000000..9d473a4bc --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/contrib/readme.txt @@ -0,0 +1,5 @@ +Download RapidXml from here +http://rapidxml.sourceforge.net/ + +and put the contents in the folder rapidxml-1.13 +(adapt version if necessary) diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp new file mode 100644 index 000000000..814e117ed --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -0,0 +1,166 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +#ifndef DOXYGEN_ELEMENTS_HPP +#define DOXYGEN_ELEMENTS_HPP + + +#include +#include + + +enum markup_type { markup_default, markup_synopsis }; +enum markup_order_type { markup_any, markup_before, markup_after }; + +// TODO: rename, not all are functions +enum function_type +{ + function_unknown, + function_define, + function_constructor_destructor, + function_member, + function_free, +}; + +struct base_element +{ + std::string name; + std::string brief_description; + + bool skip; + + base_element(std::string const& n = "") + : name(n) + , skip(false) + {} +}; + + +// contains (template)parameter +struct parameter : public base_element +{ + std::string type; + std::string default_value; // for template parameters + std::string fulltype; // post-processed +}; + +struct enumeration_value : public base_element +{ + std::string initializer; +}; + + + +struct markup +{ + std::string value; + markup_order_type order; + markup_type type; + + markup(std::string const& v = "") + : value(v) + , order(markup_any) + , type(markup_default) + { + init(); + } + + markup(markup_order_type o, markup_type t, std::string const& v = "") + : value(v) + , order(o) + , type(t) + { + init(); + } + + void init() + { + boost::trim(value); + boost::replace_all(value, "\\*", "*"); + } +}; + +// Base of a class/struct, function, define +struct element : public base_element +{ + std::string detailed_description; + std::string location; + int line; // To sort - Doxygen changes order - we change it back + + // QBK-includes + // Filled with e.g.: \qbk([include reference/myqbk.qbk]} + std::vector qbk_markup; + + // To distinguish overloads: unary, binary etc, + // Filled with: \qbk{distinguish,} + std::string additional_description; + + std::vector template_parameters; + std::vector parameters; + + element() + : line(0) + {} +}; + + +struct function : public element +{ + function_type type; + std::string definition, argsstring; + std::string return_type, return_description; + + bool unique; + + function() + : type(function_unknown) + , unique(true) + {} + +}; + + +struct enumeration : public element +{ + std::vector enumeration_values; +}; + + +struct base_class +{ + std::string name; + std::string derivation; // "prot" element + std::string virtuality; // "virt" element +}; + +struct class_or_struct : public element +{ + bool is_class; // true if class, false if struct + std::string name, fullname; + std::vector functions; + + std::vector typedefs; + std::vector variables; + + std::vector base_classes; +}; + + +struct documentation +{ + // Only one expected (no grouping) + class_or_struct cos; + + // There can be many of them (in groups): + std::vector functions; + std::vector defines; + std::vector enumerations; +}; + + +#endif // DOXYGEN_ELEMENTS_HPP diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp new file mode 100644 index 000000000..c36f85b60 --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -0,0 +1,190 @@ +// doxml2qbk (developed in the context of Boost.Geometry documentation) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Barend Gehrels, Aug 1, 2010 +// In continuation of the QuickBook documentation of Boost.Geometry +// +// Converts XML files created by Doxygen to Quickbook +// Notes: +// - basically generic, but implemented with Boost.Geometry in mind +// - makes use of some specific XML elements, which can be created by Doxygen +// using /xmlonly +// currently this is the element which will make a reference +// to an example. +// - currently still in draft + +// Aug 14/15: added classes, defines, various enhancements. + +#include +#include +#include +#include +#include + +#include +#include +#include + + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + + + +int main(int argc, char** argv) +{ + std::string filename; + try + { + configuration config; + std::string copyright_filename; + + // Read/get configuration + { + namespace po = boost::program_options; + po::options_description description("=== doxml2qbk ===\nAllowed options"); + + + std::string convenience_headers; + + description.add_options() + ("help", "Help message") + ("xml", po::value(&filename), + "Name of XML file written by Doxygen") + ("start_include", po::value(&config.start_include), + "Start include") + ("convenience_header_path", po::value(&config.convenience_header_path), + "Convenience header path") + ("convenience_headers", po::value(&convenience_headers), + "Convenience header(s) (comma-separated)") + ("skip_namespace", po::value(&config.skip_namespace), + "Namespace to skip (e.g. boost::mylib::") + ("copyright", po::value(©right_filename), + "Name of QBK file including (commented) copyright and license") + ; + + po::variables_map varmap; + + if (argc == 2 && ! boost::starts_with(argv[1], "--")) + { + // (especially for debugging) options might go into an INI file + std::ifstream config_file (argv[1], std::ifstream::in); + po::store(po::parse_config_file(config_file, description), varmap); + } + else + { + po::store(po::parse_command_line(argc, argv, description), varmap); + } + + po::notify(varmap); + + if (varmap.count("help") || filename.empty()) + { + std::cout << description << std::endl; + return 1; + } + + // Split CSV with headerfile names into configuration + if (! convenience_headers.empty()) + { + boost::split(config.convenience_headers, convenience_headers, boost::is_any_of(",")); + } + } + + // Read files into strings + std::string xml_string = file_to_string(filename); + std::string license = copyright_filename.empty() + ? "" + : file_to_string(copyright_filename); + + // Parse the XML outputted by Doxygen + xml_doc xml(xml_string.c_str()); + + documentation doc; + parse(xml.first_node(), config, doc); + + // Check for duplicate function names + for (std::size_t i = 0; i < doc.functions.size(); i++) + { + function& f1 = doc.functions[i]; + for (std::size_t j = i + 1; j < doc.functions.size(); j++) + { + function& f2 = doc.functions[j]; + + if (f1.name == f2.name) + { + // It is not a unique function, so e.g. an overload, + // so a description must distinguish them. + // Difference is either the number of parameters, or a const / non-const version + // Use the "\qbk{distinguish,with strategy}" in the source code to distinguish + f1.unique = false; + f2.unique = false; + } + } + } + + + // Write copyright/license (keep inspect silent) + if (! license.empty()) + { + std::cout << license << std::endl; + } + + // Write warning comment + std::cout + << "[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically]" << std::endl + << "[/ Generated from " << filename << "]" << std::endl; + + // Write the rest: functions, defines, classes or structs + BOOST_FOREACH(function const& f, doc.functions) + { + quickbook_output(f, config, std::cout, int()); + } + BOOST_FOREACH(function const& f, doc.defines) + { + quickbook_output(f, config, std::cout, int()); + } + BOOST_FOREACH(enumeration const& e, doc.enumerations) + { + quickbook_output(e, config, std::cout, int()); + } + + if (! doc.cos.name.empty()) + { + std::sort(doc.cos.functions.begin(), doc.cos.functions.end(), sort_on_line()); + quickbook_output(doc.cos, config, std::cout, quickbook_output_cos_alt()); + } + + } + catch(std::exception const& e) + { + std::cerr << "Exception in doxygen_xml2qbk: " << std::endl + << " Message: " << e.what() << std::endl + << " File: " << filename << std::endl + << " Type: " << typeid(e).name() << std::endl + << std::endl; + return 1; + } + catch(...) + { + std::cerr << "Unknown exception in doxygen_xml2qbk" + << std::endl; + return 1; + } + return 0; +} + diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.suo b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.suo new file mode 100644 index 0000000000000000000000000000000000000000..435bb30fea03bbc85f2d0c135c3f5ea0b1a0b00e GIT binary patch literal 22528 zcmca`Uhu)fjZzO8(10BSGsD0CoD6J8;*1Oo3?K{^5@29pVu0X(|Ns97i!m@T{2v8F zDg^%i|Nozbfq_Aufq{XQfdL%f> z{0s~X0t^fcf(#4{!VC-yLJSNHq6`cSA`A=+Vhjun5)2Fs;tUK7k_-$C(hLj?QVa|X zG7Jn1atsU%vJ4Ci3JeSknhXpKpmd|iz`&ryz`&r)z`&rwz`&r&z`&r!z`&r+z`&rv zz`&pdRR>Z#qylz`I5vnOpCO;2gh7G9l_8IzgrSI`5|)*TqQw|k;dveuhj=w9PM6hr zdzO)zfq|jH2%<88p@<=$A&bG2A&()AA)mpOp#ma7Bq_$g1h*d)>p5`Al80R84AjCAOncAKZL=J!I#0AA(5egp%|nMj?EaD7(sawlz)k}A5?C`><8s5 zbPOuo=LXEQJ`%u_QA; zFCZ~FJ25>~MQ!7LA zvs3eIlMIa0Ow-KM3=LCE4HAtL*};~92?hoRmQvr$T&>vGYLXKd5~Hl7*G5sSL>sB@8YMsSL#onGER+d0{;W&)LdAk~;yi-Cy| zlmkFzFtPT7+Ig@Bd$C?XW?o)mQch|}W{FrCtCir52Z@<|U_U z`(%O`sYRf46I_yClnP4c+=%`FrqhTL0VQHkIqt$>#Sp`g!;s04#1O-f0*;AFhI9r{ zSj00_Fyu1iFc>iuG9)o%Gl0rbnBlN+gz?FxLFRzULuar%AgMB)p@<=oA(ugc!Hpr4 zAqSi`6&N%aDi|yn%osEoVimpEC(8mp+G?v6r%8(8Y z>mr75aQh~iA%g*w6A6c=0vYWuPv?732u|(D}yu` zm>59m2h|-DiCc=EY>rC><8Hk>YIURY--TOKx+L!*_VNVAqE`Z zISjcBY2XwHONlT(0|UKNBrX?$+TA$=l1I>81WJ|33^@#-e4Pq*5qb!d#)n1)iY7|L zPz)l#!JYmp8FIljBB<4g+YmJ}@;`F@i*CO!Ln=cqLq5148V=6?pt_(OXD-ws!+y{h z1+3ADZa?<&2iYa4VPV3+#0VPa0OdUpMwP|R1C5Ws@;|7&0re+~81le11}OhSY8puS zpTz)a896iLgUdoteOQ7N8le6s$X-yN3PfYK5mmIFfq}saRPiE@=bO|Z zIN2>TC$-qF#>FZoCo?G~CBLFFJvA@BA~(mVFey8xurxC{J1IXuJ3ha(q@c7!FQcHK zrl#7(z}3*v)Y(ke$=K9V*TmJtP}kDQ%s|)J*v!<@$jI5q(a5Nl0@tKqcMZ&SsX3{+ zsd**Eq`0P!>R|(OO+{`_d_iJSacU7M?wJmAkA6h^s1XXTe{tIn>x;O6>nKo988cbxk&*wA%O6lZ3o6NB zwLK)CrGfh(p!ye7>wwyBd6-s%MRXXL7(rtqps`S5{SO-Nd;khCQ2(1Di6M)@mjTq) zgxC!#4L~Dt#SCE#pb-qPH8=@S{{uAE0xHvpwO@yUfuRX%qKl(}n~ScCv6Hi|iJ7Ib zuA{MqrLK#yqm!GXi=m~Fp-F8GQep#TOue$?ih`p2EL`~(U3oIzYzqoEUxreK9B?WF zwU!gXZQ@dJuL#t#&SGF-uw?-C85tO?89-w^)eII4h73*&E)0$g1`KWtE)2R1E)2#D zP7KZrx(p@^W(<}L#tga)jts^O7T_^GkgOwv6N4LrBZCWrA%i7@5rZLv2}3P|9zzO4 zIk=UMu-Bgf)cQlV6*Rhs-EEN48Kjm2JZ?=*w^=jTgGX+t>DwTNRB%rQ)ay@WsDb8p zV+JDzJ%%&}CvZ*!wf>zLau`74QHYSYrMg=XbuTIIfTRFN1|tSH23H1i1``HX21D?; zEr<<@ci6ZsC=(PPBU%{ZVb*0#tgv>D%^h^wR;bGY`nGVyztU+ zejf(DlTtZfc?`h}IShFWZVdV0yax&e z+S{MUfIhmS$56(Q%uvBl0G*kE%=yMKke|kgu>%sC3}8D!bs=QjB_CW8L+W4bVZq42 z!1Z^*-o`zbC%Y}~yuA9?#YwQC1%`(u{}wrKzaY3yiebS?{{M$zcA(R^^rNf8#s@W{ zK^QbYj?riK~Db*O@;@ZMg)kH`l!C{hVe^4S z47uPs36cgtI#96zh4~LO4yS;Y>rrjM&l6){Vg$uMXl{$x^2d|`l+GdM`ZJU=lz_)Q z^T55`bfl8cg&~sxG`9m$iJeqoU}6N>3z|y<(b!d?ikdSpFzA2=fxz=gsnA*9c(DDT zQm_I#0t*_E^a787g4)BNUMZ+-0L`|6T5Ws4sZNE#2|Rk94UVTGhHQpn1_g#NaD8jY z02=EAjm)9ikIaiW4;qa_79ov2(DP3r)GZd1844H*7;+W7rzzBZmZ^43HFUaoJ|9%U zf+80gLxbraBdPA59;%w#~!4WOSs;JTF)RuM*g#euI&Js0h?!n%|8V*WPsZM zCE#8u@<<0rH6{kNKd=M~ra~kUE9m+bkdPaLBZDi00k{?E3~omnGZ-)!GPuF#|BVUF z|C7A_z#24Z2eKSI*G!E4c<28~wjVV14Vv!&IRRh!18S4u&%K~EJEX6_0QDq5^U}oF z4=Qay>TqFD`3D+G0IeGWr2|~*ki|j0Di%Q% zba`xi7X}7~S5OJU;SZYKfGWm9fyVzqYbZc#B8au$1GI(%>VL?JAJnoRQHI2TXNB^? zqeBptF$}2;72p*xpqUX!tz66ygHm^Z=CnYwIH0j{(2O2vE*I3hjsef@fabzLvz$fX zxjsJu(xIc~UjwzjjZ#Rkw=2gsku7)!7aEp&v! z@)Hs&vo3#$L1s*PnAJkTc>BB~Y><8Hk!`RfI zi-j{VFg$_^67oN2EgMuRRtgmUpmnmKHM1Z$U{!=B7>!i_z)E98{z(JpFj%hHnD~AE zWab8)GcVE_Nt8#*@T-Fzm`7SZxOj!Fd|-ifZ!@zFO1!Dc@9Wx&n2| z9atdm88YDq>cMKUTeX^;p*igk3YJp?-wu$wWbJZp9Zb22l*WtWB30l3ge$p`2!lOz-}`{ z6jc6!*66}q3K7Lm#xpQ5e1Iw;WIuG69jY3W0+oL-yFoOj3QUn?&>C2%Fd_R5!K;g* zim_0j_BW`E2F*CRwEd4g{g*O;Mz}z$ z7(i__5Dgk-0JYR$xnTO#JyVrjoR@8sl4`l;w{t3JUKtdo$QbHuICX=<^iRL`7iiTG z$j3$C6}F(&u8`gnuFwciFb(6^TEObM!Qp$0S>iG5p;18D@DDccgQkZ-Lw}&6Dw_e+ zIfE>_)MF@MsASk3HZRotf>WGoaWg6P%iLD!=m3)rmc`s`_nqfUa?^`}SNFEC;5eQ5sSJAH)wG1mA5iIr+ZUkn4^%>d_GJ(o^`NyB z%b-RQwjX~B9ArPpUKoZNi!B5XhY9tg;O(Eb!yjSVuB5H4Y0V1Sjs5#W{0 z0St)@pjntiaC(HSKY)}D*k`>EHh}71kl#UT%0M(i1~&_|!zu>a|H)=Z%@3ASo}}os z@#5=qP61omK>9!?A!CpjcAQ7M@(0`0!<^DXPJs)Lm^UOH{P2m53R|gfDu+_7W5(qT51zI-_8odCG-+<k_a`s+nHGBQ-A8lS7$hhV zU>JwD;liL~0O~uNLs#J?<>wcd#2dz&8pRvLKsf2C`MIejMV0ZHc`2zCF)8`UF(4<60hH$OsfEcQum6C}{}e-4BDsTC0DxA1A-e>o6O-0}&VPdJ24PGUm?HS>2dxJL z)%3*K4%(|s`uqp7{gC-L(A+9$1O~MCs06$cE{`D{X_YUgA7CP&{ZF9%m7w*+#QMJu zy005#Mk91BU^A#s^#A|=Rt5$JP!-V5z`)SKz`)SSz`)SOz`)SWz`)SMz`)SU0ND}H z&%nSifq{WxA_D`%B&gmgP}OzLIKaTbaFBt4;Sd7@188vwC|-_2 z{cs#gpM=t&upN#Vl=3iVU2GUYD{nw+&FvU?8MweR{lxFiLN8???eKU8$k;t(?gCba zQDzgdH6^+&pp*~6D9gqf8Nh2fKr)#Q6s#eK)+A^vVJTYC&cfg_*p`ulf(aQ*FfcMP zFq{OnD4@cMOprq%Tqp=j8mz~Mx(-f391dDR2oVxF09sK9YSmNXa2g~6i1QF6#Nmgb zOUXgvSD7GN;$2YI_z&L31W006aD!GEIfC~X zXEKyAq%t@&q%nZT;cOW=z~`G_UyBS{se#`Ch*A-KYyq+A4$?XUwfqN5&jE5~OBhwk zb=a<4JqF0)CCGZw7^;|!z0QD~LURVq2HfF~EQ1~c)SbCcWXNH_oVg}E@(DS6=fRNi z5wUaesB?*s6NMtse2Kla083TG_l6TLBv3Cw6WLv}2cnfz*;16#B@c zOOTypn7u~^@M&>HGzdMA3qbLYeQFAFLft+Z*o#P^w2t$2l)il02jz`y`H0|BIpu>JT4 z=gIN^2_*l6+(0Qtj#N_3A~F3FJKz?d_&Cq;eZ`v<8nFxJ3OfIUO%G7wR8qY*s-B1t F004{K<6-~+ literal 0 HcmV?d00001 diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp new file mode 100644 index 000000000..f5d4ce02f --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -0,0 +1,596 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +#ifndef DOXYGEN_XML_PARSER_HPP +#define DOXYGEN_XML_PARSER_HPP + + +#include +#include + +#include + +#include +#include +#include +#include + + +inline std::string keep_after(std::string const& input, std::string const& sig) +{ + std::size_t pos = input.rfind(sig); + if (pos != std::string::npos) + { + std::string copy = input.substr(pos + sig.length()); + return copy; + } + return input; +} + + +static inline void add_or_set(std::vector& parameters, parameter const& p) +{ + std::vector::iterator it = std::find_if(parameters.begin(), parameters.end(), par_by_name(p.name)); + if (it != parameters.end()) + { + if (it->brief_description.empty()) it->brief_description = p.brief_description; + if (it->type.empty()) it->type = p.type; + if (it->fulltype.empty()) it->fulltype = p.fulltype; + if (it->default_value.empty()) it->default_value = p.default_value; + } + else + { + parameters.push_back(p); + } +} + + + + +/// Parses a "para" element +/* +This is used for different purposes within Doxygen. +- Either a detailed description, possibly containing several sections (para's) + -> so parse next siblings +- Or a detailed description also containing qbk records + +So we have to list explicitly either where to recurse, or where not to... + +*/ +static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& skip, bool first = true) +{ + if (node != NULL) + { + if (node->type() == rapidxml::node_element) + { + //std::cout << "ELEMENT: " << node->name() << "=" << node->value() << std::endl; + std::string name = node->name(); + if (boost::equals(name, "qbk.skip")) + { + skip = true; + return; + } + else if (! ( + (boost::equals(name, "para") && first) + || boost::equals(name, "ref") + || boost::equals(name, "defval") + || boost::equals(name, "verbatim") + || boost::equals(name, "bold") + || boost::equals(name, "emphasis") + || boost::equals(name, "linebreak") + )) + { + return; + } + } + else if (node->type() == rapidxml::node_data) + { + contents += node->value(); + //std::cout << "DATA: " << node->name() << "=" << node->value() << std::endl; + } + else + { + //std::cout << "OTHER: " << node->name() << "=" << node->value() << std::endl; + } + parse_para(node->first_node(), contents, skip, false); + parse_para(node->next_sibling(), contents, skip, false); + } +} + + +static void parse_parameter(rapidxml::xml_node<>* node, parameter& p) +{ + // #define: Point + // template: typenameCoordinateTypeCoordinateType + // template with default: typenameCoordinateSystemCoordinateSystemcs::cartesian + // with enum: closure_selector + if (node != NULL) + { + std::string name = node->name(); + if (name == "type") + { + get_contents(node->first_node(), p.fulltype); + p.type = p.fulltype; + boost::replace_all(p.type, " const", ""); + boost::trim(p.type); + boost::replace_all(p.type, "&", ""); + boost::replace_all(p.type, "*", ""); + boost::trim(p.type); + } + else if (name == "declname") p.name = node->value(); + else if (name == "parametername") p.name = node->value(); + else if (name == "defname") p.name = node->value(); + else if (name == "defval") + { + parse_para(node, p.default_value, p.skip); + } + else if (name == "para") + { + parse_para(node, p.brief_description, p.skip); + } + + parse_parameter(node->first_node(), p); + parse_parameter(node->next_sibling(), p); + } +} + +static void parse_enumeration_value(rapidxml::xml_node<>* node, enumeration_value& value) +{ + // green 2 + // ... + // ... + // + if (node != NULL) + { + std::string node_name = node->name(); + + if (node_name == "name") value.name = node->value(); + else if (node_name == "para") + { + // Parses both brief AND detailed into this description + parse_para(node, value.brief_description, value.skip); + } + else if (node_name == "initializer") + { + value.initializer = node->value(); + } + + parse_enumeration_value(node->first_node(), value); + parse_enumeration_value(node->next_sibling(), value); + } +} + +// Definition is a function or a class/struct +template +static void parse_parameter_list(rapidxml::xml_node<>* node, Parameters& parameters) +{ + if (node != NULL) + { + std::string name = node->name(); + + if (name == "parameteritem") + { + parameter p; + parse_parameter(node->first_node(), p); + if (! p.name.empty()) + { + // Copy its description + std::vector::iterator it = std::find_if(parameters.begin(), + parameters.end(), par_by_name(p.name)); + if (it != parameters.end()) + { + it->brief_description = p.brief_description; + } + else + { + parameters.push_back(p); + } + } + } + else if (name == "param") + { + // Element of 'templateparamlist.param (.type,.declname,.defname)' + parameter p; + parse_parameter(node->first_node(), p); + + // Doxygen handles templateparamlist param's differently: + // + // Case 1: + // typename T + // -> no name, assign type to name, replace typename + // + // Case 2: + // typenameTT + // -> set full type + if (p.name.empty()) + { + // Case 1 + p.name = p.type; + boost::replace_all(p.name, "typename", ""); + boost::trim(p.name); + } + else + { + // Case 2 + p.fulltype = p.type + " " + p.name; + } + + add_or_set(parameters, p); + } + + parse_parameter_list(node->first_node(), parameters); + parse_parameter_list(node->next_sibling(), parameters); + } +} + +static void copy_string_property(std::string const& source, std::string& target) +{ + if (target.empty()) + { + target = source; + } +} + + +template +static void copy_parameter_properties(parameter const& source, Parameters& target) +{ + BOOST_FOREACH(parameter& t, target) + { + if (source.name == t.name) + { + t.skip = source.skip; + copy_string_property(source.brief_description, t.brief_description); + copy_string_property(source.type, t.type); + copy_string_property(source.default_value, t.default_value); + copy_string_property(source.fulltype, t.fulltype); + + return; + } + } + // If not found, write a warning + std::cerr << "Parameter not found: " << source.name << std::endl; +} + + +template +static void copy_parameters_properties(Parameters const& source, Parameters& target) +{ + BOOST_FOREACH(parameter const& s, source) + { + copy_parameter_properties(s, target); + } +} + + + +template +static void parse_element(rapidxml::xml_node<>* node, configuration const& config, std::string const& parent, Element& el) +{ + if (node != NULL) + { + std::string name = node->name(); + std::string full = parent + "." + name; + + if (full == ".briefdescription.para") + { + parse_para(node, el.brief_description, el.skip); + } + else if (full == ".detaileddescription.para") + { + std::string para; + parse_para(node, para, el.skip); + if (!para.empty() && !el.detailed_description.empty()) + { + el.detailed_description += "\n\n"; + } + el.detailed_description += para; + } + else if (full == ".location") + { + std::string loc = get_attribute(node, "file"); + // Location of (header)file. It is a FULL path, so find the start + // and strip the rest + std::size_t pos = loc.rfind(config.start_include); + if (pos != std::string::npos) + { + loc = loc.substr(pos); + } + el.location = loc; + el.line = atol(get_attribute(node, "line").c_str()); + } + else if (full == ".detaileddescription.para.qbk") + { + el.qbk_markup.push_back(markup(node->value())); + } + else if (full == ".detaileddescription.para.qbk.after.synopsis") + { + el.qbk_markup.push_back(markup(markup_after, markup_synopsis, node->value())); + } + else if (full == ".detaileddescription.para.qbk.before.synopsis") + { + el.qbk_markup.push_back(markup(markup_before, markup_synopsis, node->value())); + } + else if (full == ".detaileddescription.para.qbk.distinguish") + { + el.additional_description = node->value(); + boost::trim(el.additional_description); + } + else if (full == ".templateparamlist") + { + parse_parameter_list(node->first_node(), el.template_parameters); + } + else if (full == ".detaileddescription.para.parameterlist") + { + std::string kind = get_attribute(node, "kind"); + if (kind == "param") + { + // Parse parameters and their descriptions. + // NOTE: they are listed here, but the order might not be the order in the function call + std::vector parameters; + parse_parameter_list(node->first_node(), parameters); + copy_parameters_properties(parameters, el.parameters); + } + else if (kind == "templateparam") + { + parse_parameter_list(node->first_node(), el.template_parameters); + } + } + else if (full == ".param") + { + // Parse one parameter, and add it to el.parameters + parameter p; + parse_parameter(node->first_node(), p); + el.parameters.push_back(p); + } + + + parse_element(node->first_node(), config, full, el); + parse_element(node->next_sibling(), config, parent, el); + } +} + +static void parse_function(rapidxml::xml_node<>* node, configuration const& config, std::string const& parent, function& f) +{ + if (node != NULL) + { + std::string name = node->name(); + std::string full = parent + "." + name; + + if (full == ".name") f.name = node->value(); + else if (full == ".argsstring") f.argsstring = node->value(); + else if (full == ".definition") + { + f.definition = node->value(); + if (! config.skip_namespace.empty()) + { + boost::replace_all(f.definition, config.skip_namespace, ""); + } + } + else if (full == ".param") + { + parameter p; + parse_parameter(node->first_node(), p); + add_or_set(f.parameters, p); + } + else if (full == ".type") + { + get_contents(node->first_node(), f.return_type); + } + else if (full == ".detaileddescription.para.simplesect") + { + std::string kind = get_attribute(node, "kind"); + if (kind == "return") + { + get_contents(node->first_node(), f.return_description); + } + /*else if (kind == "param") + { + get_contents(node->first_node(), f.paragraphs); + }*/ + } + else if (full == ".detaileddescription.para.image") + { + } + + parse_function(node->first_node(), config, full, f); + parse_function(node->next_sibling(), config, parent, f); + } +} + +static void parse_enumeration(rapidxml::xml_node<>* node, configuration const& config, std::string const& parent, enumeration& e) +{ + if (node != NULL) + { + std::string name = node->name(); + std::string full = parent + "." + name; + + if (full == ".name") e.name = node->value(); + else if (full == ".enumvalue") + { + enumeration_value value; + parse_enumeration_value(node->first_node(), value); + e.enumeration_values.push_back(value); + } + + parse_enumeration(node->first_node(), config, full, e); + parse_enumeration(node->next_sibling(), config, parent, e); + } +} + + +static std::string parse_named_node(rapidxml::xml_node<>* node, std::string const& look_for_name) +{ + if (node != NULL) + { + std::string node_name = node->name(); + std::string contents; + + if (boost::equals(node_name, look_for_name)) + { + contents = node->value(); + } + + return contents + + parse_named_node(node->first_node(), look_for_name) + + parse_named_node(node->next_sibling(), look_for_name); + } + return ""; +} + + + + +static void parse(rapidxml::xml_node<>* node, configuration const& config, documentation& doc, bool member = false) +{ + if (node != NULL) + { + bool recurse = false; + bool is_member = member; + + std::string nodename = node->name(); + + if (nodename == "doxygen") + { + recurse = true; + } + else if (nodename == "sectiondef") + { + std::string kind = get_attribute(node, "kind"); + + if (kind == "func" + || kind == "define" + || kind == "enum" + ) + { + recurse = true; + } + else if (boost::starts_with(kind, "public")) + { + recurse = true; + is_member = true; + } + } + else if (nodename == "compounddef") + { + std::string kind = get_attribute(node, "kind"); + if (kind == "group") + { + recurse = true; + } + else if (kind == "struct") + { + recurse = true; + doc.cos.is_class = false; + parse_element(node->first_node(), config, "", doc.cos); + } + else if (kind == "class") + { + recurse = true; + doc.cos.is_class = true; + parse_element(node->first_node(), config, "", doc.cos); + } + } + else if (nodename == "memberdef") + { + std::string kind = get_attribute(node, "kind"); + if (kind == "function") + { + function f; + parse_element(node->first_node(), config, "", f); + parse_function(node->first_node(), config, "", f); + if (member) + { + bool c_or_d = boost::equals(f.name, doc.cos.name) || + boost::equals(f.name, std::string("~") + doc.cos.name); + + f.type = c_or_d + ? function_constructor_destructor + : function_member; + doc.cos.functions.push_back(f); + } + else + { + f.type = function_free; + doc.functions.push_back(f); + } + } + else if (kind == "define") + { + function f; + f.type = function_define; + parse_element(node->first_node(), config, "", f); + parse_function(node->first_node(), config, "", f); + doc.functions.push_back(f); + } + else if (kind == "enum") + { + enumeration e; + parse_element(node->first_node(), config, "", e); + parse_enumeration(node->first_node(), config, "", e); + doc.enumerations.push_back(e); + } + else if (kind == "typedef") + { + if (boost::equals(get_attribute(node, "prot"), "public")) + { + std::string name = parse_named_node(node->first_node(), "name"); + doc.cos.typedefs.push_back(base_element(name)); + element dummy; + parse_element(node->first_node(), config, "", dummy); + doc.cos.typedefs.back().brief_description = dummy.brief_description; + } + } + else if (kind == "variable") + { + if (boost::equals(get_attribute(node, "static"), "yes") + && boost::equals(get_attribute(node, "mutable"), "no") + && boost::equals(get_attribute(node, "prot"), "public")) + { + std::string name = parse_named_node(node->first_node(), "name"); + doc.cos.variables.push_back(base_element(name)); + } + } + + } + else if (nodename == "compoundname") + { + std::string name = node->value(); + if (name.find("::") != std::string::npos) + { + doc.cos.fullname = name; + + // For a class, it should have "boost::something::" before + // set its name without namespace + doc.cos.name = keep_after(name, "::"); + } + } + else if (nodename == "basecompoundref") + { + base_class bc; + bc.name = node->value(); + bc.derivation = get_attribute(node, "prot"); + bc.virtuality = get_attribute(node, "virt"); + doc.cos.base_classes.push_back(bc); + } + else + { + //std::cout << nodename << " ignored." << std::endl; + } + + + if (recurse) + { + // First recurse into childnodes, then handle next siblings + parse(node->first_node(), config, doc, is_member); + } + parse(node->next_sibling(), config, doc, is_member); + } +} + +#endif // DOXYGEN_XML_PARSER_HPP diff --git a/doc/src/tools/doxygen_xml2qbk/file_to_string.hpp b/doc/src/tools/doxygen_xml2qbk/file_to_string.hpp new file mode 100644 index 000000000..e889fc75f --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/file_to_string.hpp @@ -0,0 +1,35 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +#ifndef FILE_TO_STRING_HPP +#define FILE_TO_STRING_HPP + + +#include +#include + + +inline std::string file_to_string(std::string const& filename) +{ + std::string result; + + std::ifstream cpp_file(filename.c_str()); + if (cpp_file.is_open()) + { + while (! cpp_file.eof() ) + { + std::string line; + std::getline(cpp_file, line); + result += line + "\n"; + } + } + return result; +} + + +#endif // FILE_TO_STRING_HPP diff --git a/doc/src/tools/doxygen_xml2qbk/parameter_predicates.hpp b/doc/src/tools/doxygen_xml2qbk/parameter_predicates.hpp new file mode 100644 index 000000000..8cbb55e74 --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/parameter_predicates.hpp @@ -0,0 +1,60 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +#ifndef PARAMETER_PREDICATES_HPP +#define PARAMETER_PREDICATES_HPP + + +#include + +#include + + +// Predicate for std::find_if +struct par_by_name +{ + par_by_name(std::string const& n) + : m_name(n) + {} + + inline bool operator()(parameter const& p) + { + return p.name == m_name; + } +private : + std::string m_name; +}; + + +// Predicate for std::find_if +struct par_by_type +{ + par_by_type(std::string const& n) + : m_type(n) + {} + + inline bool operator()(parameter const& p) + { + return p.type == m_type; + } +private : + std::string m_type; +}; + + +template +struct sort_on_line +{ + inline bool operator()(Element const& left, Element const& right) + { + return left.line < right.line; + } +}; + + +#endif // PARAMETER_PREDICATES_HPP diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp new file mode 100644 index 000000000..e7f2a9dc5 --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -0,0 +1,899 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +#ifndef QUICKBOOK_OUTPUT_HPP +#define QUICKBOOK_OUTPUT_HPP + + +#include +#include + +#include + +#include +#include + +std::string qbk_escaped(std::string const& s) +{ + // Replace _ by unicode to avoid accidental quickbook underlining. + // 1) do NOT do this in quickbook markup, so not within [] + // (e.g. to avoid [include get_point.qbk] having unicoded) + // 2) \[ and \] should not count as [] + std::size_t const len = s.length(); + int counter = 0; + std::string result = ""; + for (std::size_t i = 0; i < len; i++) + { + switch(s[i]) + { + case '[' : counter++; break; + case ']' : counter--; break; + case '\\' : + { + result += s[i]; + if (i + 1 < len) + { + result += s[i + 1]; + } + i++; + continue; + } + case '_' : + if (counter == 0) + { + result += "\\u005f"; + continue; + } + } + result += s[i]; + } + + return result; +} + + + +void quickbook_template_parameter_list(std::vector const& parameters, std::ostream& out, bool multiline = false, bool show_defaults = false) +{ + std::string next_param; + if ( multiline ) + { + if ( 2 < parameters.size() ) + next_param = std::string(",\n") + " "; + else + next_param = ", "; + } + else + next_param = ", "; + + + if (!parameters.empty()) + { + out << "template<" ; + bool first = true; + BOOST_FOREACH(parameter const& p, parameters) + { + out << (first ? "" : next_param.c_str()) << p.fulltype; + + if ( show_defaults && !p.default_value.empty() ) + out << " = " << p.default_value; + + first = false; + } + out << ">" << std::endl; + } +} + + +void quickbook_synopsis(function const& f, std::ostream& out, bool multiline = false, bool show_defaults = false) +{ + out << "``"; + quickbook_template_parameter_list(f.template_parameters, out, multiline, show_defaults); + + unsigned offset = 1; // '(' + switch(f.type) + { + case function_constructor_destructor : + out << f.name; + offset += f.name.size(); + break; + case function_member : + out << f.return_type << " " << f.name; + offset += f.return_type.size() + 1 + f.name.size(); + break; + case function_free : + out << f.definition; + offset += f.definition.size(); + break; + case function_define : + out << "#define " << f.name; + offset += 8 + f.name.size(); + break; + case function_unknown : + // do nothing + break; + } + + std::string after_parameter(", "); + if ( multiline && 2 < f.parameters.size() ) + after_parameter = std::string(",\n") + std::string(offset, ' '); + + // Output the parameters + // Because we want to be able to skip, we cannot use the argstring + { + bool first = true; + BOOST_FOREACH(parameter const& p, f.parameters) + { + if (! p.skip) + { + out + << (first ? "(" : after_parameter) + << p.fulltype << (p.fulltype.empty() ? "" : " ") + << p.name + << (p.default_value.empty() ? "" : " = ") + << p.default_value; + first = false; + } + } + if (! first) + { + out << ")"; + } + else if (f.type != function_define) + { + out << "()"; + } + } + + out << "``" + << std::endl + << std::endl; +} + + +void quickbook_synopsis(enumeration const& e, std::ostream& out) +{ + out << "``enum " << e.name; + bool first = true; + BOOST_FOREACH(enumeration_value const& value, e.enumeration_values) + { + out << (first ? " {" : ", ") << value.name; + if (! value.initializer.empty()) + { + out << " = " << boost::trim_copy(value.initializer); + } + first = false; + } + if (! first) + { + out << "};"; + } + out << "``" + << std::endl + << std::endl; +} + +inline bool includes(std::string const& filename, std::string const& header) +{ + std::string result; + + std::ifstream cpp_file(filename.c_str()); + if (cpp_file.is_open()) + { + while (! cpp_file.eof() ) + { + std::string line; + std::getline(cpp_file, line); + boost::trim(line); + if (boost::starts_with(line, "#include") + && boost::contains(line, header)) + { + return true; + } + } + } + return false; +} + + +void quickbook_header(std::string const& location, + configuration const& config, + std::ostream& out) +{ + if (! location.empty()) + { + std::vector including_headers; + + // Select headerfiles containing to this location + BOOST_FOREACH(std::string const& header, config.convenience_headers) + { + if (includes(config.convenience_header_path + header, location)) + { + including_headers.push_back(header); + } + } + + out << "[heading Header]" << std::endl; + if (! including_headers.empty()) + { + out << "Either" + << (including_headers.size() > 1 ? " one of" : "") + << std::endl << std::endl; + BOOST_FOREACH(std::string const& header, including_headers) + { + out << "`#include <" << config.start_include << header << ">`" << std::endl; + } + + out << std::endl << "Or" << std::endl << std::endl; + } + out << "`#include <" << location << ">`" << std::endl; + out << std::endl; + } +} + + +void quickbook_markup(std::vector const& qbk_markup, + markup_order_type order, markup_type type, + std::ostream& out) +{ + bool has_output = false; + BOOST_FOREACH(markup const& inc, qbk_markup) + { + if (inc.type == type && inc.order == order) + { + out << inc.value << std::endl; + has_output = true; + } + } + if (has_output) + { + out << std::endl; + } +} + + + +void quickbook_string_with_heading_if_present(std::string const& heading, + std::string const& contents, std::ostream& out) +{ + if (! contents.empty()) + { + out << "[heading " << heading << "]" << std::endl + << qbk_escaped(contents) << std::endl + << std::endl; + } +} + +inline std::string to_section_name(std::string const& name) +{ + // Make section-name lowercase and remove :: because these are filenames + return boost::to_lower_copy(boost::replace_all_copy(name, "::", "_")); +} + + + +void quickbook_short_output(function const& f, std::ostream& out) +{ + BOOST_FOREACH(parameter const& p, f.parameters) + { + if (! p.skip) + { + out << "[* " << p.fulltype << "]: ['" << p.name << "]: " << p.brief_description << std::endl << std::endl; + } + } + out << std::endl; + out << std::endl; + + if (! f.return_description.empty()) + { + out << "][" << std::endl; + out << f.return_description << std::endl; + out << std::endl; + } + + out << std::endl; +} + +inline std::string namespace_skipped(std::string const& name, configuration const& config) +{ + return config.skip_namespace.empty() + ? name + : boost::replace_all_copy(name, config.skip_namespace, "") + ; +} + +inline std::string output_if_different(std::string const& s, std::string const& s2) +{ + return boost::equals(s, s2) + ? "" + : s + " " + ; +} + +inline void quickbook_output_indexterm(std::string const& term, std::ostream& out + //, std::string const& secondary = "" + ) +{ + out << "'''"; + if (boost::contains(term, "::")) + { + // "Unnamespace" it and add all terms (also namespaces) + std::vector splitted; + std::string for_split = boost::replace_all_copy(term, "::", ":"); + boost::split(splitted, for_split, boost::is_any_of(":"), boost::token_compress_on); + BOOST_FOREACH(std::string const& part, splitted) + { + out << "" << part << ""; + } + } + else + { + out << "" << term; + /*if (! secondary.empty()) + { + out << "" << secondary << ""; + }*/ + out << ""; + } + out << "'''" << std::endl; +} + +template +void quickbook_output(function const& f, configuration const& config, std::ostream& out, Tag const&) +{ + // Write the parsed function + int arity = (int)f.parameters.size(); + + std::string additional_description; + + if (! f.additional_description.empty()) + { + additional_description = " ("; + additional_description += f.additional_description; + additional_description += ")"; + } + + out << "[section:" << to_section_name(f.name); + // Make section name unique if necessary by arity and additional description + if (! f.unique) + { + out << "_" << arity; + if (! f.additional_description.empty()) + { + out << "_" << boost::to_lower_copy(boost::replace_all_copy(f.additional_description, " ", "_")); + } + } + out << " " << f.name + << additional_description + << "]" << std::endl + << std::endl; + + quickbook_output_indexterm(f.name, out); + + out << qbk_escaped(f.brief_description) << std::endl; + out << std::endl; + + quickbook_string_with_heading_if_present("Description", f.detailed_description, out); + + // Synopsis + quickbook_markup(f.qbk_markup, markup_before, markup_synopsis, out); + out << "[heading Synopsis]" << std::endl; + quickbook_synopsis(f, out); + quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out); + + + out << "[heading Parameters]" << std::endl + << std::endl; + + out << "[table" << std::endl << "["; + if (f.type != function_define) + { + out << "[Type] [Concept] "; + } + out << "[Name] [Description] ]" << std::endl; + + // First: output any template parameter which is NOT used in the normal parameter list + BOOST_FOREACH(parameter const& tp, f.template_parameters) + { + if (! tp.skip) + { + std::vector::const_iterator it = std::find_if(f.parameters.begin(), f.parameters.end(), par_by_type(tp.name)); + + if (it == f.parameters.end()) + { + out << "[[" << tp.name << "] [" << tp.brief_description << "] [ - ] [Must be specified]]" << std::endl; + } + } + } + + BOOST_FOREACH(parameter const& p, f.parameters) + { + if (! p.skip) + { + out << "["; + std::vector::const_iterator it = std::find_if(f.template_parameters.begin(), + f.template_parameters.end(), par_by_name(p.type)); + + if (f.type != function_define) + { + out << "[" << p.fulltype + << "] [" << (it == f.template_parameters.end() ? "" : it->brief_description) + << "] "; + } + out << "[" << p.name + << "] [" << p.brief_description + << "]]" + << std::endl; + } + } + out << "]" << std::endl + << std::endl + << std::endl; + + quickbook_string_with_heading_if_present("Returns", f.return_description, out); + + quickbook_header(f.location, config, out); + quickbook_markup(f.qbk_markup, markup_any, markup_default, out); + + out << std::endl; + out << "[endsect]" << std::endl; + out << std::endl; +} + +template +void quickbook_output(enumeration const& e, configuration const& config, std::ostream& out, Tag const&) +{ + out << "[section:" << to_section_name(e.name); + out << " " << e.name + << "]" << std::endl + << std::endl; + + quickbook_output_indexterm(e.name, out); + BOOST_FOREACH(enumeration_value const& value, e.enumeration_values) + { + quickbook_output_indexterm(value.name, out); + } + + out << e.brief_description << std::endl; + out << std::endl; + + quickbook_string_with_heading_if_present("Description", e.detailed_description, out); + + // Synopsis + quickbook_markup(e.qbk_markup, markup_before, markup_synopsis, out); + out << "[heading Synopsis]" << std::endl; + quickbook_synopsis(e, out); + quickbook_markup(e.qbk_markup, markup_after, markup_synopsis, out); + + + out << "[heading Values]" << std::endl + << std::endl; + + out << "[table" << std::endl << "["; + out << "[Value] [Description] ]" << std::endl; + + BOOST_FOREACH(enumeration_value const& value, e.enumeration_values) + { + out << "[[" << value.name + << "] [" << value.brief_description + << "]]" + << std::endl; + } + out << "]" << std::endl + << std::endl + << std::endl; + + quickbook_header(e.location, config, out); + quickbook_markup(e.qbk_markup, markup_any, markup_default, out); + + out << std::endl; + out << "[endsect]" << std::endl; + out << std::endl; +} + +void quickbook_output_member(std::vector const& functions, + function_type type, + std::string const& title, + configuration const& config, std::ostream& out) +{ + std::string returns = type == function_constructor_destructor ? "" : " [Returns]"; + out << "[heading " << title << "(s)]" << std::endl + << "[table" << std::endl + << "[[Function] [Description] [Parameters] " << returns << "]" << std::endl; + + BOOST_FOREACH(function const& f, functions) + { + if (f.type == type) + { + out << "[["; + quickbook_synopsis(f, out); + out << "] [" << f.brief_description << "] ["; + quickbook_short_output(f, out); + out << "]]" << std::endl; + } + } + out << "]" << std::endl + << std::endl; +} + +template +void quickbook_output(class_or_struct const& cos, configuration const& config, std::ostream& out, Tag const&) +{ + // Skip namespace + std::string short_name = namespace_skipped(cos.fullname, config); + + // Write the parsed function + out << "[section:" << to_section_name(short_name) << " " << short_name << "]" << std::endl + << std::endl; + + quickbook_output_indexterm(short_name, out); + + out << cos.brief_description << std::endl; + out << std::endl; + + quickbook_string_with_heading_if_present("Description", cos.detailed_description, out); + + quickbook_markup(cos.qbk_markup, markup_before, markup_synopsis, out); + out << "[heading Synopsis]" << std::endl + << "``"; + quickbook_template_parameter_list(cos.template_parameters, out, false); + out << (cos.is_class ? "class" : "struct") + << " " << short_name << std::endl; + + if (! cos.base_classes.empty()) + { + out << " : "; + bool first = true; + BOOST_FOREACH(base_class const& bc, cos.base_classes) + { + if (! first) + { + out << std::endl << " , "; + } + out << output_if_different(bc.derivation, "private") + << output_if_different(bc.virtuality, "non-virtual") + << namespace_skipped(bc.name, config); + first = false; + } + out << std::endl; + } + + out << "{" << std::endl + << " // ..." << std::endl + << "};" << std::endl + << "``" << std::endl << std::endl; + quickbook_markup(cos.qbk_markup, markup_after, markup_synopsis, out); + + + + if (! cos.template_parameters.empty()) + { + bool has_default = false; + BOOST_FOREACH(parameter const& p, cos.template_parameters) + { + if (! p.default_value.empty()) + { + has_default = true; + } + } + + out << "[heading Template parameter(s)]" << std::endl + << "[table" << std::endl + << "[[Parameter]"; + if (has_default) + { + out << " [Default]"; + } + out << " [Description]]" << std::endl; + + BOOST_FOREACH(parameter const& p, cos.template_parameters) + { + out << "[[``"; + if ( p.fulltype.find("typename") == 0 ) + out << p.fulltype.substr(8); + else if ( p.fulltype.find("class") == 0 ) + out << p.fulltype.substr(5); + else + out << p.fulltype; + + out << "``]"; + + if (has_default && !p.default_value.empty()) + out << "[``" << p.default_value << "``]"; + else + out << "[]"; + + out << " [" << p.brief_description << "]]" << std::endl; + } + out << "]" << std::endl + << std::endl; + } + + + std::map counts; + BOOST_FOREACH(function const& f, cos.functions) + { + counts[f.type]++; + } + + if (counts[function_constructor] > 0) + { + quickbook_output_member(cos.functions, function_constructor, "Constructor", config, out); + } + + if (counts[function_member] > 0) + { + quickbook_output_member(cos.functions, function_member, "Member Function", config, out); + } + + quickbook_header(cos.location, config, out); + quickbook_markup(cos.qbk_markup, markup_any, markup_default, out); + + out << "[endsect]" << std::endl + << std::endl; +} + + + + + + +void quickbook_synopsis_short(function const& f, std::ostream& out) +{ + switch(f.type) + { + case function_constructor_destructor : + out << f.name; + break; + case function_member : + out << f.name; + break; + case function_free : + out << f.name; + break; + case function_define : + out << "#define " << f.name; + break; + case function_unknown : + // do nothing + break; + } + + // Output the parameters + // Because we want to be able to skip, we cannot use the argstring + { + bool first = true; + BOOST_FOREACH(parameter const& p, f.parameters) + { + if ( !p.skip && p.default_value.empty() ) + { + out << (first ? "(" : ", ") << p.fulltype; + first = false; + } + } + + if (! first) + out << ")"; + else if (f.type != function_define) + out << "()"; + } +} + +void quickbook_output_member(class_or_struct const& cos, + std::vector const& functions, + function_type type, + configuration const& config, std::ostream& out) +{ + out << "[table" << std::endl + << "[[Function][Description]]" << std::endl; + + for ( size_t i = 0 ; i < functions.size() ; ++i ) + { + function const& f = functions[i]; + + if (f.type == type) + { + out << "[[`"; + quickbook_synopsis_short(f, out); + out << "`][" << f.brief_description << "]]" << std::endl; + } + } + out << "]" << std::endl + << std::endl; +} + +void quickbook_output_detail_member(class_or_struct const& cos, + std::vector const& functions, + function_type type, + configuration const& config, std::ostream& out) +{ + for ( size_t i = 0 ; i < functions.size() ; ++i ) + { + function const& f = functions[i]; + if (f.type == type) + { + std::stringstream ss; + quickbook_synopsis_short(f, ss); + + out << "[section " << ss.str() << "]" << std::endl; + + out << "[heading Synopsis]" << std::endl; + quickbook_synopsis(f, out, true, true); + + if ( !f.detailed_description.empty() || !f.brief_description.empty() ) + { + out << "[heading Description]" << std::endl; + if ( !f.detailed_description.empty() ) + out << f.detailed_description; + else + out << f.brief_description; + } + + if ( !f.parameters.empty() ) + { + out << "[heading Parameters]" << std::endl; + out << "[table " << std::endl; + out << "[[Type][Name][Description]]" << std::endl; + BOOST_FOREACH(parameter const& p, f.parameters) + { + if (!p.skip) + { + out << "[[*" << p.fulltype << "*]['" << p.name << "'][" << p.brief_description << "]]"<< std::endl; + } + } + out << "]" << std::endl; + } + + if ( !f.return_description.empty() ) + { + out << "[heading Returns]" << std::endl; + out << f.return_description << std::endl; + } + + out << "[endsect]" << std::endl + << std::endl; + } + } +} + +struct quickbook_output_cos_alt {}; + +void quickbook_output(class_or_struct const& cos, configuration const& config, std::ostream& out, quickbook_output_cos_alt const&) +{ + // Skip namespace + std::string short_name = namespace_skipped(cos.fullname, config); + + // Write the parsed function + out << "[section:" << to_section_name(short_name) << " " << short_name << "]" << std::endl + << std::endl; + + quickbook_output_indexterm(short_name, out); + + // Brief + + out << cos.brief_description << std::endl; + out << std::endl; + + // Description + + quickbook_string_with_heading_if_present("Description", cos.detailed_description, out); + + // Header + + quickbook_header(cos.location, config, out); + + // Class synposis + + quickbook_markup(cos.qbk_markup, markup_before, markup_synopsis, out); + out << "[heading Synopsis]" << std::endl + << "``"; + quickbook_template_parameter_list(cos.template_parameters, out, true, true); + out << (cos.is_class ? "class " : "struct "); + out << short_name.substr(short_name.find_last_of("::") + 1) << std::endl; + + if (! cos.base_classes.empty()) + { + out << " : "; + bool first = true; + BOOST_FOREACH(base_class const& bc, cos.base_classes) + { + if (! first) + { + out << std::endl << " , "; + } + out << output_if_different(bc.derivation, "private") + << output_if_different(bc.virtuality, "non-virtual") + << namespace_skipped(bc.name, config); + first = false; + } + out << std::endl; + } + + out << "{" << std::endl + << " // ..." << std::endl + << "};" << std::endl + << "``" << std::endl << std::endl; + quickbook_markup(cos.qbk_markup, markup_after, markup_synopsis, out); + + // Template parameters + + if (! cos.template_parameters.empty()) + { + out << "[heading Template parameter(s)]" << std::endl + << "[table" << std::endl + << "[[Parameter] [Description]]" << std::endl; + + BOOST_FOREACH(parameter const& p, cos.template_parameters) + { + out << "[[`"; + if ( p.fulltype.find("typename ") == 0 ) + out << p.fulltype.substr(9); + else if ( p.fulltype.find("class ") == 0 ) + out << p.fulltype.substr(6); + else + out << p.fulltype; + out << "`][" << p.brief_description << "]]" << std::endl; + } + out << "]" << std::endl + << std::endl; + } + + // Typedefs + + if ( !cos.typedefs.empty() ) + { + out << "[heading Typedef(s)]" << std::endl + << "[table" << std::endl + << "[[Type]"; + out << " [Description]]" << std::endl; + + BOOST_FOREACH(base_element const& e, cos.typedefs) + { + out << "[[`" << e.name; + out << "`][" << e.brief_description << "]]" << std::endl; + } + out << "]" << std::endl + << std::endl; + } + + // Members + + std::map counts; + BOOST_FOREACH(function const& f, cos.functions) + { + counts[f.type]++; + } + + if (counts[function_constructor_destructor] > 0) + { + out << "[heading Constructor(s) and destructor]" << std::endl; + quickbook_output_member(cos, cos.functions, function_constructor_destructor, config, out); + } + + if (counts[function_member] > 0) + { + out << "[heading Member(s)]" << std::endl; + quickbook_output_member(cos, cos.functions, function_member, config, out); + } + + quickbook_markup(cos.qbk_markup, markup_any, markup_default, out); + + // Details start + + if (counts[function_constructor_destructor] > 0) + quickbook_output_detail_member(cos, cos.functions, function_constructor_destructor, config, out); + if (counts[function_member] > 0) + quickbook_output_detail_member(cos, cos.functions, function_member, config, out); + + // Details end + + out << "[endsect]" << std::endl + << std::endl; +} + +#endif // QUICKBOOK_OUTPUT_HPP diff --git a/doc/src/tools/doxygen_xml2qbk/rapidxml_util.hpp b/doc/src/tools/doxygen_xml2qbk/rapidxml_util.hpp new file mode 100644 index 000000000..6acdaab5b --- /dev/null +++ b/doc/src/tools/doxygen_xml2qbk/rapidxml_util.hpp @@ -0,0 +1,68 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +#ifndef RAPIDXML_UTIL_HPP +#define RAPIDXML_UTIL_HPP + + +#include +#include + +class xml_doc : public rapidxml::xml_document<> +{ + public : + xml_doc(const char* xml) + { + // Make a copy because rapidxml destructs string + m_copy = new char[strlen(xml) + 1]; + strcpy(m_copy, xml); + this->parse<0>(m_copy); + }; + virtual ~xml_doc() + { + delete[] m_copy; + } + private : + char* m_copy; + +}; + +inline std::string get_attribute(rapidxml::xml_node<>* node, const char* name) +{ + rapidxml::xml_attribute<> *attr = node->first_attribute(name); + std::string value; + if (attr) + { + value = attr->value(); + } + return value; +} + +inline void get_contents(rapidxml::xml_node<>* node, std::string& contents) +{ + if (node != NULL) + { + if (node->type() == rapidxml::node_element) + { + //std::cout << "ELEMENT: " << node->name() << "=" << node->value() << std::endl; + } + else if (node->type() == rapidxml::node_data) + { + contents += node->value(); + //std::cout << "DATA: " << node->name() << "=" << node->value() << std::endl; + } + else + { + //std::cout << "OTHER: " << node->name() << "=" << node->value() << std::endl; + } + get_contents(node->first_node(), contents); + get_contents(node->next_sibling(), contents); + } +} + +#endif // RAPIDXML_UTIL_HPP From c9a729ca2559c6f299033005133609b0dd425c35 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 7 Jan 2013 23:39:16 +0000 Subject: [PATCH 254/366] Small error in docs fixed - italics. [SVN r82394] --- doc/html/geometry_index/r_tree/index.html | 86 +++++++++---------- doc/html/index.html | 2 +- .../doxygen_xml2qbk/quickbook_output.hpp | 2 +- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index e547169c6..ad99e5f24 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    @@ -757,7 +757,7 @@ The R-tree spatial index.

    - 'parameters' + parameters

    @@ -774,7 +774,7 @@ The R-tree spatial index.

    - 'translator' + translator

    @@ -791,7 +791,7 @@ The R-tree spatial index.

    - 'allocator' + allocator

    @@ -865,7 +865,7 @@ The R-tree spatial index.

    - 'first' + first

    @@ -882,7 +882,7 @@ The R-tree spatial index.

    - 'last' + last

    @@ -899,7 +899,7 @@ The R-tree spatial index.

    - 'parameters' + parameters

    @@ -916,7 +916,7 @@ The R-tree spatial index.

    - 'translator' + translator

    @@ -933,7 +933,7 @@ The R-tree spatial index.

    - 'allocator' + allocator

    @@ -1006,7 +1006,7 @@ The R-tree spatial index.

    - 'rng' + rng

    @@ -1023,7 +1023,7 @@ The R-tree spatial index.

    - 'parameters' + parameters

    @@ -1040,7 +1040,7 @@ The R-tree spatial index.

    - 'translator' + translator

    @@ -1057,7 +1057,7 @@ The R-tree spatial index.

    - 'allocator' + allocator

    @@ -1147,7 +1147,7 @@ The R-tree spatial index.

    - 'src' + src

    @@ -1216,7 +1216,7 @@ The R-tree spatial index.

    - 'src' + src

    @@ -1233,7 +1233,7 @@ The R-tree spatial index.

    - 'allocator' + allocator

    @@ -1302,7 +1302,7 @@ The R-tree spatial index.

    - 'src' + src

    @@ -1370,7 +1370,7 @@ The R-tree spatial index.

    - 'src' + src

    @@ -1438,7 +1438,7 @@ The R-tree spatial index.

    - 'src' + src

    @@ -1506,7 +1506,7 @@ The R-tree spatial index.

    - 'other' + other

    @@ -1573,7 +1573,7 @@ The R-tree spatial index.

    - 'value' + value

    @@ -1642,7 +1642,7 @@ The R-tree spatial index.

    - 'first' + first

    @@ -1659,7 +1659,7 @@ The R-tree spatial index.

    - 'last' + last

    @@ -1728,7 +1728,7 @@ The R-tree spatial index.

    - 'rng' + rng

    @@ -1796,7 +1796,7 @@ The R-tree spatial index.

    - 'value' + value

    @@ -1875,7 +1875,7 @@ The R-tree spatial index.

    - 'first' + first

    @@ -1892,7 +1892,7 @@ The R-tree spatial index.

    - 'last' + last

    @@ -1970,7 +1970,7 @@ The R-tree spatial index.

    - 'rng' + rng

    @@ -2051,7 +2051,7 @@ The R-tree spatial index.

    - 'pred' + pred

    @@ -2068,7 +2068,7 @@ The R-tree spatial index.

    - 'out_it' + out_it

    @@ -2156,7 +2156,7 @@ The R-tree spatial index.

    - 'dpred' + dpred

    @@ -2173,7 +2173,7 @@ The R-tree spatial index.

    - 'v' + v

    @@ -2270,7 +2270,7 @@ The R-tree spatial index.

    - 'dpred' + dpred

    @@ -2287,7 +2287,7 @@ The R-tree spatial index.

    - 'pred' + pred

    @@ -2304,7 +2304,7 @@ The R-tree spatial index.

    - 'v' + v

    @@ -2393,7 +2393,7 @@ The R-tree spatial index.

    - 'dpred' + dpred

    @@ -2410,7 +2410,7 @@ The R-tree spatial index.

    - 'k' + k

    @@ -2427,7 +2427,7 @@ The R-tree spatial index.

    - 'out_it' + out_it

    @@ -2527,7 +2527,7 @@ The R-tree spatial index.

    - 'dpred' + dpred

    @@ -2544,7 +2544,7 @@ The R-tree spatial index.

    - 'k' + k

    @@ -2561,7 +2561,7 @@ The R-tree spatial index.

    - 'pred' + pred

    @@ -2578,7 +2578,7 @@ The R-tree spatial index.

    - 'out_it' + out_it

    @@ -2763,7 +2763,7 @@ The R-tree spatial index.

    - 'vori' + vori

    diff --git a/doc/html/index.html b/doc/html/index.html index 5aa48c722..46324e866 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@ - +

    Last revised: January 07, 2013 at 23:08:40 GMT

    Last revised: January 07, 2013 at 23:37:04 GMT


    diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index e7f2a9dc5..4581c92b1 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -743,7 +743,7 @@ void quickbook_output_detail_member(class_or_struct const& cos, { if (!p.skip) { - out << "[[*" << p.fulltype << "*]['" << p.name << "'][" << p.brief_description << "]]"<< std::endl; + out << "[[ *" << p.fulltype << "* ][ /" << p.name << "/ ][" << p.brief_description << "]]"<< std::endl; } } out << "]" << std::endl; From 010a58325f779e2d90b2502d066829d60006e8f9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 01:10:10 +0000 Subject: [PATCH 255/366] verbatim font used in methods parameters sections [SVN r82396] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../r_tree/exception_safety.html | 16 +- doc/html/geometry_index/r_tree/index.html | 385 +++++++++--------- .../geometry_index/r_tree/introduction.html | 20 +- .../r_tree/nearest_neighbours_queries.html | 2 +- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../doxygen_xml2qbk/quickbook_output.hpp | 6 +- 11 files changed, 232 insertions(+), 221 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 7c2eedefc..ab7a739c4 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 a79271bfb..300395d3a 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index fd669c9c6..a374ee31d 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 - + @@ -29,7 +29,7 @@

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

                    -
                      +
                      • exception-safe copy constructor and copy assignment of the Value.
                      • @@ -155,7 +155,7 @@

    nothrow or strong - [a] + [a]

    - not safe [b] + not safe [b]

    nothrow or strong - [c] + [c]

    -

    [a] +

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

    -

    [b] +

    [b] If this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

    -

    [c] +

    [c] nothrow - if CoordinateType has nonthrowing copy constructor, strong - otherwise diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index ad99e5f24..c8452c806 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -3,7 +3,7 @@ Reference - + @@ -31,12 +31,12 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    - Description + Description

    The R-tree spatial index. This is self-balancing spatial index capable @@ -64,14 +64,14 @@ The R-tree spatial index.

    - Header + Header

    #include <.hpp>

    - Synopsis + Synopsis

    @@ -88,7 +88,7 @@ The R-tree spatial index.

    - Template + Template parameter(s)
    @@ -162,7 +162,7 @@ The R-tree spatial index.
    - Typedef(s) + Typedef(s)
    @@ -270,7 +270,7 @@ The R-tree spatial index.
    - Constructor(s) + Constructor(s) and destructor
    @@ -385,7 +385,7 @@ The R-tree spatial index.
    - Member(s) + Member(s)
    @@ -705,7 +705,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -716,14 +716,14 @@ The R-tree spatial index.

    - Description + Description

    The constructor.

    - Parameters + Parameters
    @@ -752,12 +752,12 @@ The R-tree spatial index.

    - parameters_type + parameters_type

    - parameters + parameters

    @@ -769,12 +769,12 @@ The R-tree spatial index.

    - translator_type const & + translator_type const &

    - translator + translator

    @@ -786,12 +786,12 @@ The R-tree spatial index.

    - allocator_type + allocator_type

    - allocator + allocator

    @@ -810,7 +810,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -824,14 +824,14 @@ The R-tree spatial index.

    - Description + Description

    The constructor.

    - Parameters + Parameters
    @@ -860,12 +860,12 @@ The R-tree spatial index.

    - Iterator + Iterator

    - first + first

    @@ -877,12 +877,12 @@ The R-tree spatial index.

    - Iterator + Iterator

    - last + last

    @@ -894,12 +894,12 @@ The R-tree spatial index.

    - parameters_type + parameters_type

    - parameters + parameters

    @@ -911,12 +911,12 @@ The R-tree spatial index.

    - translator_type const & + translator_type const &

    - translator + translator

    @@ -928,12 +928,12 @@ The R-tree spatial index.

    - allocator_type + allocator_type

    - allocator + allocator

    @@ -952,7 +952,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -965,14 +965,14 @@ The R-tree spatial index.

    - Description + Description

    The constructor.

    - Parameters + Parameters
    @@ -1001,12 +1001,13 @@ The R-tree spatial index.

    - Range const & + Range const + &

    - rng + rng

    @@ -1018,12 +1019,12 @@ The R-tree spatial index.

    - parameters_type + parameters_type

    - parameters + parameters

    @@ -1035,12 +1036,12 @@ The R-tree spatial index.

    - translator_type const & + translator_type const &

    - translator + translator

    @@ -1052,12 +1053,12 @@ The R-tree spatial index.

    - allocator_type + allocator_type

    - allocator + allocator

    @@ -1075,7 +1076,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1084,7 +1085,7 @@ The R-tree spatial index.

    - Description + Description

    The destructor. @@ -1097,7 +1098,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1106,7 +1107,7 @@ The R-tree spatial index.

    - Description + Description

    The copy constructor. It uses parameters, translator and allocator from @@ -1114,7 +1115,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1142,12 +1143,13 @@ The R-tree spatial index.

    - rtree const & + rtree const + &

    - src + src

    @@ -1165,7 +1167,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1174,7 +1176,7 @@ The R-tree spatial index.

    - Description + Description

    The copy constructor. It uses Parameters and translator from the source @@ -1182,7 +1184,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1211,12 +1213,13 @@ The R-tree spatial index.

    - rtree const & + rtree const + &

    - src + src

    @@ -1228,12 +1231,12 @@ The R-tree spatial index.

    - allocator_type const & + allocator_type const &

    - allocator + allocator

    @@ -1252,7 +1255,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1261,7 +1264,7 @@ The R-tree spatial index.

    - Description + Description

    The moving constructor. It uses parameters, translator and allocator @@ -1269,7 +1272,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1297,12 +1300,12 @@ The R-tree spatial index.

    - rtree && + rtree &&

    - src + src

    @@ -1320,7 +1323,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1329,7 +1332,7 @@ The R-tree spatial index.

    - Description + Description

    The assignment operator. It uses parameters and translator from the source @@ -1337,7 +1340,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1365,12 +1368,13 @@ The R-tree spatial index.

    - const rtree & + const rtree + &

    - src + src

    @@ -1388,7 +1392,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1397,7 +1401,7 @@ The R-tree spatial index.

    - Description + Description

    The moving assignment. It uses parameters and translator from the source @@ -1405,7 +1409,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1433,12 +1437,12 @@ The R-tree spatial index.

    - rtree && + rtree &&

    - src + src

    @@ -1456,7 +1460,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1465,7 +1469,7 @@ The R-tree spatial index.

    - Description + Description

    Swaps contents of two rtrees. Parameters, translator and allocators are @@ -1473,7 +1477,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1501,12 +1505,12 @@ The R-tree spatial index.

    - rtree & + rtree &

    - other + other

    @@ -1524,7 +1528,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1533,14 +1537,14 @@ The R-tree spatial index.

    - Description + Description

    Insert a value to the index.

    - Parameters + Parameters
    @@ -1568,12 +1572,12 @@ The R-tree spatial index.

    - value_type const & + value_type const &

    - value + value

    @@ -1591,7 +1595,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1601,14 +1605,14 @@ The R-tree spatial index.

    - Description + Description

    Insert a range of values to the index.

    - Parameters + Parameters
    @@ -1637,12 +1641,12 @@ The R-tree spatial index. @@ -694,12 +693,22 @@ The R-tree spatial index.

    - Iterator + Iterator

    - first + first

    @@ -1654,12 +1658,12 @@ The R-tree spatial index.

    - Iterator + Iterator

    - last + last

    @@ -1678,7 +1682,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1688,14 +1692,14 @@ The R-tree spatial index.

    - Description + Description

    Insert a range of values to the index.

    - Parameters + Parameters
    @@ -1723,12 +1727,13 @@ The R-tree spatial index.

    - Range const & + Range const + &

    - rng + rng

    @@ -1746,7 +1751,7 @@ The R-tree spatial index.
    - Synopsis + Synopsis

    @@ -1755,7 +1760,7 @@ The R-tree spatial index.

    - Description + Description

    In contrast to the STL set/map erase() method this method removes only @@ -1763,7 +1768,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1791,12 +1796,12 @@ The R-tree spatial index.

    - value_type const & + value_type const &

    - value + value

    @@ -1808,7 +1813,7 @@ The R-tree spatial index.
    - Returns + Returns

    1 if the value was removed, 0 otherwise. @@ -1821,7 +1826,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1831,7 +1836,7 @@ The R-tree spatial index.

    - Description + Description

    In contrast to the STL set/map erase() method it doesn't take iterators @@ -1841,7 +1846,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1870,12 +1875,12 @@ The R-tree spatial index.

    - Iterator + Iterator

    - first + first

    @@ -1887,12 +1892,12 @@ The R-tree spatial index.

    - Iterator + Iterator

    - last + last

    @@ -1905,7 +1910,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of removed values. @@ -1918,7 +1923,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1928,7 +1933,7 @@ The R-tree spatial index.

    - Description + Description

    In contrast to the STL set/map erase() method it removes values equal @@ -1937,7 +1942,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1965,12 +1970,13 @@ The R-tree spatial index.

    - Range const & + Range const + &

    - rng + rng

    @@ -1982,7 +1988,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of removed values. @@ -1995,7 +2001,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2005,7 +2011,7 @@ The R-tree spatial index.

    - Description + Description

    Spatial predicates may be a Geometry (in this case default predicate @@ -2017,7 +2023,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2046,12 +2052,12 @@ The R-tree spatial index.

    - Predicates const & + Predicates const &

    - pred + pred

    @@ -2063,12 +2069,12 @@ The R-tree spatial index.

    - OutIter + OutIter

    - out_it + out_it

    @@ -2082,7 +2088,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2095,7 +2101,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2105,7 +2111,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates may be a Point. This is default case where Value @@ -2122,7 +2128,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2151,12 +2157,13 @@ The R-tree spatial index.

    - DistancesPredicates const & + DistancesPredicates + const &

    - dpred + dpred

    @@ -2168,12 +2175,12 @@ The R-tree spatial index.

    - value_type & + value_type &

    - v + v

    @@ -2186,7 +2193,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2199,7 +2206,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2211,7 +2218,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates may be a Point. This is default case where Value @@ -2236,7 +2243,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2265,12 +2272,13 @@ The R-tree spatial index.

    - DistancesPredicates const & + DistancesPredicates + const &

    - dpred + dpred

    @@ -2282,12 +2290,12 @@ The R-tree spatial index.

    - Predicates const & + Predicates const &

    - pred + pred

    @@ -2299,12 +2307,12 @@ The R-tree spatial index.

    - value_type & + value_type &

    - v + v

    @@ -2317,7 +2325,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2330,7 +2338,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2342,7 +2350,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates. May be a Point. This is default case where @@ -2359,7 +2367,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2388,12 +2396,13 @@ The R-tree spatial index.

    - DistancesPredicates const & + DistancesPredicates + const &

    - dpred + dpred

    @@ -2405,12 +2414,12 @@ The R-tree spatial index.

    - size_t + size_t

    - k + k

    @@ -2422,12 +2431,12 @@ The R-tree spatial index.

    - OutIter + OutIter

    - out_it + out_it

    @@ -2440,7 +2449,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2453,7 +2462,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2468,7 +2477,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates may be a Point. This is default case where Value @@ -2493,7 +2502,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2522,12 +2531,13 @@ The R-tree spatial index.

    - DistancesPredicates const & + DistancesPredicates + const &

    - dpred + dpred

    @@ -2539,12 +2549,12 @@ The R-tree spatial index.

    - size_t + size_t

    - k + k

    @@ -2556,12 +2566,12 @@ The R-tree spatial index.

    - Predicates const & + Predicates const &

    - pred + pred

    @@ -2573,12 +2583,12 @@ The R-tree spatial index.

    - OutIter + OutIter

    - out_it + out_it

    @@ -2591,7 +2601,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2603,7 +2613,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2612,14 +2622,14 @@ The R-tree spatial index.

    - Description + Description

    Returns the number of stored values.

    - Returns + Returns

    The number of stored values. @@ -2631,7 +2641,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2640,14 +2650,14 @@ The R-tree spatial index.

    - Description + Description

    Query if the container is empty.

    - Returns + Returns

    true if the container is empty. @@ -2659,7 +2669,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2668,7 +2678,7 @@ The R-tree spatial index.

    - Description + Description

    Removes all values stored in the container. @@ -2680,7 +2690,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2689,7 +2699,7 @@ The R-tree spatial index.

    - Description + Description

    Returns the box containing all values stored in the container. If the @@ -2697,7 +2707,7 @@ The R-tree spatial index.

    - Returns + Returns

    The box containing all values stored in the container or an invalid box @@ -2711,7 +2721,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2721,7 +2731,7 @@ The R-tree spatial index.

    - Description + Description

    For indexable_type it returns the number of values which indexables equals @@ -2730,7 +2740,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2758,12 +2768,13 @@ The R-tree spatial index.

    - ValueOrIndexable const & + ValueOrIndexable + const &

    - vori + vori

    @@ -2775,7 +2786,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2787,7 +2798,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2796,14 +2807,14 @@ The R-tree spatial index.

    - Description + Description

    Returns parameters.

    - Returns + Returns

    The parameters object. @@ -2815,7 +2826,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2824,14 +2835,14 @@ The R-tree spatial index.

    - Description + Description

    Returns the translator object.

    - Returns + Returns

    The translator object. @@ -2843,7 +2854,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2852,14 +2863,14 @@ The R-tree spatial index.

    - Description + Description

    Returns allocator used by the rtree.

    - Returns + Returns

    The allocator. diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 89d93898c..b0b2ee116 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

    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 + 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 [2]. + close to some point in space [2].

    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

    -
      +
      • capable to store arbitrary Value type,
      • @@ -201,20 +201,20 @@
      -

      -

      [1] +


      +

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

      -

      [2] +

      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

      -

      [3] +

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

      -

      [4] +

      [4] 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 390fe04c5..341fd302b 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 9ec8f8b5c..2e4bf7514 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 - + @@ -150,7 +150,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 dc19fd16b..7fee097e3 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 46324e866..febcd44df 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -57,7 +57,7 @@

      - +

      Last revised: January 07, 2013 at 23:37:04 GMT

      Last revised: January 08, 2013 at 01:06:35 GMT


      diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 4581c92b1..fc9feef88 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -621,9 +621,9 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s counts[f.type]++; } - if (counts[function_constructor] > 0) + if (counts[function_constructor_destructor] > 0) { - quickbook_output_member(cos.functions, function_constructor, "Constructor", config, out); + quickbook_output_member(cos.functions, function_constructor_destructor, "Constructor", config, out); } if (counts[function_member] > 0) @@ -743,7 +743,7 @@ void quickbook_output_detail_member(class_or_struct const& cos, { if (!p.skip) { - out << "[[ *" << p.fulltype << "* ][ /" << p.name << "/ ][" << p.brief_description << "]]"<< std::endl; + out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl; } } out << "]" << std::endl; From 273f5f53474a524670bcf98fdc1bd191f9ca4ce6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 03:36:16 +0000 Subject: [PATCH 256/366] Added document_id_path to the doxygen_xml2qbk. Added links to reference. [SVN r82398] --- doc/html/geometry_index/r_tree/index.html | 539 +++++++++--------- doc/html/index.html | 2 +- doc/make_qbk.py | 3 +- .../tools/doxygen_xml2qbk/configuration.hpp | 2 + .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 5 + .../doxygen_xml2qbk/quickbook_output.hpp | 12 +- 6 files changed, 286 insertions(+), 277 deletions(-) diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index c8452c806..445c32f79 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,7 @@ boost::geometry::index::rtree

      - + The R-tree spatial index.

      @@ -294,7 +294,7 @@ The R-tree spatial index.

    - rtree() + rtree()

    @@ -306,8 +306,8 @@ The R-tree spatial index.

    - rtree(Iterator, - Iterator) + rtree(Iterator, + Iterator)

    @@ -319,8 +319,8 @@ The R-tree spatial index.

    - rtree(Range const - &) + rtree(Range const + &)

    @@ -332,7 +332,7 @@ The R-tree spatial index.

    - ~rtree() + ~rtree()

    @@ -344,8 +344,8 @@ The R-tree spatial index.

    - rtree(rtree const - &) + rtree(rtree const + &)

    @@ -357,9 +357,9 @@ The R-tree spatial index.

    - rtree(rtree const + rtree(rtree const &, allocator_type - const &) + const &)

    @@ -372,7 +372,7 @@ The R-tree spatial index.

    - rtree(rtree &&) + rtree(rtree &&)

    @@ -408,8 +408,8 @@ The R-tree spatial index.

    - operator=(const rtree - &) + operator=(const rtree + &)

    @@ -421,7 +421,7 @@ The R-tree spatial index.

    - operator=(rtree &&) + operator=(rtree &&)

    @@ -433,7 +433,7 @@ The R-tree spatial index.

    - swap(rtree &) + swap(rtree &)

    @@ -445,8 +445,8 @@ The R-tree spatial index.

    - insert(value_type const - &) + insert(value_type const + &)

    @@ -458,8 +458,8 @@ The R-tree spatial index.

    - insert(Iterator, - Iterator) + insert(Iterator, + Iterator)

    @@ -471,8 +471,8 @@ The R-tree spatial index.

    - insert(Range const - &) + insert(Range const + &)

    @@ -484,8 +484,8 @@ The R-tree spatial index.

    - remove(value_type const - &) + remove(value_type const + &)

    @@ -497,8 +497,8 @@ The R-tree spatial index.

    - remove(Iterator, - Iterator) + remove(Iterator, + Iterator)

    @@ -510,8 +510,8 @@ The R-tree spatial index.

    - remove(Range const - &) + remove(Range const + &)

    @@ -523,9 +523,8 @@ The R-tree spatial index.

    - spatial_query(Predicates - const &, - OutIter) + spatial_query(Predicates const + &, OutIter)

    @@ -538,9 +537,9 @@ The R-tree spatial index.

    - nearest_query(DistancesPredicates - const &, - value_type &) + nearest_query(DistancesPredicates const + &, value_type + &)

    @@ -553,11 +552,10 @@ The R-tree spatial index.

    - nearest_query(DistancesPredicates + nearest_query(DistancesPredicates const + &, Predicates const &, - Predicates const - &, value_type - &) + value_type &)

    @@ -570,10 +568,8 @@ The R-tree spatial index.

    - nearest_query(DistancesPredicates - const &, - size_t, - OutIter) + nearest_query(DistancesPredicates const + &, size_t, OutIter)

    @@ -586,11 +582,10 @@ The R-tree spatial index.

    - nearest_query(DistancesPredicates + nearest_query(DistancesPredicates const + &, size_t, Predicates const &, - size_t, - Predicates const - &, OutIter) + OutIter)

    @@ -603,7 +598,7 @@ The R-tree spatial index.

    - size() + size()

    @@ -615,7 +610,7 @@ The R-tree spatial index.

    - empty() + empty()

    @@ -627,7 +622,7 @@ The R-tree spatial index.

    - clear() + clear()

    @@ -639,7 +634,7 @@ The R-tree spatial index.

    - box() + box()

    @@ -651,8 +646,8 @@ The R-tree spatial index.

    - count(ValueOrIndexable const - &) + count(ValueOrIndexable const + &)

    @@ -664,7 +659,7 @@ The R-tree spatial index.

    - parameters() + parameters()

    @@ -676,7 +671,7 @@ The R-tree spatial index.

    - translator() + translator()

    @@ -688,7 +683,7 @@ The R-tree spatial index.

    - get_allocator() + get_allocator()

    @@ -701,11 +696,11 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -715,15 +710,15 @@ The R-tree spatial index.

    - - Description + + Description

    The constructor.

    - - Parameters + + Parameters
    @@ -805,12 +800,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -823,15 +818,15 @@ The R-tree spatial index.

    - - Description + + Description

    The constructor.

    - - Parameters + + Parameters
    @@ -947,12 +942,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -964,15 +959,15 @@ The R-tree spatial index.

    - - Description + + Description

    The constructor.

    - - Parameters + + Parameters
    @@ -1072,11 +1067,11 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1084,8 +1079,8 @@ The R-tree spatial index.

    - - Description + + Description

    The destructor. @@ -1093,12 +1088,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -1106,16 +1101,16 @@ The R-tree spatial index.

    - - Description + + Description

    The copy constructor. It uses parameters, translator and allocator from the source tree.

    - - Parameters + + Parameters
    @@ -1162,12 +1157,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1175,16 +1170,16 @@ The R-tree spatial index.

    - - Description + + Description

    The copy constructor. It uses Parameters and translator from the source tree.

    - - Parameters + + Parameters
    @@ -1250,12 +1245,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1263,16 +1258,16 @@ The R-tree spatial index.

    - - Description + + Description

    The moving constructor. It uses parameters, translator and allocator from the source tree.

    - - Parameters + + Parameters
    @@ -1318,12 +1313,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1331,16 +1326,16 @@ The R-tree spatial index.

    - - Description + + Description

    The assignment operator. It uses parameters and translator from the source tree.

    - - Parameters + + Parameters
    @@ -1387,12 +1382,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1400,16 +1395,16 @@ The R-tree spatial index.

    - - Description + + Description

    The moving assignment. It uses parameters and translator from the source tree.

    - - Parameters + + Parameters
    @@ -1455,12 +1450,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1468,16 +1463,16 @@ The R-tree spatial index.

    - - Description + + Description

    Swaps contents of two rtrees. Parameters, translator and allocators are swapped as well.

    - - Parameters + + Parameters
    @@ -1523,12 +1518,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1536,15 +1531,15 @@ The R-tree spatial index.

    - - Description + + Description

    Insert a value to the index.

    - - Parameters + + Parameters
    @@ -1590,12 +1585,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1604,15 +1599,15 @@ The R-tree spatial index.

    - - Description + + Description

    Insert a range of values to the index.

    - - Parameters + + Parameters
    @@ -1677,12 +1672,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1691,15 +1686,15 @@ The R-tree spatial index.

    - - Description + + Description

    Insert a range of values to the index.

    - - Parameters + + Parameters
    @@ -1746,12 +1741,12 @@ The R-tree spatial index.
    - - Synopsis + + Synopsis

    @@ -1759,16 +1754,16 @@ The R-tree spatial index.

    - - Description + + Description

    In contrast to the STL set/map erase() method this method removes only one value from the container.

    - - Parameters + + Parameters
    @@ -1812,8 +1807,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    1 if the value was removed, 0 otherwise. @@ -1821,12 +1816,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -1835,8 +1830,8 @@ The R-tree spatial index.

    - - Description + + Description

    In contrast to the STL set/map erase() method it doesn't take iterators @@ -1845,8 +1840,8 @@ The R-tree spatial index. value for each one passed in the range, not all equal values.

    - - Parameters + + Parameters
    @@ -1909,8 +1904,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of removed values. @@ -1918,12 +1913,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -1932,8 +1927,8 @@ The R-tree spatial index.

    - - Description + + Description

    In contrast to the STL set/map erase() method it removes values equal @@ -1941,8 +1936,8 @@ The R-tree spatial index. value for each one passed in the range, not all equal values.

    - - Parameters + + Parameters
    @@ -1987,8 +1982,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of removed values. @@ -1996,12 +1991,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2010,8 +2005,8 @@ The R-tree spatial index.

    - - Description + + Description

    Spatial predicates may be a Geometry (in this case default predicate @@ -2022,8 +2017,8 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

    - - Parameters + + Parameters
    @@ -2087,8 +2082,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found. @@ -2096,12 +2091,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2110,8 +2105,8 @@ The R-tree spatial index.

    - - Description + + Description

    The distances predicates may be a Point. This is default case where Value @@ -2127,8 +2122,8 @@ The R-tree spatial index. or bgi::to_furthest(dist_bound).

    - - Parameters + + Parameters
    @@ -2192,8 +2187,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found. @@ -2201,12 +2196,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2217,8 +2212,8 @@ The R-tree spatial index.

    - - Description + + Description

    The distances predicates may be a Point. This is default case where Value @@ -2242,8 +2237,8 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

    - - Parameters + + Parameters
    @@ -2324,8 +2319,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found. @@ -2333,12 +2328,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2349,8 +2344,8 @@ The R-tree spatial index.

    - - Description + + Description

    The distances predicates. May be a Point. This is default case where @@ -2366,8 +2361,8 @@ The R-tree spatial index. or bgi::to_furthest(dist_bound).

    - - Parameters + + Parameters
    @@ -2448,8 +2443,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found. @@ -2457,12 +2452,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2476,8 +2471,8 @@ The R-tree spatial index.

    - - Description + + Description

    The distances predicates may be a Point. This is default case where Value @@ -2501,8 +2496,8 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

    - - Parameters + + Parameters
    @@ -2600,8 +2595,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found. @@ -2609,11 +2604,11 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2621,15 +2616,15 @@ The R-tree spatial index.

    - - Description + + Description

    Returns the number of stored values.

    - - Returns + + Returns

    The number of stored values. @@ -2637,11 +2632,11 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2649,15 +2644,15 @@ The R-tree spatial index.

    - - Description + + Description

    Query if the container is empty.

    - - Returns + + Returns

    true if the container is empty. @@ -2665,11 +2660,11 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2677,8 +2672,8 @@ The R-tree spatial index.

    - - Description + + Description

    Removes all values stored in the container. @@ -2686,11 +2681,11 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2698,16 +2693,16 @@ The R-tree spatial index.

    - - Description + + Description

    Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.

    - - Returns + + Returns

    The box containing all values stored in the container or an invalid box @@ -2716,12 +2711,12 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2730,8 +2725,8 @@ The R-tree spatial index.

    - - Description + + Description

    For indexable_type it returns the number of values which indexables equals @@ -2739,8 +2734,8 @@ The R-tree spatial index. the parameter.

    - - Parameters + + Parameters
    @@ -2785,8 +2780,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found. @@ -2794,11 +2789,11 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2806,15 +2801,15 @@ The R-tree spatial index.

    - - Description + + Description

    Returns parameters.

    - - Returns + + Returns

    The parameters object. @@ -2822,11 +2817,11 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2834,15 +2829,15 @@ The R-tree spatial index.

    - - Description + + Description

    Returns the translator object.

    - - Returns + + Returns

    The translator object. @@ -2850,11 +2845,11 @@ The R-tree spatial index.

    - - Synopsis + + Synopsis

    @@ -2862,15 +2857,15 @@ The R-tree spatial index.

    - - Description + + Description

    Returns allocator used by the rtree.

    - - Returns + + Returns

    The allocator. diff --git a/doc/html/index.html b/doc/html/index.html index febcd44df..ea7fc22ca 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@

    - +

    Last revised: January 08, 2013 at 01:06:35 GMT

    Last revised: January 08, 2013 at 03:33:47 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index 0434b678a..5f2b0fbee 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -13,9 +13,10 @@ import os, sys cmd = "doxygen_xml2qbk" cmd = cmd + " --xml xml/%s.xml" cmd = cmd + " --start_include ." +cmd = cmd + " --document_id_path %s" cmd = cmd + " > generated/%s.qbk" os.system("doxygen Doxyfile") -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "rtree")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_tree.index.boost_geometry_index_rtree", "rtree")) os.system("b2") diff --git a/doc/src/tools/doxygen_xml2qbk/configuration.hpp b/doc/src/tools/doxygen_xml2qbk/configuration.hpp index 96cf8104c..fded4e794 100644 --- a/doc/src/tools/doxygen_xml2qbk/configuration.hpp +++ b/doc/src/tools/doxygen_xml2qbk/configuration.hpp @@ -27,6 +27,8 @@ struct configuration std::vector convenience_headers; std::string skip_namespace; + + std::string document_id_path; }; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp index c36f85b60..ecbad95ce 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -75,6 +75,8 @@ int main(int argc, char** argv) "Namespace to skip (e.g. boost::mylib::") ("copyright", po::value(©right_filename), "Name of QBK file including (commented) copyright and license") + ("document_id_path", po::value(&config.document_id_path), + "The QBK document ID path") ; po::variables_map varmap; @@ -103,6 +105,9 @@ int main(int argc, char** argv) { boost::split(config.convenience_headers, convenience_headers, boost::is_any_of(",")); } + + if ( !config.document_id_path.empty() && config.document_id_path[config.document_id_path.size() - 1] != '.' ) + config.document_id_path += '.'; } // Read files into strings diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index fc9feef88..00c715d65 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -698,9 +698,15 @@ void quickbook_output_member(class_or_struct const& cos, if (f.type == type) { - out << "[[`"; + out << "[["; + if ( !config.document_id_path.empty() ) + out << "[link " << config.document_id_path << "member" << i << " "; + out << "`"; quickbook_synopsis_short(f, out); - out << "`][" << f.brief_description << "]]" << std::endl; + out << "`"; + if ( !config.document_id_path.empty() ) + out << "]"; + out << "][" << f.brief_description << "]]" << std::endl; } } out << "]" << std::endl @@ -720,7 +726,7 @@ void quickbook_output_detail_member(class_or_struct const& cos, std::stringstream ss; quickbook_synopsis_short(f, ss); - out << "[section " << ss.str() << "]" << std::endl; + out << "[section:member" << i << " " << ss.str() << "]" << std::endl; out << "[heading Synopsis]" << std::endl; quickbook_synopsis(f, out, true, true); From a75b7cdc0aae8dd47fd4e31660dede866d093b84 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 05:03:50 +0000 Subject: [PATCH 257/366] Exceptions info moved to \qbk section in methods description. [SVN r82399] --- doc/html/geometry_index/r_tree/index.html | 593 ++++++++++-------- doc/html/index.html | 2 +- .../doxygen_xml2qbk/quickbook_output.hpp | 18 +- 3 files changed, 360 insertions(+), 253 deletions(-) diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 445c32f79..99ccfb8be 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    @@ -364,8 +364,7 @@ The R-tree spatial index.

    - The copy constructor. It uses Parameters and translator from - the source tree. + The copy constructor.

    +

    +
    +

    + Description +
    +

    + The constructor. +

    +
    + Synopsis

    @@ -710,13 +719,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The constructor. -

    -
    Parameters
    @@ -798,6 +800,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + The constructor. +

    +
    + Synopsis

    @@ -818,13 +830,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The constructor. -

    -
    Parameters
    @@ -940,6 +945,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + The constructor. +

    +
    + Synopsis

    @@ -959,13 +974,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The constructor. -

    -
    Parameters
    @@ -1065,12 +1073,29 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + { +

    +
    + + Exception-safety +
    +

    + nothrow } +

    +
    + Synopsis

    @@ -1078,14 +1103,10 @@ The R-tree spatial index.

    ~rtree()

    -
    - - Description -
    -

    - The destructor. -

    +

    +
    +

    + Description +
    +

    + The copy constructor. It uses parameters, translator and allocator from + the source tree. +

    +
    + Synopsis

    @@ -1101,14 +1130,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The copy constructor. It uses parameters, translator and allocator from - the source tree. -

    -
    Parameters
    @@ -1155,6 +1176,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + The copy constructor. It uses Parameters and translator from the source + tree. +

    +
    + Synopsis

    @@ -1170,14 +1202,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The copy constructor. It uses Parameters and translator from the source - tree. -

    -
    Parameters
    @@ -1243,6 +1267,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + The moving constructor. It uses parameters, translator and allocator + from the source tree. +

    +
    + Synopsis

    @@ -1258,14 +1293,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The moving constructor. It uses parameters, translator and allocator - from the source tree. -

    -
    Parameters
    @@ -1311,6 +1338,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + The assignment operator. It uses parameters and translator from the source + tree. +

    +
    + Synopsis

    @@ -1326,14 +1364,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The assignment operator. It uses parameters and translator from the source - tree. -

    -
    Parameters
    @@ -1380,6 +1410,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + The moving assignment. It uses parameters and translator from the source + tree. +

    +
    + Synopsis

    @@ -1395,14 +1436,6 @@ The R-tree spatial index.

    - - Description -
    -

    - The moving assignment. It uses parameters and translator from the source - tree. -

    -
    Parameters
    @@ -1448,6 +1481,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + Swaps contents of two rtrees. Parameters, translator and allocators are + swapped as well. +

    +
    + Synopsis

    @@ -1463,14 +1507,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Swaps contents of two rtrees. Parameters, translator and allocators are - swapped as well. -

    -
    Parameters
    @@ -1516,6 +1552,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + Insert a value to the index. +

    +
    + Synopsis

    @@ -1531,13 +1577,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Insert a value to the index. -

    -
    Parameters
    @@ -1583,6 +1622,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + Insert a range of values to the index. +

    +
    + Synopsis

    @@ -1599,13 +1648,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Insert a range of values to the index. -

    -
    Parameters
    @@ -1670,6 +1712,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + Insert a range of values to the index. +

    +
    + Synopsis

    @@ -1686,13 +1738,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Insert a range of values to the index. -

    -
    Parameters
    @@ -1739,6 +1784,9 @@ The R-tree spatial index.
    +

    +
    +

    + Description +
    +

    + In contrast to the STL set/map erase() method this method removes only + one value from the container. +

    +
    + Synopsis

    @@ -1754,14 +1810,6 @@ The R-tree spatial index.

    - - Description -
    -

    - In contrast to the STL set/map erase() method this method removes only - one value from the container. -

    -
    Parameters
    @@ -1814,6 +1862,9 @@ The R-tree spatial index. 1 if the value was removed, 0 otherwise.

    +

    +
    +

    - Synopsis -
    -

    -

    -
    template<typename Iterator>
    -size_type remove(Iterator first, Iterator last)
    -

    -

    -
    - Description

    @@ -1840,6 +1881,16 @@ The R-tree spatial index. value for each one passed in the range, not all equal values.

    + + Synopsis +
    +

    +

    +
    template<typename Iterator>
    +size_type remove(Iterator first, Iterator last)
    +

    +

    +
    Parameters
    @@ -1911,6 +1962,9 @@ The R-tree spatial index. The number of removed values.

    +

    +
    +

    + Description +
    +

    + In contrast to the STL set/map erase() method it removes values equal + to these passed as a range. Furthermore, this method removes only one + value for each one passed in the range, not all equal values. +

    +
    + Synopsis

    @@ -1927,15 +1990,6 @@ The R-tree spatial index.

    - - Description -
    -

    - In contrast to the STL set/map erase() method it removes values equal - to these passed as a range. Furthermore, this method removes only one - value for each one passed in the range, not all equal values. -

    -
    Parameters
    @@ -1989,6 +2043,9 @@ The R-tree spatial index. The number of removed values.

    +

    +
    +

    - Synopsis -
    -

    -

    -
    template<typename Predicates, typename OutIter>
    -size_type spatial_query(Predicates const & pred, OutIter out_it)
    -

    -

    -
    - Description

    @@ -2017,6 +2064,16 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

    + + Synopsis +
    +

    +

    +
    template<typename Predicates, typename OutIter>
    +size_type spatial_query(Predicates const & pred, OutIter out_it)
    +

    +

    +
    Parameters
    @@ -2089,6 +2146,9 @@ The R-tree spatial index. The number of values found.

    +

    +
    +

    - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates>
    -size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
    -

    -

    -
    - Description

    @@ -2122,6 +2172,16 @@ The R-tree spatial index. or bgi::to_furthest(dist_bound).

    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates>
    +size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
    +

    +

    +
    Parameters
    @@ -2194,6 +2254,9 @@ The R-tree spatial index. The number of values found.

    +

    +
    +

    - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates, typename Predicates>
    -size_type nearest_query(DistancesPredicates const & dpred,
    -                        Predicates const & pred,
    -                        value_type & v)
    -

    -

    -
    - Description

    @@ -2237,6 +2288,18 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates, typename Predicates>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        Predicates const & pred,
    +                        value_type & v)
    +

    +

    +
    Parameters
    @@ -2326,6 +2389,9 @@ The R-tree spatial index. The number of values found.

    +

    +
    +

    - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates, typename OutIter>
    -size_type nearest_query(DistancesPredicates const & dpred,
    -                        size_t k,
    -                        OutIter out_it)
    -

    -

    -
    - Description

    @@ -2361,6 +2415,18 @@ The R-tree spatial index. or bgi::to_furthest(dist_bound).

    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates, typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        size_t k,
    +                        OutIter out_it)
    +

    +

    +
    Parameters
    @@ -2450,6 +2516,9 @@ The R-tree spatial index. The number of values found.

    +

    +
    +

    - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates,
    -         typename Predicates,
    -         typename OutIter>
    -size_type nearest_query(DistancesPredicates const & dpred,
    -                        size_t k,
    -                        Predicates const & pred,
    -                        OutIter out_it)
    -

    -

    -
    - Description

    @@ -2496,6 +2550,21 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates,
    +         typename Predicates,
    +         typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        size_t k,
    +                        Predicates const & pred,
    +                        OutIter out_it)
    +

    +

    +
    Parameters
    @@ -2602,12 +2671,22 @@ The R-tree spatial index. The number of values found.

    +

    +
    +

    + Description +
    +

    + Returns the number of stored values. +

    +
    + Synopsis

    @@ -2616,13 +2695,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Returns the number of stored values. -

    -
    Returns
    @@ -2630,12 +2702,22 @@ The R-tree spatial index. The number of stored values.

    +

    +
    +

    + Description +
    +

    + Query if the container is empty. +

    +
    + Synopsis

    @@ -2644,13 +2726,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Query if the container is empty. -

    -
    Returns
    @@ -2658,12 +2733,29 @@ The R-tree spatial index. true if the container is empty.

    +

    +
    +

    + Description +
    +

    + { +

    +
    + + Exception-safety +
    +

    + nothrow } +

    +
    + Synopsis

    @@ -2671,20 +2763,24 @@ The R-tree spatial index.

    void clear()

    -
    - - Description -
    -

    - Removes all values stored in the container. -

    +

    +
    +

    + Description +
    +

    + Returns the box containing all values stored in the container. If the + container is empty the result of geometry::assign_inverse() is returned. +

    +
    + Synopsis

    @@ -2693,14 +2789,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Returns the box containing all values stored in the container. If the - container is empty the result of geometry::assign_inverse() is returned. -

    -
    Returns
    @@ -2709,6 +2797,9 @@ The R-tree spatial index. if there are no values in the container.

    +

    +
    +

    + Description +
    +

    + For indexable_type it returns the number of values which indexables equals + the parameter. For value_type it returns the number of values which equals + the parameter. +

    +
    + Synopsis

    @@ -2725,15 +2825,6 @@ The R-tree spatial index.

    - - Description -
    -

    - For indexable_type it returns the number of values which indexables equals - the parameter. For value_type it returns the number of values which equals - the parameter. -

    -
    Parameters
    @@ -2787,12 +2878,22 @@ The R-tree spatial index. The number of values found.

    +

    +
    +

    + Description +
    +

    + Returns parameters. +

    +
    + Synopsis

    @@ -2801,13 +2902,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Returns parameters. -

    -
    Returns
    @@ -2815,12 +2909,22 @@ The R-tree spatial index. The parameters object.

    +

    +
    +

    + Description +
    +

    + Returns the translator object. +

    +
    + Synopsis

    @@ -2829,13 +2933,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Returns the translator object. -

    -
    Returns
    @@ -2843,12 +2940,22 @@ The R-tree spatial index. The translator object.

    +

    +
    +

    + Description +
    +

    + Returns allocator used by the rtree. +

    +
    + Synopsis

    @@ -2857,13 +2964,6 @@ The R-tree spatial index.

    - - Description -
    -

    - Returns allocator used by the rtree. -

    -
    Returns
    @@ -2871,6 +2971,9 @@ The R-tree spatial index. The allocator.

    +

    +
    +

    diff --git a/doc/html/index.html b/doc/html/index.html index ea7fc22ca..b08ef5114 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@
    - +

    Last revised: January 08, 2013 at 03:33:47 GMT

    Last revised: January 08, 2013 at 05:02:12 GMT


    diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 00c715d65..1055067ac 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -728,9 +728,6 @@ void quickbook_output_detail_member(class_or_struct const& cos, out << "[section:member" << i << " " << ss.str() << "]" << std::endl; - out << "[heading Synopsis]" << std::endl; - quickbook_synopsis(f, out, true, true); - if ( !f.detailed_description.empty() || !f.brief_description.empty() ) { out << "[heading Description]" << std::endl; @@ -738,7 +735,10 @@ void quickbook_output_detail_member(class_or_struct const& cos, out << f.detailed_description; else out << f.brief_description; - } + } + + out << "[heading Synopsis]" << std::endl; + quickbook_synopsis(f, out, true, true); if ( !f.parameters.empty() ) { @@ -759,9 +759,11 @@ void quickbook_output_detail_member(class_or_struct const& cos, { out << "[heading Returns]" << std::endl; out << f.return_description << std::endl; - } - - out << "[endsect]" << std::endl + } + + quickbook_markup(f.qbk_markup, markup_any, markup_default, out); + + out << "[endsect][br]" << std::endl << std::endl; } } @@ -891,6 +893,8 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s // Details start + out << "[br]"; + if (counts[function_constructor_destructor] > 0) quickbook_output_detail_member(cos, cos.functions, function_constructor_destructor, config, out); if (counts[function_member] > 0) From c3bd62df8186bf351d2de09d01b39d26def9ea81 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 14:32:32 +0000 Subject: [PATCH 258/366] doxygen_xml2qbk document_id_path parameter changed to index_id_path [SVN r82401] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../r_tree/exception_safety.html | 16 +- doc/html/geometry_index/r_tree/index.html | 227 +++++++++--------- .../geometry_index/r_tree/introduction.html | 20 +- .../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/make_qbk.py | 4 +- .../tools/doxygen_xml2qbk/configuration.hpp | 2 +- .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 7 +- .../doxygen_xml2qbk/quickbook_output.hpp | 8 +- 14 files changed, 148 insertions(+), 162 deletions(-) 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 ab7a739c4..7c2eedefc 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 300395d3a..a79271bfb 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html index a374ee31d..fd669c9c6 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 - + @@ -29,7 +29,7 @@

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

                    -
                      +
                      • exception-safe copy constructor and copy assignment of the Value.
                      • @@ -155,7 +155,7 @@

    nothrow or strong - [a] + [a]

    - not safe [b] + not safe [b]

    nothrow or strong - [c] + [c]

    -

    [a] +

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

    -

    [b] +

    [b] If this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.

    -

    [c] +

    [c] nothrow - if CoordinateType has nonthrowing copy constructor, strong - otherwise diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 99ccfb8be..24c967a08 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -3,7 +3,7 @@ Reference - + @@ -31,12 +31,12 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    - Description + Description

    The R-tree spatial index. This is self-balancing spatial index capable @@ -64,14 +64,14 @@ The R-tree spatial index.

    - Header + Header

    #include <.hpp>

    - Synopsis + Synopsis

    @@ -88,7 +88,7 @@ The R-tree spatial index.

    - Template + Template parameter(s)
    @@ -162,7 +162,7 @@ The R-tree spatial index.
    - Typedef(s) + Typedef(s)
    @@ -270,7 +270,7 @@ The R-tree spatial index.
    - Constructor(s) + Constructor(s) and destructor
    @@ -364,7 +364,8 @@ The R-tree spatial index. @@ -384,7 +385,7 @@ The R-tree spatial index.

    - The copy constructor. + The copy constructor. It uses Parameters and translator from + the source tree.

    - Member(s) + Member(s)
    @@ -702,14 +703,14 @@ The R-tree spatial index.
    - Description + Description

    The constructor.

    - Synopsis + Synopsis

    @@ -720,7 +721,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -810,14 +811,14 @@ The R-tree spatial index.
    - Description + Description

    The constructor.

    - Synopsis + Synopsis

    @@ -831,7 +832,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -955,14 +956,14 @@ The R-tree spatial index.
    - Description + Description

    The constructor.

    - Synopsis + Synopsis

    @@ -975,7 +976,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1082,21 +1083,14 @@ The R-tree spatial index.
    - Description + Description

    - { + The destructor.

    - Exception-safety -
    -

    - nothrow } -

    -
    - - Synopsis + Synopsis

    @@ -1114,7 +1108,7 @@ The R-tree spatial index.
    - Description + Description

    The copy constructor. It uses parameters, translator and allocator from @@ -1122,7 +1116,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1131,7 +1125,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1186,7 +1180,7 @@ The R-tree spatial index.
    - Description + Description

    The copy constructor. It uses Parameters and translator from the source @@ -1194,7 +1188,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1203,7 +1197,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1277,7 +1271,7 @@ The R-tree spatial index.
    - Description + Description

    The moving constructor. It uses parameters, translator and allocator @@ -1285,7 +1279,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1294,7 +1288,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1348,7 +1342,7 @@ The R-tree spatial index.
    - Description + Description

    The assignment operator. It uses parameters and translator from the source @@ -1356,7 +1350,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1365,7 +1359,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1420,7 +1414,7 @@ The R-tree spatial index.
    - Description + Description

    The moving assignment. It uses parameters and translator from the source @@ -1428,7 +1422,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1437,7 +1431,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1491,7 +1485,7 @@ The R-tree spatial index.
    - Description + Description

    Swaps contents of two rtrees. Parameters, translator and allocators are @@ -1499,7 +1493,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1508,7 +1502,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1562,14 +1556,14 @@ The R-tree spatial index.
    - Description + Description

    Insert a value to the index.

    - Synopsis + Synopsis

    @@ -1578,7 +1572,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1632,14 +1626,14 @@ The R-tree spatial index.
    - Description + Description

    Insert a range of values to the index.

    - Synopsis + Synopsis

    @@ -1649,7 +1643,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1722,14 +1716,14 @@ The R-tree spatial index.
    - Description + Description

    Insert a range of values to the index.

    - Synopsis + Synopsis

    @@ -1739,7 +1733,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1794,7 +1788,7 @@ The R-tree spatial index.
    - Description + Description

    In contrast to the STL set/map erase() method this method removes only @@ -1802,7 +1796,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1811,7 +1805,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1856,7 +1850,7 @@ The R-tree spatial index.
    - Returns + Returns

    1 if the value was removed, 0 otherwise. @@ -1872,7 +1866,7 @@ The R-tree spatial index.

    - Description + Description

    In contrast to the STL set/map erase() method it doesn't take iterators @@ -1882,7 +1876,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1892,7 +1886,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -1956,7 +1950,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of removed values. @@ -1972,7 +1966,7 @@ The R-tree spatial index.

    - Description + Description

    In contrast to the STL set/map erase() method it removes values equal @@ -1981,7 +1975,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -1991,7 +1985,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2037,7 +2031,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of removed values. @@ -2053,7 +2047,7 @@ The R-tree spatial index.

    - Description + Description

    Spatial predicates may be a Geometry (in this case default predicate @@ -2065,7 +2059,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2075,7 +2069,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2140,7 +2134,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2156,7 +2150,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates may be a Point. This is default case where Value @@ -2173,7 +2167,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2183,7 +2177,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2248,7 +2242,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2264,7 +2258,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates may be a Point. This is default case where Value @@ -2289,7 +2283,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2301,7 +2295,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2383,7 +2377,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2399,7 +2393,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates. May be a Point. This is default case where @@ -2416,7 +2410,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2428,7 +2422,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2510,7 +2504,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2526,7 +2520,7 @@ The R-tree spatial index.

    - Description + Description

    The distances predicates may be a Point. This is default case where Value @@ -2551,7 +2545,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2566,7 +2560,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2665,7 +2659,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2680,14 +2674,14 @@ The R-tree spatial index.

    - Description + Description

    Returns the number of stored values.

    - Synopsis + Synopsis

    @@ -2696,7 +2690,7 @@ The R-tree spatial index.

    - Returns + Returns

    The number of stored values. @@ -2711,14 +2705,14 @@ The R-tree spatial index.

    - Description + Description

    Query if the container is empty.

    - Synopsis + Synopsis

    @@ -2727,7 +2721,7 @@ The R-tree spatial index.

    - Returns + Returns

    true if the container is empty. @@ -2742,21 +2736,14 @@ The R-tree spatial index.

    - Description + Description

    - { + Removes all values stored in the container.

    - Exception-safety -
    -

    - nothrow } -

    -
    - - Synopsis + Synopsis

    @@ -2773,7 +2760,7 @@ The R-tree spatial index.
    - Description + Description

    Returns the box containing all values stored in the container. If the @@ -2781,7 +2768,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2790,7 +2777,7 @@ The R-tree spatial index.

    - Returns + Returns

    The box containing all values stored in the container or an invalid box @@ -2807,7 +2794,7 @@ The R-tree spatial index.

    - Description + Description

    For indexable_type it returns the number of values which indexables equals @@ -2816,7 +2803,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis

    @@ -2826,7 +2813,7 @@ The R-tree spatial index.

    - Parameters + Parameters
    @@ -2872,7 +2859,7 @@ The R-tree spatial index.
    - Returns + Returns

    The number of values found. @@ -2887,14 +2874,14 @@ The R-tree spatial index.

    - Description + Description

    Returns parameters.

    - Synopsis + Synopsis

    @@ -2903,7 +2890,7 @@ The R-tree spatial index.

    - Returns + Returns

    The parameters object. @@ -2918,14 +2905,14 @@ The R-tree spatial index.

    - Description + Description

    Returns the translator object.

    - Synopsis + Synopsis

    @@ -2934,7 +2921,7 @@ The R-tree spatial index.

    - Returns + Returns

    The translator object. @@ -2949,14 +2936,14 @@ The R-tree spatial index.

    - Description + Description

    Returns allocator used by the rtree.

    - Synopsis + Synopsis

    @@ -2965,7 +2952,7 @@ The R-tree spatial index.

    - Returns + Returns

    The allocator. diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index b0b2ee116..89d93898c 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

    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 + 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 [2]. + close to some point in space [2].

    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

    -
      +
      • capable to store arbitrary Value type,
      • @@ -201,20 +201,20 @@
      -

      -

      [1] +


      +

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

      -

      [2] +

      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

      -

      [3] +

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

      -

      [4] +

      [4] 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 341fd302b..390fe04c5 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 2e4bf7514..9ec8f8b5c 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 - + @@ -150,7 +150,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 7fee097e3..dc19fd16b 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 b08ef5114..747fd4f5b 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -57,7 +57,7 @@

      - +

      Last revised: January 08, 2013 at 05:02:12 GMT

      Last revised: January 08, 2013 at 14:30:11 GMT


      diff --git a/doc/make_qbk.py b/doc/make_qbk.py index 5f2b0fbee..fc48d6b5c 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -13,10 +13,10 @@ import os, sys cmd = "doxygen_xml2qbk" cmd = cmd + " --xml xml/%s.xml" cmd = cmd + " --start_include ." -cmd = cmd + " --document_id_path %s" +cmd = cmd + " --index_id_path %s" cmd = cmd + " > generated/%s.qbk" os.system("doxygen Doxyfile") -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_tree.index.boost_geometry_index_rtree", "rtree")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_tree.index", "rtree")) os.system("b2") diff --git a/doc/src/tools/doxygen_xml2qbk/configuration.hpp b/doc/src/tools/doxygen_xml2qbk/configuration.hpp index fded4e794..ff73674d7 100644 --- a/doc/src/tools/doxygen_xml2qbk/configuration.hpp +++ b/doc/src/tools/doxygen_xml2qbk/configuration.hpp @@ -28,7 +28,7 @@ struct configuration std::string skip_namespace; - std::string document_id_path; + std::string index_id_path; }; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp index ecbad95ce..25bd93146 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -75,8 +75,8 @@ int main(int argc, char** argv) "Namespace to skip (e.g. boost::mylib::") ("copyright", po::value(©right_filename), "Name of QBK file including (commented) copyright and license") - ("document_id_path", po::value(&config.document_id_path), - "The QBK document ID path") + ("index_id_path", po::value(&config.index_id_path), + "The QBK index ID path") ; po::variables_map varmap; @@ -105,9 +105,6 @@ int main(int argc, char** argv) { boost::split(config.convenience_headers, convenience_headers, boost::is_any_of(",")); } - - if ( !config.document_id_path.empty() && config.document_id_path[config.document_id_path.size() - 1] != '.' ) - config.document_id_path += '.'; } // Read files into strings diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 1055067ac..842d004d8 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -699,12 +699,14 @@ void quickbook_output_member(class_or_struct const& cos, if (f.type == type) { out << "[["; - if ( !config.document_id_path.empty() ) - out << "[link " << config.document_id_path << "member" << i << " "; + if ( !config.index_id_path.empty() ) + out << "[link " << config.index_id_path + << "." << to_section_name(namespace_skipped(cos.fullname, config)) + << ".member" << i << " "; out << "`"; quickbook_synopsis_short(f, out); out << "`"; - if ( !config.document_id_path.empty() ) + if ( !config.index_id_path.empty() ) out << "]"; out << "][" << f.brief_description << "]]" << std::endl; } From 033fb806bfac06f9f73543df150d87aca5488e8e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 14:40:57 +0000 Subject: [PATCH 259/366] added qbk params in rtree description [SVN r82402] --- .../geometry/extensions/index/rtree/rtree.hpp | 293 +++++++++++++----- 1 file changed, 209 insertions(+), 84 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 49c9054aa..76c2fb9d4 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -124,11 +124,14 @@ public: /*! \brief The constructor. - \exception nothrow - \param parameters The parameters object. \param translator The translator object. \param allocator The allocator object. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline explicit rtree(parameters_type parameters = parameters_type(), translator_type const& translator = translator_type(), @@ -144,13 +147,16 @@ public: /*! \brief The constructor. - \exception strong - \param first The beginning of the range of Values. \param last The end of the range of Values. \param parameters The parameters object. \param translator The translator object. \param allocator The allocator object. + + \qbk{ + [heading Exception-safety] + strong + } */ template inline rtree(Iterator first, Iterator last, @@ -178,12 +184,15 @@ public: /*! \brief The constructor. - \exception strong - \param rng The range of Values. \param parameters The parameters object. \param translator The translator object. \param allocator The allocator object. + + \qbk{ + [heading Exception-safety] + strong + } */ template inline explicit rtree(Range const& rng, @@ -211,7 +220,10 @@ public: /*! \brief The destructor. - \exception nothrow + \qbk{ + [heading Exception-safety] + nothrow + } */ inline ~rtree() { @@ -223,9 +235,12 @@ public: The copy constructor. It uses parameters, translator and allocator from the source tree. - \exception strong - \param src The rtree which content will be copied. + + \qbk{ + [heading Exception-safety] + strong + } */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -241,12 +256,17 @@ public: } /*! - \brief The copy constructor. It uses Parameters and translator from the source tree. + \brief The copy constructor. - \exception strong + The copy constructor. It uses Parameters and translator from the source tree. \param src The rtree which content will be copied. \param allocator The allocator which will be used. + + \qbk{ + [heading Exception-safety] + strong + } */ inline rtree(rtree const& src, allocator_type const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -264,9 +284,12 @@ public: The moving constructor. It uses parameters, translator and allocator from the source tree. - \exception nothrow - \param src The rtree which content will be moved. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline rtree(BOOST_RV_REF(rtree) src) // TODO - use boost::move() @@ -287,9 +310,12 @@ public: The assignment operator. It uses parameters and translator from the source tree. - \exception strong - \param src The rtree which content will be copied. + + \qbk{ + [heading Exception-safety] + strong + } */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -309,9 +335,12 @@ public: The moving assignment. It uses parameters and translator from the source tree. - \exception nothrow (if allocators are equal), strong (if allocators aren't equal) - \param src The rtree which content will be moved. + + \qbk{ + [heading Exception-safety] + nothrow (if allocators are equal), strong (if allocators aren't equal) + } */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -349,9 +378,12 @@ public: Swaps contents of two rtrees. Parameters, translator and allocators are swapped as well. - \exception nothrow - \param other The rtree which content will be swapped with this rtree content. + + \qbk{ + [heading Exception-safety] + nothrow + } */ void swap(rtree & other) { @@ -369,10 +401,13 @@ public: /*! \brief Insert a value to the index. - \exception not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - \param value The value which will be stored in the container. + + \qbk{ + [heading Exception-safety] + not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + } */ inline void insert(value_type const& value) { @@ -385,11 +420,14 @@ public: /*! \brief Insert a range of values to the index. - \exception not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - \param first The beginning of the range of values. \param last The end of the range of values. + + \qbk{ + [heading Exception-safety] + not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + } */ template inline void insert(Iterator first, Iterator last) @@ -404,10 +442,13 @@ public: /*! \brief Insert a range of values to the index. - \exception not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - \param rng The range of values. + + \qbk{ + [heading Exception-safety] + not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + } */ template inline void insert(Range const& rng) @@ -426,12 +467,15 @@ public: In contrast to the STL set/map erase() method this method removes only one value from the container. - \exception not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - \param value The value which will be removed from the container. \return 1 if the value was removed, 0 otherwise. + + \qbk{ + [heading Exception-safety] + not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + } */ inline size_type remove(value_type const& value) { @@ -446,13 +490,16 @@ public: to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. - \exception not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - \param first The beginning of the range of values. \param last The end of the range of values. \return The number of removed values. + + \qbk{ + [heading Exception-safety] + not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + } */ template inline size_type remove(Iterator first, Iterator last) @@ -470,12 +517,15 @@ public: it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values. - \exception not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - \param rng The range of values. \return The number of removed values. + + \qbk{ + [heading Exception-safety] + not safe - if this operation throws, the R-tree may be left in + an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + } */ template inline size_type remove(Range const& rng) @@ -490,10 +540,13 @@ public: /* Assign new elements to the rtree. This method replaces the content of the rtree. - \exception strong - \param first The beginning of the range of values. \param last The end of the range of values. + + \qbk{ + [heading Exception-safety] + strong + } */ /*template inline void assign(Iterator first, Iterator last) @@ -505,9 +558,12 @@ public: /* Assign new elements to the rtree. This method replaces the content of the rtree. - \exception strong - \param rng The range of values. + + \qbk{ + [heading Exception-safety] + strong + } */ /*template inline void assign(Range const& rng) @@ -527,13 +583,16 @@ public: or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple. - \exception strong - \param pred The spatial predicates or a Geometry. \param out_it The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container) \return The number of values found. + + \qbk{ + [heading Exception-safety] + strong + } */ template inline size_type spatial_query(Predicates const& pred, OutIter out_it) const @@ -562,13 +621,16 @@ public: MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). - \exception strong - \param dpred The distances predicates or a Point. \param v The reference to the object which will contain the result. \return The number of values found. + + \qbk{ + [heading Exception-safety] + strong + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, value_type & v) const @@ -598,13 +660,16 @@ public: or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple. - \exception strong - \param dpred The distances predicates or a Point. \param pred The spatial predicates or a Geometry \param v The reference to the object which will contain the result. \return The number of values found. + + \qbk{ + [heading Exception-safety] + strong + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -625,13 +690,16 @@ public: MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). - \exception strong - \param dpred The distances predicates or a Point. \param k The max number of values. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. \return The number of values found. + + \qbk{ + [heading Exception-safety] + strong + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, OutIter out_it) const @@ -661,14 +729,17 @@ public: or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple. - \exception strong - \param dpred The distances predicates or a Point \param k The max number of values. \param pred The spatial predicates or a Geometry. \param out_it The output iterator of the result range. E.g. a back_insert_iterator. \return The number of values found. + + \qbk{ + [heading Exception-safety] + strong + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const @@ -679,9 +750,12 @@ public: /*! \brief Returns the number of stored values. - \exception nothrow - \return The number of stored values. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline size_type size() const { @@ -691,9 +765,12 @@ public: /*! \brief Query if the container is empty. - \exception nothrow - \return true if the container is empty. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline bool empty() const { @@ -703,7 +780,10 @@ public: /*! \brief Removes all values stored in the container. - \exception nothrow. + \qbk{ + [heading Exception-safety] + nothrow + } */ inline void clear() { @@ -716,11 +796,14 @@ public: Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned. - \exception nothrow (if Indexable's CoordinateType copy assignment doesn't throw), - strong (if Indexable's CoordinateType copy assignment throws). - \return The box containing all values stored in the container or an invalid box if there are no values in the container. + + \qbk{ + [heading Exception-safety] + nothrow (if Indexable's CoordinateType copy assignment doesn't throw), + strong (if Indexable's CoordinateType copy assignment throws). + } */ inline box_type box() const { @@ -745,11 +828,14 @@ public: For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter. - \exception nothrow. - \param vori The value or indexable which will be counted. \return The number of values found. + + \qbk{ + [heading Exception-safety] + nothrow + } */ template size_type count(ValueOrIndexable const& vori) const @@ -768,9 +854,12 @@ public: /*! \brief Returns parameters. - \exception nothrow. - \return The parameters object. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline parameters_type const& parameters() const { @@ -780,9 +869,12 @@ public: /*! \brief Returns the translator object. - \exception nothrow. - \return The translator object. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline translator_type const& translator() const { @@ -792,9 +884,12 @@ public: /*! \brief Returns allocator used by the rtree. - \exception nothrow - \return The allocator. + + \qbk{ + [heading Exception-safety] + nothrow + } */ allocator_type get_allocator() const { @@ -810,9 +905,12 @@ private: This function is not a part of the 'official' interface. However it makes possible e.g. to pass a visitor drawing the tree structure. - \exception the same as Visitor::operator(). - \param visitor The visitor object. + + \qbk{ + [heading Exception-safety] + the same as Visitor::operator(). + } */ template inline void apply_visitor(Visitor & visitor) const @@ -826,9 +924,12 @@ private: This function is not a part of the 'official' interface. - \exception nothrow - \return The number of stored objects. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline size_type values_count() const { @@ -840,9 +941,12 @@ private: This function is not a part of the 'official' interface. - \exception nothrow. - \return The depth of the R-tree. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline size_type depth() const { @@ -855,9 +959,12 @@ private: \brief Insert a value to the index. - \exception basic - \param value The value which will be stored in the container. + + \qbk{ + [heading Exception-safety] + basic + } */ inline void raw_insert(value_type const& value) { @@ -884,9 +991,12 @@ private: /*! \brief Remove the value from the container. - \exception basic - \param value The value which will be removed from the container. + + \qbk{ + [heading Exception-safety] + basic + } */ inline size_type raw_remove(value_type const& value) { @@ -914,7 +1024,10 @@ private: /*! \brief Create an empty R-tree i.e. new empty root node and clear other attributes. - \exception strong. + \qbk{ + [heading Exception-safety] + strong + } */ inline void raw_create() { @@ -928,9 +1041,12 @@ private: /*! \brief Destroy the R-tree i.e. all nodes and clear attributes. - \exception nothrow. - \param t The container which is going to be destroyed. + + \qbk{ + [heading Exception-safety] + nothrow + } */ inline void raw_destroy(rtree & t) { @@ -949,10 +1065,13 @@ private: \brief Copy the R-tree i.e. whole nodes structure, values and other attributes. It uses destination's allocators to create the new structure. - \exception strong. - \param src The source R-tree. \param dst The destination R-tree. + + \qbk{ + [heading Exception-safety] + strong + } */ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { @@ -984,7 +1103,10 @@ private: /*! \brief Find one value meeting distances and spatial predicates. - \exception strong. + \qbk{ + [heading Exception-safety] + strong + } */ template inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -1022,7 +1144,10 @@ private: /*! \brief Find k values meeting distances and spatial predicates. - \exception strong. + \qbk{ + [heading Exception-safety] + strong + } */ template inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const From f63be3858347c9fd8b937e5cee8d16faf414973f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 15:32:33 +0000 Subject: [PATCH 260/366] rtree methods description: \qbk{} alias changed to manual \xmlonly...\endxmlonly [SVN r82404] --- doc/html/geometry_index/r_tree/index.html | 221 +++++++++++++++- doc/html/index.html | 2 +- .../geometry/extensions/index/rtree/rtree.hpp | 246 ++++++++++++------ 3 files changed, 383 insertions(+), 86 deletions(-) diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index 24c967a08..d4965fd53 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,7 @@ boost::geometry::index::rtree

      - + The R-tree spatial index.

      @@ -364,8 +364,7 @@ The R-tree spatial index.

    - The copy constructor. It uses Parameters and translator from - the source tree. + The copy constructor.

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -945,6 +951,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + strong +


    @@ -1073,6 +1086,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + strong +


    @@ -1097,6 +1117,13 @@ The R-tree spatial index.

    ~rtree()

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -1169,6 +1196,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + strong +


    @@ -1260,6 +1294,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + strong +


    @@ -1331,6 +1372,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + nothrow +


    @@ -1403,6 +1451,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + strong +


    @@ -1474,6 +1529,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + nothrow (if allocators are equal), strong (if allocators aren't equal) +


    @@ -1545,6 +1607,13 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + nothrow +


    @@ -1615,6 +1684,15 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +


    @@ -1705,6 +1783,15 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +


    @@ -1777,6 +1864,15 @@ The R-tree spatial index. +

    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +


    @@ -1855,6 +1951,15 @@ The R-tree spatial index.

    1 if the value was removed, 0 otherwise.

    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +


    @@ -1955,6 +2060,15 @@ The R-tree spatial index.

    The number of removed values.

    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +


    @@ -2036,6 +2150,15 @@ The R-tree spatial index.

    The number of removed values.

    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +


    @@ -2139,6 +2262,13 @@ The R-tree spatial index.

    The number of values found.

    +
    + + Exception-safety +
    +

    + strong +


    @@ -2247,6 +2377,13 @@ The R-tree spatial index.

    The number of values found.

    +
    + + Exception-safety +
    +

    + strong +


    @@ -2382,6 +2519,13 @@ The R-tree spatial index.

    The number of values found.

    +
    + + Exception-safety +
    +

    + strong +


    @@ -2509,6 +2653,13 @@ The R-tree spatial index.

    The number of values found.

    +
    + + Exception-safety +
    +

    + strong +


    @@ -2664,6 +2815,13 @@ The R-tree spatial index.

    The number of values found.

    +
    + + Exception-safety +
    +

    + strong +


    @@ -2695,6 +2853,13 @@ The R-tree spatial index.

    The number of stored values.

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -2726,6 +2891,13 @@ The R-tree spatial index.

    true if the container is empty.

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -2750,6 +2922,13 @@ The R-tree spatial index.

    void clear()

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -2783,6 +2962,14 @@ The R-tree spatial index. The box containing all values stored in the container or an invalid box if there are no values in the container.

    +
    + + Exception-safety +
    +

    + nothrow (if Indexable's CoordinateType copy assignment doesn't throw), + strong (if Indexable's CoordinateType copy assignment throws). +


    @@ -2864,6 +3051,13 @@ The R-tree spatial index.

    The number of values found.

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -2895,6 +3089,13 @@ The R-tree spatial index.

    The parameters object.

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -2926,6 +3127,13 @@ The R-tree spatial index.

    The translator object.

    +
    + + Exception-safety +
    +

    + nothrow +


    @@ -2957,6 +3165,13 @@ The R-tree spatial index.

    The allocator.

    +
    + + Exception-safety +
    +

    + nothrow +


    diff --git a/doc/html/index.html b/doc/html/index.html index 747fd4f5b..510891ead 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@ - +

    Last revised: January 08, 2013 at 14:30:11 GMT

    Last revised: January 08, 2013 at 15:23:33 GMT


    diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 76c2fb9d4..bd66489c6 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -128,10 +128,12 @@ public: \param translator The translator object. \param allocator The allocator object. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline explicit rtree(parameters_type parameters = parameters_type(), translator_type const& translator = translator_type(), @@ -153,10 +155,12 @@ public: \param translator The translator object. \param allocator The allocator object. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline rtree(Iterator first, Iterator last, @@ -189,10 +193,12 @@ public: \param translator The translator object. \param allocator The allocator object. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline explicit rtree(Range const& rng, @@ -220,10 +226,12 @@ public: /*! \brief The destructor. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline ~rtree() { @@ -237,10 +245,12 @@ public: \param src The rtree which content will be copied. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -263,10 +273,12 @@ public: \param src The rtree which content will be copied. \param allocator The allocator which will be used. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ inline rtree(rtree const& src, allocator_type const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -286,10 +298,12 @@ public: \param src The rtree which content will be moved. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline rtree(BOOST_RV_REF(rtree) src) // TODO - use boost::move() @@ -312,10 +326,12 @@ public: \param src The rtree which content will be copied. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -337,10 +353,12 @@ public: \param src The rtree which content will be moved. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow (if allocators are equal), strong (if allocators aren't equal) - } + + \endxmlonly */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -380,10 +398,12 @@ public: \param other The rtree which content will be swapped with this rtree content. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ void swap(rtree & other) { @@ -403,11 +423,13 @@ public: \param value The value which will be stored in the container. - \qbk{ + \xmlonly + [heading Exception-safety] not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } + + \endxmlonly */ inline void insert(value_type const& value) { @@ -423,11 +445,13 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. - \qbk{ + \xmlonly + [heading Exception-safety] not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } + + \endxmlonly */ template inline void insert(Iterator first, Iterator last) @@ -444,11 +468,13 @@ public: \param rng The range of values. - \qbk{ + \xmlonly + [heading Exception-safety] not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } + + \endxmlonly */ template inline void insert(Range const& rng) @@ -471,11 +497,13 @@ public: \return 1 if the value was removed, 0 otherwise. - \qbk{ + \xmlonly + [heading Exception-safety] not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } + + \endxmlonly */ inline size_type remove(value_type const& value) { @@ -495,11 +523,13 @@ public: \return The number of removed values. - \qbk{ + \xmlonly + [heading Exception-safety] not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } + + \endxmlonly */ template inline size_type remove(Iterator first, Iterator last) @@ -521,11 +551,13 @@ public: \return The number of removed values. - \qbk{ + \xmlonly + [heading Exception-safety] not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } + + \endxmlonly */ template inline size_type remove(Range const& rng) @@ -543,10 +575,12 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ /*template inline void assign(Iterator first, Iterator last) @@ -560,10 +594,12 @@ public: \param rng The range of values. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ /*template inline void assign(Range const& rng) @@ -589,10 +625,12 @@ public: \return The number of values found. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline size_type spatial_query(Predicates const& pred, OutIter out_it) const @@ -627,10 +665,12 @@ public: \return The number of values found. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline size_type nearest_query(DistancesPredicates const& dpred, value_type & v) const @@ -666,10 +706,12 @@ public: \return The number of values found. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline size_type nearest_query(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -696,10 +738,12 @@ public: \return The number of values found. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, OutIter out_it) const @@ -736,10 +780,12 @@ public: \return The number of values found. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const @@ -752,10 +798,12 @@ public: \return The number of stored values. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline size_type size() const { @@ -767,10 +815,12 @@ public: \return true if the container is empty. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline bool empty() const { @@ -780,10 +830,12 @@ public: /*! \brief Removes all values stored in the container. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline void clear() { @@ -799,11 +851,13 @@ public: \return The box containing all values stored in the container or an invalid box if there are no values in the container. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow (if Indexable's CoordinateType copy assignment doesn't throw), strong (if Indexable's CoordinateType copy assignment throws). - } + + \endxmlonly */ inline box_type box() const { @@ -832,10 +886,12 @@ public: \return The number of values found. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ template size_type count(ValueOrIndexable const& vori) const @@ -856,10 +912,12 @@ public: \return The parameters object. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline parameters_type const& parameters() const { @@ -871,10 +929,12 @@ public: \return The translator object. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline translator_type const& translator() const { @@ -886,10 +946,12 @@ public: \return The allocator. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ allocator_type get_allocator() const { @@ -907,10 +969,12 @@ private: \param visitor The visitor object. - \qbk{ + \xmlonly + [heading Exception-safety] the same as Visitor::operator(). - } + + \endxmlonly */ template inline void apply_visitor(Visitor & visitor) const @@ -926,10 +990,12 @@ private: \return The number of stored objects. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline size_type values_count() const { @@ -943,10 +1009,12 @@ private: \return The depth of the R-tree. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline size_type depth() const { @@ -961,10 +1029,12 @@ private: \param value The value which will be stored in the container. - \qbk{ + \xmlonly + [heading Exception-safety] basic - } + + \endxmlonly */ inline void raw_insert(value_type const& value) { @@ -993,10 +1063,12 @@ private: \param value The value which will be removed from the container. - \qbk{ + \xmlonly + [heading Exception-safety] basic - } + + \endxmlonly */ inline size_type raw_remove(value_type const& value) { @@ -1024,10 +1096,12 @@ private: /*! \brief Create an empty R-tree i.e. new empty root node and clear other attributes. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ inline void raw_create() { @@ -1043,10 +1117,12 @@ private: \param t The container which is going to be destroyed. - \qbk{ + \xmlonly + [heading Exception-safety] nothrow - } + + \endxmlonly */ inline void raw_destroy(rtree & t) { @@ -1068,10 +1144,12 @@ private: \param src The source R-tree. \param dst The destination R-tree. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { @@ -1103,10 +1181,12 @@ private: /*! \brief Find one value meeting distances and spatial predicates. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -1144,10 +1224,12 @@ private: /*! \brief Find k values meeting distances and spatial predicates. - \qbk{ + \xmlonly + [heading Exception-safety] strong - } + + \endxmlonly */ template inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const From 81e43183a5fb6d8985c364f29562af420e9c4cc2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 15:54:30 +0000 Subject: [PATCH 261/366] Added cos_output_style to doxygen_xml2_qbk tool. Detail member description output slightly changed. [SVN r82405] --- doc/html/geometry_index/r_tree/index.html | 195 +++++++++--------- doc/html/index.html | 2 +- doc/make_qbk.py | 1 + .../tools/doxygen_xml2qbk/configuration.hpp | 1 + .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 9 +- .../doxygen_xml2qbk/quickbook_output.hpp | 11 +- .../geometry/extensions/index/rtree/rtree.hpp | 12 +- 7 files changed, 117 insertions(+), 114 deletions(-) diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index d4965fd53..a9be6e8e1 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -700,15 +700,11 @@ The R-tree spatial index. -
    - - Description -

    The constructor.

    - + Synopsis

    @@ -719,7 +715,7 @@ The R-tree spatial index.

    - + Parameters
    @@ -800,7 +796,7 @@ The R-tree spatial index.
    - + Exception-safety

    @@ -815,15 +811,11 @@ The R-tree spatial index. rtree(Iterator, Iterator) -

    - - Description -

    The constructor.

    - + Synopsis

    @@ -837,7 +829,7 @@ The R-tree spatial index.

    - + Parameters
    @@ -952,7 +944,7 @@ The R-tree spatial index.
    - + Exception-safety

    @@ -967,15 +959,11 @@ The R-tree spatial index. rtree(Range const &) -

    - - Description -

    The constructor.

    - + Synopsis

    @@ -988,7 +976,7 @@ The R-tree spatial index.

    - + Parameters
    @@ -1087,7 +1075,7 @@ The R-tree spatial index.
    - + Exception-safety

    @@ -1101,15 +1089,11 @@ The R-tree spatial index.

    -
    - - Description -

    The destructor.

    - + Synopsis

    @@ -1118,7 +1102,7 @@ The R-tree spatial index.

    - + Exception-safety

    @@ -1133,13 +1117,15 @@ The R-tree spatial index. rtree(rtree const &) +

    + The copy constructor. +

    Description

    - The copy constructor. It uses parameters, translator and allocator from - the source tree. + It uses parameters, translator and allocator from the source tree.

    @@ -1212,13 +1198,15 @@ The R-tree spatial index. rtree(rtree const &, allocator_type const &)
    +

    + The copy constructor. +

    Description

    - The copy constructor. It uses Parameters and translator from the source - tree. + It uses Parameters and translator from the source tree.

    @@ -1310,13 +1298,15 @@ The R-tree spatial index. rtree(rtree &&)
    +

    + The moving constructor. +

    Description

    - The moving constructor. It uses parameters, translator and allocator - from the source tree. + It uses parameters, translator and allocator from the source tree.

    @@ -1388,13 +1378,15 @@ The R-tree spatial index. operator=(const rtree &)
    +

    + The assignment operator. +

    Description

    - The assignment operator. It uses parameters and translator from the source - tree. + It uses parameters and translator from the source tree.

    @@ -1467,13 +1459,15 @@ The R-tree spatial index. operator=(rtree &&)
    +

    + The moving assignment. +

    Description

    - The moving assignment. It uses parameters and translator from the source - tree. + It uses parameters and translator from the source tree.

    @@ -1545,13 +1539,15 @@ The R-tree spatial index. swap(rtree &)
    +

    + Swaps contents of two rtrees. +

    Description

    - Swaps contents of two rtrees. Parameters, translator and allocators are - swapped as well. + Parameters, translator and allocators are swapped as well.

    @@ -1623,15 +1619,11 @@ The R-tree spatial index. insert(value_type const &)
    -
    - - Description -

    Insert a value to the index.

    - + Synopsis

    @@ -1640,7 +1632,7 @@ The R-tree spatial index.

    - + Parameters
    @@ -1685,7 +1677,7 @@ The R-tree spatial index.
    - + Exception-safety

    @@ -1702,15 +1694,11 @@ The R-tree spatial index. insert(Iterator, Iterator) -

    - - Description -

    Insert a range of values to the index.

    - + Synopsis

    @@ -1720,7 +1708,7 @@ The R-tree spatial index.

    - + Parameters
    @@ -1784,7 +1772,7 @@ The R-tree spatial index.
    - + Exception-safety

    @@ -1801,15 +1789,11 @@ The R-tree spatial index. insert(Range const &) -

    - - Description -

    Insert a range of values to the index.

    - + Synopsis

    @@ -1819,7 +1803,7 @@ The R-tree spatial index.

    - + Parameters
    @@ -1865,7 +1849,7 @@ The R-tree spatial index.
    - + Exception-safety

    @@ -1882,6 +1866,9 @@ The R-tree spatial index. remove(value_type const &) +

    + Remove a value from the container. +

    Description @@ -1969,6 +1956,9 @@ The R-tree spatial index. remove(Iterator, Iterator)
    +

    + Remove a range of values from the container. +

    Description @@ -2078,6 +2068,9 @@ The R-tree spatial index. remove(Range const &)
    +

    + Remove a range of values from the container. +

    Description @@ -2168,6 +2161,9 @@ The R-tree spatial index. spatial_query(Predicates const &, OutIter)
    +

    + Finds values meeting spatial predicates, e.g. intersecting some Box. +

    Description @@ -2278,6 +2274,9 @@ The R-tree spatial index. nearest_query(DistancesPredicates const &, value_type &)
    +

    + Finds one value meeting distances predicates, e.g. nearest to some Point. +

    Description @@ -2393,6 +2392,10 @@ The R-tree spatial index. nearest_query(DistancesPredicates const &, Predicates const &, value_type &)
    +

    + Finds one value meeting distances predicates and spatial predicates, + e.g. nearest to some Point and intersecting some Box. +

    Description @@ -2535,6 +2538,10 @@ The R-tree spatial index. nearest_query(DistancesPredicates const &, size_t, OutIter)
    +

    + Finds k values meeting distances predicates, e.g. k nearest values to + some Point. +

    Description @@ -2669,6 +2676,10 @@ The R-tree spatial index. nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter)
    +

    + Finds k values meeting distances predicates and spatial predicates, e.g. + k nearest values to some Point and intersecting some Box. +

    Description @@ -2830,15 +2841,11 @@ The R-tree spatial index. -
    - - Description -

    Returns the number of stored values.

    - + Synopsis

    @@ -2847,14 +2854,14 @@ The R-tree spatial index.

    - + Returns

    The number of stored values.

    - + Exception-safety

    @@ -2868,15 +2875,11 @@ The R-tree spatial index.

    -
    - - Description -

    Query if the container is empty.

    - + Synopsis

    @@ -2885,14 +2888,14 @@ The R-tree spatial index.

    - + Returns

    true if the container is empty.

    - + Exception-safety

    @@ -2906,15 +2909,11 @@ The R-tree spatial index.

    -
    - - Description -

    Removes all values stored in the container.

    - + Synopsis

    @@ -2923,7 +2922,7 @@ The R-tree spatial index.

    - + Exception-safety

    @@ -2937,6 +2936,9 @@ The R-tree spatial index.

    +

    + Returns the box containing all values stored in the container. +

    Description @@ -2979,6 +2981,9 @@ The R-tree spatial index. count(ValueOrIndexable const &)
    +

    + Count Values or Indexables stored in the container. +

    Description @@ -3066,15 +3071,11 @@ The R-tree spatial index. -
    - - Description -

    Returns parameters.

    - + Synopsis

    @@ -3083,14 +3084,14 @@ The R-tree spatial index.

    - + Returns

    The parameters object.

    - + Exception-safety

    @@ -3104,15 +3105,11 @@ The R-tree spatial index.

    -
    - - Description -

    Returns the translator object.

    - + Synopsis

    @@ -3121,14 +3118,14 @@ The R-tree spatial index.

    - + Returns

    The translator object.

    - + Exception-safety

    @@ -3142,15 +3139,11 @@ The R-tree spatial index.

    -
    - - Description -

    Returns allocator used by the rtree.

    - + Synopsis

    @@ -3159,14 +3152,14 @@ The R-tree spatial index.

    - + Returns

    The allocator.

    - + Exception-safety

    diff --git a/doc/html/index.html b/doc/html/index.html index 510891ead..644cc71bb 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@ - +

    Last revised: January 08, 2013 at 15:23:33 GMT

    Last revised: January 08, 2013 at 15:52:09 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index fc48d6b5c..07bc750a8 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -14,6 +14,7 @@ cmd = "doxygen_xml2qbk" cmd = cmd + " --xml xml/%s.xml" cmd = cmd + " --start_include ." cmd = cmd + " --index_id_path %s" +cmd = cmd + " --cos_output_style alt" cmd = cmd + " > generated/%s.qbk" os.system("doxygen Doxyfile") diff --git a/doc/src/tools/doxygen_xml2qbk/configuration.hpp b/doc/src/tools/doxygen_xml2qbk/configuration.hpp index ff73674d7..e9ce191ae 100644 --- a/doc/src/tools/doxygen_xml2qbk/configuration.hpp +++ b/doc/src/tools/doxygen_xml2qbk/configuration.hpp @@ -28,6 +28,7 @@ struct configuration std::string skip_namespace; + std::string cos_output_style; std::string index_id_path; }; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp index 25bd93146..6d6e60a4e 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -75,6 +75,9 @@ int main(int argc, char** argv) "Namespace to skip (e.g. boost::mylib::") ("copyright", po::value(©right_filename), "Name of QBK file including (commented) copyright and license") + + ("cos_output_style", po::value(&config.cos_output_style), + "Class or struct docbook output style. Value:'alt'") ("index_id_path", po::value(&config.index_id_path), "The QBK index ID path") ; @@ -168,7 +171,11 @@ int main(int argc, char** argv) if (! doc.cos.name.empty()) { std::sort(doc.cos.functions.begin(), doc.cos.functions.end(), sort_on_line()); - quickbook_output(doc.cos, config, std::cout, quickbook_output_cos_alt()); + + if ( config.cos_output_style == "alt" ) + quickbook_output(doc.cos, config, std::cout, quickbook_output_cos_alt()); + else + quickbook_output(doc.cos, config, std::cout, 0); } } diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 842d004d8..73b9d65e3 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -730,17 +730,18 @@ void quickbook_output_detail_member(class_or_struct const& cos, out << "[section:member" << i << " " << ss.str() << "]" << std::endl; - if ( !f.detailed_description.empty() || !f.brief_description.empty() ) + out << f.brief_description; + + if ( !f.detailed_description.empty() ) { out << "[heading Description]" << std::endl; - if ( !f.detailed_description.empty() ) - out << f.detailed_description; - else - out << f.brief_description; + out << f.detailed_description; } + quickbook_markup(f.qbk_markup, markup_before, markup_synopsis, out); out << "[heading Synopsis]" << std::endl; quickbook_synopsis(f, out, true, true); + quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out); if ( !f.parameters.empty() ) { diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index bd66489c6..b68530ab0 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -241,7 +241,7 @@ public: /*! \brief The copy constructor. - The copy constructor. It uses parameters, translator and allocator from the source tree. + It uses parameters, translator and allocator from the source tree. \param src The rtree which content will be copied. @@ -268,7 +268,7 @@ public: /*! \brief The copy constructor. - The copy constructor. It uses Parameters and translator from the source tree. + It uses Parameters and translator from the source tree. \param src The rtree which content will be copied. \param allocator The allocator which will be used. @@ -294,7 +294,7 @@ public: /*! \brief The moving constructor. - The moving constructor. It uses parameters, translator and allocator from the source tree. + It uses parameters, translator and allocator from the source tree. \param src The rtree which content will be moved. @@ -322,7 +322,7 @@ public: /*! \brief The assignment operator. - The assignment operator. It uses parameters and translator from the source tree. + It uses parameters and translator from the source tree. \param src The rtree which content will be copied. @@ -349,7 +349,7 @@ public: /*! \brief The moving assignment. - The moving assignment. It uses parameters and translator from the source tree. + It uses parameters and translator from the source tree. \param src The rtree which content will be moved. @@ -394,7 +394,7 @@ public: /*! \brief Swaps contents of two rtrees. - Swaps contents of two rtrees. Parameters, translator and allocators are swapped as well. + Parameters, translator and allocators are swapped as well. \param other The rtree which content will be swapped with this rtree content. From bd3dc677b5c297023dd403fac23a15e965eeef80 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 17:45:27 +0000 Subject: [PATCH 262/366] \bgi_exception{} alias used. [SVN r82407] --- doc/Doxyfile | 2 +- doc/html/geometry_index/r_tree/index.html | 2 +- doc/html/index.html | 2 +- .../geometry/extensions/index/rtree/rtree.hpp | 291 ++++++------------ 4 files changed, 89 insertions(+), 208 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 36e493d78..b6153ae9c 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -203,7 +203,7 @@ TAB_SIZE = 8 # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = +ALIASES = bgi_exception{1}="\xmlonly [heading Exception-safety] \1 \endxmlonly \htmlonly
    Exception-safety
    \1
    \endhtmlonly \latexonly \begin{DoxyReturn}{Exception-safety} \1 \end{DoxyReturn} \endlatexonly" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html index a9be6e8e1..a18d7704f 100644 --- a/doc/html/geometry_index/r_tree/index.html +++ b/doc/html/geometry_index/r_tree/index.html @@ -31,7 +31,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    diff --git a/doc/html/index.html b/doc/html/index.html index 644cc71bb..ea50d3b3a 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@ - +

    Last revised: January 08, 2013 at 15:52:09 GMT

    Last revised: January 08, 2013 at 17:43:46 GMT


    diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index b68530ab0..0f1ef1091 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -128,12 +128,9 @@ public: \param translator The translator object. \param allocator The allocator object. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline explicit rtree(parameters_type parameters = parameters_type(), translator_type const& translator = translator_type(), @@ -155,12 +152,9 @@ public: \param translator The translator object. \param allocator The allocator object. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline rtree(Iterator first, Iterator last, @@ -193,12 +187,9 @@ public: \param translator The translator object. \param allocator The allocator object. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline explicit rtree(Range const& rng, @@ -226,12 +217,9 @@ public: /*! \brief The destructor. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline ~rtree() { @@ -245,12 +233,9 @@ public: \param src The rtree which content will be copied. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -273,12 +258,9 @@ public: \param src The rtree which content will be copied. \param allocator The allocator which will be used. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ inline rtree(rtree const& src, allocator_type const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -298,12 +280,9 @@ public: \param src The rtree which content will be moved. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline rtree(BOOST_RV_REF(rtree) src) // TODO - use boost::move() @@ -326,12 +305,9 @@ public: \param src The rtree which content will be copied. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -353,12 +329,9 @@ public: \param src The rtree which content will be moved. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow (if allocators are equal), strong (if allocators aren't equal) - - \endxmlonly + } */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -398,12 +371,9 @@ public: \param other The rtree which content will be swapped with this rtree content. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ void swap(rtree & other) { @@ -423,13 +393,10 @@ public: \param value The value which will be stored in the container. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - - \endxmlonly + } */ inline void insert(value_type const& value) { @@ -445,13 +412,10 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - - \endxmlonly + } */ template inline void insert(Iterator first, Iterator last) @@ -468,13 +432,10 @@ public: \param rng The range of values. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - - \endxmlonly + } */ template inline void insert(Range const& rng) @@ -497,13 +458,10 @@ public: \return 1 if the value was removed, 0 otherwise. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - - \endxmlonly + } */ inline size_type remove(value_type const& value) { @@ -523,13 +481,10 @@ public: \return The number of removed values. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - - \endxmlonly + } */ template inline size_type remove(Iterator first, Iterator last) @@ -551,13 +506,10 @@ public: \return The number of removed values. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ not safe - if this operation throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - - \endxmlonly + } */ template inline size_type remove(Range const& rng) @@ -575,12 +527,9 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ /*template inline void assign(Iterator first, Iterator last) @@ -594,12 +543,9 @@ public: \param rng The range of values. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ /*template inline void assign(Range const& rng) @@ -625,12 +571,9 @@ public: \return The number of values found. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline size_type spatial_query(Predicates const& pred, OutIter out_it) const @@ -665,12 +608,9 @@ public: \return The number of values found. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, value_type & v) const @@ -706,12 +646,9 @@ public: \return The number of values found. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -738,12 +675,9 @@ public: \return The number of values found. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, OutIter out_it) const @@ -780,12 +714,9 @@ public: \return The number of values found. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const @@ -798,12 +729,9 @@ public: \return The number of stored values. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline size_type size() const { @@ -815,12 +743,9 @@ public: \return true if the container is empty. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline bool empty() const { @@ -830,12 +755,9 @@ public: /*! \brief Removes all values stored in the container. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline void clear() { @@ -851,13 +773,10 @@ public: \return The box containing all values stored in the container or an invalid box if there are no values in the container. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow (if Indexable's CoordinateType copy assignment doesn't throw), strong (if Indexable's CoordinateType copy assignment throws). - - \endxmlonly + } */ inline box_type box() const { @@ -886,12 +805,9 @@ public: \return The number of values found. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ template size_type count(ValueOrIndexable const& vori) const @@ -912,12 +828,9 @@ public: \return The parameters object. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline parameters_type const& parameters() const { @@ -929,12 +842,9 @@ public: \return The translator object. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline translator_type const& translator() const { @@ -946,12 +856,9 @@ public: \return The allocator. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ allocator_type get_allocator() const { @@ -969,12 +876,9 @@ private: \param visitor The visitor object. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ the same as Visitor::operator(). - - \endxmlonly + } */ template inline void apply_visitor(Visitor & visitor) const @@ -990,12 +894,9 @@ private: \return The number of stored objects. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline size_type values_count() const { @@ -1009,12 +910,9 @@ private: \return The depth of the R-tree. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline size_type depth() const { @@ -1029,12 +927,9 @@ private: \param value The value which will be stored in the container. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ basic - - \endxmlonly + } */ inline void raw_insert(value_type const& value) { @@ -1063,12 +958,9 @@ private: \param value The value which will be removed from the container. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ basic - - \endxmlonly + } */ inline size_type raw_remove(value_type const& value) { @@ -1096,12 +988,9 @@ private: /*! \brief Create an empty R-tree i.e. new empty root node and clear other attributes. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ inline void raw_create() { @@ -1117,12 +1006,9 @@ private: \param t The container which is going to be destroyed. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ nothrow - - \endxmlonly + } */ inline void raw_destroy(rtree & t) { @@ -1144,12 +1030,9 @@ private: \param src The source R-tree. \param dst The destination R-tree. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { @@ -1181,12 +1064,9 @@ private: /*! \brief Find one value meeting distances and spatial predicates. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -1224,12 +1104,9 @@ private: /*! \brief Find k values meeting distances and spatial predicates. - \xmlonly - - [heading Exception-safety] + \bgi_exception{ strong - - \endxmlonly + } */ template inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const @@ -1274,6 +1151,10 @@ private: node * m_root; }; +/*! +\defgroup rtree_functions Global functions +*/ + /*! \brief Insert a value to the index. From a127e0eb70b1d9eec15fe80fcc79ce6b930522d3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 23:03:43 +0000 Subject: [PATCH 263/366] Added rtree group to src description and free functions to reference. Some changed in doxygen_xml2qbk - group handling, parameters changes etc. [SVN r82411] --- doc/html/geometry_index/r_tree.html | 9 +- .../r_tree/exception_safety.html | 424 -- doc/html/geometry_index/r_tree/index.html | 3187 ---------- .../r_tree/nearest_neighbours_queries.html | 6 +- doc/html/geometry_index/r_tree/reference.html | 5102 +++++++++++++++++ doc/html/index.html | 5 +- doc/make_qbk.py | 5 +- doc/rtree.qbk | 5 +- .../tools/doxygen_xml2qbk/configuration.hpp | 2 +- .../doxygen_xml2qbk/doxygen_elements.hpp | 3 + .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 53 +- .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 4 + .../doxygen_xml2qbk/quickbook_output.hpp | 123 +- .../geometry/extensions/index/rtree/rtree.hpp | 40 +- 14 files changed, 5282 insertions(+), 3686 deletions(-) delete mode 100644 doc/html/geometry_index/r_tree/exception_safety.html delete mode 100644 doc/html/geometry_index/r_tree/index.html create mode 100644 doc/html/geometry_index/r_tree/reference.html diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 7c2eedefc..a33049cd4 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -74,9 +74,12 @@
    Using spatial predicates
    -
    Exception safety
    -
    Reference
    -
    boost::geometry::index::rtree
    +
    Reference
    +
    +
    boost::geometry::index::rtree
    +
    boost::geometry::index::rtree + - global functions
    +
    diff --git a/doc/html/geometry_index/r_tree/exception_safety.html b/doc/html/geometry_index/r_tree/exception_safety.html deleted file mode 100644 index fd669c9c6..000000000 --- a/doc/html/geometry_index/r_tree/exception_safety.html +++ /dev/null @@ -1,424 +0,0 @@ - - - -Exception safety - - - - - - - - -
    - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

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

    -
      -
    • - exception-safe copy constructor and copy assignment of the Value. -
    • -
    • - exception-safe copy constructor and copy assignment of the CoordinateType used in the Indexable. -
    • -
    • - nonthrowing copy constructor of the Translator. -
    • -
    • - nonthrowing destructors of above types. -
    • -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Operation -

    -
    -

    - exception-safety -

    -
    -

    - rtree() -

    -
    -

    - nothrow -

    -
    -

    - rtree(Iterator, - Iterator) -

    -
    -

    - strong -

    -
    -

    - ~rtree() -

    -
    -

    - nothrow -

    -
    - -
    -

    - rtree(rtree const&) -

    -
    -

    - strong -

    -
    -

    - operator=(rtree const&) -

    -
    -

    - strong -

    -
    - -
    -

    - rtree(rtree &&) -

    -
    -

    - nothrow -

    -
    -

    - operator=(rtree &&) -

    -
    -

    - nothrow or strong - [a] -

    -
    -

    - swap(rtree &) -

    -
    -

    - nothrow -

    -
    - -
    -

    - insert(Value) -

    -
    -

    - not safe [b] -

    -
    -

    - insert(Iterator, - Iterator) -

    -
    -

    - not safe -

    -
    -

    - insert(Range) -

    -
    -

    - not safe -

    -
    -

    - remove(Value) -

    -
    -

    - not safe -

    -
    -

    - remove(Iterator, - Iterator) -

    -
    -

    - not safe -

    -
    -

    - remove(Range) -

    -
    -

    - not safe -

    -
    -

    - clear() -

    -
    -

    - nothrow -

    -
    - -
    -

    - spatial_query(...) -

    -
    -

    - strong -

    -
    -

    - nearest_query(...) -

    -
    -

    - strong -

    -
    -

    - count(ValueOrIndexable) -

    -
    -

    - nothrow -

    -
    - -
    -

    - size() -

    -
    -

    - nothrow -

    -
    -

    - empty() -

    -
    -

    - nothrow -

    -
    -

    - box() -

    -
    -

    - nothrow or strong - [c] -

    -
    - -
    -

    - get_allocator() -

    -
    -

    - nothrow -

    -
    -

    - parameters() -

    -
    -

    - nothrow -

    -
    -

    - translator() -

    -
    -

    - nothrow -

    -
    -

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

    -

    [b] - If this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may - return invalid data. -

    -

    [c] - nothrow - if CoordinateType - has nonthrowing copy constructor, strong - - otherwise -

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/geometry_index/r_tree/index.html b/doc/html/geometry_index/r_tree/index.html deleted file mode 100644 index a18d7704f..000000000 --- a/doc/html/geometry_index/r_tree/index.html +++ /dev/null @@ -1,3187 +0,0 @@ - - - -Reference - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHome -
    -
    - - -
    - -

    - -The R-tree spatial index. -

    -
    - - Description -
    -

    - The R-tree spatial index. This is self-balancing spatial index capable - to store various types of Values and balancing algorithms. -

    -

    - The user must pass a type defining the Parameters which will be used in - rtree creation process. This type is used e.g. to specify balancing algorithm - with specific parameters like min and max number of elements in node. Predefined - algorithms with compile-time parameters are: bgi::linear<MinElements, - MaxElements>, bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, - MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements - * 0.3>. Predefined algorithms with run-time parameters are: bgi::runtime::linear, - bgi::runtime::quadratic, bgi::runtime::rstar. -

    -

    - The Translator translates from Value to Indexable each time r-tree requires - it. Which means that this operation is done for each Value access. Therefore - the Translator should return the Indexable by const reference instead of - a value. Default translator can translate all types adapted to Point or - Box concepts (which are Indexables). It also handles std::pair<Indexable, - T>, pointers, smart pointers, and iterators. E.g. If std::pair<Box, - int> is stored, the default translator translates from std::pair<Box, - int> const& to Box const&. -

    -
    - - Header -
    -

    - #include <.hpp> -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Value,
    -         typename Parameters,
    -         typename Translator = translator::def<Value>,
    -         typename Allocator = std::allocator<Value>>
    -class rtree
    -{
    -  // ...
    -};
    -
    -

    -

    -
    - - Template - parameter(s) -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Parameter -

    -
    -

    - Description -

    -
    -

    - Value -

    -
    -

    - The type of objects stored in the container. -

    -
    -

    - Parameters -

    -
    -

    - Compile-time parameters. -

    -
    -

    - Translator -

    -
    -

    - The type of the translator which translates from Value to Indexable. -

    -
    -

    - Allocator -

    -
    -

    - The allocator used to allocate/deallocate memory, construct/destroy - nodes and Values. -

    -
    -
    - - Typedef(s) -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Description -

    -
    -

    - value_type -

    -
    -

    - The type of Value stored in the container. -

    -
    -

    - parameters_type -

    -
    -

    - R-tree parameters type. -

    -
    -

    - translator_type -

    -
    -

    - Value to Indexable Translator type. -

    -
    -

    - allocator_type -

    -
    -

    - The type of allocator used by the container. -

    -
    -

    - size_type -

    -
    -

    - Unsigned integral type used by the container. -

    -
    -

    - indexable_type -

    -
    -

    - The Indexable type to which Value is translated. -

    -
    -

    - box_type -

    -
    -

    - The Box type used by the R-tree. -

    -
    -
    - - Constructor(s) - and destructor -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Function -

    -
    -

    - Description -

    -
    -

    - rtree() -

    -
    -

    - The constructor. -

    -
    -

    - rtree(Iterator, - Iterator) -

    -
    -

    - The constructor. -

    -
    -

    - rtree(Range const - &) -

    -
    -

    - The constructor. -

    -
    -

    - ~rtree() -

    -
    -

    - The destructor. -

    -
    -

    - rtree(rtree const - &) -

    -
    -

    - The copy constructor. -

    -
    -

    - rtree(rtree const - &, allocator_type - const &) -

    -
    -

    - The copy constructor. -

    -
    -

    - rtree(rtree &&) -

    -
    -

    - The moving constructor. -

    -
    -
    - - Member(s) -
    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Function -

    -
    -

    - Description -

    -
    -

    - operator=(const rtree - &) -

    -
    -

    - The assignment operator. -

    -
    -

    - operator=(rtree &&) -

    -
    -

    - The moving assignment. -

    -
    -

    - swap(rtree &) -

    -
    -

    - Swaps contents of two rtrees. -

    -
    -

    - insert(value_type const - &) -

    -
    -

    - Insert a value to the index. -

    -
    -

    - insert(Iterator, - Iterator) -

    -
    -

    - Insert a range of values to the index. -

    -
    -

    - insert(Range const - &) -

    -
    -

    - Insert a range of values to the index. -

    -
    -

    - remove(value_type const - &) -

    -
    -

    - Remove a value from the container. -

    -
    -

    - remove(Iterator, - Iterator) -

    -
    -

    - Remove a range of values from the container. -

    -
    -

    - remove(Range const - &) -

    -
    -

    - Remove a range of values from the container. -

    -
    -

    - spatial_query(Predicates const - &, OutIter) -

    -
    -

    - Finds values meeting spatial predicates, e.g. intersecting some - Box. -

    -
    -

    - nearest_query(DistancesPredicates const - &, value_type - &) -

    -
    -

    - Finds one value meeting distances predicates, e.g. nearest to - some Point. -

    -
    -

    - nearest_query(DistancesPredicates const - &, Predicates - const &, - value_type &) -

    -
    -

    - Finds one value meeting distances predicates and spatial predicates, - e.g. nearest to some Point and intersecting some Box. -

    -
    -

    - nearest_query(DistancesPredicates const - &, size_t, OutIter) -

    -
    -

    - Finds k values meeting distances predicates, e.g. k nearest values - to some Point. -

    -
    -

    - nearest_query(DistancesPredicates const - &, size_t, Predicates - const &, - OutIter) -

    -
    -

    - Finds k values meeting distances predicates and spatial predicates, - e.g. k nearest values to some Point and intersecting some Box. -

    -
    -

    - size() -

    -
    -

    - Returns the number of stored values. -

    -
    -

    - empty() -

    -
    -

    - Query if the container is empty. -

    -
    -

    - clear() -

    -
    -

    - Removes all values stored in the container. -

    -
    -

    - box() -

    -
    -

    - Returns the box containing all values stored in the container. -

    -
    -

    - count(ValueOrIndexable const - &) -

    -
    -

    - Count Values or Indexables stored in the container. -

    -
    -

    - parameters() -

    -
    -

    - Returns parameters. -

    -
    -

    - translator() -

    -
    -

    - Returns the translator object. -

    -
    -

    - get_allocator() -

    -
    -

    - Returns allocator used by the rtree. -

    -
    -

    -
    -

    -
    - -

    - The constructor. -

    -
    - - Synopsis -
    -

    -

    -
    rtree(parameters_type parameters = parameters_type(),
    -      translator_type const & translator = translator_type(),
    -      allocator_type allocator = allocator_type())
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - parameters_type -

    -
    -

    - parameters -

    -
    -

    - The parameters object. -

    -
    -

    - translator_type const & -

    -
    -

    - translator -

    -
    -

    - The translator object. -

    -
    -

    - allocator_type -

    -
    -

    - allocator -

    -
    -

    - The allocator object. -

    -
    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - The constructor. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Iterator>
    -rtree(Iterator first,
    -      Iterator last,
    -      parameters_type parameters = parameters_type(),
    -      translator_type const & translator = translator_type(),
    -      allocator_type allocator = allocator_type())
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Iterator -

    -
    -

    - first -

    -
    -

    - The beginning of the range of Values. -

    -
    -

    - Iterator -

    -
    -

    - last -

    -
    -

    - The end of the range of Values. -

    -
    -

    - parameters_type -

    -
    -

    - parameters -

    -
    -

    - The parameters object. -

    -
    -

    - translator_type const & -

    -
    -

    - translator -

    -
    -

    - The translator object. -

    -
    -

    - allocator_type -

    -
    -

    - allocator -

    -
    -

    - The allocator object. -

    -
    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - The constructor. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Range>
    -rtree(Range const & rng,
    -      parameters_type parameters = parameters_type(),
    -      translator_type const & translator = translator_type(),
    -      allocator_type allocator = allocator_type())
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Range const - & -

    -
    -

    - rng -

    -
    -

    - The range of Values. -

    -
    -

    - parameters_type -

    -
    -

    - parameters -

    -
    -

    - The parameters object. -

    -
    -

    - translator_type const & -

    -
    -

    - translator -

    -
    -

    - The translator object. -

    -
    -

    - allocator_type -

    -
    -

    - allocator -

    -
    -

    - The allocator object. -

    -
    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - The destructor. -

    -
    - - Synopsis -
    -

    -

    -
    ~rtree()
    -

    -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - The copy constructor. -

    -
    - - Description -
    -

    - It uses parameters, translator and allocator from the source tree. -

    -
    - - Synopsis -
    -

    -

    -
    rtree(rtree const & src)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - rtree const - & -

    -
    -

    - src -

    -
    -

    - The rtree which content will be copied. -

    -
    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - The copy constructor. -

    -
    - - Description -
    -

    - It uses Parameters and translator from the source tree. -

    -
    - - Synopsis -
    -

    -

    -
    rtree(rtree const & src, allocator_type const & allocator)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - rtree const - & -

    -
    -

    - src -

    -
    -

    - The rtree which content will be copied. -

    -
    -

    - allocator_type const & -

    -
    -

    - allocator -

    -
    -

    - The allocator which will be used. -

    -
    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - The moving constructor. -

    -
    - - Description -
    -

    - It uses parameters, translator and allocator from the source tree. -

    -
    - - Synopsis -
    -

    -

    -
    rtree(rtree && src)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - rtree && -

    -
    -

    - src -

    -
    -

    - The rtree which content will be moved. -

    -
    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - The assignment operator. -

    -
    - - Description -
    -

    - It uses parameters and translator from the source tree. -

    -
    - - Synopsis -
    -

    -

    -
    rtree & operator=(const rtree & src)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - const rtree - & -

    -
    -

    - src -

    -
    -

    - The rtree which content will be copied. -

    -
    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - The moving assignment. -

    -
    - - Description -
    -

    - It uses parameters and translator from the source tree. -

    -
    - - Synopsis -
    -

    -

    -
    rtree & operator=(rtree && src)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - rtree && -

    -
    -

    - src -

    -
    -

    - The rtree which content will be moved. -

    -
    -
    - - Exception-safety -
    -

    - nothrow (if allocators are equal), strong (if allocators aren't equal) -

    -
    -

    -
    -

    -
    - -

    - Swaps contents of two rtrees. -

    -
    - - Description -
    -

    - Parameters, translator and allocators are swapped as well. -

    -
    - - Synopsis -
    -

    -

    -
    void swap(rtree & other)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - rtree & -

    -
    -

    - other -

    -
    -

    - The rtree which content will be swapped with this rtree content. -

    -
    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - Insert a value to the index. -

    -
    - - Synopsis -
    -

    -

    -
    void insert(value_type const & value)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - value_type const & -

    -
    -

    - value -

    -
    -

    - The value which will be stored in the container. -

    -
    -
    - - Exception-safety -
    -

    - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. -

    -
    -

    -
    -

    -
    - -

    - Insert a range of values to the index. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Iterator>
    -void insert(Iterator first, Iterator last)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Iterator -

    -
    -

    - first -

    -
    -

    - The beginning of the range of values. -

    -
    -

    - Iterator -

    -
    -

    - last -

    -
    -

    - The end of the range of values. -

    -
    -
    - - Exception-safety -
    -

    - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. -

    -
    -

    -
    -

    -
    - -

    - Insert a range of values to the index. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Range>
    -void insert(Range const & rng)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Range const - & -

    -
    -

    - rng -

    -
    -

    - The range of values. -

    -
    -
    - - Exception-safety -
    -

    - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. -

    -
    -

    -
    -

    -
    - -

    - Remove a value from the container. -

    -
    - - Description -
    -

    - In contrast to the STL set/map erase() method this method removes only - one value from the container. -

    -
    - - Synopsis -
    -

    -

    -
    size_type remove(value_type const & value)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - value_type const & -

    -
    -

    - value -

    -
    -

    - The value which will be removed from the container. -

    -
    -
    - - Returns -
    -

    - 1 if the value was removed, 0 otherwise. -

    -
    - - Exception-safety -
    -

    - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. -

    -
    -

    -
    -

    -
    - -

    - Remove a range of values from the container. -

    -
    - - Description -
    -

    - In contrast to the STL set/map erase() method it doesn't take iterators - pointing to values stored in this container. It removes values equal - to these passed as a range. Furthermore this method removes only one - value for each one passed in the range, not all equal values. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Iterator>
    -size_type remove(Iterator first, Iterator last)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Iterator -

    -
    -

    - first -

    -
    -

    - The beginning of the range of values. -

    -
    -

    - Iterator -

    -
    -

    - last -

    -
    -

    - The end of the range of values. -

    -
    -
    - - Returns -
    -

    - The number of removed values. -

    -
    - - Exception-safety -
    -

    - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. -

    -
    -

    -
    -

    -
    - -

    - Remove a range of values from the container. -

    -
    - - Description -
    -

    - In contrast to the STL set/map erase() method it removes values equal - to these passed as a range. Furthermore, this method removes only one - value for each one passed in the range, not all equal values. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Range>
    -size_type remove(Range const & rng)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Range const - & -

    -
    -

    - rng -

    -
    -

    - The range of values. -

    -
    -
    - - Returns -
    -

    - The number of removed values. -

    -
    - - Exception-safety -
    -

    - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. -

    -
    -

    -
    -

    -
    - -

    - Finds values meeting spatial predicates, e.g. intersecting some Box. -

    -
    - - Description -
    -

    - Spatial predicates may be a Geometry (in this case default predicate - - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), - bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), - !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), - !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). - Those predicates may be passed together in std::pair or boost::tuple. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename Predicates, typename OutIter>
    -size_type spatial_query(Predicates const & pred, OutIter out_it)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Predicates const & -

    -
    -

    - pred -

    -
    -

    - The spatial predicates or a Geometry. -

    -
    -

    - OutIter -

    -
    -

    - out_it -

    -
    -

    - The output iterator of the result range. E.g. an iterator generated - by std::back_inserter(container) -

    -
    -
    - - Returns -
    -

    - The number of values found. -

    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - Finds one value meeting distances predicates, e.g. nearest to some Point. -

    -
    - - Description -
    -

    - The distances predicates may be a Point. This is default case where Value - which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). -

    -
    - - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates>
    -size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - DistancesPredicates - const & -

    -
    -

    - dpred -

    -
    -

    - The distances predicates or a Point. -

    -
    -

    - value_type & -

    -
    -

    - v -

    -
    -

    - The reference to the object which will contain the result. -

    -
    -
    - - Returns -
    -

    - The number of values found. -

    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - Finds one value meeting distances predicates and spatial predicates, - e.g. nearest to some Point and intersecting some Box. -

    -
    - - Description -
    -

    - The distances predicates may be a Point. This is default case where Value - which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). -

    -

    - The spatial predicates. May be a Geometry (in this case default predicate - - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), - bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), - !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), - !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). - Those predicates may be passed together in std::pair or boost::tuple. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates, typename Predicates>
    -size_type nearest_query(DistancesPredicates const & dpred,
    -                        Predicates const & pred,
    -                        value_type & v)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - DistancesPredicates - const & -

    -
    -

    - dpred -

    -
    -

    - The distances predicates or a Point. -

    -
    -

    - Predicates const & -

    -
    -

    - pred -

    -
    -

    - The spatial predicates or a Geometry -

    -
    -

    - value_type & -

    -
    -

    - v -

    -
    -

    - The reference to the object which will contain the result. -

    -
    -
    - - Returns -
    -

    - The number of values found. -

    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - Finds k values meeting distances predicates, e.g. k nearest values to - some Point. -

    -
    - - Description -
    -

    - The distances predicates. May be a Point. This is default case where - Value which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). -

    -
    - - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates, typename OutIter>
    -size_type nearest_query(DistancesPredicates const & dpred,
    -                        size_t k,
    -                        OutIter out_it)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - DistancesPredicates - const & -

    -
    -

    - dpred -

    -
    -

    - The distances predicates or a Point. -

    -
    -

    - size_t -

    -
    -

    - k -

    -
    -

    - The max number of values. -

    -
    -

    - OutIter -

    -
    -

    - out_it -

    -
    -

    - The output iterator of the result range. E.g. a back_insert_iterator. -

    -
    -
    - - Returns -
    -

    - The number of values found. -

    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    - -

    - Finds k values meeting distances predicates and spatial predicates, e.g. - k nearest values to some Point and intersecting some Box. -

    -
    - - Description -
    -

    - The distances predicates may be a Point. This is default case where Value - which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). -

    -

    - The spatial predicates. May be a Geometry (in this case default predicate - - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), - bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), - !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), - !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). - Those predicates may be passed together in std::pair or boost::tuple. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename DistancesPredicates,
    -         typename Predicates,
    -         typename OutIter>
    -size_type nearest_query(DistancesPredicates const & dpred,
    -                        size_t k,
    -                        Predicates const & pred,
    -                        OutIter out_it)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - DistancesPredicates - const & -

    -
    -

    - dpred -

    -
    -

    - The distances predicates or a Point -

    -
    -

    - size_t -

    -
    -

    - k -

    -
    -

    - The max number of values. -

    -
    -

    - Predicates const & -

    -
    -

    - pred -

    -
    -

    - The spatial predicates or a Geometry. -

    -
    -

    - OutIter -

    -
    -

    - out_it -

    -
    -

    - The output iterator of the result range. E.g. a back_insert_iterator. -

    -
    -
    - - Returns -
    -

    - The number of values found. -

    -
    - - Exception-safety -
    -

    - strong -

    -
    -

    -
    -

    -
    -
    -size() -
    -

    - Returns the number of stored values. -

    -
    - - Synopsis -
    -

    -

    -
    size_type size()
    -

    -

    -
    - - Returns -
    -

    - The number of stored values. -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - Query if the container is empty. -

    -
    - - Synopsis -
    -

    -

    -
    bool empty()
    -

    -

    -
    - - Returns -
    -

    - true if the container is empty. -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - Removes all values stored in the container. -

    -
    - - Synopsis -
    -

    -

    -
    void clear()
    -

    -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    -
    -box() -
    -

    - Returns the box containing all values stored in the container. -

    -
    - - Description -
    -

    - Returns the box containing all values stored in the container. If the - container is empty the result of geometry::assign_inverse() is returned. -

    -
    - - Synopsis -
    -

    -

    -
    box_type box()
    -

    -

    -
    - - Returns -
    -

    - The box containing all values stored in the container or an invalid box - if there are no values in the container. -

    -
    - - Exception-safety -
    -

    - nothrow (if Indexable's CoordinateType copy assignment doesn't throw), - strong (if Indexable's CoordinateType copy assignment throws). -

    -
    -

    -
    -

    -
    - -

    - Count Values or Indexables stored in the container. -

    -
    - - Description -
    -

    - For indexable_type it returns the number of values which indexables equals - the parameter. For value_type it returns the number of values which equals - the parameter. -

    -
    - - Synopsis -
    -

    -

    -
    template<typename ValueOrIndexable>
    -size_type count(ValueOrIndexable const & vori)
    -

    -

    -
    - - Parameters -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - ValueOrIndexable - const & -

    -
    -

    - vori -

    -
    -

    - The value or indexable which will be counted. -

    -
    -
    - - Returns -
    -

    - The number of values found. -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - Returns parameters. -

    -
    - - Synopsis -
    -

    -

    -
    parameters_type const & parameters()
    -

    -

    -
    - - Returns -
    -

    - The parameters object. -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - Returns the translator object. -

    -
    - - Synopsis -
    -

    -

    -
    translator_type const & translator()
    -

    -

    -
    - - Returns -
    -

    - The translator object. -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    - -

    - Returns allocator used by the rtree. -

    -
    - - Synopsis -
    -

    -

    -
    allocator_type get_allocator()
    -

    -

    -
    - - Returns -
    -

    - The allocator. -

    -
    - - Exception-safety -
    -

    - nothrow -

    -
    -

    -
    -

    -
    -
    - - - -
    -
    -
    -PrevUpHome -
    - - 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 390fe04c5..ffbfe87f5 100644 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext

    @@ -234,7 +234,7 @@ must be greater than 10 */
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html new file mode 100644 index 000000000..a71b8dd98 --- /dev/null +++ b/doc/html/geometry_index/r_tree/reference.html @@ -0,0 +1,5102 @@ + + + +Reference + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHome +
    +
    + + +
    + +

    + +The R-tree spatial index. +

    +
    + + Description +
    +

    + The R-tree spatial index. This is self-balancing spatial index capable + to store various types of Values and balancing algorithms. +

    +

    + The user must pass a type defining the Parameters which will be used in + rtree creation process. This type is used e.g. to specify balancing algorithm + with specific parameters like min and max number of elements in node. Predefined + algorithms with compile-time parameters are: bgi::linear<MinElements, + MaxElements>, bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, + MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements + * 0.3>. Predefined algorithms with run-time parameters are: bgi::runtime::linear, + bgi::runtime::quadratic, bgi::runtime::rstar. +

    +

    + The Translator translates from Value to Indexable each time r-tree requires + it. Which means that this operation is done for each Value access. Therefore + the Translator should return the Indexable by const reference instead of + a value. Default translator can translate all types adapted to Point or + Box concepts (which are Indexables). It also handles std::pair<Indexable, + T>, pointers, smart pointers, and iterators. E.g. If std::pair<Box, + int> is stored, the default translator translates from std::pair<Box, + int> const& to Box const&. +

    +
    + + Header +
    +

    + #include <.hpp> +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Parameters,
    +         typename Translator = translator::def<Value>,
    +         typename Allocator = std::allocator<Value>>
    +class rtree
    +{
    +  // ...
    +};
    +
    +

    +

    +
    + + Template + parameter(s) +
    +
    ++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Value +

    +
    +

    + The type of objects stored in the container. +

    +
    +

    + Parameters +

    +
    +

    + Compile-time parameters. +

    +
    +

    + Translator +

    +
    +

    + The type of the translator which translates from Value to Indexable. +

    +
    +

    + Allocator +

    +
    +

    + The allocator used to allocate/deallocate memory, construct/destroy + nodes and Values. +

    +
    +
    + + Typedef(s) +
    +
    ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Description +

    +
    +

    + value_type +

    +
    +

    + The type of Value stored in the container. +

    +
    +

    + parameters_type +

    +
    +

    + R-tree parameters type. +

    +
    +

    + translator_type +

    +
    +

    + Value to Indexable Translator type. +

    +
    +

    + allocator_type +

    +
    +

    + The type of allocator used by the container. +

    +
    +

    + size_type +

    +
    +

    + Unsigned integral type used by the container. +

    +
    +

    + indexable_type +

    +
    +

    + The Indexable type to which Value is translated. +

    +
    +

    + box_type +

    +
    +

    + The Box type used by the R-tree. +

    +
    +
    + + Constructor(s) + and destructor +
    +
    ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Function +

    +
    +

    + Description +

    +
    +

    + rtree() +

    +
    +

    + The constructor. +

    +
    +

    + rtree(Iterator, + Iterator) +

    +
    +

    + The constructor. +

    +
    +

    + rtree(Range const + &) +

    +
    +

    + The constructor. +

    +
    +

    + ~rtree() +

    +
    +

    + The destructor. +

    +
    +

    + rtree(rtree const + &) +

    +
    +

    + The copy constructor. +

    +
    +

    + rtree(rtree const + &, allocator_type + const &) +

    +
    +

    + The copy constructor. +

    +
    +

    + rtree(rtree &&) +

    +
    +

    + The moving constructor. +

    +
    +
    + + Member(s) +
    +
    ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Function +

    +
    +

    + Description +

    +
    +

    + operator=(const rtree + &) +

    +
    +

    + The assignment operator. +

    +
    +

    + operator=(rtree &&) +

    +
    +

    + The moving assignment. +

    +
    +

    + swap(rtree &) +

    +
    +

    + Swaps contents of two rtrees. +

    +
    +

    + insert(value_type const + &) +

    +
    +

    + Insert a value to the index. +

    +
    +

    + insert(Iterator, + Iterator) +

    +
    +

    + Insert a range of values to the index. +

    +
    +

    + insert(Range const + &) +

    +
    +

    + Insert a range of values to the index. +

    +
    +

    + remove(value_type const + &) +

    +
    +

    + Remove a value from the container. +

    +
    +

    + remove(Iterator, + Iterator) +

    +
    +

    + Remove a range of values from the container. +

    +
    +

    + remove(Range const + &) +

    +
    +

    + Remove a range of values from the container. +

    +
    +

    + spatial_query(Predicates const + &, OutIter) +

    +
    +

    + Finds values meeting spatial predicates, e.g. intersecting some + Box. +

    +
    +

    + nearest_query(DistancesPredicates const + &, value_type + &) +

    +
    +

    + Finds one value meeting distances predicates, e.g. nearest to + some Point. +

    +
    +

    + nearest_query(DistancesPredicates const + &, Predicates + const &, + value_type &) +

    +
    +

    + Finds one value meeting distances predicates and spatial predicates, + e.g. nearest to some Point and intersecting some Box. +

    +
    +

    + nearest_query(DistancesPredicates const + &, size_t, OutIter) +

    +
    +

    + Finds k values meeting distances predicates, e.g. k nearest values + to some Point. +

    +
    +

    + nearest_query(DistancesPredicates const + &, size_t, Predicates + const &, + OutIter) +

    +
    +

    + Finds k values meeting distances predicates and spatial predicates, + e.g. k nearest values to some Point and intersecting some Box. +

    +
    +

    + size() +

    +
    +

    + Returns the number of stored values. +

    +
    +

    + empty() +

    +
    +

    + Query if the container is empty. +

    +
    +

    + clear() +

    +
    +

    + Removes all values stored in the container. +

    +
    +

    + box() +

    +
    +

    + Returns the box containing all values stored in the container. +

    +
    +

    + count(ValueOrIndexable const + &) +

    +
    +

    + Count Values or Indexables stored in the container. +

    +
    +

    + parameters() +

    +
    +

    + Returns parameters. +

    +
    +

    + translator() +

    +
    +

    + Returns the translator object. +

    +
    +

    + get_allocator() +

    +
    +

    + Returns allocator used by the rtree. +

    +
    +

    +
    +

    +
    + +

    + The constructor. +

    +
    + + Synopsis +
    +

    +

    +
    rtree(parameters_type parameters = parameters_type(),
    +      translator_type const & translator = translator_type(),
    +      allocator_type allocator = allocator_type())
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + parameters_type +

    +
    +

    + parameters +

    +
    +

    + The parameters object. +

    +
    +

    + translator_type const & +

    +
    +

    + translator +

    +
    +

    + The translator object. +

    +
    +

    + allocator_type +

    +
    +

    + allocator +

    +
    +

    + The allocator object. +

    +
    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + The constructor. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Iterator>
    +rtree(Iterator first,
    +      Iterator last,
    +      parameters_type parameters = parameters_type(),
    +      translator_type const & translator = translator_type(),
    +      allocator_type allocator = allocator_type())
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Iterator +

    +
    +

    + first +

    +
    +

    + The beginning of the range of Values. +

    +
    +

    + Iterator +

    +
    +

    + last +

    +
    +

    + The end of the range of Values. +

    +
    +

    + parameters_type +

    +
    +

    + parameters +

    +
    +

    + The parameters object. +

    +
    +

    + translator_type const & +

    +
    +

    + translator +

    +
    +

    + The translator object. +

    +
    +

    + allocator_type +

    +
    +

    + allocator +

    +
    +

    + The allocator object. +

    +
    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + The constructor. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Range>
    +rtree(Range const & rng,
    +      parameters_type parameters = parameters_type(),
    +      translator_type const & translator = translator_type(),
    +      allocator_type allocator = allocator_type())
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Range const + & +

    +
    +

    + rng +

    +
    +

    + The range of Values. +

    +
    +

    + parameters_type +

    +
    +

    + parameters +

    +
    +

    + The parameters object. +

    +
    +

    + translator_type const & +

    +
    +

    + translator +

    +
    +

    + The translator object. +

    +
    +

    + allocator_type +

    +
    +

    + allocator +

    +
    +

    + The allocator object. +

    +
    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + The destructor. +

    +
    + + Synopsis +
    +

    +

    +
    ~rtree()
    +

    +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + The copy constructor. +

    +
    + + Description +
    +

    + It uses parameters, translator and allocator from the source tree. +

    +
    + + Synopsis +
    +

    +

    +
    rtree(rtree const & src)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree const + & +

    +
    +

    + src +

    +
    +

    + The rtree which content will be copied. +

    +
    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + The copy constructor. +

    +
    + + Description +
    +

    + It uses Parameters and translator from the source tree. +

    +
    + + Synopsis +
    +

    +

    +
    rtree(rtree const & src, allocator_type const & allocator)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree const + & +

    +
    +

    + src +

    +
    +

    + The rtree which content will be copied. +

    +
    +

    + allocator_type const & +

    +
    +

    + allocator +

    +
    +

    + The allocator which will be used. +

    +
    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + The moving constructor. +

    +
    + + Description +
    +

    + It uses parameters, translator and allocator from the source tree. +

    +
    + + Synopsis +
    +

    +

    +
    rtree(rtree && src)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree && +

    +
    +

    + src +

    +
    +

    + The rtree which content will be moved. +

    +
    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + The assignment operator. +

    +
    + + Description +
    +

    + It uses parameters and translator from the source tree. +

    +
    + + Synopsis +
    +

    +

    +
    rtree & operator=(const rtree & src)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + const rtree + & +

    +
    +

    + src +

    +
    +

    + The rtree which content will be copied. +

    +
    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + The moving assignment. +

    +
    + + Description +
    +

    + It uses parameters and translator from the source tree. +

    +
    + + Synopsis +
    +

    +

    +
    rtree & operator=(rtree && src)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree && +

    +
    +

    + src +

    +
    +

    + The rtree which content will be moved. +

    +
    +
    + + Exception-safety +
    +

    + nothrow (if allocators are equal), strong (if allocators aren't equal) +

    +
    +

    +
    +

    +
    + +

    + Swaps contents of two rtrees. +

    +
    + + Description +
    +

    + Parameters, translator and allocators are swapped as well. +

    +
    + + Synopsis +
    +

    +

    +
    void swap(rtree & other)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree & +

    +
    +

    + other +

    +
    +

    + The rtree which content will be swapped with this rtree content. +

    +
    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + Insert a value to the index. +

    +
    + + Synopsis +
    +

    +

    +
    void insert(value_type const & value)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + value_type const & +

    +
    +

    + value +

    +
    +

    + The value which will be stored in the container. +

    +
    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +

    +
    +

    +
    +

    +
    + +

    + Insert a range of values to the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Iterator>
    +void insert(Iterator first, Iterator last)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Iterator +

    +
    +

    + first +

    +
    +

    + The beginning of the range of values. +

    +
    +

    + Iterator +

    +
    +

    + last +

    +
    +

    + The end of the range of values. +

    +
    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +

    +
    +

    +
    +

    +
    + +

    + Insert a range of values to the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Range>
    +void insert(Range const & rng)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Range const + & +

    +
    +

    + rng +

    +
    +

    + The range of values. +

    +
    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +

    +
    +

    +
    +

    +
    + +

    + Remove a value from the container. +

    +
    + + Description +
    +

    + In contrast to the STL set/map erase() method this method removes only + one value from the container. +

    +
    + + Synopsis +
    +

    +

    +
    size_type remove(value_type const & value)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + value_type const & +

    +
    +

    + value +

    +
    +

    + The value which will be removed from the container. +

    +
    +
    + + Returns +
    +

    + 1 if the value was removed, 0 otherwise. +

    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +

    +
    +

    +
    +

    +
    + +

    + Remove a range of values from the container. +

    +
    + + Description +
    +

    + In contrast to the STL set/map erase() method it doesn't take iterators + pointing to values stored in this container. It removes values equal + to these passed as a range. Furthermore this method removes only one + value for each one passed in the range, not all equal values. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Iterator>
    +size_type remove(Iterator first, Iterator last)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Iterator +

    +
    +

    + first +

    +
    +

    + The beginning of the range of values. +

    +
    +

    + Iterator +

    +
    +

    + last +

    +
    +

    + The end of the range of values. +

    +
    +
    + + Returns +
    +

    + The number of removed values. +

    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +

    +
    +

    +
    +

    +
    + +

    + Remove a range of values from the container. +

    +
    + + Description +
    +

    + In contrast to the STL set/map erase() method it removes values equal + to these passed as a range. Furthermore, this method removes only one + value for each one passed in the range, not all equal values. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Range>
    +size_type remove(Range const & rng)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Range const + & +

    +
    +

    + rng +

    +
    +

    + The range of values. +

    +
    +
    + + Returns +
    +

    + The number of removed values. +

    +
    + + Exception-safety +
    +

    + not safe - if this operation throws, the R-tree may be left in an inconsistent + state, elements must not be inserted or removed, methods may return invalid + data. +

    +
    +

    +
    +

    +
    + +

    + Finds values meeting spatial predicates, e.g. intersecting some Box. +

    +
    + + Description +
    +

    + Spatial predicates may be a Geometry (in this case default predicate + - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), + bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), + !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), + !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). + Those predicates may be passed together in std::pair or boost::tuple. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Predicates, typename OutIter>
    +size_type spatial_query(Predicates const & pred, OutIter out_it)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + The spatial predicates or a Geometry. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator of the result range. E.g. an iterator generated + by std::back_inserter(container) +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + Finds one value meeting distances predicates, e.g. nearest to some Point. +

    +
    + + Description +
    +

    + The distances predicates may be a Point. This is default case where Value + which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates>
    +size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates or a Point. +

    +
    +

    + value_type & +

    +
    +

    + v +

    +
    +

    + The reference to the object which will contain the result. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + Finds one value meeting distances predicates and spatial predicates, + e.g. nearest to some Point and intersecting some Box. +

    +
    + + Description +
    +

    + The distances predicates may be a Point. This is default case where Value + which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + The spatial predicates. May be a Geometry (in this case default predicate + - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), + bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), + !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), + !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). + Those predicates may be passed together in std::pair or boost::tuple. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates, typename Predicates>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        Predicates const & pred,
    +                        value_type & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates or a Point. +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + The spatial predicates or a Geometry +

    +
    +

    + value_type & +

    +
    +

    + v +

    +
    +

    + The reference to the object which will contain the result. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + Finds k values meeting distances predicates, e.g. k nearest values to + some Point. +

    +
    + + Description +
    +

    + The distances predicates. May be a Point. This is default case where + Value which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates, typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        size_t k,
    +                        OutIter out_it)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates or a Point. +

    +
    +

    + size_t +

    +
    +

    + k +

    +
    +

    + The max number of values. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator of the result range. E.g. a back_insert_iterator. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    + +

    + Finds k values meeting distances predicates and spatial predicates, e.g. + k nearest values to some Point and intersecting some Box. +

    +
    + + Description +
    +

    + The distances predicates may be a Point. This is default case where Value + which nearest point is closest to Point is returned. May be a PointRelation + which define how distance to Value is calculated. This may be generated + by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). + DistancesPredicates may also define distances bounds. E.g. that some + distance must be between min_distance and max_distance. This may be generated + by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, + MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, + MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds + and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) + or bgi::to_furthest(dist_bound). +

    +

    + The spatial predicates. May be a Geometry (in this case default predicate + - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), + bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), + !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), + !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). + Those predicates may be passed together in std::pair or boost::tuple. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates,
    +         typename Predicates,
    +         typename OutIter>
    +size_type nearest_query(DistancesPredicates const & dpred,
    +                        size_t k,
    +                        Predicates const & pred,
    +                        OutIter out_it)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates or a Point +

    +
    +

    + size_t +

    +
    +

    + k +

    +
    +

    + The max number of values. +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + The spatial predicates or a Geometry. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator of the result range. E.g. a back_insert_iterator. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Exception-safety +
    +

    + strong +

    +
    +

    +
    +

    +
    +
    +size() +
    +

    + Returns the number of stored values. +

    +
    + + Synopsis +
    +

    +

    +
    size_type size()
    +

    +

    +
    + + Returns +
    +

    + The number of stored values. +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + Query if the container is empty. +

    +
    + + Synopsis +
    +

    +

    +
    bool empty()
    +

    +

    +
    + + Returns +
    +

    + true if the container is empty. +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + Removes all values stored in the container. +

    +
    + + Synopsis +
    +

    +

    +
    void clear()
    +

    +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    +
    +box() +
    +

    + Returns the box containing all values stored in the container. +

    +
    + + Description +
    +

    + Returns the box containing all values stored in the container. If the + container is empty the result of geometry::assign_inverse() is returned. +

    +
    + + Synopsis +
    +

    +

    +
    box_type box()
    +

    +

    +
    + + Returns +
    +

    + The box containing all values stored in the container or an invalid box + if there are no values in the container. +

    +
    + + Exception-safety +
    +

    + nothrow (if Indexable's CoordinateType copy assignment doesn't throw), + strong (if Indexable's CoordinateType copy assignment throws). +

    +
    +

    +
    +

    +
    + +

    + Count Values or Indexables stored in the container. +

    +
    + + Description +
    +

    + For indexable_type it returns the number of values which indexables equals + the parameter. For value_type it returns the number of values which equals + the parameter. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename ValueOrIndexable>
    +size_type count(ValueOrIndexable const & vori)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + ValueOrIndexable + const & +

    +
    +

    + vori +

    +
    +

    + The value or indexable which will be counted. +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + Returns parameters. +

    +
    + + Synopsis +
    +

    +

    +
    parameters_type const & parameters()
    +

    +

    +
    + + Returns +
    +

    + The parameters object. +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + Returns the translator object. +

    +
    + + Synopsis +
    +

    +

    +
    translator_type const & translator()
    +

    +

    +
    + + Returns +
    +

    + The translator object. +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

    +
    + +

    + Returns allocator used by the rtree. +

    +
    + + Synopsis +
    +

    +

    +
    allocator_type get_allocator()
    +

    +

    +
    + + Returns +
    +

    + The allocator. +

    +
    + + Exception-safety +
    +

    + nothrow +

    +
    +

    +
    +

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

    + Function +

    +
    +

    + Description +

    +
    +

    + insert(rtree<...> + &, Value + const &) +

    +
    +

    + Insert a value to the index. +

    +
    +

    + insert(rtree<...> + &, Iterator, Iterator) +

    +
    +

    + Insert a range of values to the index. +

    +
    +

    + insert(rtree<...> + &, Range + const &) +

    +
    +

    + Insert a range of values to the index. +

    +
    +

    + remove(rtree<...> + &, Value + const &) +

    +
    +

    + Remove a value from the container. +

    +
    +

    + remove(rtree<...> + &, Iterator, Iterator) +

    +
    +

    + Remove a range of values from the container. +

    +
    +

    + remove(rtree<...> + &, Range + const &) +

    +
    +

    + Remove a range of values from the container. +

    +
    +

    + spatial_query(rtree<...> + const &, + Predicates const + &, OutIter) +

    +
    +

    + Find values meeting spatial predicates. +

    +
    +

    + nearest_query(rtree<...> + const &, + DistancesPredicates const &, + Value &) +

    +
    +

    + Find the value meeting distances predicates. +

    +
    +

    + nearest_query(rtree<...> + const &, + DistancesPredicates const &, + Predicates const + &, Value + &) +

    +
    +

    + Find the value meeting distances and spatial predicates. +

    +
    +

    + nearest_query(rtree<...> + const &, + DistancesPredicates const &, + size_t, + OutIter) +

    +
    +

    + Find k values meeting distances predicates. +

    +
    +

    + nearest_query(rtree<...> + const &, + DistancesPredicates const &, + size_t, + Predicates const + &, OutIter) +

    +
    +

    + Find k values meeting distances and spatial predicates. +

    +
    +

    + clear(rtree<...> + &) +

    +
    +

    + Remove all values from the index. +

    +
    +

    + size(rtree<...> + const &) +

    +
    +

    + Get the number of values stored in the index. +

    +
    +

    + empty(rtree<...> + const &) +

    +
    +

    + Query if there are no values stored in the index. +

    +
    +

    + box(rtree<...> + const &) +

    +
    +

    + Get the box containing all stored values or an invalid box if + the index has no values. +

    +
    +
    + +

    + Insert a value to the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator>
    +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Value const + & +

    +
    +

    + v +

    +
    +

    + The value which will be stored in the index. +

    +
    +
    +

    +
    +

    +
    + +

    + Insert a range of values to the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename Iterator>
    +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree,
    +                                    Iterator first,
    +                                    Iterator last)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Iterator +

    +
    +

    + first +

    +
    +

    + The beginning of the range of values. +

    +
    +

    + Iterator +

    +
    +

    + last +

    +
    +

    + The end of the range of values. +

    +
    +
    +

    +
    +

    +
    + +

    + Insert a range of values to the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename Range>
    +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Range const + & +

    +
    +

    + rng +

    +
    +

    + The range of values. +

    +
    +
    +

    +
    +

    +
    + +

    + Remove a value from the container. +

    +
    + + Description +
    +

    + Remove a value from the container. In contrast to the STL set/map erase() + method this function removes only one value from the container. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator>
    +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Value const + & +

    +
    +

    + v +

    +
    +

    + The value which will be removed from the index. +

    +
    +
    + + Returns +
    +

    + 1 if value was removed, 0 otherwise. +

    +
    +

    +
    +

    +
    + +

    + Remove a range of values from the container. +

    +
    + + Description +
    +

    + Remove a range of values from the container. In contrast to the STL set/map + erase() method it doesn't take iterators pointing to values stored in + this container. It removes values equal to these passed as a range. Furthermore + this function removes only one value for each one passed in the range, + not all equal values. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename Iterator>
    +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree,
    +                                                                                       Iterator first,
    +                                                                                       Iterator last)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Iterator +

    +
    +

    + first +

    +
    +

    + The beginning of the range of values. +

    +
    +

    + Iterator +

    +
    +

    + last +

    +
    +

    + The end of the range of values. +

    +
    +
    + + Returns +
    +

    + The number of removed values. +

    +
    +

    +
    +

    +
    + +

    + Remove a range of values from the container. +

    +
    + + Description +
    +

    + Remove a range of values from the container. In contrast to the STL set/map + erase() method it removes values equal to these passed as a range. Furthermore + this method removes only one value for each one passed in the range, + not all equal values. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename Range>
    +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Range const + & +

    +
    +

    + rng +

    +
    +

    + The range of values. +

    +
    +
    + + Returns +
    +

    + The number of removed values. +

    +
    +

    +
    +

    +
    + +

    + Find values meeting spatial predicates. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename Predicates,
    +         typename OutIter>
    +size_t boost::geometry::index::spatial_query(rtree< Value, Options, Translator, Allocator > const & tree,
    +                                             Predicates const & pred,
    +                                             OutIter out_it)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + The spatial predicates. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator of the result range. +

    +
    +
    + + Returns +
    +

    + The number of found values. +

    +
    +

    +
    +

    +
    + +

    + Find the value meeting distances predicates. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename DistancesPredicates>
    +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
    +                                             DistancesPredicates const & dpred,
    +                                             Value & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates. +

    +
    +

    + Value & +

    +
    +

    + v +

    +
    +

    + The result. +

    +
    +
    + + Returns +
    +

    + The number of found values. +

    +
    +

    +
    +

    +
    + +

    + Find the value meeting distances and spatial predicates. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename DistancesPredicates,
    +         typename Predicates>
    +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
    +                                             DistancesPredicates const & dpred,
    +                                             Predicates const & pred,
    +                                             Value & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates. +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + The spatial predicates. +

    +
    +

    + Value & +

    +
    +

    + v +

    +
    +

    + The result. +

    +
    +
    + + Returns +
    +

    + The number of found values. +

    +
    +

    +
    +

    +
    + +

    + Find k values meeting distances predicates. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename DistancesPredicates,
    +         typename OutIter>
    +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
    +                                             DistancesPredicates const & dpred,
    +                                             size_t k,
    +                                             OutIter out_it)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates. +

    +
    +

    + size_t +

    +
    +

    + k +

    +
    +

    + The max number of values. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator of the result range. +

    +
    +
    + + Returns +
    +

    + The number of found values. +

    +
    +

    +
    +

    +
    + +

    + Find k values meeting distances and spatial predicates. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename DistancesPredicates,
    +         typename Predicates,
    +         typename OutIter>
    +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
    +                                             DistancesPredicates const & dpred,
    +                                             size_t k,
    +                                             Predicates const & pred,
    +                                             OutIter out_it)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distances predicates. +

    +
    +

    + size_t +

    +
    +

    + k +

    +
    +

    + The max number of values. +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + The spatial predicates. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator of the result range. +

    +
    +
    + + Returns +
    +

    + The number of found values. +

    +
    +

    +
    +

    +
    + +

    + Remove all values from the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator>
    +void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +
    +

    +
    +

    +
    + +

    + Get the number of values stored in the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator>
    +size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +
    + + Returns +
    +

    + The number of values stored in the index. +

    +
    +

    +
    +

    +
    + +

    + Query if there are no values stored in the index. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator>
    +bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +
    + + Returns +
    +

    + true if there are no values in the index. +

    +
    +

    +
    +

    +
    + +

    + Get the box containing all stored values or an invalid box if the index + has no values. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator>
    +rtree<Value, Options, Translator, Allocator>::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +
    + + Returns +
    +

    + The box containing all stored values or an invalid box. +

    +
    +

    +
    +

    +
    +
    + + + +
    +
    +
    +PrevUpHome +
    + + diff --git a/doc/html/index.html b/doc/html/index.html index ea50d3b3a..db38adc81 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -50,14 +50,13 @@
    Spatial queries
    Nearest neighbours queries
    -
    Exception safety
    -
    Reference
    +
    Reference

    - +

    Last revised: January 08, 2013 at 17:43:46 GMT

    Last revised: January 08, 2013 at 23:01:28 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index 07bc750a8..1fc61d148 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -14,10 +14,11 @@ cmd = "doxygen_xml2qbk" cmd = cmd + " --xml xml/%s.xml" cmd = cmd + " --start_include ." cmd = cmd + " --index_id_path %s" -cmd = cmd + " --cos_output_style alt" +cmd = cmd + " --output_style alt" cmd = cmd + " > generated/%s.qbk" os.system("doxygen Doxyfile") -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_tree.index", "rtree")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_tree.reference", "rtree")) +os.system(cmd % ("group__rtree__group", "geometry_index.r_tree.reference", "rtree_group")) os.system("b2") diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 2cd050894..1c116f39a 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -15,11 +15,12 @@ [include rtree/creation.qbk] [include rtree/spatial_query.qbk] [include rtree/nearest_query.qbk] -[include rtree/exception_safety.qbk] +[/include rtree/exception_safety.qbk] -[section:index Reference] +[section:reference Reference] [include generated/rtree.qbk] +[include generated/rtree_group.qbk] [endsect] diff --git a/doc/src/tools/doxygen_xml2qbk/configuration.hpp b/doc/src/tools/doxygen_xml2qbk/configuration.hpp index e9ce191ae..3b107abdb 100644 --- a/doc/src/tools/doxygen_xml2qbk/configuration.hpp +++ b/doc/src/tools/doxygen_xml2qbk/configuration.hpp @@ -28,7 +28,7 @@ struct configuration std::string skip_namespace; - std::string cos_output_style; + std::string output_style; std::string index_id_path; }; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp index 814e117ed..3f6b9391c 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -153,6 +153,9 @@ struct class_or_struct : public element struct documentation { + std::string group_id; + std::string group_title; + // Only one expected (no grouping) class_or_struct cos; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp index 6d6e60a4e..b6c229a04 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -76,8 +76,8 @@ int main(int argc, char** argv) ("copyright", po::value(©right_filename), "Name of QBK file including (commented) copyright and license") - ("cos_output_style", po::value(&config.cos_output_style), - "Class or struct docbook output style. Value:'alt'") + ("output_style", po::value(&config.output_style), + "Docbook output style. Value:'alt'") ("index_id_path", po::value(&config.index_id_path), "The QBK index ID path") ; @@ -154,30 +154,39 @@ int main(int argc, char** argv) << "[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically]" << std::endl << "[/ Generated from " << filename << "]" << std::endl; - // Write the rest: functions, defines, classes or structs - BOOST_FOREACH(function const& f, doc.functions) + if ( config.output_style.empty() ) { - quickbook_output(f, config, std::cout, int()); - } - BOOST_FOREACH(function const& f, doc.defines) - { - quickbook_output(f, config, std::cout, int()); - } - BOOST_FOREACH(enumeration const& e, doc.enumerations) - { - quickbook_output(e, config, std::cout, int()); - } + // Write the rest: functions, defines, classes or structs + BOOST_FOREACH(function const& f, doc.functions) + { + quickbook_output(f, config, std::cout); + } + BOOST_FOREACH(function const& f, doc.defines) + { + quickbook_output(f, config, std::cout); + } + BOOST_FOREACH(enumeration const& e, doc.enumerations) + { + quickbook_output(e, config, std::cout); + } - if (! doc.cos.name.empty()) - { - std::sort(doc.cos.functions.begin(), doc.cos.functions.end(), sort_on_line()); - - if ( config.cos_output_style == "alt" ) - quickbook_output(doc.cos, config, std::cout, quickbook_output_cos_alt()); - else - quickbook_output(doc.cos, config, std::cout, 0); + if (! doc.cos.name.empty()) + { + std::sort(doc.cos.functions.begin(), doc.cos.functions.end(), sort_on_line()); + quickbook_output(doc.cos, config, std::cout); + } } + else if ( config.output_style == "alt" ) + { + if (! doc.cos.name.empty()) + { + std::sort(doc.cos.functions.begin(), doc.cos.functions.end(), sort_on_line()); + quickbook_output_alt(doc.cos, config, std::cout); + } + if ( !doc.functions.empty() ) + quickbook_output_alt(doc, config, std::cout); + } } catch(std::exception const& e) { diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index f5d4ce02f..adb30647a 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -482,6 +482,10 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum if (kind == "group") { recurse = true; + doc.group_id = get_attribute(node, "id"); + rapidxml::xml_node<> * n = node->first_node("title"); + if ( n ) + doc.group_title = n->value(); } else if (kind == "struct") { diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 73b9d65e3..ad25d4388 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -58,7 +58,7 @@ std::string qbk_escaped(std::string const& s) -void quickbook_template_parameter_list(std::vector const& parameters, std::ostream& out, bool multiline = false, bool show_defaults = false) +void quickbook_template_parameter_list(std::vector const& parameters, std::ostream& out, bool multiline = false, bool show_defaults = true) { std::string next_param; if ( multiline ) @@ -90,7 +90,7 @@ void quickbook_template_parameter_list(std::vector const& parameters, } -void quickbook_synopsis(function const& f, std::ostream& out, bool multiline = false, bool show_defaults = false) +void quickbook_synopsis(function const& f, std::ostream& out, bool multiline = false, bool show_defaults = true) { out << "``"; quickbook_template_parameter_list(f.template_parameters, out, multiline, show_defaults); @@ -343,8 +343,7 @@ inline void quickbook_output_indexterm(std::string const& term, std::ostream& ou out << "'''" << std::endl; } -template -void quickbook_output(function const& f, configuration const& config, std::ostream& out, Tag const&) +void quickbook_output(function const& f, configuration const& config, std::ostream& out) { // Write the parsed function int arity = (int)f.parameters.size(); @@ -445,8 +444,7 @@ void quickbook_output(function const& f, configuration const& config, std::ostre out << std::endl; } -template -void quickbook_output(enumeration const& e, configuration const& config, std::ostream& out, Tag const&) +void quickbook_output(enumeration const& e, configuration const& config, std::ostream& out) { out << "[section:" << to_section_name(e.name); out << " " << e.name @@ -496,7 +494,7 @@ void quickbook_output(enumeration const& e, configuration const& config, std::os out << std::endl; } -void quickbook_output_member(std::vector const& functions, +void quickbook_output_function(std::vector const& functions, function_type type, std::string const& title, configuration const& config, std::ostream& out) @@ -521,8 +519,7 @@ void quickbook_output_member(std::vector const& functions, << std::endl; } -template -void quickbook_output(class_or_struct const& cos, configuration const& config, std::ostream& out, Tag const&) +void quickbook_output(class_or_struct const& cos, configuration const& config, std::ostream& out) { // Skip namespace std::string short_name = namespace_skipped(cos.fullname, config); @@ -623,12 +620,12 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s if (counts[function_constructor_destructor] > 0) { - quickbook_output_member(cos.functions, function_constructor_destructor, "Constructor", config, out); + quickbook_output_function(cos.functions, function_constructor_destructor, "Constructor", config, out); } if (counts[function_member] > 0) { - quickbook_output_member(cos.functions, function_member, "Member Function", config, out); + quickbook_output_function(cos.functions, function_member, "Member Function", config, out); } quickbook_header(cos.location, config, out); @@ -642,6 +639,39 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s +std::string remove_template_parameters(std::string const& name) +{ + std::string res; + std::string::size_type prev_i = 0, i = 0; + int blocks_counter = 0; + for ( ;; ) + { + std::string::size_type next_begin = name.find('<', i); + std::string::size_type next_end = name.find('>', i); + + if ( next_begin == next_end ) + { + res += name.substr(prev_i, next_begin); + break; + } + else if ( next_begin < next_end ) + { + i = next_begin + 1; + if ( blocks_counter == 0 ) + res += name.substr(prev_i, next_begin) + "<...>"; + blocks_counter++; + } + else + { + i = next_end + 1; + blocks_counter--; + if ( blocks_counter == 0 ) + prev_i = i; + } + } + + return res; +} void quickbook_synopsis_short(function const& f, std::ostream& out) { @@ -672,7 +702,7 @@ void quickbook_synopsis_short(function const& f, std::ostream& out) { if ( !p.skip && p.default_value.empty() ) { - out << (first ? "(" : ", ") << p.fulltype; + out << (first ? "(" : ", ") << remove_template_parameters(p.fulltype); first = false; } } @@ -684,10 +714,12 @@ void quickbook_synopsis_short(function const& f, std::ostream& out) } } -void quickbook_output_member(class_or_struct const& cos, - std::vector const& functions, - function_type type, - configuration const& config, std::ostream& out) +void quickbook_output_function(std::vector const& functions, + function_type type, + configuration const& config, + std::string const& qbk_id_prefix, + std::ostream& out, + bool display_all = false) { out << "[table" << std::endl << "[[Function][Description]]" << std::endl; @@ -696,13 +728,12 @@ void quickbook_output_member(class_or_struct const& cos, { function const& f = functions[i]; - if (f.type == type) + if (display_all || f.type == type) { out << "[["; if ( !config.index_id_path.empty() ) out << "[link " << config.index_id_path - << "." << to_section_name(namespace_skipped(cos.fullname, config)) - << ".member" << i << " "; + << "." << qbk_id_prefix << i << " "; out << "`"; quickbook_synopsis_short(f, out); out << "`"; @@ -715,20 +746,22 @@ void quickbook_output_member(class_or_struct const& cos, << std::endl; } -void quickbook_output_detail_member(class_or_struct const& cos, - std::vector const& functions, +void quickbook_output_detail_function(std::vector const& functions, function_type type, - configuration const& config, std::ostream& out) + configuration const& config, + std::string const& qbk_id_prefix, + std::ostream& out, + bool display_all = false) { for ( size_t i = 0 ; i < functions.size() ; ++i ) { function const& f = functions[i]; - if (f.type == type) + if ( display_all || f.type == type ) { std::stringstream ss; quickbook_synopsis_short(f, ss); - out << "[section:member" << i << " " << ss.str() << "]" << std::endl; + out << "[section:" << qbk_id_prefix << i << " " << ss.str() << "]" << std::endl; out << f.brief_description; @@ -766,21 +799,41 @@ void quickbook_output_detail_member(class_or_struct const& cos, quickbook_markup(f.qbk_markup, markup_any, markup_default, out); - out << "[endsect][br]" << std::endl + out << "[endsect]" << std::endl + << "[br]" << std::endl << std::endl; } } } -struct quickbook_output_cos_alt {}; +void quickbook_output_alt(documentation const& doc, configuration const& config, std::ostream& out) +{ + std::string id_prefix("function"); -void quickbook_output(class_or_struct const& cos, configuration const& config, std::ostream& out, quickbook_output_cos_alt const&) + if ( !doc.group_id.empty() ) + { + id_prefix = doc.group_id + ".function"; + std::cout << "[section:" << doc.group_id << " " << doc.group_title << " - global functions]" << std::endl; + } + + quickbook_output_function(doc.functions, function_constructor_destructor, config, id_prefix, out, true); + quickbook_output_detail_function(doc.functions, function_unknown, config, "function", out, true); + + if ( !doc.group_id.empty() ) + { + out << "[endsect]" << std::endl + << std::endl; + } +} + +void quickbook_output_alt(class_or_struct const& cos, configuration const& config, std::ostream& out) { // Skip namespace std::string short_name = namespace_skipped(cos.fullname, config); + std::string section_name = to_section_name(short_name); // Write the parsed function - out << "[section:" << to_section_name(short_name) << " " << short_name << "]" << std::endl + out << "[section:" << section_name << " " << short_name << "]" << std::endl << std::endl; quickbook_output_indexterm(short_name, out); @@ -794,6 +847,8 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s quickbook_string_with_heading_if_present("Description", cos.detailed_description, out); + quickbook_markup(cos.qbk_markup, markup_any, markup_default, out); + // Header quickbook_header(cos.location, config, out); @@ -883,25 +938,23 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s if (counts[function_constructor_destructor] > 0) { out << "[heading Constructor(s) and destructor]" << std::endl; - quickbook_output_member(cos, cos.functions, function_constructor_destructor, config, out); + quickbook_output_function(cos.functions, function_constructor_destructor, config, section_name + ".member", out); } if (counts[function_member] > 0) { out << "[heading Member(s)]" << std::endl; - quickbook_output_member(cos, cos.functions, function_member, config, out); + quickbook_output_function(cos.functions, function_member, config, section_name + ".member", out); } - quickbook_markup(cos.qbk_markup, markup_any, markup_default, out); - // Details start - out << "[br]"; + out << "[br]" << std::endl; if (counts[function_constructor_destructor] > 0) - quickbook_output_detail_member(cos, cos.functions, function_constructor_destructor, config, out); + quickbook_output_detail_function(cos.functions, function_constructor_destructor, config, "member", out); if (counts[function_member] > 0) - quickbook_output_detail_member(cos, cos.functions, function_member, config, out); + quickbook_output_detail_function(cos.functions, function_member, config, "member", out); // Details end diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 0f1ef1091..c8b2752b6 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -52,6 +52,10 @@ namespace boost { namespace geometry { namespace index { +/*! +\defgroup rtree_group boost::geometry::index::rtree +*/ + /*! \brief The R-tree spatial index. @@ -77,6 +81,8 @@ or Box concepts (which are Indexables). It also handles std::pair, and iterators. E.g. If std::pair is stored, the default translator translates from std::pair const& to Box const&. +\ingroup rtree_group + \tparam Value The type of objects stored in the container. \tparam Parameters Compile-time parameters. \tparam Translator The type of the translator which translates from Value to Indexable. @@ -1151,13 +1157,11 @@ private: node * m_root; }; -/*! -\defgroup rtree_functions Global functions -*/ - /*! \brief Insert a value to the index. +\ingroup rtree_group + \param tree The spatial index. \param v The value which will be stored in the index. */ @@ -1170,6 +1174,8 @@ inline void insert(rtree & tree, Value co /*! \brief Insert a range of values to the index. +\ingroup rtree_group + \param tree The spatial index. \param first The beginning of the range of values. \param last The end of the range of values. @@ -1183,6 +1189,8 @@ inline void insert(rtree & tree, Iterator /*! \brief Insert a range of values to the index. +\ingroup rtree_group + \param tree The spatial index. \param rng The range of values. */ @@ -1198,6 +1206,8 @@ inline void insert(rtree & tree, Range co Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container. +\ingroup rtree_group + \param tree The spatial index. \param v The value which will be removed from the index. @@ -1218,6 +1228,8 @@ it doesn't take iterators pointing to values stored in this container. It remove to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. +\ingroup rtree_group + \param tree The spatial index. \param first The beginning of the range of values. \param last The end of the range of values. @@ -1238,6 +1250,8 @@ Remove a range of values from the container. In contrast to the STL set/map eras it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. +\ingroup rtree_group + \param tree The spatial index. \param rng The range of values. @@ -1253,6 +1267,8 @@ remove(rtree & tree, Range const& rng) /*! \brief Find values meeting spatial predicates. +\ingroup rtree_group + \param tree The spatial index. \param pred The spatial predicates. \param out_it The output iterator of the result range. @@ -1268,6 +1284,8 @@ inline size_t spatial_query(rtree const& /*! \brief Find the value meeting distances predicates. +\ingroup rtree_group + \param tree The spatial index. \param dpred The distances predicates. \param v The result. @@ -1283,6 +1301,8 @@ inline size_t nearest_query(rtree const& /*! \brief Find the value meeting distances and spatial predicates. +\ingroup rtree_group + \param tree The spatial index. \param dpred The distances predicates. \param pred The spatial predicates. @@ -1299,6 +1319,8 @@ inline size_t nearest_query(rtree const& /*! \brief Find k values meeting distances predicates. +\ingroup rtree_group + \param tree The spatial index. \param dpred The distances predicates. \param k The max number of values. @@ -1315,6 +1337,8 @@ inline size_t nearest_query(rtree const& /*! \brief Find k values meeting distances and spatial predicates. +\ingroup rtree_group + \param tree The spatial index. \param dpred The distances predicates. \param k The max number of values. @@ -1332,6 +1356,8 @@ inline size_t nearest_query(rtree const& /*! \brief Remove all values from the index. +\ingroup rtree_group + \param tree The spatial index. */ template @@ -1343,6 +1369,8 @@ inline void clear(rtree & tree) /*! \brief Get the number of values stored in the index. +\ingroup rtree_group + \param tree The spatial index. \return The number of values stored in the index. @@ -1356,6 +1384,8 @@ inline size_t size(rtree const& tree) /*! \brief Query if there are no values stored in the index. +\ingroup rtree_group + \param tree The spatial index. \return true if there are no values in the index. @@ -1369,6 +1399,8 @@ inline bool empty(rtree const& tree) /*! \brief Get the box containing all stored values or an invalid box if the index has no values. +\ingroup rtree_group + \param tree The spatial index. \return The box containing all stored values or an invalid box. From 54a789ec78a901129ccae940ce1fe3448a9cd29d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 23:41:27 +0000 Subject: [PATCH 264/366] Added spatial and distance predicates to the reference. [SVN r82413] --- doc/Doxyfile | 3 +- doc/html/geometry_index/r_tree.html | 8 +- doc/html/geometry_index/r_tree/reference.html | 1614 +++++++++++++++-- doc/html/index.html | 2 +- doc/make_qbk.py | 4 +- doc/rtree.qbk | 4 +- .../doxygen_xml2qbk/quickbook_output.hpp | 2 +- .../extensions/index/distance_predicates.hpp | 32 + .../geometry/extensions/index/predicates.hpp | 38 +- .../geometry/extensions/index/rtree/rtree.hpp | 38 +- 10 files changed, 1593 insertions(+), 152 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index b6153ae9c..b43f01eaa 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -665,7 +665,8 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = ../boost/geometry/extensions/index/rtree/rtree.hpp +INPUT = ../boost/geometry/extensions/index/ \ + ../boost/geometry/extensions/index/rtree # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index a33049cd4..003a1f998 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -77,8 +77,12 @@
    Reference
    boost::geometry::index::rtree
    -
    boost::geometry::index::rtree - - global functions
    +
    Functions + related to the rtree (boost::geometry::index::)
    +
    Predicates + (boost::geometry::index::)
    +
    Distance + predicates (boost::geometry::index::)
    diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index a71b8dd98..3b9a9bcd6 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -27,15 +27,19 @@

    - + The R-tree spatial index.

    @@ -3176,8 +3180,8 @@ The R-tree spatial index.
    @@ -3200,7 +3204,7 @@ The R-tree spatial index. @@ -3227,7 +3231,7 @@ The R-tree spatial index. @@ -3268,7 +3272,7 @@ The R-tree spatial index. @@ -3375,7 +3379,7 @@ The R-tree spatial index. @@ -3388,7 +3392,7 @@ The R-tree spatial index. @@ -3401,7 +3405,7 @@ The R-tree spatial index. @@ -3416,15 +3420,15 @@ The R-tree spatial index.

    - insert(rtree<...> + insert(rtree<...> &, Value const &)

    @@ -3214,7 +3218,7 @@ The R-tree spatial index.

    - insert(rtree<...> + insert(rtree<...> &, Iterator, Iterator)

    - insert(rtree<...> + insert(rtree<...> &, Range const &)

    @@ -3241,7 +3245,7 @@ The R-tree spatial index.

    - remove(rtree<...> + remove(rtree<...> &, Value const &)

    @@ -3255,7 +3259,7 @@ The R-tree spatial index.

    - remove(rtree<...> + remove(rtree<...> &, Iterator, Iterator)

    - remove(rtree<...> + remove(rtree<...> &, Range const &)

    @@ -3282,7 +3286,7 @@ The R-tree spatial index.

    - spatial_query(rtree<...> + spatial_query(rtree<...> const &, Predicates const &, OutIter) @@ -3297,7 +3301,7 @@ The R-tree spatial index.

    - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, Value &) @@ -3312,7 +3316,7 @@ The R-tree spatial index.

    - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const @@ -3329,7 +3333,7 @@ The R-tree spatial index.

    - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, @@ -3345,7 +3349,7 @@ The R-tree spatial index.

    - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, @@ -3362,7 +3366,7 @@ The R-tree spatial index.

    - clear(rtree<...> + clear(rtree<...> &)

    - size(rtree<...> + size(rtree<...> const &)

    - empty(rtree<...> + empty(rtree<...> const &)

    - box(rtree<...> + box(rtree<...> const &)

    Insert a value to the index.

    - - Synopsis + + Synopsis

    @@ -3436,8 +3440,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -3511,15 +3515,15 @@ The R-tree spatial index.

    Insert a range of values to the index.

    - - Synopsis + + Synopsis

    @@ -3534,8 +3538,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -3625,15 +3629,15 @@ The R-tree spatial index.

    Insert a range of values to the index.

    - - Synopsis + + Synopsis

    @@ -3646,8 +3650,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -3721,23 +3725,23 @@ The R-tree spatial index.

    Remove a value from the container.

    - - Description + + Description

    Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

    - - Synopsis + + Synopsis

    @@ -3749,8 +3753,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -3819,8 +3823,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    1 if value was removed, 0 otherwise. @@ -3831,15 +3835,15 @@ The R-tree spatial index.

    Remove a range of values from the container.

    - - Description + + Description

    Remove a range of values from the container. In contrast to the STL set/map @@ -3849,8 +3853,8 @@ The R-tree spatial index. not all equal values.

    - - Synopsis + + Synopsis

    @@ -3865,8 +3869,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -3951,8 +3955,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of removed values. @@ -3963,15 +3967,15 @@ The R-tree spatial index.

    Remove a range of values from the container.

    - - Description + + Description

    Remove a range of values from the container. In contrast to the STL set/map @@ -3980,8 +3984,8 @@ The R-tree spatial index. not all equal values.

    - - Synopsis + + Synopsis

    @@ -3994,8 +3998,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4064,8 +4068,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of removed values. @@ -4076,15 +4080,15 @@ The R-tree spatial index.

    Find values meeting spatial predicates.

    - - Synopsis + + Synopsis

    @@ -4100,8 +4104,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4186,8 +4190,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of found values. @@ -4198,15 +4202,15 @@ The R-tree spatial index.

    Find the value meeting distances predicates.

    - - Synopsis + + Synopsis

    @@ -4221,8 +4225,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4308,8 +4312,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of found values. @@ -4320,7 +4324,7 @@ The R-tree spatial index.

    @@ -4328,8 +4332,8 @@ The R-tree spatial index. Find the value meeting distances and spatial predicates.

    - - Synopsis + + Synopsis

    @@ -4346,8 +4350,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4450,8 +4454,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of found values. @@ -4462,15 +4466,15 @@ The R-tree spatial index.

    Find k values meeting distances predicates.

    - - Synopsis + + Synopsis

    @@ -4487,8 +4491,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4591,8 +4595,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of found values. @@ -4603,7 +4607,7 @@ The R-tree spatial index.

    @@ -4611,8 +4615,8 @@ The R-tree spatial index. Find k values meeting distances and spatial predicates.

    - - Synopsis + + Synopsis

    @@ -4631,8 +4635,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4752,8 +4756,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of found values. @@ -4764,15 +4768,15 @@ The R-tree spatial index.

    Remove all values from the index.

    - - Synopsis + + Synopsis

    @@ -4784,8 +4788,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4839,15 +4843,15 @@ The R-tree spatial index.

    Get the number of values stored in the index.

    - - Synopsis + + Synopsis

    @@ -4859,8 +4863,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4909,8 +4913,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values stored in the index. @@ -4921,15 +4925,15 @@ The R-tree spatial index.

    Query if there are no values stored in the index.

    - - Synopsis + + Synopsis

    @@ -4941,8 +4945,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -4991,8 +4995,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    true if there are no values in the index. @@ -5003,7 +5007,7 @@ The R-tree spatial index.

    @@ -5011,8 +5015,8 @@ The R-tree spatial index. has no values.

    - - Synopsis + + Synopsis

    @@ -5024,8 +5028,8 @@ The R-tree spatial index.

    - - Parameters + + Parameters
    @@ -5074,8 +5078,8 @@ The R-tree spatial index.
    - - Returns + + Returns

    The box containing all stored values or an invalid box. @@ -5085,6 +5089,1370 @@ The R-tree spatial index.

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

    + Function +

    +
    +

    + Description +

    +
    +

    + empty() +

    +
    +

    + Generate empty predicate. +

    +
    +

    + value(ValuePredicate const + &) +

    +
    +

    + Generate value predicate. +

    +
    +

    + covered_by(Geometry const + &) +

    +
    +

    + Generate covered_by() predicate. +

    +
    +

    + disjoint(Geometry const + &) +

    +
    +

    + Generate disjoint() predicate. +

    +
    +

    + intersects(Geometry const + &) +

    +
    +

    + Generate intersects() predicate. +

    +
    +

    + overlaps(Geometry const + &) +

    +
    +

    + Generate overlaps() predicate. +

    +
    +

    + within(Geometry const + &) +

    +
    +

    + Generate within() predicate. +

    +
    +
    + +

    + Generate empty predicate. +

    +
    + + Synopsis +
    +

    +

    +
    detail::empty boost::geometry::index::empty()
    +

    +

    +
    +

    +
    +

    +
    + +

    + Generate value predicate. +

    +
    + + Description +
    +

    + A wrapper around user-defined functor describing if Value should be returned + by spatial query. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename ValuePredicate>
    +detail::value<ValuePredicate> boost::geometry::index::value(ValuePredicate const & vpred)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + ValuePredicate const & +

    +
    +

    + vpred +

    +
    +

    + The functor. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate covered_by() predicate. +

    +
    + + Description +
    +

    + Generate a predicate defining Value and Geometry relationship. Value + will be returned by the query if bg::covered_by(Indexable, Geometry) + returns true. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Geometry>
    +detail::covered_by<Geometry> boost::geometry::index::covered_by(Geometry const & g)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Geometry const + & +

    +
    +

    + g +

    +
    +

    + The Geometry object. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate disjoint() predicate. +

    +
    + + Description +
    +

    + Generate a predicate defining Value and Geometry relationship. Value + will be returned by the query if bg::disjoint(Indexable, Geometry) returns + true. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Geometry>
    +detail::disjoint<Geometry> boost::geometry::index::disjoint(Geometry const & g)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Geometry const + & +

    +
    +

    + g +

    +
    +

    + The Geometry object. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate intersects() predicate. +

    +
    + + Description +
    +

    + Generate a predicate defining Value and Geometry relationship. Value + will be returned by the query if bg::intersects(Indexable, Geometry) + returns true. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Geometry>
    +detail::intersects<Geometry> boost::geometry::index::intersects(Geometry const & g)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Geometry const + & +

    +
    +

    + g +

    +
    +

    + The Geometry object. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate overlaps() predicate. +

    +
    + + Description +
    +

    + Generate a predicate defining Value and Geometry relationship. Value + will be returned by the query if bg::overlaps(Indexable, Geometry) returns + true. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Geometry>
    +detail::overlaps<Geometry> boost::geometry::index::overlaps(Geometry const & g)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Geometry const + & +

    +
    +

    + g +

    +
    +

    + The Geometry object. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate within() predicate. +

    +
    + + Description +
    +

    + Generate a predicate defining Value and Geometry relationship. Value + will be returned by the query if bg::within(Indexable, Geometry) returns + true. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Geometry>
    +detail::within<Geometry> boost::geometry::index::within(Geometry const & g)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Geometry const + & +

    +
    +

    + g +

    +
    +

    + The Geometry object. +

    +
    +
    +

    +
    +

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

    + Function +

    +
    +

    + Description +

    +
    +

    + to_nearest(T const + &) +

    +
    +

    + Generate to_nearest() Point-Indexable relationship. +

    +
    +

    + to_centroid(T const + &) +

    +
    +

    + Generate to_centroid() Point-Indexable relationship. +

    +
    +

    + to_furthest(T const + &) +

    +
    +

    + Generate to_furthest() Point-Indexable relationship. +

    +
    +

    + unbounded(PointRelation const + &) +

    +
    +

    + Generate unbounded() distance predicate. +

    +
    +

    + min_bounded(PointRelation const + &, MinRelation + const &) +

    +
    +

    + Generate min_bounded() distance predicate. +

    +
    +

    + max_bounded(PointRelation const + &, MaxRelation + const &) +

    +
    +

    + Generate max_bounded() distance predicate. +

    +
    +

    + bounded(PointRelation const + &, MinRelation + const &, + MaxRelation const + &) +

    +
    +

    + Generate bounded() distance predicate. +

    +
    +
    + +

    + Generate to_nearest() Point-Indexable relationship. +

    +
    + + Description +
    +

    + Generate a nearest query Point and Value's Indexable relationship while + calculating distances. This function may be used to define that knn query + should calculate distances as smallest as possible between query Point + and Indexable's points. In other words it should be the distance to the + nearest Indexable's point. This function may be also used to define distances + bounds which indicates that Indexable's nearest point should be closer + or further than value v. This is default relation. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename T>
    +detail::to_nearest<T> boost::geometry::index::to_nearest(T const & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + T const + & +

    +
    +

    + v +

    +
    +

    + Point or bound value. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate to_centroid() Point-Indexable relationship. +

    +
    + + Description +
    +

    + Generate a nearest query Point and Value's Indexable relationship while + calculating distances. This function may be used to define that knn query + should calculate distances between query Point and Indexable's centroid. + This function may be also used to define distances bounds which indicates + that Indexable's centroid should be closer or further than value v. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename T>
    +detail::to_centroid<T> boost::geometry::index::to_centroid(T const & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + T const + & +

    +
    +

    + v +

    +
    +

    + Point or bound value. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate to_furthest() Point-Indexable relationship. +

    +
    + + Description +
    +

    + Generate a nearest query Point and Value's Indexable relationship while + calculating distances. This function may be used to define that knn query + should calculate distances as biggest as possible between query Point + and Indexable's points. In other words it should be the distance to the + furthest Indexable's point. This function may be also used to define + distances bounds which indicates that Indexable's furthest point should + be closer or further than value v. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename T>
    +detail::to_furthest<T> boost::geometry::index::to_furthest(T const & v)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + T const + & +

    +
    +

    + v +

    +
    +

    + Point or bound value. +

    +
    +
    +

    +
    +

    +
    + +

    + Generate unbounded() distance predicate. +

    +
    + + Description +
    +

    + Generate a distance predicate. This defines distances bounds which are + used by knn query. This function indicates that there is no distance + bounds and Values should be returned if distances between Point and Indexable + are the smallest. Distance calculation is defined by PointRelation. This + is default nearest predicate. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename PointRelation>
    +detail::unbounded<PointRelation> boost::geometry::index::unbounded(PointRelation const & pr)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + PointRelation const & +

    +
    +

    + pr +

    +
    +

    + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +

    +
    +
    +

    +
    +

    +
    + +

    + Generate min_bounded() distance predicate. +

    +
    + + Description +
    +

    + Generate a distance predicate. This defines distances bounds which are + used by knn query. This function indicates that Values should be returned + only if distances between Point and Indexable are greater or equal to + some min_distance passed in MinRelation. Check for closest Value is defined + by PointRelation. So it is possible e.g. to return Values with centroids + closest to some Point but only if nearest points are further than some + distance. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename PointRelation, typename MinRelation>
    +detail::min_bounded<PointRelation, MinRelation> boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + PointRelation const & +

    +
    +

    + pr +

    +
    +

    + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +

    +
    +

    + MinRelation const & +

    +
    +

    + minr +

    +
    +

    + The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). +

    +
    +
    +

    +
    +

    +
    + +

    + Generate max_bounded() distance predicate. +

    +
    + + Description +
    +

    + Generate a distance predicate. This defines distances bounds which are + used by knn query. This function indicates that Values should be returned + only if distances between Point and Indexable are lesser or equal to + some max_distance passed in MaxRelation. Check for closest Value is defined + by PointRelation. So it is possible e.g. to return Values with centroids + closest to some Point but only if nearest points are closer than some + distance. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename PointRelation, typename MaxRelation>
    +detail::max_bounded<PointRelation, MaxRelation> boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + PointRelation const & +

    +
    +

    + pr +

    +
    +

    + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +

    +
    +

    + MaxRelation const & +

    +
    +

    + maxr +

    +
    +

    + The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). +

    +
    +
    +

    +
    +

    +
    + +

    + Generate bounded() distance predicate. +

    +
    + + Description +
    +

    + Generate a distance predicate. This defines distances bounds which are + used by knn query. This function indicates that Values should be returned + only if distances between Point and Indexable are greater or equal to + some min_distance passed in MinRelation and lesser or equal to some max_distance + passed in MaxRelation. Check for closest Value is defined by PointRelation. + So it is possible e.g. to return Values with centroids closest to some + Point but only if nearest points are further than some distance and closer + than some other distance. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename PointRelation,
    +         typename MinRelation,
    +         typename MaxRelation>
    +detail::bounded<PointRelation, MinRelation, MaxRelation> boost::geometry::index::bounded(PointRelation const & pr,
    +                                                                                         MinRelation const & minr,
    +                                                                                         MaxRelation const & maxr)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + PointRelation const & +

    +
    +

    + pr +

    +
    +

    + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point). +

    +
    +

    + MinRelation const & +

    +
    +

    + minr +

    +
    +

    + The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). +

    +
    +

    + MaxRelation const & +

    +
    +

    + maxr +

    +
    +

    + The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). +

    +
    +
    +

    +
    +

    +
    diff --git a/doc/html/index.html b/doc/html/index.html index db38adc81..7a164ce02 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: January 08, 2013 at 23:01:28 GMT

    Last revised: January 08, 2013 at 23:37:30 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index 1fc61d148..fa1eba72b 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -19,6 +19,8 @@ cmd = cmd + " > generated/%s.qbk" os.system("doxygen Doxyfile") os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_tree.reference", "rtree")) -os.system(cmd % ("group__rtree__group", "geometry_index.r_tree.reference", "rtree_group")) +os.system(cmd % ("group__rtree__functions", "geometry_index.r_tree.reference", "rtree_functions")) +os.system(cmd % ("group__predicates", "geometry_index.r_tree.reference", "predicates")) +os.system(cmd % ("group__distance__predicates", "geometry_index.r_tree.reference", "distance_predicates")) os.system("b2") diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 1c116f39a..68f211273 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -20,7 +20,9 @@ [section:reference Reference] [include generated/rtree.qbk] -[include generated/rtree_group.qbk] +[include generated/rtree_functions.qbk] +[include generated/predicates.qbk] +[include generated/distance_predicates.qbk] [endsect] diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index ad25d4388..8302a1dde 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -813,7 +813,7 @@ void quickbook_output_alt(documentation const& doc, configuration const& config, if ( !doc.group_id.empty() ) { id_prefix = doc.group_id + ".function"; - std::cout << "[section:" << doc.group_id << " " << doc.group_title << " - global functions]" << std::endl; + std::cout << "[section:" << doc.group_id << " " << doc.group_title << "]" << std::endl; } quickbook_output_function(doc.functions, function_constructor_destructor, config, id_prefix, out, true); diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index afc0d2bdf..5f4d53ed8 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -17,6 +17,10 @@ #include +/*! +\defgroup distance_predicates Distance predicates (boost::geometry::index::) +*/ + namespace boost { namespace geometry { namespace index { //TODO: awulkiew - consider storing values instead of const references @@ -102,6 +106,8 @@ struct relation< to_furthest > // relations generators /*! +\brief Generate to_nearest() Point-Indexable relationship. + Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it @@ -109,6 +115,8 @@ should be the distance to the nearest Indexable's point. This function may be al to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation. +\ingroup distance_predicates + \tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation @@ -121,12 +129,16 @@ detail::to_nearest to_nearest(T const& v) } /*! +\brief Generate to_centroid() Point-Indexable relationship. + Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v. +\ingroup distance_predicates + \tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation @@ -139,6 +151,8 @@ detail::to_centroid to_centroid(T const& v) } /*! +\brief Generate to_furthest() Point-Indexable relationship. + Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it @@ -146,6 +160,8 @@ should be the distance to the furthest Indexable's point. This function may be a to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v. +\ingroup distance_predicates + \tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation @@ -237,11 +253,15 @@ struct bounded // distance predicates generators /*! +\brief Generate unbounded() distance predicate. + Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that there is no distance bounds and Values should be returned if distances between Point and Indexable are the smallest. Distance calculation is defined by PointRelation. This is default nearest predicate. +\ingroup distance_predicates + \tparam PointRelation PointRelation type. \param pr The point relation. This may be generated by bgi::to_nearest(Point), @@ -255,12 +275,16 @@ unbounded(PointRelation const& pr) } /*! +\brief Generate min_bounded() distance predicate. + Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance. +\ingroup distance_predicates + \tparam PointRelation PointRelation type. \tparam MinRelation MinRelation type. @@ -277,12 +301,16 @@ min_bounded(PointRelation const& pr, MinRelation const& minr) } /*! +\brief Generate max_bounded() distance predicate. + Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are closer than some distance. +\ingroup distance_predicates + \tparam PointRelation PointRelation type. \tparam MaxRelation MaxRelation type. @@ -299,6 +327,8 @@ max_bounded(PointRelation const& pr, MaxRelation const& maxr) } /*! +\brief Generate bounded() distance predicate. + Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to @@ -306,6 +336,8 @@ some max_distance passed in MaxRelation. Check for closest Value is defined by P So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance and closer than some other distance. +\ingroup distance_predicates + \tparam PointRelation PointRelation type. \tparam MinRelation MinRelation type. \tparam MaxRelation MaxRelation type. diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 3a9777d26..78f08f970 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -18,6 +18,10 @@ // TODO: awulkiew - temporary #include +/*! +\defgroup predicates Predicates (boost::geometry::index::) +*/ + namespace boost { namespace geometry { namespace index { namespace detail { @@ -122,7 +126,9 @@ struct not_within // generators /*! -Generate empty predicate. +\brief Generate empty predicate. + +\ingroup predicates */ inline detail::empty empty() { @@ -130,9 +136,13 @@ inline detail::empty empty() } /*! -Generate value predicate. A wrapper around user-defined functor +\brief Generate value predicate. + +A wrapper around user-defined functor describing if Value should be returned by spatial query. +\ingroup predicates + \tparam ValuePredicate Functor type. \param vpred The functor. @@ -144,10 +154,14 @@ inline detail::value value(ValuePredicate const& vpred) } /*! +\brief Generate covered_by() predicate. + Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::covered_by(Indexable, Geometry) returns true. +\ingroup predicates + \tparam Geometry The Geometry type. \param g The Geometry object. @@ -159,10 +173,14 @@ inline detail::covered_by covered_by(Geometry const& g) } /*! +\brief Generate disjoint() predicate. + Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::disjoint(Indexable, Geometry) returns true. +\ingroup predicates + \tparam Geometry The Geometry type. \param g The Geometry object. @@ -174,10 +192,14 @@ inline detail::disjoint disjoint(Geometry const& g) } /*! +\brief Generate intersects() predicate. + Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::intersects(Indexable, Geometry) returns true. +\ingroup predicates + \tparam Geometry The Geometry type. \param g The Geometry object. @@ -189,10 +211,14 @@ inline detail::intersects intersects(Geometry const& g) } /*! +\brief Generate overlaps() predicate. + Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::overlaps(Indexable, Geometry) returns true. +\ingroup predicates + \tparam Geometry The Geometry type. \param g The Geometry object. @@ -204,10 +230,14 @@ inline detail::overlaps overlaps(Geometry const& g) } //*! +//\brief Generate touches() predicate. +// //Generate a predicate defining Value and Geometry relationship. //Value will be returned by the query if bg::touches(Indexable, Geometry) //returns true. // +//\ingroup predicates +// //\tparam Geometry The Geometry type. // //\param g The Geometry object. @@ -219,10 +249,14 @@ inline detail::overlaps overlaps(Geometry const& g) //} /*! +\brief Generate within() predicate. + Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::within(Indexable, Geometry) returns true. +\ingroup predicates + \tparam Geometry The Geometry type. \param g The Geometry object. diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index c8b2752b6..fd865ded6 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -50,12 +50,12 @@ // TODO change the name to bounding_tree -namespace boost { namespace geometry { namespace index { - /*! -\defgroup rtree_group boost::geometry::index::rtree +\defgroup rtree_functions Functions related to the rtree (boost::geometry::index::) */ +namespace boost { namespace geometry { namespace index { + /*! \brief The R-tree spatial index. @@ -81,8 +81,6 @@ or Box concepts (which are Indexables). It also handles std::pair, and iterators. E.g. If std::pair is stored, the default translator translates from std::pair const& to Box const&. -\ingroup rtree_group - \tparam Value The type of objects stored in the container. \tparam Parameters Compile-time parameters. \tparam Translator The type of the translator which translates from Value to Indexable. @@ -1160,7 +1158,7 @@ private: /*! \brief Insert a value to the index. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param v The value which will be stored in the index. @@ -1174,7 +1172,7 @@ inline void insert(rtree & tree, Value co /*! \brief Insert a range of values to the index. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param first The beginning of the range of values. @@ -1189,7 +1187,7 @@ inline void insert(rtree & tree, Iterator /*! \brief Insert a range of values to the index. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param rng The range of values. @@ -1206,7 +1204,7 @@ inline void insert(rtree & tree, Range co Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param v The value which will be removed from the index. @@ -1228,7 +1226,7 @@ it doesn't take iterators pointing to values stored in this container. It remove to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param first The beginning of the range of values. @@ -1250,7 +1248,7 @@ Remove a range of values from the container. In contrast to the STL set/map eras it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param rng The range of values. @@ -1267,7 +1265,7 @@ remove(rtree & tree, Range const& rng) /*! \brief Find values meeting spatial predicates. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param pred The spatial predicates. @@ -1284,7 +1282,7 @@ inline size_t spatial_query(rtree const& /*! \brief Find the value meeting distances predicates. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param dpred The distances predicates. @@ -1301,7 +1299,7 @@ inline size_t nearest_query(rtree const& /*! \brief Find the value meeting distances and spatial predicates. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param dpred The distances predicates. @@ -1319,7 +1317,7 @@ inline size_t nearest_query(rtree const& /*! \brief Find k values meeting distances predicates. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param dpred The distances predicates. @@ -1337,7 +1335,7 @@ inline size_t nearest_query(rtree const& /*! \brief Find k values meeting distances and spatial predicates. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. \param dpred The distances predicates. @@ -1356,7 +1354,7 @@ inline size_t nearest_query(rtree const& /*! \brief Remove all values from the index. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. */ @@ -1369,7 +1367,7 @@ inline void clear(rtree & tree) /*! \brief Get the number of values stored in the index. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. @@ -1384,7 +1382,7 @@ inline size_t size(rtree const& tree) /*! \brief Query if there are no values stored in the index. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. @@ -1399,7 +1397,7 @@ inline bool empty(rtree const& tree) /*! \brief Get the box containing all stored values or an invalid box if the index has no values. -\ingroup rtree_group +\ingroup rtree_functions \param tree The spatial index. From cf6a052ffd2601a13572c3a59555d7f2a584dfc7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 8 Jan 2013 23:56:10 +0000 Subject: [PATCH 265/366] Added adaptors to the reference. [SVN r82414] --- doc/Doxyfile | 3 +- doc/html/geometry_index/r_tree.html | 2 + doc/html/geometry_index/r_tree/reference.html | 330 +++++++++++++++++- doc/html/index.html | 2 +- doc/make_qbk.py | 1 + doc/rtree.qbk | 1 + .../index/adaptors/nearest_query.hpp | 21 ++ .../index/adaptors/spatial_query.hpp | 11 + 8 files changed, 368 insertions(+), 3 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index b43f01eaa..1bba24089 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -666,7 +666,8 @@ WARN_LOGFILE = # with spaces. INPUT = ../boost/geometry/extensions/index/ \ - ../boost/geometry/extensions/index/rtree + ../boost/geometry/extensions/index/rtree \ + ../boost/geometry/extensions/index/adaptors # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 003a1f998..4ac7d7f96 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -83,6 +83,8 @@ (boost::geometry::index::)
    Distance predicates (boost::geometry::index::)
    +
    Spatial + indexes adaptors (boost::geometry::index::adaptors::)
    diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 3b9a9bcd6..e5f113879 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -33,13 +33,15 @@ (boost::geometry::index::)
    Distance predicates (boost::geometry::index::)
    +
    Spatial + indexes adaptors (boost::geometry::index::adaptors::)

    - + The R-tree spatial index.

    @@ -6453,6 +6455,332 @@ The R-tree spatial index.

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

    + Function +

    +
    +

    + Description +

    +
    +

    + nearest_queried(DistancesPredicates const + &, size_t, Predicates + const &) +

    +
    +

    + The nearest query index adaptor generator. +

    +
    +

    + nearest_queried(DistancesPredicates const + &, size_t) +

    +
    +

    + The nearest query index adaptor generator. +

    +
    +

    + spatial_queried(Predicates const + &) +

    +
    +

    + The spatial query index adaptor generator. +

    +
    +
    + +

    + The nearest query index adaptor generator. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates, typename Predicates>
    +detail::nearest_query<DistancesPredicates, Predicates> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred,
    +                                                                                                         size_t k,
    +                                                                                                         Predicates const & pred)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + Distance predicates. +

    +
    +

    + size_t +

    +
    +

    + k +

    +
    +

    + The number of values to find. +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + Spatial predicates. +

    +
    +
    +

    +
    +

    +
    + +

    + The nearest query index adaptor generator. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename DistancesPredicates>
    +detail::nearest_query<DistancesPredicates, index::detail::empty> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancesPredicates + const & +

    +
    +

    + dpred +

    +
    +

    + Distance predicates. +

    +
    +

    + size_t +

    +
    +

    + k +

    +
    +

    + The number of values to find. +

    +
    +
    +

    +
    +

    +
    + +

    + The spatial query index adaptor generator. +

    +
    + + Synopsis +
    +

    +

    +
    template<typename Predicates>
    +detail::spatial_query<Predicates> boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)
    +

    +

    +
    + + Parameters +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + Spatial predicates. +

    +
    +
    +

    +
    +

    +
    diff --git a/doc/html/index.html b/doc/html/index.html index 7a164ce02..ee3345a82 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: January 08, 2013 at 23:37:30 GMT

    Last revised: January 08, 2013 at 23:53:48 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index fa1eba72b..437d7d1ba 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -22,5 +22,6 @@ os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_t os.system(cmd % ("group__rtree__functions", "geometry_index.r_tree.reference", "rtree_functions")) os.system(cmd % ("group__predicates", "geometry_index.r_tree.reference", "predicates")) os.system(cmd % ("group__distance__predicates", "geometry_index.r_tree.reference", "distance_predicates")) +os.system(cmd % ("group__adaptors", "geometry_index.r_tree.reference", "adaptors")) os.system("b2") diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 68f211273..a4ea56da5 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -23,6 +23,7 @@ [include generated/rtree_functions.qbk] [include generated/predicates.qbk] [include generated/distance_predicates.qbk] +[include generated/adaptors.qbk] [endsect] diff --git a/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp b/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp index f9c6a046f..ea32d0d5e 100644 --- a/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp @@ -11,6 +11,10 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP +/*! +\defgroup adaptors Spatial indexes adaptors (boost::geometry::index::adaptors::) +*/ + namespace boost { namespace geometry { namespace index { namespace adaptors { @@ -65,6 +69,15 @@ struct nearest_query } // namespace detail +/*! +\brief The nearest query index adaptor generator. + +\ingroup adaptors + +\param dpred Distance predicates. +\param k The number of values to find. +\param pred Spatial predicates. +*/ template detail::nearest_query nearest_queried( @@ -75,6 +88,14 @@ nearest_queried( return detail::nearest_query(dpred, k, pred); } +/*! +\brief The nearest query index adaptor generator. + +\ingroup adaptors + +\param dpred Distance predicates. +\param k The number of values to find. +*/ template detail::nearest_query nearest_queried( diff --git a/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp b/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp index 8b9d12262..74439e3b1 100644 --- a/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp +++ b/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp @@ -11,6 +11,10 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP +/*! +\defgroup adaptors Spatial indexes adaptors (boost::geometry::index::adaptors::) +*/ + namespace boost { namespace geometry { namespace index { namespace adaptors { @@ -54,6 +58,13 @@ struct spatial_query } // namespace detail +/*! +\brief The spatial query index adaptor generator. + +\ingroup adaptors + +\param pred Spatial predicates. +*/ template detail::spatial_query spatial_queried(Predicates const& pred) From e72e9bcfadf480c04bda396924aed4e37f4b1f28 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 13:07:45 +0000 Subject: [PATCH 266/366] Added move ctors and swap() to nodes allocators. Used those in rtree move ctor and swap(). Docs: added rtree methods exceptions detailed description. [SVN r82415] --- doc/Doxyfile | 3 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 20 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 928 ++++++++++-------- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../extensions/index/rtree/node/concept.hpp | 2 +- .../extensions/index/rtree/node/node.hpp | 8 - .../index/rtree/node/node_d_mem_dynamic.hpp | 39 +- .../index/rtree/node/node_d_mem_static.hpp | 31 +- .../index/rtree/node/node_s_mem_dynamic.hpp | 35 +- .../index/rtree/node/node_s_mem_static.hpp | 25 + .../geometry/extensions/index/rtree/rtree.hpp | 203 ++-- test/rtree/test_rtree.hpp | 54 +- 18 files changed, 769 insertions(+), 605 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 1bba24089..c7265d0b0 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -203,7 +203,8 @@ TAB_SIZE = 8 # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = bgi_exception{1}="\xmlonly [heading Exception-safety] \1 \endxmlonly \htmlonly
    Exception-safety
    \1
    \endhtmlonly \latexonly \begin{DoxyReturn}{Exception-safety} \1 \end{DoxyReturn} \endlatexonly" +ALIASES = bgi_exception{1}="\xmlonly [heading Exception-safety] \1 \endxmlonly \htmlonly
    Exception-safety
    \1
    \endhtmlonly \latexonly \begin{DoxyReturn}{Exception-safety} \1 \end{DoxyReturn} \endlatexonly" \ + bgi_throws{1}="\xmlonly [heading Throws] \1 \endxmlonly \htmlonly
    Throws
    \1
    \endhtmlonly \latexonly \begin{DoxyReturn}{Throws} \1 \end{DoxyReturn} \endlatexonly" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding 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 4ac7d7f96..64c111cb5 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 a79271bfb..300395d3a 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 89d93898c..b0b2ee116 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

              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 + 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 [2]. + close to some point in space [2].

              The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

              The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

              -
                +
                • capable to store arbitrary Value type,
                • @@ -201,20 +201,20 @@
                -

                -

                [1] +


                +

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

                -

                [2] +

                [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                -

                [3] +

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

                -

                [4] +

                [4] 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 ffbfe87f5..d13849cbd 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index e5f113879..5b1c16d4e 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -41,12 +41,12 @@ boost::geometry::index::rtree

                - + The R-tree spatial index.

                - Description + Description

                The R-tree spatial index. This is self-balancing spatial index capable @@ -74,14 +74,14 @@ The R-tree spatial index.

                - Header + Header

                #include <.hpp>

                - Synopsis + Synopsis

                @@ -98,7 +98,7 @@ The R-tree spatial index.

                - Template + Template parameter(s)
                @@ -172,7 +172,7 @@ The R-tree spatial index.
                - Typedef(s) + Typedef(s)
                @@ -280,7 +280,7 @@ The R-tree spatial index.
                - Constructor(s) + Constructor(s) and destructor
                @@ -307,6 +307,18 @@ The R-tree spatial index. rtree()

                + + + + @@ -329,7 +341,7 @@ The R-tree spatial index. @@ -342,7 +354,7 @@ The R-tree spatial index. @@ -367,7 +379,7 @@ The R-tree spatial index.
                +

                + The default constructor. +

                +
                +

                + rtree() +

                +

                The constructor. @@ -316,7 +328,7 @@ The R-tree spatial index.

                - rtree(Iterator, + rtree(Iterator, Iterator)

                - rtree(Range const + rtree(Range const &)

                - ~rtree() + ~rtree()

                @@ -354,7 +366,7 @@ The R-tree spatial index.

                - rtree(rtree const + rtree(rtree const &)

                - rtree(rtree const + rtree(rtree const &, allocator_type const &)

                @@ -381,7 +393,7 @@ The R-tree spatial index.

                - rtree(rtree &&) + rtree(rtree &&)

                @@ -394,7 +406,7 @@ The R-tree spatial index.
                - Member(s) + Member(s)
                @@ -417,7 +429,7 @@ The R-tree spatial index. @@ -430,7 +442,7 @@ The R-tree spatial index. @@ -467,7 +479,7 @@ The R-tree spatial index. @@ -480,7 +492,7 @@ The R-tree spatial index. @@ -493,7 +505,7 @@ The R-tree spatial index. @@ -506,7 +518,7 @@ The R-tree spatial index. @@ -519,7 +531,7 @@ The R-tree spatial index. @@ -532,7 +544,7 @@ The R-tree spatial index. @@ -546,7 +558,7 @@ The R-tree spatial index. @@ -591,7 +603,7 @@ The R-tree spatial index. @@ -668,7 +680,7 @@ The R-tree spatial index. @@ -792,6 +795,9 @@ The R-tree spatial index.

                @@ -6948,7 +6954,7 @@ The R-tree spatial index. boost::geometry::index::translator::def

                - + The default translator.

                @@ -7022,7 +7028,7 @@ The default translator. boost::geometry::index::translator::index

                - + The index translator.

                diff --git a/doc/html/index.html b/doc/html/index.html index 6acab8b37..dcaf534de 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@

                - operator=(const rtree + operator=(const rtree &)

                - operator=(rtree &&) + operator=(rtree &&)

                @@ -442,7 +454,7 @@ The R-tree spatial index.

                - swap(rtree &) + swap(rtree &)

                @@ -454,7 +466,7 @@ The R-tree spatial index.

                - insert(value_type const + insert(value_type const &)

                - insert(Iterator, + insert(Iterator, Iterator)

                - insert(Range const + insert(Range const &)

                - remove(value_type const + remove(value_type const &)

                - remove(Iterator, + remove(Iterator, Iterator)

                - remove(Range const + remove(Range const &)

                - spatial_query(Predicates const + spatial_query(Predicates const &, OutIter)

                - nearest_query(DistancesPredicates const + nearest_query(DistancesPredicates const &, value_type &)

                @@ -561,7 +573,7 @@ The R-tree spatial index.

                - nearest_query(DistancesPredicates const + nearest_query(DistancesPredicates const &, Predicates const &, value_type &) @@ -577,7 +589,7 @@ The R-tree spatial index.

                - nearest_query(DistancesPredicates const + nearest_query(DistancesPredicates const &, size_t, OutIter)

                - nearest_query(DistancesPredicates const + nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter) @@ -607,7 +619,7 @@ The R-tree spatial index.

                - size() + size()

                @@ -619,7 +631,7 @@ The R-tree spatial index.

                - empty() + empty()

                @@ -631,7 +643,7 @@ The R-tree spatial index.

                - clear() + clear()

                @@ -643,7 +655,7 @@ The R-tree spatial index.

                - box() + box()

                @@ -655,7 +667,7 @@ The R-tree spatial index.

                - count(ValueOrIndexable const + count(ValueOrIndexable const &)

                - parameters() + parameters()

                @@ -680,7 +692,7 @@ The R-tree spatial index.

                - translator() + translator()

                @@ -692,7 +704,7 @@ The R-tree spatial index.

                - get_allocator() + get_allocator()

                @@ -711,11 +723,38 @@ The R-tree spatial index. rtree()

                - The constructor. + The default constructor.

                - Synopsis + Synopsis +
                +

                +

                +
                rtree()
                +

                +

                +
                + + Throws +
                +

                + Nothing. +

                + +

                +
                +

                +
                + +

                + The constructor. +

                +
                + + Synopsis

                @@ -725,8 +764,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -806,11 +845,11 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - nothrow + If allocator copy constructor throws.

                @@ -818,15 +857,15 @@ The R-tree spatial index.

                The constructor.

                - - Synopsis + + Synopsis

                @@ -839,8 +878,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -954,11 +993,12 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - strong + If allocator copy constructor throws. If Value copy constructor or copy + assignment throws. When nodes allocation fails.

                @@ -966,15 +1006,15 @@ The R-tree spatial index.

                The constructor.

                - - Synopsis + + Synopsis

                @@ -986,8 +1026,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1085,11 +1125,12 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - strong + If allocator copy constructor throws. If Value copy constructor or copy + assignment throws. When nodes allocation fails.

                @@ -1097,14 +1138,14 @@ The R-tree spatial index.

                The destructor.

                - - Synopsis + + Synopsis

                @@ -1112,11 +1153,11 @@ The R-tree spatial index.

                - - Exception-safety + + Throws

                - nothrow + Nothing.

                @@ -1124,22 +1165,22 @@ The R-tree spatial index.

                The copy constructor.

                - - Description + + Description

                It uses parameters, translator and allocator from the source tree.

                - - Synopsis + + Synopsis

                @@ -1147,8 +1188,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1193,11 +1234,12 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - strong + If allocator copy constructor throws. If Value copy constructor throws. + When nodes allocation fails.

                @@ -1205,22 +1247,22 @@ The R-tree spatial index.

                The copy constructor.

                - - Description + + Description

                It uses Parameters and translator from the source tree.

                - - Synopsis + + Synopsis

                @@ -1228,8 +1270,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1293,11 +1335,12 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - strong + If allocator copy constructor throws. If Value copy constructor throws. + When nodes allocation fails.

                @@ -1305,22 +1348,22 @@ The R-tree spatial index.

                The moving constructor.

                - - Description + + Description

                It uses parameters, translator and allocator from the source tree.

                - - Synopsis + + Synopsis

                @@ -1328,8 +1371,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1373,11 +1416,11 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - nothrow + If allocator move constructor throws.

                @@ -1385,22 +1428,22 @@ The R-tree spatial index.

                The assignment operator.

                - - Description + + Description

                It uses parameters and translator from the source tree.

                - - Synopsis + + Synopsis

                @@ -1408,8 +1451,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1454,11 +1497,11 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - strong + If Value copy constructor throws. When nodes allocation fails.

                @@ -1466,22 +1509,22 @@ The R-tree spatial index.

                The moving assignment.

                - - Description + + Description

                It uses parameters and translator from the source tree.

                - - Synopsis + + Synopsis

                @@ -1489,8 +1532,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1534,11 +1577,12 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - nothrow (if allocators are equal), strong (if allocators aren't equal) + Only if allocators aren't equal. If Value copy constructor throws. When + nodes allocation fails.

                @@ -1546,22 +1590,22 @@ The R-tree spatial index.

                Swaps contents of two rtrees.

                - - Description + + Description

                Parameters, translator and allocators are swapped as well.

                - - Synopsis + + Synopsis

                @@ -1569,8 +1613,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1614,11 +1658,11 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - nothrow + If allocators swap throws.

                @@ -1626,15 +1670,15 @@ The R-tree spatial index.

                Insert a value to the index.

                - - Synopsis + + Synopsis

                @@ -1642,8 +1686,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1687,13 +1731,21 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. + If Value copy constructor or copy assignment throws. When nodes allocation + fails. +

                +
                + + Exception-safety +
                +

                + This operation is not thread safe. If it throws, the R-tree may be left + in an inconsistent state, elements must not be inserted or removed, methods + may return invalid data.

                @@ -1701,15 +1753,15 @@ The R-tree spatial index.

                Insert a range of values to the index.

                - - Synopsis + + Synopsis

                @@ -1718,8 +1770,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1782,13 +1834,21 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. + If Value copy constructor or copy assignment throws. When nodes allocation + fails. +

                +
                + + Exception-safety +
                +

                + This operation is not thread safe. If it throws, the R-tree may be left + in an inconsistent state, elements must not be inserted or removed, methods + may return invalid data.

                @@ -1796,15 +1856,15 @@ The R-tree spatial index.

                Insert a range of values to the index.

                - - Synopsis + + Synopsis

                @@ -1813,8 +1873,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1859,13 +1919,21 @@ The R-tree spatial index.
                - - Exception-safety + + Throws

                - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. + If Value copy constructor or copy assignment throws. When nodes allocation + fails. +

                +
                + + Exception-safety +
                +

                + This operation is not thread safe. If it throws, the R-tree may be left + in an inconsistent state, elements must not be inserted or removed, methods + may return invalid data.

                @@ -1873,23 +1941,23 @@ The R-tree spatial index.

                Remove a value from the container.

                - - Description + + Description

                In contrast to the STL set/map erase() method this method removes only one value from the container.

                - - Synopsis + + Synopsis

                @@ -1897,8 +1965,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -1942,20 +2010,28 @@ The R-tree spatial index.
                - - Returns + + Returns

                1 if the value was removed, 0 otherwise.

                - - Exception-safety + + Throws

                - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. + If Value copy constructor or copy assignment throws. When nodes allocation + fails. +

                +
                + + Exception-safety +
                +

                + This operation is not thread safe. If it throws, the R-tree may be left + in an inconsistent state, elements must not be inserted or removed, methods + may return invalid data.

                @@ -1963,15 +2039,15 @@ The R-tree spatial index.

                Remove a range of values from the container.

                - - Description + + Description

                In contrast to the STL set/map erase() method it doesn't take iterators @@ -1980,8 +2056,8 @@ The R-tree spatial index. value for each one passed in the range, not all equal values.

                - - Synopsis + + Synopsis

                @@ -1990,8 +2066,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -2054,20 +2130,28 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of removed values.

                - - Exception-safety + + Throws

                - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. + If Value copy constructor or copy assignment throws. When nodes allocation + fails. +

                +
                + + Exception-safety +
                +

                + This operation is not thread safe. If it throws, the R-tree may be left + in an inconsistent state, elements must not be inserted or removed, methods + may return invalid data.

                @@ -2075,15 +2159,15 @@ The R-tree spatial index.

                Remove a range of values from the container.

                - - Description + + Description

                In contrast to the STL set/map erase() method it removes values equal @@ -2091,8 +2175,8 @@ The R-tree spatial index. value for each one passed in the range, not all equal values.

                - - Synopsis + + Synopsis

                @@ -2101,8 +2185,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -2147,20 +2231,28 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of removed values.

                - - Exception-safety + + Throws

                - not safe - if this operation throws, the R-tree may be left in an inconsistent - state, elements must not be inserted or removed, methods may return invalid - data. + If Value copy constructor or copy assignment throws. When nodes allocation + fails. +

                +
                + + Exception-safety +
                +

                + This operation is not thread safe. If it throws, the R-tree may be left + in an inconsistent state, elements must not be inserted or removed, methods + may return invalid data.

                @@ -2168,15 +2260,15 @@ The R-tree spatial index.

                Finds values meeting spatial predicates, e.g. intersecting some Box.

                - - Description + + Description

                Spatial predicates may be a Geometry (in this case default predicate @@ -2187,8 +2279,8 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

                - - Synopsis + + Synopsis

                @@ -2197,8 +2289,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -2262,18 +2354,19 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of values found.

                - - Exception-safety + + Throws

                - strong + If Value copy constructor or copy assignment throws. If OutIter dereference + or increment throws.

                @@ -2281,15 +2374,15 @@ The R-tree spatial index.

                Finds one value meeting distances predicates, e.g. nearest to some Point.

                - - Description + + Description

                The distances predicates may be a Point. This is default case where Value @@ -2305,8 +2398,8 @@ The R-tree spatial index. or bgi::to_furthest(dist_bound).

                - - Synopsis + + Synopsis

                @@ -2315,8 +2408,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -2380,18 +2473,18 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of values found.

                - - Exception-safety + + Throws

                - strong + If Value copy constructor or copy assignment throws.

                @@ -2399,7 +2492,7 @@ The R-tree spatial index.

                @@ -2407,8 +2500,8 @@ The R-tree spatial index. e.g. nearest to some Point and intersecting some Box.

                - - Description + + Description

                The distances predicates may be a Point. This is default case where Value @@ -2432,8 +2525,8 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

                - - Synopsis + + Synopsis

                @@ -2444,8 +2537,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -2526,18 +2619,18 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of values found.

                - - Exception-safety + + Throws

                - strong + If Value copy constructor or copy assignment throws.

                @@ -2545,7 +2638,7 @@ The R-tree spatial index.

                @@ -2553,8 +2646,8 @@ The R-tree spatial index. some Point.

                - - Description + + Description

                The distances predicates. May be a Point. This is default case where @@ -2570,8 +2663,8 @@ The R-tree spatial index. or bgi::to_furthest(dist_bound).

                - - Synopsis + + Synopsis

                @@ -2582,8 +2675,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -2664,18 +2757,19 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of values found.

                - - Exception-safety + + Throws

                - strong + If Value copy constructor or copy assignment throws. If OutIter dereference + or increment throws.

                @@ -2683,7 +2777,7 @@ The R-tree spatial index.

                @@ -2691,8 +2785,8 @@ The R-tree spatial index. k nearest values to some Point and intersecting some Box.

                - - Description + + Description

                The distances predicates may be a Point. This is default case where Value @@ -2716,8 +2810,8 @@ The R-tree spatial index. Those predicates may be passed together in std::pair or boost::tuple.

                - - Synopsis + + Synopsis

                @@ -2731,8 +2825,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -2830,18 +2924,19 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of values found.

                - - Exception-safety + + Throws

                - strong + If Value copy constructor or copy assignment throws. If OutIter dereference + or increment throws.

                @@ -2849,14 +2944,14 @@ The R-tree spatial index.

                Returns the number of stored values.

                - - Synopsis + + Synopsis

                @@ -2864,18 +2959,18 @@ The R-tree spatial index.

                - - Returns + + Returns

                The number of stored values.

                - - Exception-safety + + Throws

                - nothrow + Nothing.

                @@ -2883,14 +2978,14 @@ The R-tree spatial index.

                Query if the container is empty.

                - - Synopsis + + Synopsis

                @@ -2898,18 +2993,18 @@ The R-tree spatial index.

                - - Returns + + Returns

                true if the container is empty.

                - - Exception-safety + + Throws

                - nothrow + Nothing.

                @@ -2917,14 +3012,14 @@ The R-tree spatial index.

                Removes all values stored in the container.

                - - Synopsis + + Synopsis

                @@ -2932,11 +3027,11 @@ The R-tree spatial index.

                - - Exception-safety + + Throws

                - nothrow + Nothing.

                @@ -2944,22 +3039,22 @@ The R-tree spatial index.

                Returns the box containing all values stored in the container.

                - - Description + + Description

                Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.

                - - Synopsis + + Synopsis

                @@ -2967,20 +3062,19 @@ The R-tree spatial index.

                - - Returns + + Returns

                The box containing all values stored in the container or an invalid box if there are no values in the container.

                - - Exception-safety + + Throws

                - nothrow (if Indexable's CoordinateType copy assignment doesn't throw), - strong (if Indexable's CoordinateType copy assignment throws). + Nothing.

                @@ -2988,15 +3082,15 @@ The R-tree spatial index.

                Count Values or Indexables stored in the container.

                - - Description + + Description

                For indexable_type it returns the number of values which indexables equals @@ -3004,8 +3098,8 @@ The R-tree spatial index. the parameter.

                - - Synopsis + + Synopsis

                @@ -3014,8 +3108,8 @@ The R-tree spatial index.

                - - Parameters + + Parameters
                @@ -3060,18 +3154,18 @@ The R-tree spatial index.
                - - Returns + + Returns

                The number of values found.

                - - Exception-safety + + Throws

                - nothrow + Nothing.

                @@ -3079,14 +3173,14 @@ The R-tree spatial index.

                Returns parameters.

                - - Synopsis + + Synopsis

                @@ -3094,18 +3188,18 @@ The R-tree spatial index.

                - - Returns + + Returns

                The parameters object.

                - - Exception-safety + + Throws

                - nothrow + Nothing.

                @@ -3113,14 +3207,14 @@ The R-tree spatial index.

                Returns the translator object.

                - - Synopsis + + Synopsis

                @@ -3128,18 +3222,18 @@ The R-tree spatial index.

                - - Returns + + Returns

                The translator object.

                - - Exception-safety + + Throws

                - nothrow + Nothing.

                @@ -3147,14 +3241,14 @@ The R-tree spatial index.

                Returns allocator used by the rtree.

                - - Synopsis + + Synopsis

                @@ -3162,18 +3256,18 @@ The R-tree spatial index.

                - - Returns + + Returns

                The allocator.

                - - Exception-safety + + Throws

                - nothrow + If allocator copy constructor throws.

                @@ -3430,7 +3524,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -3443,7 +3537,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -3525,7 +3619,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -3541,7 +3635,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -3639,7 +3733,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -3653,7 +3747,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -3735,7 +3829,7 @@ The R-tree spatial index.

                - Description + Description

                Remove a value from the container. In contrast to the STL set/map erase() @@ -3743,7 +3837,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -3756,7 +3850,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -3826,7 +3920,7 @@ The R-tree spatial index.
                - Returns + Returns

                1 if value was removed, 0 otherwise. @@ -3845,7 +3939,7 @@ The R-tree spatial index.

                - Description + Description

                Remove a range of values from the container. In contrast to the STL set/map @@ -3856,7 +3950,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -3872,7 +3966,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -3958,7 +4052,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of removed values. @@ -3977,7 +4071,7 @@ The R-tree spatial index.

                - Description + Description

                Remove a range of values from the container. In contrast to the STL set/map @@ -3987,7 +4081,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4001,7 +4095,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4071,7 +4165,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of removed values. @@ -4090,7 +4184,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4107,7 +4201,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4193,7 +4287,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of found values. @@ -4212,7 +4306,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4228,7 +4322,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4315,7 +4409,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of found values. @@ -4335,7 +4429,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4353,7 +4447,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4457,7 +4551,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of found values. @@ -4476,7 +4570,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4494,7 +4588,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4598,7 +4692,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of found values. @@ -4618,7 +4712,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4638,7 +4732,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4759,7 +4853,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of found values. @@ -4778,7 +4872,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4791,7 +4885,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4853,7 +4947,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4866,7 +4960,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4916,7 +5010,7 @@ The R-tree spatial index.
                - Returns + Returns

                The number of values stored in the index. @@ -4935,7 +5029,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -4948,7 +5042,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -4998,7 +5092,7 @@ The R-tree spatial index.
                - Returns + Returns

                true if there are no values in the index. @@ -5018,7 +5112,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5031,7 +5125,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5081,7 +5175,7 @@ The R-tree spatial index.
                - Returns + Returns

                The box containing all stored values or an invalid box. @@ -5215,7 +5309,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5236,7 +5330,7 @@ The R-tree spatial index.

                - Description + Description

                A wrapper around user-defined functor describing if Value should be returned @@ -5244,7 +5338,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5254,7 +5348,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5311,7 +5405,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a predicate defining Value and Geometry relationship. Value @@ -5320,7 +5414,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5330,7 +5424,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5388,7 +5482,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a predicate defining Value and Geometry relationship. Value @@ -5397,7 +5491,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5407,7 +5501,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5465,7 +5559,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a predicate defining Value and Geometry relationship. Value @@ -5474,7 +5568,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5484,7 +5578,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5542,7 +5636,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a predicate defining Value and Geometry relationship. Value @@ -5551,7 +5645,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5561,7 +5655,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5619,7 +5713,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a predicate defining Value and Geometry relationship. Value @@ -5628,7 +5722,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5638,7 +5732,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5818,7 +5912,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a nearest query Point and Value's Indexable relationship while @@ -5831,7 +5925,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5841,7 +5935,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5899,7 +5993,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a nearest query Point and Value's Indexable relationship while @@ -5910,7 +6004,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -5920,7 +6014,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -5978,7 +6072,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a nearest query Point and Value's Indexable relationship while @@ -5991,7 +6085,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6001,7 +6095,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -6059,7 +6153,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a distance predicate. This defines distances bounds which are @@ -6070,7 +6164,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6080,7 +6174,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -6138,7 +6232,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a distance predicate. This defines distances bounds which are @@ -6151,7 +6245,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6161,7 +6255,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -6239,7 +6333,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a distance predicate. This defines distances bounds which are @@ -6252,7 +6346,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6262,7 +6356,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -6340,7 +6434,7 @@ The R-tree spatial index.

                - Description + Description

                Generate a distance predicate. This defines distances bounds which are @@ -6354,7 +6448,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6368,7 +6462,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -6530,7 +6624,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6542,7 +6636,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -6636,7 +6730,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6646,7 +6740,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                @@ -6723,7 +6817,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis

                @@ -6733,7 +6827,7 @@ The R-tree spatial index.

                - Parameters + Parameters
                diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 9ec8f8b5c..2e4bf7514 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 - + @@ -150,7 +150,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 dc19fd16b..7fee097e3 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 ee3345a82..eebc5f656 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: January 08, 2013 at 23:53:48 GMT

                Last revised: January 09, 2013 at 12:57:55 GMT


                diff --git a/include/boost/geometry/extensions/index/rtree/node/concept.hpp b/include/boost/geometry/extensions/index/rtree/node/concept.hpp index 55238ddb0..dacc3d746 100644 --- a/include/boost/geometry/extensions/index/rtree/node/concept.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/concept.hpp @@ -52,7 +52,7 @@ struct visitor }; template -struct allocators +class allocators { BOOST_MPL_ASSERT_MSG( (false), diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/rtree/node/node.hpp index 87f5d9d0a..64b0bfc30 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node.hpp @@ -13,14 +13,6 @@ #include -// WARNING! -// The Node elements containing pointers to nodes, i.e. pair MUST NOT throw an exception -// in the copy constructor. Otherwise copying may be broken in push_back() of internal vectors. -// The result may be two copies of the same pointer in the vector. This may cause the attempt to destroy -// the same object two times. -// This means for example that Value's CoordinateType copy constructor MUST NOT throw an exception -// because Value's CoordinateType is used in Box type. - #include #include diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp index 66aa289f1..5d06919a3 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp @@ -152,8 +152,12 @@ struct container_from_elements_type // allocators template -struct allocators +class allocators + : nonassignable { + BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) + +public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; @@ -173,6 +177,14 @@ struct allocators Value >::other leaf_elements_allocator_type; + inline allocators() + : allocator() + , internal_node_allocator() + , leaf_allocator() + , internal_node_elements_allocator() + , leaf_elements_allocator() + {} + inline explicit allocators(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) @@ -181,6 +193,31 @@ struct allocators , leaf_elements_allocator(allocator) {} + inline allocators(allocators const& a) + : allocator(a.allocator) + , internal_node_allocator(a.internal_node_allocator) + , leaf_allocator(a.leaf_allocator) + , internal_node_elements_allocator(a.internal_node_elements_allocator) + , leaf_elements_allocator(a.leaf_elements_allocator) + {} + + inline allocators(BOOST_RV_REF(allocators) a) + : allocator(boost::move(a.allocator)) + , internal_node_allocator(boost::move(a.internal_node_allocator)) + , leaf_allocator(boost::move(a.leaf_allocator)) + , internal_node_elements_allocator(boost::move(a.internal_node_elements_allocator)) + , leaf_elements_allocator(boost::move(a.leaf_elements_allocator)) + {} + + void swap(allocators & a) + { + boost::swap(allocator, a.allocator); + boost::swap(internal_node_allocator, a.internal_node_allocator); + boost::swap(leaf_allocator, a.leaf_allocator); + boost::swap(internal_node_elements_allocator, a.internal_node_elements_allocator); + boost::swap(leaf_elements_allocator, a.leaf_elements_allocator); + } + allocator_type allocator; internal_node_allocator_type internal_node_allocator; leaf_allocator_type leaf_allocator; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp index 5fde64552..71d4b4488 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp @@ -90,8 +90,12 @@ struct container_from_elements_type, NewValue> // allocators template -struct allocators +class allocators + : nonassignable { + BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) + +public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; @@ -103,12 +107,37 @@ struct allocators typename leaf::type >::other leaf_allocator_type; + inline allocators() + : allocator() + , internal_node_allocator() + , leaf_allocator() + {} + inline explicit allocators(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) {} + inline allocators(allocators const& a) + : allocator(a.allocator) + , internal_node_allocator(a.internal_node_allocator) + , leaf_allocator(a.leaf_allocator) + {} + + inline allocators(BOOST_RV_REF(allocators) a) + : allocator(boost::move(a.allocator)) + , internal_node_allocator(boost::move(a.internal_node_allocator)) + , leaf_allocator(boost::move(a.leaf_allocator)) + {} + + void swap(allocators & a) + { + boost::swap(allocator, a.allocator); + boost::swap(internal_node_allocator, a.internal_node_allocator); + boost::swap(leaf_allocator, a.leaf_allocator); + } + allocator_type allocator; internal_node_allocator_type internal_node_allocator; leaf_allocator_type leaf_allocator; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp index 237141e74..e620ded8d 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp @@ -121,8 +121,12 @@ element_indexable(std::pair< // allocators template -struct allocators +class allocators + : nonassignable { + BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) + +public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; @@ -138,6 +142,13 @@ struct allocators Value >::other leaf_elements_allocator_type; + inline allocators() + : allocator() + , node_allocator() + , internal_node_elements_allocator() + , leaf_elements_allocator() + {} + inline explicit allocators(Allocator alloc) : allocator(alloc) , node_allocator(allocator) @@ -145,6 +156,28 @@ struct allocators , leaf_elements_allocator(allocator) {} + inline allocators(allocators const& a) + : allocator(a.allocator) + , node_allocator(a.node_allocator) + , internal_node_elements_allocator(a.internal_node_elements_allocator) + , leaf_elements_allocator(a.leaf_elements_allocator) + {} + + inline allocators(BOOST_RV_REF(allocators) a) + : allocator(boost::move(a.allocator)) + , node_allocator(boost::move(a.node_allocator)) + , internal_node_elements_allocator(boost::move(a.internal_node_elements_allocator)) + , leaf_elements_allocator(boost::move(a.leaf_elements_allocator)) + {} + + void swap(allocators & a) + { + boost::swap(allocator, a.allocator); + boost::swap(node_allocator, a.node_allocator); + boost::swap(internal_node_elements_allocator, a.internal_node_elements_allocator); + boost::swap(leaf_elements_allocator, a.leaf_elements_allocator); + } + allocator_type allocator; node_allocator_type node_allocator; internal_node_elements_allocator_type internal_node_elements_allocator; diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp index 54ac35a9d..4040124bc 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp @@ -84,7 +84,11 @@ struct visitor struct allocators + : nonassignable { + BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) + +public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; @@ -100,11 +104,32 @@ struct allocators Value >::other leaf_elements_allocator_type; + inline allocators() + : allocator() + , node_allocator() + {} + inline explicit allocators(Allocator alloc) : allocator(alloc) , node_allocator(allocator) {} + inline allocators(allocators const& a) + : allocator(a.allocator) + , node_allocator(a.node_allocator) + {} + + inline allocators(BOOST_RV_REF(allocators) a) + : allocator(boost::move(a.allocator)) + , node_allocator(boost::move(a.node_allocator)) + {} + + void swap(allocators & a) + { + boost::swap(allocator, a.allocator); + boost::swap(node_allocator, a.node_allocator); + } + allocator_type allocator; node_allocator_type node_allocator; }; diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index fd865ded6..d5800c75a 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -125,6 +125,22 @@ private: typedef typename detail::rtree::leaf::type leaf; public: + /*! + \brief The default constructor. + + \bgi_throws{ + Nothing. + } + */ + inline explicit rtree() + : m_translator() // SHOULDN'T THROW + , m_parameters() + , m_allocators() + , m_values_count(0) + , m_leafs_level(0) + , m_root(0) + {} + /*! \brief The constructor. @@ -132,8 +148,8 @@ public: \param translator The translator object. \param allocator The allocator object. - \bgi_exception{ - nothrow + \bgi_throws{ + If allocator copy constructor throws. } */ inline explicit rtree(parameters_type parameters = parameters_type(), @@ -156,8 +172,9 @@ public: \param translator The translator object. \param allocator The allocator object. - \bgi_exception{ - strong + \bgi_throws{ + If allocator copy constructor throws. If Value copy constructor or copy assignment throws. + When nodes allocation fails. } */ template @@ -191,8 +208,9 @@ public: \param translator The translator object. \param allocator The allocator object. - \bgi_exception{ - strong + \bgi_throws{ + If allocator copy constructor throws. If Value copy constructor or copy assignment throws. + When nodes allocation fails. } */ template @@ -221,8 +239,8 @@ public: /*! \brief The destructor. - \bgi_exception{ - nothrow + \bgi_throws{ + Nothing. } */ inline ~rtree() @@ -237,8 +255,9 @@ public: \param src The rtree which content will be copied. - \bgi_exception{ - strong + \bgi_throws{ + If allocator copy constructor throws. If Value copy constructor throws. + When nodes allocation fails. } */ inline rtree(rtree const& src) @@ -262,8 +281,9 @@ public: \param src The rtree which content will be copied. \param allocator The allocator which will be used. - \bgi_exception{ - strong + \bgi_throws{ + If allocator copy constructor throws. If Value copy constructor throws. + When nodes allocation fails. } */ inline rtree(rtree const& src, allocator_type const& allocator) @@ -284,8 +304,8 @@ public: \param src The rtree which content will be moved. - \bgi_exception{ - nothrow + \bgi_throws{ + If allocator move constructor throws. } */ inline rtree(BOOST_RV_REF(rtree) src) @@ -309,8 +329,9 @@ public: \param src The rtree which content will be copied. - \bgi_exception{ - strong + \bgi_throws{ + If Value copy constructor throws. + When nodes allocation fails. } */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) @@ -333,8 +354,8 @@ public: \param src The rtree which content will be moved. - \bgi_exception{ - nothrow (if allocators are equal), strong (if allocators aren't equal) + \bgi_throws{ + Only if allocators aren't equal. If Value copy constructor throws. When nodes allocation fails. } */ inline rtree & operator=(BOOST_RV_REF(rtree) src) @@ -375,21 +396,19 @@ public: \param other The rtree which content will be swapped with this rtree content. - \bgi_exception{ - nothrow + \bgi_throws{ + If allocators swap throws. } */ void swap(rtree & other) { -// TODO - use boost::move? -// TODO - allocators may throw in copy/move - std::swap(m_translator, other.m_translator); // SHOULDN'T THROW - std::swap(m_parameters, other.m_parameters); - std::swap(m_allocators, other.m_allocators); + boost::swap(m_translator, other.m_translator); // SHOULDN'T THROW + boost::swap(m_parameters, other.m_parameters); + m_allocators.swap(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); + boost::swap(m_values_count, other.m_values_count); + boost::swap(m_leafs_level, other.m_leafs_level); + boost::swap(m_root, other.m_root); } /*! @@ -397,9 +416,12 @@ public: \param value The value which will be stored in the container. + \bgi_throws{ + If Value copy constructor or copy assignment throws. When nodes allocation fails. + } \bgi_exception{ - not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, + elements must not be inserted or removed, methods may return invalid data. } */ inline void insert(value_type const& value) @@ -416,9 +438,12 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. + \bgi_throws{ + If Value copy constructor or copy assignment throws. When nodes allocation fails. + } \bgi_exception{ - not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, + elements must not be inserted or removed, methods may return invalid data. } */ template @@ -436,9 +461,12 @@ public: \param rng The range of values. + \bgi_throws{ + If Value copy constructor or copy assignment throws. When nodes allocation fails. + } \bgi_exception{ - not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, + elements must not be inserted or removed, methods may return invalid data. } */ template @@ -462,9 +490,12 @@ public: \return 1 if the value was removed, 0 otherwise. + \bgi_throws{ + If Value copy constructor or copy assignment throws. When nodes allocation fails. + } \bgi_exception{ - not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, + elements must not be inserted or removed, methods may return invalid data. } */ inline size_type remove(value_type const& value) @@ -485,9 +516,12 @@ public: \return The number of removed values. + \bgi_throws{ + If Value copy constructor or copy assignment throws. When nodes allocation fails. + } \bgi_exception{ - not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, + elements must not be inserted or removed, methods may return invalid data. } */ template @@ -510,9 +544,12 @@ public: \return The number of removed values. + \bgi_throws{ + If Value copy constructor or copy assignment throws. When nodes allocation fails. + } \bgi_exception{ - not safe - if this operation throws, the R-tree may be left in - an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, + elements must not be inserted or removed, methods may return invalid data. } */ template @@ -525,39 +562,6 @@ public: return result; } - /* - Assign new elements to the rtree. This method replaces the content of the rtree. - - \param first The beginning of the range of values. - \param last The end of the range of values. - - \bgi_exception{ - strong - } - */ - /*template - inline void assign(Iterator first, Iterator last) - { - rtree foo(first, last, this->parameters(), this->translator(), this->get_allocator()); - this->swap(foo); - }*/ - - /* - Assign new elements to the rtree. This method replaces the content of the rtree. - - \param rng The range of values. - - \bgi_exception{ - strong - } - */ - /*template - inline void assign(Range const& rng) - { - rtree foo(rng, this->parameters(), this->translator(), this->get_allocator()); - this->swap(foo); - }*/ - /*! \brief Finds values meeting spatial predicates, e.g. intersecting some Box. @@ -575,8 +579,8 @@ public: \return The number of values found. - \bgi_exception{ - strong + \bgi_throws{ + If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. } */ template @@ -612,8 +616,8 @@ public: \return The number of values found. - \bgi_exception{ - strong + \bgi_throws{ + If Value copy constructor or copy assignment throws. } */ template @@ -650,8 +654,8 @@ public: \return The number of values found. - \bgi_exception{ - strong + \bgi_throws{ + If Value copy constructor or copy assignment throws. } */ template @@ -679,8 +683,8 @@ public: \return The number of values found. - \bgi_exception{ - strong + \bgi_throws{ + If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. } */ template @@ -718,8 +722,8 @@ public: \return The number of values found. - \bgi_exception{ - strong + \bgi_throws{ + If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. } */ template @@ -733,8 +737,8 @@ public: \return The number of stored values. - \bgi_exception{ - nothrow + \bgi_throws{ + Nothing. } */ inline size_type size() const @@ -747,8 +751,8 @@ public: \return true if the container is empty. - \bgi_exception{ - nothrow + \bgi_throws{ + Nothing. } */ inline bool empty() const @@ -759,8 +763,8 @@ public: /*! \brief Removes all values stored in the container. - \bgi_exception{ - nothrow + \bgi_throws{ + Nothing. } */ inline void clear() @@ -777,9 +781,8 @@ public: \return The box containing all values stored in the container or an invalid box if there are no values in the container. - \bgi_exception{ - nothrow (if Indexable's CoordinateType copy assignment doesn't throw), - strong (if Indexable's CoordinateType copy assignment throws). + \bgi_throws{ + Nothing. } */ inline box_type box() const @@ -809,8 +812,8 @@ public: \return The number of values found. - \bgi_exception{ - nothrow + \bgi_throws{ + Nothing. } */ template @@ -832,8 +835,8 @@ public: \return The parameters object. - \bgi_exception{ - nothrow + \bgi_throws{ + Nothing. } */ inline parameters_type const& parameters() const @@ -846,8 +849,8 @@ public: \return The translator object. - \bgi_exception{ - nothrow + \bgi_throws{ + Nothing. } */ inline translator_type const& translator() const @@ -860,8 +863,8 @@ public: \return The allocator. - \bgi_exception{ - nothrow + \bgi_throws{ + If allocator copy constructor throws. } */ allocator_type get_allocator() const diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 12a18be8e..9c32a4711 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1038,7 +1038,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const // rtree removing template -void test_remove(bgi::rtree & tree, std::vector const& input, Box const& qbox) +void test_remove(bgi::rtree & tree, Box const& qbox) { typedef bgi::rtree T; @@ -1140,56 +1140,6 @@ void test_clear(bgi::rtree & tree, std::vector const& input, t.spatial_query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } - - ////assign iterators - //{ - // T t(tree); - - // BOOST_CHECK(t.size() == tree.size()); - - // std::vector expected_output; - // t.spatial_query(t.box(), std::back_inserter(expected_output)); - // - // std::vector values_to_remove; - // t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); - // t.remove(values_to_remove); - // - // BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); - - // t.assign(input.begin(), input.end()); - - // BOOST_CHECK(t.size() == tree.size()); - - // std::vector output; - // t.spatial_query(t.box(), std::back_inserter(output)); - - // test_exactly_the_same_outputs(t, output, expected_output); - //} - - ////assign range - //{ - // T t(tree); - - // BOOST_CHECK(t.size() == tree.size()); - - // std::vector expected_output; - // t.spatial_query(t.box(), std::back_inserter(expected_output)); - - // std::vector values_to_remove; - // t.spatial_query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); - // t.remove(values_to_remove); - - // BOOST_CHECK(t.size() == tree.size() - values_to_remove.size()); - - // t.assign(input); - - // BOOST_CHECK(t.size() == tree.size()); - - // std::vector output; - // t.spatial_query(t.box(), std::back_inserter(output)); - - // test_exactly_the_same_outputs(t, output, expected_output); - //} } // run all tests for a single Algorithm and single rtree @@ -1227,7 +1177,7 @@ void test_rtree_by_value(Parameters const& parameters) test_copy_assignment_swap_move(tree, qbox); test_create_insert(tree, input, qbox); - test_remove(tree, input, qbox); + test_remove(tree, qbox); test_clear(tree, input, qbox); // empty tree test From 0b84c2b0a5a27cca0937e56693806556abdd8e13 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 13:36:19 +0000 Subject: [PATCH 267/366] rtree constructors parameters moddified [SVN r82416] --- doc/html/geometry_index/r_tree/reference.html | 81 ++++++++++++++++--- doc/html/index.html | 2 +- .../geometry/extensions/index/rtree/rtree.hpp | 17 ++-- 3 files changed, 81 insertions(+), 19 deletions(-) diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 5b1c16d4e..b420c0b91 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -41,7 +41,7 @@ boost::geometry::index::rtree

                - + The R-tree spatial index.

                @@ -309,14 +309,16 @@ The R-tree spatial index.

                - The default constructor. + The constructor.

                - rtree() + rtree(parameters_type, + translator_type const + &, allocator_type)

                @@ -723,7 +725,7 @@ The R-tree spatial index. rtree()

                - The default constructor. + The constructor.

                @@ -731,15 +733,73 @@ The R-tree spatial index.

                -
                rtree()
                +
                rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())

                + Parameters +
                +
                +++++ + + + + + + + + + + + + + + + + + +
                +

                + Type +

                +
                +

                + Name +

                +
                +

                + Description +

                +
                +

                + parameters_type +

                +
                +

                + parameters +

                +
                +
                +

                + translator_type const & +

                +
                +

                + translator +

                +
                +
                +
                + Throws

                - Nothing. + If allocator default constructor throws.

                @@ -747,7 +807,8 @@ The R-tree spatial index.

                The constructor. @@ -758,9 +819,9 @@ The R-tree spatial index.

                -
                rtree(parameters_type parameters = parameters_type(),
                -      translator_type const & translator = translator_type(),
                -      allocator_type allocator = allocator_type())
                +
                rtree(parameters_type parameters,
                +      translator_type const & translator,
                +      allocator_type allocator)

                diff --git a/doc/html/index.html b/doc/html/index.html index eebc5f656..4b48db873 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
                - +

                Last revised: January 09, 2013 at 12:57:55 GMT

                Last revised: January 09, 2013 at 13:33:08 GMT


                diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index d5800c75a..45a9b246b 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -126,15 +126,16 @@ private: public: /*! - \brief The default constructor. + \brief The constructor. \bgi_throws{ - Nothing. + If allocator default constructor throws. } */ - inline explicit rtree() - : m_translator() // SHOULDN'T THROW - , m_parameters() + inline explicit rtree(parameters_type parameters = parameters_type(), + translator_type const& translator = translator_type()) + : m_translator(translator) // SHOULDN'T THROW + , m_parameters(parameters) , m_allocators() , m_values_count(0) , m_leafs_level(0) @@ -152,9 +153,9 @@ public: If allocator copy constructor throws. } */ - inline explicit rtree(parameters_type parameters = parameters_type(), - translator_type const& translator = translator_type(), - allocator_type allocator = allocator_type()) + inline rtree(parameters_type parameters, + translator_type const& translator, + allocator_type allocator) : m_translator(translator) // SHOULDN'T THROW , m_parameters(parameters) , m_allocators(allocator) From 383036d1d6026242444a918b698f4ed640c554cb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 15:09:06 +0000 Subject: [PATCH 268/366] error in rtree exceptions test fixed (adaptation to the new allocator concept). [SVN r82417] --- test/rtree/test_rtree_exceptions.hpp | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 8c98a6ac3..80a9cb146 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -143,8 +143,11 @@ struct visitor -struct allocators +class allocators { + BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) + +public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; @@ -156,12 +159,37 @@ struct allocators::type >::other leaf_allocator_type; + inline allocators() + : allocator() + , internal_node_allocator() + , leaf_allocator() + {} + inline explicit allocators(Allocator alloc) : allocator(alloc) , internal_node_allocator(allocator) , leaf_allocator(allocator) {} + inline allocators(allocators const& a) + : allocator(a.allocator) + , internal_node_allocator(a.internal_node_allocator) + , leaf_allocator(a.leaf_allocator) + {} + + inline allocators(BOOST_RV_REF(allocators) a) + : allocator(boost::move(a.allocator)) + , internal_node_allocator(boost::move(a.internal_node_allocator)) + , leaf_allocator(boost::move(a.leaf_allocator)) + {} + + void swap(allocators & a) + { + boost::swap(allocator, a.allocator); + boost::swap(internal_node_allocator, a.internal_node_allocator); + boost::swap(leaf_allocator, a.leaf_allocator); + } + allocator_type allocator; internal_node_allocator_type internal_node_allocator; leaf_allocator_type leaf_allocator; From 7a707809a724eafd83501c23efb1058e0136a439 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 16:31:16 +0000 Subject: [PATCH 269/366] Default and index translator added to the reference. doxygen_xml2qbk now displays members only if they have brief description. [SVN r82418] --- doc/Doxyfile | 3 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 4 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 20 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 695 ++++++++++++------ .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- doc/make_qbk.py | 2 + doc/rtree.qbk | 7 + .../doxygen_xml2qbk/quickbook_output.hpp | 100 ++- .../geometry/extensions/index/inserter.hpp | 8 + .../extensions/index/translator/def.hpp | 113 +-- .../extensions/index/translator/index.hpp | 31 +- 16 files changed, 626 insertions(+), 381 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index c7265d0b0..e50c9ab2b 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -668,7 +668,8 @@ WARN_LOGFILE = INPUT = ../boost/geometry/extensions/index/ \ ../boost/geometry/extensions/index/rtree \ - ../boost/geometry/extensions/index/adaptors + ../boost/geometry/extensions/index/adaptors \ + ../boost/geometry/extensions/index/translator # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 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 64c111cb5..48b2c4520 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -85,6 +85,8 @@ predicates (boost::geometry::index::)
                Spatial indexes adaptors (boost::geometry::index::adaptors::)
                +
                Translators + (boost::geometry::index::translators::)
                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 300395d3a..a79271bfb 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 - + @@ -55,7 +55,7 @@

                rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
                 
                -
                  +
                  • Value - type of object which will be stored in the container,
                  • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

                    -
                      +
                      • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

                        -
                          +
                          • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                            If comparison of two Values is required, the default translator:

                            -
                              +
                              • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index b0b2ee116..89d93898c 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                          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 + 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 [2]. + close to some point in space [2].

                          The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                          The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

                          -
                            +
                            • capable to store arbitrary Value type,
                            • @@ -201,20 +201,20 @@
                            -

                            -

                            [1] +


                            +

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

                            -

                            [2] +

                            [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                            -

                            [3] +

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

                            -

                            [4] +

                            [4] 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 d13849cbd..ffbfe87f5 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index b420c0b91..484411f2c 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -35,18 +35,20 @@ predicates (boost::geometry::index::)
                            Spatial indexes adaptors (boost::geometry::index::adaptors::)
                            +
                            Translators + (boost::geometry::index::translators::)

                            - + The R-tree spatial index.

                            - Description + Description

                            The R-tree spatial index. This is self-balancing spatial index capable @@ -74,14 +76,14 @@ The R-tree spatial index.

                            - Header + Header

                            #include <.hpp>

                            - Synopsis + Synopsis

                            @@ -98,7 +100,7 @@ The R-tree spatial index.

                            - Template + Template parameter(s)
                            @@ -172,7 +174,7 @@ The R-tree spatial index.
                            - Typedef(s) + Typedef(s)
                            @@ -280,7 +282,7 @@ The R-tree spatial index.
                            - Constructor(s) + Constructor(s) and destructor
                            @@ -408,7 +410,7 @@ The R-tree spatial index.
                            - Member(s) + Member(s)
                            @@ -729,7 +731,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -738,7 +740,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -796,7 +798,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocator default constructor throws. @@ -815,7 +817,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -826,7 +828,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -907,7 +909,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocator copy constructor throws. @@ -926,7 +928,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -940,7 +942,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1055,7 +1057,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocator copy constructor throws. If Value copy constructor or copy @@ -1075,7 +1077,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -1088,7 +1090,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1187,7 +1189,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocator copy constructor throws. If Value copy constructor or copy @@ -1206,7 +1208,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -1215,7 +1217,7 @@ The R-tree spatial index.

                            - Throws + Throws

                            Nothing. @@ -1234,14 +1236,14 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters, translator and allocator from the source tree.

                            - Synopsis + Synopsis

                            @@ -1250,7 +1252,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1296,7 +1298,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocator copy constructor throws. If Value copy constructor throws. @@ -1316,14 +1318,14 @@ The R-tree spatial index.

                            - Description + Description

                            It uses Parameters and translator from the source tree.

                            - Synopsis + Synopsis

                            @@ -1332,7 +1334,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1397,7 +1399,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocator copy constructor throws. If Value copy constructor throws. @@ -1417,14 +1419,14 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters, translator and allocator from the source tree.

                            - Synopsis + Synopsis

                            @@ -1433,7 +1435,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1478,7 +1480,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocator move constructor throws. @@ -1497,14 +1499,14 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters and translator from the source tree.

                            - Synopsis + Synopsis

                            @@ -1513,7 +1515,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1559,7 +1561,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If Value copy constructor throws. When nodes allocation fails. @@ -1578,14 +1580,14 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters and translator from the source tree.

                            - Synopsis + Synopsis

                            @@ -1594,7 +1596,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1639,7 +1641,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            Only if allocators aren't equal. If Value copy constructor throws. When @@ -1659,14 +1661,14 @@ The R-tree spatial index.

                            - Description + Description

                            Parameters, translator and allocators are swapped as well.

                            - Synopsis + Synopsis

                            @@ -1675,7 +1677,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1720,7 +1722,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If allocators swap throws. @@ -1739,7 +1741,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -1748,7 +1750,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1793,7 +1795,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. When nodes allocation @@ -1801,7 +1803,7 @@ The R-tree spatial index.

                            - Exception-safety + Exception-safety

                            This operation is not thread safe. If it throws, the R-tree may be left @@ -1822,7 +1824,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -1832,7 +1834,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1896,7 +1898,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. When nodes allocation @@ -1904,7 +1906,7 @@ The R-tree spatial index.

                            - Exception-safety + Exception-safety

                            This operation is not thread safe. If it throws, the R-tree may be left @@ -1925,7 +1927,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -1935,7 +1937,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -1981,7 +1983,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. When nodes allocation @@ -1989,7 +1991,7 @@ The R-tree spatial index.

                            - Exception-safety + Exception-safety

                            This operation is not thread safe. If it throws, the R-tree may be left @@ -2010,7 +2012,7 @@ The R-tree spatial index.

                            - Description + Description

                            In contrast to the STL set/map erase() method this method removes only @@ -2018,7 +2020,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2027,7 +2029,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2072,14 +2074,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            1 if the value was removed, 0 otherwise.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. When nodes allocation @@ -2087,7 +2089,7 @@ The R-tree spatial index.

                            - Exception-safety + Exception-safety

                            This operation is not thread safe. If it throws, the R-tree may be left @@ -2108,7 +2110,7 @@ The R-tree spatial index.

                            - Description + Description

                            In contrast to the STL set/map erase() method it doesn't take iterators @@ -2118,7 +2120,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2128,7 +2130,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2192,14 +2194,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of removed values.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. When nodes allocation @@ -2207,7 +2209,7 @@ The R-tree spatial index.

                            - Exception-safety + Exception-safety

                            This operation is not thread safe. If it throws, the R-tree may be left @@ -2228,7 +2230,7 @@ The R-tree spatial index.

                            - Description + Description

                            In contrast to the STL set/map erase() method it removes values equal @@ -2237,7 +2239,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2247,7 +2249,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2293,14 +2295,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of removed values.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. When nodes allocation @@ -2308,7 +2310,7 @@ The R-tree spatial index.

                            - Exception-safety + Exception-safety

                            This operation is not thread safe. If it throws, the R-tree may be left @@ -2329,7 +2331,7 @@ The R-tree spatial index.

                            - Description + Description

                            Spatial predicates may be a Geometry (in this case default predicate @@ -2341,7 +2343,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2351,7 +2353,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2416,14 +2418,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of values found.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. If OutIter dereference @@ -2443,7 +2445,7 @@ The R-tree spatial index.

                            - Description + Description

                            The distances predicates may be a Point. This is default case where Value @@ -2460,7 +2462,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2470,7 +2472,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2535,14 +2537,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of values found.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. @@ -2562,7 +2564,7 @@ The R-tree spatial index.

                            - Description + Description

                            The distances predicates may be a Point. This is default case where Value @@ -2587,7 +2589,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2599,7 +2601,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2681,14 +2683,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of values found.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. @@ -2708,7 +2710,7 @@ The R-tree spatial index.

                            - Description + Description

                            The distances predicates. May be a Point. This is default case where @@ -2725,7 +2727,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2737,7 +2739,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2819,14 +2821,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of values found.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. If OutIter dereference @@ -2847,7 +2849,7 @@ The R-tree spatial index.

                            - Description + Description

                            The distances predicates may be a Point. This is default case where Value @@ -2872,7 +2874,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -2887,7 +2889,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -2986,14 +2988,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of values found.

                            - Throws + Throws

                            If Value copy constructor or copy assignment throws. If OutIter dereference @@ -3012,7 +3014,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3021,14 +3023,14 @@ The R-tree spatial index.

                            - Returns + Returns

                            The number of stored values.

                            - Throws + Throws

                            Nothing. @@ -3046,7 +3048,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3055,14 +3057,14 @@ The R-tree spatial index.

                            - Returns + Returns

                            true if the container is empty.

                            - Throws + Throws

                            Nothing. @@ -3080,7 +3082,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3089,7 +3091,7 @@ The R-tree spatial index.

                            - Throws + Throws

                            Nothing. @@ -3107,7 +3109,7 @@ The R-tree spatial index.

                            - Description + Description

                            Returns the box containing all values stored in the container. If the @@ -3115,7 +3117,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3124,7 +3126,7 @@ The R-tree spatial index.

                            - Returns + Returns

                            The box containing all values stored in the container or an invalid box @@ -3132,7 +3134,7 @@ The R-tree spatial index.

                            - Throws + Throws

                            Nothing. @@ -3151,7 +3153,7 @@ The R-tree spatial index.

                            - Description + Description

                            For indexable_type it returns the number of values which indexables equals @@ -3160,7 +3162,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3170,7 +3172,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -3216,14 +3218,14 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of values found.

                            - Throws + Throws

                            Nothing. @@ -3241,7 +3243,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3250,14 +3252,14 @@ The R-tree spatial index.

                            - Returns + Returns

                            The parameters object.

                            - Throws + Throws

                            Nothing. @@ -3275,7 +3277,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3284,14 +3286,14 @@ The R-tree spatial index.

                            - Returns + Returns

                            The translator object.

                            - Throws + Throws

                            Nothing. @@ -3309,7 +3311,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3318,14 +3320,14 @@ The R-tree spatial index.

                            - Returns + Returns

                            The allocator.

                            - Throws + Throws

                            If allocator copy constructor throws. @@ -3585,7 +3587,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3598,7 +3600,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -3680,7 +3682,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3696,7 +3698,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -3794,7 +3796,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3808,7 +3810,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -3890,7 +3892,7 @@ The R-tree spatial index.

                            - Description + Description

                            Remove a value from the container. In contrast to the STL set/map erase() @@ -3898,7 +3900,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -3911,7 +3913,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -3981,7 +3983,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            1 if value was removed, 0 otherwise. @@ -4000,7 +4002,7 @@ The R-tree spatial index.

                            - Description + Description

                            Remove a range of values from the container. In contrast to the STL set/map @@ -4011,7 +4013,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4027,7 +4029,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -4113,7 +4115,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of removed values. @@ -4132,7 +4134,7 @@ The R-tree spatial index.

                            - Description + Description

                            Remove a range of values from the container. In contrast to the STL set/map @@ -4142,7 +4144,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4156,7 +4158,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -4226,7 +4228,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of removed values. @@ -4245,7 +4247,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4262,7 +4264,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -4348,7 +4350,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of found values. @@ -4367,7 +4369,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4383,7 +4385,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -4470,7 +4472,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of found values. @@ -4490,7 +4492,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4508,7 +4510,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -4612,7 +4614,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of found values. @@ -4631,7 +4633,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4649,7 +4651,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -4753,7 +4755,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of found values. @@ -4773,7 +4775,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4793,7 +4795,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -4914,7 +4916,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of found values. @@ -4933,7 +4935,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -4946,7 +4948,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5008,7 +5010,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5021,7 +5023,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5071,7 +5073,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The number of values stored in the index. @@ -5090,7 +5092,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5103,7 +5105,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5153,7 +5155,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            true if there are no values in the index. @@ -5173,7 +5175,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5186,7 +5188,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5236,7 +5238,7 @@ The R-tree spatial index.
                            - Returns + Returns

                            The box containing all stored values or an invalid box. @@ -5370,7 +5372,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5391,7 +5393,7 @@ The R-tree spatial index.

                            - Description + Description

                            A wrapper around user-defined functor describing if Value should be returned @@ -5399,7 +5401,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5409,7 +5411,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5466,7 +5468,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a predicate defining Value and Geometry relationship. Value @@ -5475,7 +5477,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5485,7 +5487,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5543,7 +5545,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a predicate defining Value and Geometry relationship. Value @@ -5552,7 +5554,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5562,7 +5564,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5620,7 +5622,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a predicate defining Value and Geometry relationship. Value @@ -5629,7 +5631,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5639,7 +5641,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5697,7 +5699,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a predicate defining Value and Geometry relationship. Value @@ -5706,7 +5708,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5716,7 +5718,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5774,7 +5776,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a predicate defining Value and Geometry relationship. Value @@ -5783,7 +5785,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5793,7 +5795,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -5973,7 +5975,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a nearest query Point and Value's Indexable relationship while @@ -5986,7 +5988,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -5996,7 +5998,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6054,7 +6056,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a nearest query Point and Value's Indexable relationship while @@ -6065,7 +6067,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6075,7 +6077,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6133,7 +6135,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a nearest query Point and Value's Indexable relationship while @@ -6146,7 +6148,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6156,7 +6158,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6214,7 +6216,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a distance predicate. This defines distances bounds which are @@ -6225,7 +6227,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6235,7 +6237,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6293,7 +6295,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a distance predicate. This defines distances bounds which are @@ -6306,7 +6308,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6316,7 +6318,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6394,7 +6396,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a distance predicate. This defines distances bounds which are @@ -6407,7 +6409,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6417,7 +6419,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6495,7 +6497,7 @@ The R-tree spatial index.

                            - Description + Description

                            Generate a distance predicate. This defines distances bounds which are @@ -6509,7 +6511,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6523,7 +6525,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6685,7 +6687,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6697,7 +6699,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6791,7 +6793,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6801,7 +6803,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6878,7 +6880,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis

                            @@ -6888,7 +6890,7 @@ The R-tree spatial index.

                            - Parameters + Parameters
                            @@ -6936,6 +6938,263 @@ The R-tree spatial index.

                            +
                            + +
                            + +

                            + +The default translator. +

                            +
                            + + Description +
                            +

                            + It translates Value object to Indexable object. The default version handles + Values which are Indexables. This translator is also specialized for + std::pair<Indexable, Second> and boost::tuple<Indexable, ...>. +

                            +
                            + + Header +
                            +

                            + #include <.hpp> +

                            +
                            + + Synopsis +
                            +

                            +

                            +
                            template<typename Value>
                            +struct def
                            +{
                            +  // ...
                            +};
                            +
                            +

                            +

                            +
                            + + Template + parameter(s) +
                            +
                            ++++ + + + + + + + + +
                            +

                            + Parameter +

                            +
                            +

                            + Description +

                            +
                            +

                            + Value +

                            +
                            +

                            + The Value type which may be translated directly to the Indexable. +

                            +
                            +
                            +
                            + +

                            + +The index translator. +

                            +
                            + + Description +
                            +

                            + This translator translates from index of an element in an external Container + to the Indexable. The container should have operator[](size_type) defined. + Index translator uses translator::def<...> to translate from Container::value_type + to the Indexable which means that it can handle Indexables, std::pairs + and boost::tuples stored in an external Container. +

                            +
                            + + Header +
                            +

                            + #include <.hpp> +

                            +
                            + + Synopsis +
                            +

                            +

                            +
                            template<typename Container>
                            +class index
                            +{
                            +  // ...
                            +};
                            +
                            +

                            +

                            +
                            + + Template + parameter(s) +
                            +
                            ++++ + + + + + + + + +
                            +

                            + Parameter +

                            +
                            +

                            + Description +

                            +
                            +

                            + Container +

                            +
                            +

                            + The Container type. +

                            +
                            +
                            + + Constructor(s) + and destructor +
                            +
                            ++++ + + + + + + + + +
                            +

                            + Function +

                            +
                            +

                            + Description +

                            +
                            +

                            + index(Container const + &) +

                            +
                            +

                            + The constructor. +

                            +
                            +

                            +
                            +

                            +
                            + +

                            + The constructor. +

                            + + Synopsis +

                            +

                            +
                            index(Container const & c)
                            +

                            +

                            + + Parameters +
                            +++++ + + + + + + + + + + +
                            +

                            + Type +

                            +
                            +

                            + Name +

                            +
                            +

                            + Description +

                            +
                            +

                            + Container const & +

                            +
                            +

                            + c +

                            +
                            +

                            + The container which stores indexed values. +

                            +
                            +
                            +

                            +
                            +

                            +
                            +
                            diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 2e4bf7514..9ec8f8b5c 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 - + @@ -150,7 +150,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 7fee097e3..dc19fd16b 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 4b48db873..6acab8b37 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: January 09, 2013 at 13:33:08 GMT

                            Last revised: January 09, 2013 at 16:28:08 GMT


                            diff --git a/doc/make_qbk.py b/doc/make_qbk.py index 437d7d1ba..bd588ec28 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -23,5 +23,7 @@ os.system(cmd % ("group__rtree__functions", "geometry_index.r_tree.reference", " os.system(cmd % ("group__predicates", "geometry_index.r_tree.reference", "predicates")) os.system(cmd % ("group__distance__predicates", "geometry_index.r_tree.reference", "distance_predicates")) os.system(cmd % ("group__adaptors", "geometry_index.r_tree.reference", "adaptors")) +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_1_1def", "geometry_index.r_tree.reference.translators", "translator_def")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1translator_1_1index", "geometry_index.r_tree.reference.translators", "translator_index")) os.system("b2") diff --git a/doc/rtree.qbk b/doc/rtree.qbk index a4ea56da5..1fd1fe148 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -25,6 +25,13 @@ [include generated/distance_predicates.qbk] [include generated/adaptors.qbk] +[section:translators Translators (boost::geometry::index::translators::)] + +[include generated/translator_def.qbk] +[include generated/translator_index.qbk] + +[endsect] + [endsect] [endsect] diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 8302a1dde..c4f23981f 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -826,6 +826,30 @@ void quickbook_output_alt(documentation const& doc, configuration const& config, } } +template +bool has_brief_description(Range const& rng) +{ + typedef typename Range::value_type V; + BOOST_FOREACH(V const& bc, rng) + { + if ( !bc.brief_description.empty() ) + return true; + } + return false; +} + +template +bool has_brief_description(Range const& rng, function_type t) +{ + typedef typename Range::value_type V; + BOOST_FOREACH(V const& bc, rng) + { + if ( bc.type == t && !bc.brief_description.empty() ) + return true; + } + return false; +} + void quickbook_output_alt(class_or_struct const& cos, configuration const& config, std::ostream& out) { // Skip namespace @@ -890,58 +914,73 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi if (! cos.template_parameters.empty()) { - out << "[heading Template parameter(s)]" << std::endl - << "[table" << std::endl - << "[[Parameter] [Description]]" << std::endl; - - BOOST_FOREACH(parameter const& p, cos.template_parameters) + if ( has_brief_description(cos.template_parameters) ) { - out << "[[`"; - if ( p.fulltype.find("typename ") == 0 ) - out << p.fulltype.substr(9); - else if ( p.fulltype.find("class ") == 0 ) - out << p.fulltype.substr(6); - else - out << p.fulltype; - out << "`][" << p.brief_description << "]]" << std::endl; + out << "[heading Template parameter(s)]" << std::endl + << "[table" << std::endl + << "[[Parameter] [Description]]" << std::endl; + + BOOST_FOREACH(parameter const& p, cos.template_parameters) + { + if ( p.brief_description.empty() ) + continue; + + out << "[[`"; + if ( p.fulltype.find("typename ") == 0 ) + out << p.fulltype.substr(9); + else if ( p.fulltype.find("class ") == 0 ) + out << p.fulltype.substr(6); + else + out << p.fulltype; + out << "`][" << p.brief_description << "]]" << std::endl; + } + out << "]" << std::endl + << std::endl; } - out << "]" << std::endl - << std::endl; } // Typedefs if ( !cos.typedefs.empty() ) { - out << "[heading Typedef(s)]" << std::endl - << "[table" << std::endl - << "[[Type]"; - out << " [Description]]" << std::endl; - - BOOST_FOREACH(base_element const& e, cos.typedefs) + if ( has_brief_description(cos.typedefs) ) { - out << "[[`" << e.name; - out << "`][" << e.brief_description << "]]" << std::endl; + out << "[heading Typedef(s)]" << std::endl + << "[table" << std::endl + << "[[Type]"; + out << " [Description]]" << std::endl; + + BOOST_FOREACH(base_element const& e, cos.typedefs) + { + if ( e.brief_description.empty() ) + continue; + + out << "[[`" << e.name; + out << "`][" << e.brief_description << "]]" << std::endl; + } + out << "]" << std::endl + << std::endl; } - out << "]" << std::endl - << std::endl; } // Members + bool display_ctors = has_brief_description(cos.functions, function_constructor_destructor); + bool display_members = has_brief_description(cos.functions, function_member); + std::map counts; BOOST_FOREACH(function const& f, cos.functions) { counts[f.type]++; } - if (counts[function_constructor_destructor] > 0) + if (display_ctors && counts[function_constructor_destructor] > 0) { out << "[heading Constructor(s) and destructor]" << std::endl; quickbook_output_function(cos.functions, function_constructor_destructor, config, section_name + ".member", out); } - if (counts[function_member] > 0) + if (display_members && counts[function_member] > 0) { out << "[heading Member(s)]" << std::endl; quickbook_output_function(cos.functions, function_member, config, section_name + ".member", out); @@ -949,11 +988,12 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi // Details start - out << "[br]" << std::endl; + if ( display_ctors || display_members ) + out << "[br]" << std::endl; - if (counts[function_constructor_destructor] > 0) + if (display_ctors && counts[function_constructor_destructor] > 0) quickbook_output_detail_function(cos.functions, function_constructor_destructor, config, "member", out); - if (counts[function_member] > 0) + if (display_members && counts[function_member] > 0) quickbook_output_detail_function(cos.functions, function_member, config, "member", out); // Details end diff --git a/include/boost/geometry/extensions/index/inserter.hpp b/include/boost/geometry/extensions/index/inserter.hpp index ef1e949cc..499182072 100644 --- a/include/boost/geometry/extensions/index/inserter.hpp +++ b/include/boost/geometry/extensions/index/inserter.hpp @@ -51,6 +51,14 @@ private: Container * container; }; +/*! +\brief Returns insert iterator capable to insert values to the container +(spatial index) which allows inserting values - has member function insert(value_type const&). + +\param c The reference to the container (spatial index) to which values will be inserted. + +\return The insert iterator inserting values to the container. +*/ template insert_iterator inserter(Container & c) { diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index 6c65a0d52..375907e2d 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -15,105 +15,11 @@ 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 -// -///*! -//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. +\brief The default translator. + +It translates Value object to Indexable object. The default version handles Values which are Indexables. +This translator is also specialized for std::pair and boost::tuple. \tparam Value The Value type which may be translated directly to the Indexable. */ @@ -142,7 +48,9 @@ struct def }; /*! -The default translator. This specialization translates from std::pair. +\brief The default translator. + +This specialization translates from std::pair. \tparam Indexable The Indexable type. \tparam Second The second type. @@ -206,10 +114,11 @@ struct compare_tuples } // namespace detail /*! -The default translator. This specialization translates from boost::tuple. +\brief The default translator. -\tparam Indexable The Indexable type. -\tparam Second The second type. +This specialization translates from boost::tuple. + +\tparam Indexable The Indexable type. */ template diff --git a/include/boost/geometry/extensions/index/translator/index.hpp b/include/boost/geometry/extensions/index/translator/index.hpp index 8245e3c38..b49d774bb 100644 --- a/include/boost/geometry/extensions/index/translator/index.hpp +++ b/include/boost/geometry/extensions/index/translator/index.hpp @@ -11,34 +11,51 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP -#include +#include namespace boost { namespace geometry { namespace index { namespace translator { +/*! +\brief The index translator. + +This translator translates from index of an element in an external Container to the Indexable. +The container should have operator[](size_type) defined. +Index translator uses translator::def<...> to translate from Container::value_type to the Indexable which +means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. + +\tparam Container The Container type. +*/ template class index { + typedef typename Container::value_type value_type; typedef typename Container::size_type size_type; public: - typedef typename detail::extract_indexable - ::type const& result_type; + typedef typename translator::def::result_type result_type; + + /*! + \brief The constructor. - explicit index(Container const& c) : m_c(c) {} + \param c The container which stores indexed values. + */ + explicit index(Container const& c) + : m_c(c) + {} result_type operator()(size_type i) const { - return detail::extract_indexable - ::get(m_c[i]); + return m_tr(m_c[i]); } bool equals(size_type i1, size_type i2) const { - return i1 == i2; + return m_tr.equals(m_c[i1], m_c[i2]); } private: Container const& m_c; + translator::def m_tr; }; }}}} // namespace boost::geometry::index::translator From 121ac6c6837649079014cced1d643d67e031e351 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 16:34:02 +0000 Subject: [PATCH 270/366] rtree: missing parameters description added. [SVN r82419] --- doc/html/geometry_index/r_tree/reference.html | 12 +++++++++--- doc/html/index.html | 2 +- .../boost/geometry/extensions/index/rtree/rtree.hpp | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 484411f2c..8c5be08ef 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -43,7 +43,7 @@ boost::geometry::index::rtree

                          - + The R-tree spatial index.

                          @@ -778,6 +778,9 @@ The R-tree spatial index.

                +

                + The parameters object. +

                +

                + The translator object. +

                - +

                Last revised: January 09, 2013 at 16:28:08 GMT

                Last revised: January 09, 2013 at 16:32:37 GMT


                diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 45a9b246b..b7f9d9e71 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -128,6 +128,9 @@ public: /*! \brief The constructor. + \param parameters The parameters object. + \param translator The translator object. + \bgi_throws{ If allocator default constructor throws. } From 5310131f4c825ccff384a229b6a7d442ad43b9e1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 16:43:16 +0000 Subject: [PATCH 271/366] Rtree docs: added inserter, groups names changed. [SVN r82420] --- doc/html/geometry_index/r_tree.html | 10 +- doc/html/geometry_index/r_tree/reference.html | 143 ++++++++++++++++-- doc/html/index.html | 2 +- doc/make_qbk.py | 1 + doc/rtree.qbk | 2 + .../index/adaptors/nearest_query.hpp | 2 +- .../index/adaptors/spatial_query.hpp | 2 +- .../geometry/extensions/index/inserter.hpp | 12 +- .../geometry/extensions/index/predicates.hpp | 2 +- 9 files changed, 155 insertions(+), 21 deletions(-) diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 48b2c4520..ece3dc4fb 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -79,14 +79,16 @@
                boost::geometry::index::rtree
                Functions related to the rtree (boost::geometry::index::)
                -
                Predicates - (boost::geometry::index::)
                +
                Spatial + predicates (boost::geometry::index::)
                Distance predicates (boost::geometry::index::)
                -
                Spatial - indexes adaptors (boost::geometry::index::adaptors::)
                +
                Adaptors + (boost::geometry::index::adaptors::)
                Translators (boost::geometry::index::translators::)
                +
                Inserters + (boost::geometry::index::)
                diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 8c5be08ef..308bbf208 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -29,21 +29,23 @@
                boost::geometry::index::rtree
                Functions related to the rtree (boost::geometry::index::)
                -
                Predicates - (boost::geometry::index::)
                +
                Spatial + predicates (boost::geometry::index::)
                Distance predicates (boost::geometry::index::)
                -
                Spatial - indexes adaptors (boost::geometry::index::adaptors::)
                +
                Adaptors + (boost::geometry::index::adaptors::)
                Translators (boost::geometry::index::translators::)
                +
                Inserters + (boost::geometry::index::)

                - + The R-tree spatial index.

                @@ -5256,8 +5258,8 @@ The R-tree spatial index.
                @@ -6620,8 +6622,8 @@ The R-tree spatial index.
                @@ -6954,7 +6956,7 @@ The R-tree spatial index. boost::geometry::index::translator::def

                - + The default translator.

                @@ -7028,7 +7030,7 @@ The default translator. boost::geometry::index::translator::index

                - + The index translator.

                @@ -7201,6 +7203,125 @@ The index translator.

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

                + Function +

                +
                +

                + Description +

                +
                +

                + inserter(Container &) +

                +
                +

                + Insert iterator generator. +

                +
                +
                + +

                + Insert iterator generator. +

                +
                + + Description +
                +

                + Returns insert iterator capable to insert values to the container (spatial + index) which has member function insert(value_type const&) defined. +

                +
                + + Synopsis +
                +

                +

                +
                template<typename Container>
                +insert_iterator<Container> boost::geometry::index::inserter(Container & c)
                +

                +

                +
                + + Parameters +
                +
                +++++ + + + + + + + + + + +
                +

                + Type +

                +
                +

                + Name +

                +
                +

                + Description +

                +
                +

                + Container & +

                +
                +

                + c +

                +
                +

                + The reference to the container (spatial index) to which values + will be inserted. +

                +
                +
                + + Returns +
                +

                + The insert iterator inserting values to the container. +

                +
                +

                +
                +

                +
              diff --git a/doc/html/index.html b/doc/html/index.html index dcaf534de..3df4561a0 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
              - +

              Last revised: January 09, 2013 at 16:32:37 GMT

              Last revised: January 09, 2013 at 16:40:37 GMT


              diff --git a/doc/make_qbk.py b/doc/make_qbk.py index bd588ec28..c731d21de 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -25,5 +25,6 @@ os.system(cmd % ("group__distance__predicates", "geometry_index.r_tree.reference os.system(cmd % ("group__adaptors", "geometry_index.r_tree.reference", "adaptors")) os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_1_1def", "geometry_index.r_tree.reference.translators", "translator_def")) os.system(cmd % ("classboost_1_1geometry_1_1index_1_1translator_1_1index", "geometry_index.r_tree.reference.translators", "translator_index")) +os.system(cmd % ("group__inserters", "geometry_index.r_tree.reference", "inserters")) os.system("b2") diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 1fd1fe148..8e69ffa18 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -32,6 +32,8 @@ [endsect] +[include generated/inserters.qbk] + [endsect] [endsect] diff --git a/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp b/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp index ea32d0d5e..dfa34b31f 100644 --- a/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp @@ -12,7 +12,7 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP /*! -\defgroup adaptors Spatial indexes adaptors (boost::geometry::index::adaptors::) +\defgroup adaptors Adaptors (boost::geometry::index::adaptors::) */ namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp b/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp index 74439e3b1..b57ca3270 100644 --- a/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp +++ b/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp @@ -12,7 +12,7 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP /*! -\defgroup adaptors Spatial indexes adaptors (boost::geometry::index::adaptors::) +\defgroup adaptors Adaptors (boost::geometry::index::adaptors::) */ namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/inserter.hpp b/include/boost/geometry/extensions/index/inserter.hpp index 499182072..35497afb5 100644 --- a/include/boost/geometry/extensions/index/inserter.hpp +++ b/include/boost/geometry/extensions/index/inserter.hpp @@ -13,6 +13,10 @@ #include +/*! +\defgroup inserters Inserters (boost::geometry::index::) +*/ + namespace boost { namespace geometry { namespace index { template @@ -52,8 +56,12 @@ private: }; /*! -\brief Returns insert iterator capable to insert values to the container -(spatial index) which allows inserting values - has member function insert(value_type const&). +\brief Insert iterator generator. + +Returns insert iterator capable to insert values to the container +(spatial index) which has member function insert(value_type const&) defined. + +\ingroup inserters \param c The reference to the container (spatial index) to which values will be inserted. diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 78f08f970..78ba8df47 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -19,7 +19,7 @@ #include /*! -\defgroup predicates Predicates (boost::geometry::index::) +\defgroup predicates Spatial predicates (boost::geometry::index::) */ namespace boost { namespace geometry { namespace index { From ba0c1b840f6cbfe3199627c8b3c87a60948a8cdf Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 18:33:43 +0000 Subject: [PATCH 272/366] static_vector test moddified, added generated reference files [SVN r82422] --- doc/generated/adaptors.qbk | 56 +++ doc/generated/distance_predicates.qbk | 122 +++++ doc/generated/predicates.qbk | 107 +++++ doc/generated/rtree.qbk | 627 ++++++++++++++++++++++++++ doc/generated/rtree_functions.qbk | 343 ++++++++++++++ test/static_vector.cpp | 21 +- 6 files changed, 1262 insertions(+), 14 deletions(-) create mode 100644 doc/generated/adaptors.qbk create mode 100644 doc/generated/distance_predicates.qbk create mode 100644 doc/generated/predicates.qbk create mode 100644 doc/generated/rtree.qbk create mode 100644 doc/generated/rtree_functions.qbk diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk new file mode 100644 index 000000000..fc65f4236 --- /dev/null +++ b/doc/generated/adaptors.qbk @@ -0,0 +1,56 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/group__adaptors.xml] +[section:group__adaptors Spatial indexes adaptors (boost::geometry::index::adaptors::)] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.group__adaptors.function0 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] +[[[link geometry_index.r_tree.reference.group__adaptors.function1 `nearest_queried(DistancesPredicates const &, size_t)`]][The nearest query index adaptor generator. ]] +[[[link geometry_index.r_tree.reference.group__adaptors.function2 `spatial_queried(Predicates const &)`]][The spatial query index adaptor generator. ]] +] + +[section:function0 nearest_queried(DistancesPredicates const &, size_t, Predicates const &)] +The nearest query index adaptor generator. [heading Synopsis] +``template +detail::nearest_query boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, + size_t k, + Predicates const & pred)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `DistancesPredicates const &` ][ `dpred` ][Distance predicates. ]] +[[ `size_t` ][ `k` ][The number of values to find. ]] +[[ `Predicates const &` ][ `pred` ][Spatial predicates. ]] +] +[endsect] +[br] + +[section:function1 nearest_queried(DistancesPredicates const &, size_t)] +The nearest query index adaptor generator. [heading Synopsis] +``template +detail::nearest_query boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `DistancesPredicates const &` ][ `dpred` ][Distance predicates. ]] +[[ `size_t` ][ `k` ][The number of values to find. ]] +] +[endsect] +[br] + +[section:function2 spatial_queried(Predicates const &)] +The spatial query index adaptor generator. [heading Synopsis] +``template +detail::spatial_query boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Predicates const &` ][ `pred` ][Spatial predicates. ]] +] +[endsect] +[br] + +[endsect] + diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk new file mode 100644 index 000000000..a8af3ab77 --- /dev/null +++ b/doc/generated/distance_predicates.qbk @@ -0,0 +1,122 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/group__distance__predicates.xml] +[section:group__distance__predicates Distance predicates (boost::geometry::index::)] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.group__distance__predicates.function0 `to_nearest(T const &)`]][Generate to_nearest() Point-Indexable relationship. ]] +[[[link geometry_index.r_tree.reference.group__distance__predicates.function1 `to_centroid(T const &)`]][Generate to_centroid() Point-Indexable relationship. ]] +[[[link geometry_index.r_tree.reference.group__distance__predicates.function2 `to_furthest(T const &)`]][Generate to_furthest() Point-Indexable relationship. ]] +[[[link geometry_index.r_tree.reference.group__distance__predicates.function3 `unbounded(PointRelation const &)`]][Generate unbounded() distance predicate. ]] +[[[link geometry_index.r_tree.reference.group__distance__predicates.function4 `min_bounded(PointRelation const &, MinRelation const &)`]][Generate min_bounded() distance predicate. ]] +[[[link geometry_index.r_tree.reference.group__distance__predicates.function5 `max_bounded(PointRelation const &, MaxRelation const &)`]][Generate max_bounded() distance predicate. ]] +[[[link geometry_index.r_tree.reference.group__distance__predicates.function6 `bounded(PointRelation const &, MinRelation const &, MaxRelation const &)`]][Generate bounded() distance predicate. ]] +] + +[section:function0 to_nearest(T const &)] +Generate to_nearest() Point-Indexable relationship. [heading Description] +Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it should be the distance to the nearest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation.[heading Synopsis] +``template +detail::to_nearest boost::geometry::index::to_nearest(T const & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `T const &` ][ `v` ][Point or bound value. ]] +] +[endsect] +[br] + +[section:function1 to_centroid(T const &)] +Generate to_centroid() Point-Indexable relationship. [heading Description] +Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v.[heading Synopsis] +``template +detail::to_centroid boost::geometry::index::to_centroid(T const & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `T const &` ][ `v` ][Point or bound value. ]] +] +[endsect] +[br] + +[section:function2 to_furthest(T const &)] +Generate to_furthest() Point-Indexable relationship. [heading Description] +Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it should be the distance to the furthest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v.[heading Synopsis] +``template +detail::to_furthest boost::geometry::index::to_furthest(T const & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `T const &` ][ `v` ][Point or bound value. ]] +] +[endsect] +[br] + +[section:function3 unbounded(PointRelation const &)] +Generate unbounded() distance predicate. [heading Description] +Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that there is no distance bounds and Values should be returned if distances between Point and Indexable are the smallest. Distance calculation is defined by PointRelation. This is default nearest predicate.[heading Synopsis] +``template +detail::unbounded boost::geometry::index::unbounded(PointRelation const & pr)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] +] +[endsect] +[br] + +[section:function4 min_bounded(PointRelation const &, MinRelation const &)] +Generate min_bounded() distance predicate. [heading Description] +Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance.[heading Synopsis] +``template +detail::min_bounded boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] +[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). ]] +] +[endsect] +[br] + +[section:function5 max_bounded(PointRelation const &, MaxRelation const &)] +Generate max_bounded() distance predicate. [heading Description] +Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are closer than some distance.[heading Synopsis] +``template +detail::max_bounded boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] +[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). ]] +] +[endsect] +[br] + +[section:function6 bounded(PointRelation const &, MinRelation const &, MaxRelation const &)] +Generate bounded() distance predicate. [heading Description] +Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance and closer than some other distance.[heading Synopsis] +``template +detail::bounded boost::geometry::index::bounded(PointRelation const & pr, + MinRelation const & minr, + MaxRelation const & maxr)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] +[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). ]] +[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). ]] +] +[endsect] +[br] + +[endsect] + diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk new file mode 100644 index 000000000..d74e2534a --- /dev/null +++ b/doc/generated/predicates.qbk @@ -0,0 +1,107 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/group__predicates.xml] +[section:group__predicates Predicates (boost::geometry::index::)] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.group__predicates.function0 `empty()`]][Generate empty predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function1 `value(ValuePredicate const &)`]][Generate value predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function2 `covered_by(Geometry const &)`]][Generate covered_by() predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function3 `disjoint(Geometry const &)`]][Generate disjoint() predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function4 `intersects(Geometry const &)`]][Generate intersects() predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function5 `overlaps(Geometry const &)`]][Generate overlaps() predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function6 `within(Geometry const &)`]][Generate within() predicate. ]] +] + +[section:function0 empty()] +Generate empty predicate. [heading Synopsis] +``detail::empty boost::geometry::index::empty()`` + +[endsect] +[br] + +[section:function1 value(ValuePredicate const &)] +Generate value predicate. [heading Description] +A wrapper around user-defined functor describing if Value should be returned by spatial query.[heading Synopsis] +``template +detail::value boost::geometry::index::value(ValuePredicate const & vpred)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `ValuePredicate const &` ][ `vpred` ][The functor. ]] +] +[endsect] +[br] + +[section:function2 covered_by(Geometry const &)] +Generate covered_by() predicate. [heading Description] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::covered_by(Indexable, Geometry) returns true.[heading Synopsis] +``template +detail::covered_by boost::geometry::index::covered_by(Geometry const & g)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +] +[endsect] +[br] + +[section:function3 disjoint(Geometry const &)] +Generate disjoint() predicate. [heading Description] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::disjoint(Indexable, Geometry) returns true.[heading Synopsis] +``template +detail::disjoint boost::geometry::index::disjoint(Geometry const & g)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +] +[endsect] +[br] + +[section:function4 intersects(Geometry const &)] +Generate intersects() predicate. [heading Description] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::intersects(Indexable, Geometry) returns true.[heading Synopsis] +``template +detail::intersects boost::geometry::index::intersects(Geometry const & g)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +] +[endsect] +[br] + +[section:function5 overlaps(Geometry const &)] +Generate overlaps() predicate. [heading Description] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::overlaps(Indexable, Geometry) returns true.[heading Synopsis] +``template +detail::overlaps boost::geometry::index::overlaps(Geometry const & g)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +] +[endsect] +[br] + +[section:function6 within(Geometry const &)] +Generate within() predicate. [heading Description] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::within(Indexable, Geometry) returns true.[heading Synopsis] +``template +detail::within boost::geometry::index::within(Geometry const & g)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +] +[endsect] +[br] + +[endsect] + diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk new file mode 100644 index 000000000..fd143e5b9 --- /dev/null +++ b/doc/generated/rtree.qbk @@ -0,0 +1,627 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1rtree.xml] +[section:boost_geometry_index_rtree boost::geometry::index::rtree] + +'''boostgeometryindexrtree''' +The R-tree spatial index. + +[heading Description] +The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. + +The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. Predefined algorithms with compile-time parameters are: bgi::linear, bgi::quadratic, bgi::rstar. Predefined algorithms with run-time parameters are: bgi::runtime::linear, bgi::runtime::quadratic, bgi::runtime::rstar. + +The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (which are Indexables). It also handles std::pair, pointers, smart pointers, and iterators. E.g. If std::pair is stored, the default translator translates from std::pair const& to Box const&. + +[heading Header] +`#include <.hpp>` + +[heading Synopsis] +``template, + typename Allocator = std::allocator> +class rtree +{ + // ... +}; +`` + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Value`][The type of objects stored in the container. ]] +[[`Parameters`][Compile-time parameters. ]] +[[`Translator`][The type of the translator which translates from Value to Indexable. ]] +[[`Allocator`][The allocator used to allocate/deallocate memory, construct/destroy nodes and Values. ]] +] + +[heading Typedef(s)] +[table +[[Type] [Description]] +[[`value_type`][The type of Value stored in the container. ]] +[[`parameters_type`][R-tree parameters type. ]] +[[`translator_type`][Value to Indexable Translator type. ]] +[[`allocator_type`][The type of allocator used by the container. ]] +[[`size_type`][Unsigned integral type used by the container. ]] +[[`indexable_type`][The Indexable type to which Value is translated. ]] +[[`box_type`][The Box type used by the R-tree. ]] +] + +[heading Constructor(s) and destructor] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member0 `rtree()`]][The constructor. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member1 `rtree(parameters_type, translator_type const &, allocator_type)`]][The constructor. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member2 `rtree(Iterator, Iterator)`]][The constructor. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member3 `rtree(Range const &)`]][The constructor. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member4 `~rtree()`]][The destructor. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member5 `rtree(rtree const &)`]][The copy constructor. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member6 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member7 `rtree(rtree &&)`]][The moving constructor. ]] +] + +[heading Member(s)] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member8 `operator=(const rtree &)`]][The assignment operator. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member9 `operator=(rtree &&)`]][The moving assignment. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member10 `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member11 `insert(value_type const &)`]][Insert a value to the index. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member12 `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member13 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member14 `remove(value_type const &)`]][Remove a value from the container. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member15 `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member16 `remove(Range const &)`]][Remove a range of values from the container. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member17 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member18 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member19 `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member20 `nearest_query(DistancesPredicates const &, size_t, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member21 `nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member22 `size()`]][Returns the number of stored values. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member23 `empty()`]][Query if the container is empty. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member24 `clear()`]][Removes all values stored in the container. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member25 `box()`]][Returns the box containing all values stored in the container. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member26 `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member27 `parameters()`]][Returns parameters. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member28 `translator()`]][Returns the translator object. ]] +[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member29 `get_allocator()`]][Returns allocator used by the rtree. ]] +] + +[br] +[section:member0 rtree()] +The constructor. [heading Synopsis] +``rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `parameters_type` ][ `parameters` ][]] +[[ `translator_type const &` ][ `translator` ][]] +] +[heading Throws] +If allocator default constructor throws. + +[endsect] +[br] + +[section:member1 rtree(parameters_type, translator_type const &, allocator_type)] +The constructor. [heading Synopsis] +``rtree(parameters_type parameters, + translator_type const & translator, + allocator_type allocator)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `parameters_type` ][ `parameters` ][The parameters object. ]] +[[ `translator_type const &` ][ `translator` ][The translator object. ]] +[[ `allocator_type` ][ `allocator` ][The allocator object.]] +] +[heading Throws] +If allocator copy constructor throws. + +[endsect] +[br] + +[section:member2 rtree(Iterator, Iterator)] +The constructor. [heading Synopsis] +``template +rtree(Iterator first, + Iterator last, + parameters_type parameters = parameters_type(), + translator_type const & translator = translator_type(), + allocator_type allocator = allocator_type())`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Iterator` ][ `first` ][The beginning of the range of Values. ]] +[[ `Iterator` ][ `last` ][The end of the range of Values. ]] +[[ `parameters_type` ][ `parameters` ][The parameters object. ]] +[[ `translator_type const &` ][ `translator` ][The translator object. ]] +[[ `allocator_type` ][ `allocator` ][The allocator object.]] +] +[heading Throws] +If allocator copy constructor throws. If Value copy constructor or copy assignment throws. +When nodes allocation fails. + +[endsect] +[br] + +[section:member3 rtree(Range const &)] +The constructor. [heading Synopsis] +``template +rtree(Range const & rng, + parameters_type parameters = parameters_type(), + translator_type const & translator = translator_type(), + allocator_type allocator = allocator_type())`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Range const &` ][ `rng` ][The range of Values. ]] +[[ `parameters_type` ][ `parameters` ][The parameters object. ]] +[[ `translator_type const &` ][ `translator` ][The translator object. ]] +[[ `allocator_type` ][ `allocator` ][The allocator object.]] +] +[heading Throws] +If allocator copy constructor throws. If Value copy constructor or copy assignment throws. +When nodes allocation fails. + +[endsect] +[br] + +[section:member4 ~rtree()] +The destructor. [heading Synopsis] +``~rtree()`` + +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member5 rtree(rtree const &)] +The copy constructor. [heading Description] +It uses parameters, translator and allocator from the source tree.[heading Synopsis] +``rtree(rtree const & src)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree const &` ][ `src` ][The rtree which content will be copied.]] +] +[heading Throws] +If allocator copy constructor throws. If Value copy constructor throws. +When nodes allocation fails. + +[endsect] +[br] + +[section:member6 rtree(rtree const &, allocator_type const &)] +The copy constructor. [heading Description] +It uses Parameters and translator from the source tree.[heading Synopsis] +``rtree(rtree const & src, allocator_type const & allocator)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree const &` ][ `src` ][The rtree which content will be copied. ]] +[[ `allocator_type const &` ][ `allocator` ][The allocator which will be used.]] +] +[heading Throws] +If allocator copy constructor throws. If Value copy constructor throws. +When nodes allocation fails. + +[endsect] +[br] + +[section:member7 rtree(rtree &&)] +The moving constructor. [heading Description] +It uses parameters, translator and allocator from the source tree.[heading Synopsis] +``rtree(rtree && src)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree &&` ][ `src` ][The rtree which content will be moved.]] +] +[heading Throws] +If allocator move constructor throws. + +[endsect] +[br] + +[section:member8 operator=(const rtree &)] +The assignment operator. [heading Description] +It uses parameters and translator from the source tree.[heading Synopsis] +``rtree & operator=(const rtree & src)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `const rtree &` ][ `src` ][The rtree which content will be copied.]] +] +[heading Throws] +If Value copy constructor throws. +When nodes allocation fails. + +[endsect] +[br] + +[section:member9 operator=(rtree &&)] +The moving assignment. [heading Description] +It uses parameters and translator from the source tree.[heading Synopsis] +``rtree & operator=(rtree && src)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree &&` ][ `src` ][The rtree which content will be moved.]] +] +[heading Throws] +Only if allocators aren't equal. If Value copy constructor throws. When nodes allocation fails. + +[endsect] +[br] + +[section:member10 swap(rtree &)] +Swaps contents of two rtrees. [heading Description] +Parameters, translator and allocators are swapped as well.[heading Synopsis] +``void swap(rtree & other)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree &` ][ `other` ][The rtree which content will be swapped with this rtree content.]] +] +[heading Throws] +If allocators swap throws. + +[endsect] +[br] + +[section:member11 insert(value_type const &)] +Insert a value to the index. [heading Synopsis] +``void insert(value_type const & value)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `value_type const &` ][ `value` ][The value which will be stored in the container.]] +] +[heading Throws] +If Value copy constructor or copy assignment throws. When nodes allocation fails. +[heading Exception-safety] +This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, +elements must not be inserted or removed, methods may return invalid data. + +[endsect] +[br] + +[section:member12 insert(Iterator, Iterator)] +Insert a range of values to the index. [heading Synopsis] +``template +void insert(Iterator first, Iterator last)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] +[[ `Iterator` ][ `last` ][The end of the range of values.]] +] +[heading Throws] +If Value copy constructor or copy assignment throws. When nodes allocation fails. +[heading Exception-safety] +This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, +elements must not be inserted or removed, methods may return invalid data. + +[endsect] +[br] + +[section:member13 insert(Range const &)] +Insert a range of values to the index. [heading Synopsis] +``template +void insert(Range const & rng)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Range const &` ][ `rng` ][The range of values.]] +] +[heading Throws] +If Value copy constructor or copy assignment throws. When nodes allocation fails. +[heading Exception-safety] +This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, +elements must not be inserted or removed, methods may return invalid data. + +[endsect] +[br] + +[section:member14 remove(value_type const &)] +Remove a value from the container. [heading Description] +In contrast to the STL set/map erase() method this method removes only one value from the container.[heading Synopsis] +``size_type remove(value_type const & value)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `value_type const &` ][ `value` ][The value which will be removed from the container.]] +] +[heading Returns] +1 if the value was removed, 0 otherwise. +[heading Throws] +If Value copy constructor or copy assignment throws. When nodes allocation fails. +[heading Exception-safety] +This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, +elements must not be inserted or removed, methods may return invalid data. + +[endsect] +[br] + +[section:member15 remove(Iterator, Iterator)] +Remove a range of values from the container. [heading Description] +In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +``template +size_type remove(Iterator first, Iterator last)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] +[[ `Iterator` ][ `last` ][The end of the range of values.]] +] +[heading Returns] +The number of removed values. +[heading Throws] +If Value copy constructor or copy assignment throws. When nodes allocation fails. +[heading Exception-safety] +This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, +elements must not be inserted or removed, methods may return invalid data. + +[endsect] +[br] + +[section:member16 remove(Range const &)] +Remove a range of values from the container. [heading Description] +In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +``template +size_type remove(Range const & rng)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Range const &` ][ `rng` ][The range of values.]] +] +[heading Returns] +The number of removed values. +[heading Throws] +If Value copy constructor or copy assignment throws. When nodes allocation fails. +[heading Exception-safety] +This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, +elements must not be inserted or removed, methods may return invalid data. + +[endsect] +[br] + +[section:member17 spatial_query(Predicates const &, OutIter)] +Finds values meeting spatial predicates, e.g. intersecting some Box. [heading Description] +Spatial predicates may be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] +``template +size_type spatial_query(Predicates const & pred, OutIter out_it)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Predicates const &` ][ `pred` ][The spatial predicates or a Geometry. ]] +[[ `OutIter` ][ `out_it` ][The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container)]] +] +[heading Returns] +The number of values found. +[heading Throws] +If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. + +[endsect] +[br] + +[section:member18 nearest_query(DistancesPredicates const &, value_type &)] +Finds one value meeting distances predicates, e.g. nearest to some Point. [heading Description] +The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).[heading Synopsis] +``template +size_type nearest_query(DistancesPredicates const & dpred, value_type & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point.]] +[[ `value_type &` ][ `v` ][The reference to the object which will contain the result.]] +] +[heading Returns] +The number of values found. +[heading Throws] +If Value copy constructor or copy assignment throws. + +[endsect] +[br] + +[section:member19 nearest_query(DistancesPredicates const &, Predicates const &, value_type &)] +Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. [heading Description] +The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + +The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] +``template +size_type nearest_query(DistancesPredicates const & dpred, + Predicates const & pred, + value_type & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point. ]] +[[ `Predicates const &` ][ `pred` ][The spatial predicates or a Geometry ]] +[[ `value_type &` ][ `v` ][The reference to the object which will contain the result.]] +] +[heading Returns] +The number of values found. +[heading Throws] +If Value copy constructor or copy assignment throws. + +[endsect] +[br] + +[section:member20 nearest_query(DistancesPredicates const &, size_t, OutIter)] +Finds k values meeting distances predicates, e.g. k nearest values to some Point. [heading Description] +The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).[heading Synopsis] +``template +size_type nearest_query(DistancesPredicates const & dpred, + size_t k, + OutIter out_it)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point. ]] +[[ `size_t` ][ `k` ][The max number of values. ]] +[[ `OutIter` ][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] +] +[heading Returns] +The number of values found. +[heading Throws] +If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. + +[endsect] +[br] + +[section:member21 nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter)] +Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. [heading Description] +The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + +The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] +``template +size_type nearest_query(DistancesPredicates const & dpred, + size_t k, + Predicates const & pred, + OutIter out_it)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point ]] +[[ `size_t` ][ `k` ][The max number of values. ]] +[[ `Predicates const &` ][ `pred` ][The spatial predicates or a Geometry. ]] +[[ `OutIter` ][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] +] +[heading Returns] +The number of values found. +[heading Throws] +If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. + +[endsect] +[br] + +[section:member22 size()] +Returns the number of stored values. [heading Synopsis] +``size_type size()`` + +[heading Returns] +The number of stored values. +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member23 empty()] +Query if the container is empty. [heading Synopsis] +``bool empty()`` + +[heading Returns] +true if the container is empty. +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member24 clear()] +Removes all values stored in the container. [heading Synopsis] +``void clear()`` + +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member25 box()] +Returns the box containing all values stored in the container. [heading Description] +Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.[heading Synopsis] +``box_type box()`` + +[heading Returns] +The box containing all values stored in the container or an invalid box if there are no values in the container. +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member26 count(ValueOrIndexable const &)] +Count Values or Indexables stored in the container. [heading Description] +For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter.[heading Synopsis] +``template +size_type count(ValueOrIndexable const & vori)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `ValueOrIndexable const &` ][ `vori` ][The value or indexable which will be counted.]] +] +[heading Returns] +The number of values found. +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member27 parameters()] +Returns parameters. [heading Synopsis] +``parameters_type const & parameters()`` + +[heading Returns] +The parameters object. +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member28 translator()] +Returns the translator object. [heading Synopsis] +``translator_type const & translator()`` + +[heading Returns] +The translator object. +[heading Throws] +Nothing. + +[endsect] +[br] + +[section:member29 get_allocator()] +Returns allocator used by the rtree. [heading Synopsis] +``allocator_type get_allocator()`` + +[heading Returns] +The allocator. +[heading Throws] +If allocator copy constructor throws. + +[endsect] +[br] + +[endsect] + diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk new file mode 100644 index 000000000..e96a6d4c5 --- /dev/null +++ b/doc/generated/rtree_functions.qbk @@ -0,0 +1,343 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/group__rtree__functions.xml] +[section:group__rtree__functions Functions related to the rtree (boost::geometry::index::)] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function0 `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function1 `insert(rtree<...> &, Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function2 `insert(rtree<...> &, Range const &)`]][Insert a range of values to the index. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function3 `remove(rtree<...> &, Value const &)`]][Remove a value from the container. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function4 `remove(rtree<...> &, Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function5 `remove(rtree<...> &, Range const &)`]][Remove a range of values from the container. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function6 `spatial_query(rtree<...> const &, Predicates const &, OutIter)`]][Find values meeting spatial predicates. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function7 `nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)`]][Find the value meeting distances predicates. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function8 `nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)`]][Find the value meeting distances and spatial predicates. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function9 `nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, OutIter)`]][Find k values meeting distances predicates. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function10 `nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, Predicates const &, OutIter)`]][Find k values meeting distances and spatial predicates. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function11 `clear(rtree<...> &)`]][Remove all values from the index. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function12 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function13 `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] +[[[link geometry_index.r_tree.reference.group__rtree__functions.function14 `box(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +] + +[section:function0 insert(rtree<...> &, Value const &)] +Insert a value to the index. [heading Synopsis] +``template +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +[[ `Value const &` ][ `v` ][The value which will be stored in the index. ]] +] +[endsect] +[br] + +[section:function1 insert(rtree<...> &, Iterator, Iterator)] +Insert a range of values to the index. [heading Synopsis] +``template +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, + Iterator first, + Iterator last)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] +[[ `Iterator` ][ `last` ][The end of the range of values. ]] +] +[endsect] +[br] + +[section:function2 insert(rtree<...> &, Range const &)] +Insert a range of values to the index. [heading Synopsis] +``template +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +[[ `Range const &` ][ `rng` ][The range of values. ]] +] +[endsect] +[br] + +[section:function3 remove(rtree<...> &, Value const &)] +Remove a value from the container. [heading Description] +Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.[heading Synopsis] +``template +rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +[[ `Value const &` ][ `v` ][The value which will be removed from the index.]] +] +[heading Returns] +1 if value was removed, 0 otherwise. +[endsect] +[br] + +[section:function4 remove(rtree<...> &, Iterator, Iterator)] +Remove a range of values from the container. [heading Description] +Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +``template +rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, + Iterator first, + Iterator last)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] +[[ `Iterator` ][ `last` ][The end of the range of values.]] +] +[heading Returns] +The number of removed values. +[endsect] +[br] + +[section:function5 remove(rtree<...> &, Range const &)] +Remove a range of values from the container. [heading Description] +Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +``template +rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +[[ `Range const &` ][ `rng` ][The range of values.]] +] +[heading Returns] +The number of removed values. +[endsect] +[br] + +[section:function6 spatial_query(rtree<...> const &, Predicates const &, OutIter)] +Find values meeting spatial predicates. [heading Synopsis] +``template +size_t boost::geometry::index::spatial_query(rtree< Value, Options, Translator, Allocator > const & tree, + Predicates const & pred, + OutIter out_it)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] +[[ `Predicates const &` ][ `pred` ][The spatial predicates. ]] +[[ `OutIter` ][ `out_it` ][The output iterator of the result range.]] +] +[heading Returns] +The number of found values. +[endsect] +[br] + +[section:function7 nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)] +Find the value meeting distances predicates. [heading Synopsis] +``template +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, + DistancesPredicates const & dpred, + Value & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] +[[ `Value &` ][ `v` ][The result.]] +] +[heading Returns] +The number of found values. +[endsect] +[br] + +[section:function8 nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)] +Find the value meeting distances and spatial predicates. [heading Synopsis] +``template +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, + DistancesPredicates const & dpred, + Predicates const & pred, + Value & v)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] +[[ `Predicates const &` ][ `pred` ][The spatial predicates. ]] +[[ `Value &` ][ `v` ][The result.]] +] +[heading Returns] +The number of found values. +[endsect] +[br] + +[section:function9 nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, OutIter)] +Find k values meeting distances predicates. [heading Synopsis] +``template +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, + DistancesPredicates const & dpred, + size_t k, + OutIter out_it)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] +[[ `size_t` ][ `k` ][The max number of values. ]] +[[ `OutIter` ][ `out_it` ][The output iterator of the result range.]] +] +[heading Returns] +The number of found values. +[endsect] +[br] + +[section:function10 nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, Predicates const &, OutIter)] +Find k values meeting distances and spatial predicates. [heading Synopsis] +``template +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, + DistancesPredicates const & dpred, + size_t k, + Predicates const & pred, + OutIter out_it)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] +[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] +[[ `size_t` ][ `k` ][The max number of values. ]] +[[ `Predicates const &` ][ `pred` ][The spatial predicates. ]] +[[ `OutIter` ][ `out_it` ][The output iterator of the result range.]] +] +[heading Returns] +The number of found values. +[endsect] +[br] + +[section:function11 clear(rtree<...> &)] +Remove all values from the index. [heading Synopsis] +``template +void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +] +[endsect] +[br] + +[section:function12 size(rtree<...> const &)] +Get the number of values stored in the index. [heading Synopsis] +``template +size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] +] +[heading Returns] +The number of values stored in the index. +[endsect] +[br] + +[section:function13 empty(rtree<...> const &)] +Query if there are no values stored in the index. [heading Synopsis] +``template +bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] +] +[heading Returns] +true if there are no values in the index. +[endsect] +[br] + +[section:function14 box(rtree<...> const &)] +Get the box containing all stored values or an invalid box if the index has no values. [heading Synopsis] +``template +rtree::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] +] +[heading Returns] +The box containing all stored values or an invalid box. +[endsect] +[br] + +[endsect] + diff --git a/test/static_vector.cpp b/test/static_vector.cpp index 9dca95562..ae54323df 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -78,14 +78,10 @@ void test_ctor_nc(size_t n) BOOST_CHECK(s.size() == n); BOOST_CHECK(s.capacity() == N); BOOST_CHECK_THROW( s.at(n), std::out_of_range ); - if ( 1 < n ) + if ( !boost::has_trivial_constructor::value ) { - s[0] = T(10); - BOOST_CHECK(T(10) == s[0]); - BOOST_CHECK(T(10) == s.at(0)); - s.at(1) = T(20); - BOOST_CHECK(T(20) == s[1]); - BOOST_CHECK(T(20) == s.at(1)); + for ( size_t i = 0 ; i < n ; ++i ) + BOOST_CHECK(T() == s[i]); } } @@ -120,14 +116,11 @@ void test_resize_nc(size_t n) BOOST_CHECK(s.size() == n); BOOST_CHECK(s.capacity() == N); BOOST_CHECK_THROW( s.at(n), std::out_of_range ); - if ( 1 < n ) + + if ( !boost::has_trivial_constructor::value ) { - s[0] = T(10); - BOOST_CHECK(T(10) == s[0]); - BOOST_CHECK(T(10) == s.at(0)); - s.at(1) = T(20); - BOOST_CHECK(T(20) == s[1]); - BOOST_CHECK(T(20) == s.at(1)); + for ( size_t i = 0 ; i < n ; ++i ) + BOOST_CHECK(T() == s[i]); } } From 9ec3d2289e43ee6815af038707ac5c802714a41a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 18:41:55 +0000 Subject: [PATCH 273/366] Added the rest of generated files. [SVN r82423] --- doc/generated/adaptors.qbk | 2 +- doc/generated/inserters.qbk | 26 ++++++++++ doc/generated/predicates.qbk | 2 +- doc/generated/rtree.qbk | 4 +- doc/generated/translator_def.qbk | 29 +++++++++++ doc/generated/translator_index.qbk | 48 +++++++++++++++++++ doc/html/geometry_index/r_tree/reference.html | 6 +-- doc/html/index.html | 2 +- 8 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 doc/generated/inserters.qbk create mode 100644 doc/generated/translator_def.qbk create mode 100644 doc/generated/translator_index.qbk diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index fc65f4236..b33e31f71 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -1,6 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__adaptors.xml] -[section:group__adaptors Spatial indexes adaptors (boost::geometry::index::adaptors::)] +[section:group__adaptors Adaptors (boost::geometry::index::adaptors::)] [table [[Function][Description]] [[[link geometry_index.r_tree.reference.group__adaptors.function0 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] diff --git a/doc/generated/inserters.qbk b/doc/generated/inserters.qbk new file mode 100644 index 000000000..a9e3b78d1 --- /dev/null +++ b/doc/generated/inserters.qbk @@ -0,0 +1,26 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/group__inserters.xml] +[section:group__inserters Inserters (boost::geometry::index::)] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.group__inserters.function0 `inserter(Container &)`]][Insert iterator generator. ]] +] + +[section:function0 inserter(Container &)] +Insert iterator generator. [heading Description] +Returns insert iterator capable to insert values to the container (spatial index) which has member function insert(value_type const&) defined.[heading Synopsis] +``template +insert_iterator boost::geometry::index::inserter(Container & c)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Container &` ][ `c` ][The reference to the container (spatial index) to which values will be inserted.]] +] +[heading Returns] +The insert iterator inserting values to the container. +[endsect] +[br] + +[endsect] + diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index d74e2534a..471df593e 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -1,6 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__predicates.xml] -[section:group__predicates Predicates (boost::geometry::index::)] +[section:group__predicates Spatial predicates (boost::geometry::index::)] [table [[Function][Description]] [[[link geometry_index.r_tree.reference.group__predicates.function0 `empty()`]][Generate empty predicate. ]] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index fd143e5b9..25b168794 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -95,8 +95,8 @@ The constructor. [heading Synopsis] [heading Parameters] [table [[Type][Name][Description]] -[[ `parameters_type` ][ `parameters` ][]] -[[ `translator_type const &` ][ `translator` ][]] +[[ `parameters_type` ][ `parameters` ][The parameters object. ]] +[[ `translator_type const &` ][ `translator` ][The translator object.]] ] [heading Throws] If allocator default constructor throws. diff --git a/doc/generated/translator_def.qbk b/doc/generated/translator_def.qbk new file mode 100644 index 000000000..933b7b5c3 --- /dev/null +++ b/doc/generated/translator_def.qbk @@ -0,0 +1,29 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/structboost_1_1geometry_1_1index_1_1translator_1_1def.xml] +[section:boost_geometry_index_translator_def boost::geometry::index::translator::def] + +'''boostgeometryindextranslatordef''' +The default translator. + +[heading Description] +It translates Value object to Indexable object. The default version handles Values which are Indexables. This translator is also specialized for std::pair and boost::tuple. + +[heading Header] +`#include <.hpp>` + +[heading Synopsis] +``template +struct def +{ + // ... +}; +`` + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Value`][The Value type which may be translated directly to the Indexable. ]] +] + +[endsect] + diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk new file mode 100644 index 000000000..1d903c273 --- /dev/null +++ b/doc/generated/translator_index.qbk @@ -0,0 +1,48 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1translator_1_1index.xml] +[section:boost_geometry_index_translator_index boost::geometry::index::translator::index] + +'''boostgeometryindextranslatorindex''' +The index translator. + +[heading Description] +This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size\u005ftype) defined. Index translator uses translator::def<...> to translate from Container::value\u005ftype to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. + +[heading Header] +`#include <.hpp>` + +[heading Synopsis] +``template +class index +{ + // ... +}; +`` + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Container`][The Container type. ]] +] + +[heading Constructor(s) and destructor] +[table +[[Function][Description]] +[[[link geometry_index.r_tree.reference.translators.boost_geometry_index_translator_index.member0 `index(Container const &)`]][The constructor. ]] +] + +[br] +[section:member0 index(Container const &)] +The constructor. [heading Synopsis] +``index(Container const & c)`` + +[heading Parameters] +[table +[[Type][Name][Description]] +[[ `Container const &` ][ `c` ][The container which stores indexed values. ]] +] +[endsect] +[br] + +[endsect] + diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 308bbf208..2a7a2808a 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -45,7 +45,7 @@ boost::geometry::index::rtree

        - + The R-tree spatial index.

        @@ -6956,7 +6956,7 @@ The R-tree spatial index. boost::geometry::index::translator::def

    - + The default translator.

    @@ -7030,7 +7030,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    diff --git a/doc/html/index.html b/doc/html/index.html index 3df4561a0..98ca2b1ea 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: January 09, 2013 at 16:40:37 GMT

    Last revised: January 09, 2013 at 18:40:07 GMT


    From b8c48f13ef76a57ffee74554d5deca63317c3b73 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 21:57:37 +0000 Subject: [PATCH 274/366] Added \par and \li support in doxygen_xml2qbk. [SVN r82424] --- .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index adb30647a..ff51567e7 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -75,6 +75,23 @@ static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& skip = true; return; } + else if ( boost::equals(name, "itemizedlist") ) + { + contents += "\n\n"; + parse_para(node->first_node(), contents, skip); + contents += "\n[/]"; + parse_para(node->next_sibling(), contents, skip); + return; + } + else if ( boost::equals(name, "listitem") ) + { + contents += "* "; + rapidxml::xml_node<>* li = node->first_node("para"); + contents += li ? li->value() : ""; + contents += "\n"; + parse_para(node->next_sibling(), contents, skip); + return; + } else if (! ( (boost::equals(name, "para") && first) || boost::equals(name, "ref") @@ -97,6 +114,7 @@ static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& { //std::cout << "OTHER: " << node->name() << "=" << node->value() << std::endl; } + parse_para(node->first_node(), contents, skip, false); parse_para(node->next_sibling(), contents, skip, false); } @@ -341,6 +359,33 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi parse_parameter_list(node->first_node(), el.template_parameters); } } + else if (full == ".detaileddescription.para.simplesect") + { + std::string kind = get_attribute(node, "kind"); + if (kind == "par") + { + rapidxml::xml_node<> * title_node = node->first_node("title"); + std::string title = title_node ? title_node->value() : ""; + + std::string m; + if ( title_node ) + m = std::string("[heading ") + title + "]\n"; + else + m = "\n\n"; + + parse_para(node->first_node("para"), m, el.skip); + m += "\n"; + + el.qbk_markup.push_back(markup(m)); + } + else if (kind == "pre") + { + std::string para; + parse_para(node->first_node("para"), para, el.skip); + + el.qbk_markup.push_back(markup(std::string("[heading Precondition]\n") + para)); + } + } else if (full == ".param") { // Parse one parameter, and add it to el.parameters From 53a5a25f55053f1c225758818548ca9ec0b88311 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 9 Jan 2013 23:48:23 +0000 Subject: [PATCH 275/366] Docs improved. [SVN r82428] --- doc/generated/rtree.qbk | 110 ++++++------- doc/generated/translator_def.qbk | 2 +- doc/generated/translator_index.qbk | 2 +- doc/html/geometry_index/r_tree/reference.html | 32 ++-- doc/html/index.html | 2 +- doc/make_qbk.py | 2 +- .../geometry/extensions/index/rtree/rtree.hpp | 152 +++++++----------- 7 files changed, 131 insertions(+), 171 deletions(-) diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 25b168794..db748cc04 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -8,12 +8,13 @@ The R-tree spatial index. [heading Description] The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. +[heading Parameters] The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. Predefined algorithms with compile-time parameters are: bgi::linear, bgi::quadratic, bgi::rstar. Predefined algorithms with run-time parameters are: bgi::runtime::linear, bgi::runtime::quadratic, bgi::runtime::rstar. - +[heading Translator] The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (which are Indexables). It also handles std::pair, pointers, smart pointers, and iterators. E.g. If std::pair is stored, the default translator translates from std::pair const& to Box const&. [heading Header] -`#include <.hpp>` +`#include ` [heading Synopsis] ``template and boost::tuple. [heading Header] -`#include <.hpp>` +`#include ` [heading Synopsis] ``template diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 1d903c273..790900975 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -9,7 +9,7 @@ The index translator. This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size\u005ftype) defined. Index translator uses translator::def<...> to translate from Container::value\u005ftype to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. [heading Header] -`#include <.hpp>` +`#include ` [heading Synopsis] ``template diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 2a7a2808a..40f4ef13a 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -45,7 +45,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    @@ -56,6 +56,10 @@ The R-tree spatial index. The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms.

    +
    + + Parameters +

    The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm @@ -66,6 +70,10 @@ The R-tree spatial index. * 0.3>. Predefined algorithms with run-time parameters are: bgi::runtime::linear, bgi::runtime::quadratic, bgi::runtime::rstar.

    +
    + + Translator +

    The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore @@ -77,14 +85,14 @@ The R-tree spatial index. int> const& to Box const&.

    - + Header

    - #include <.hpp> + #include <boost/geometry/extensions/index/rtree/rtree.hpp>

    - + Synopsis

    @@ -101,7 +109,7 @@ The R-tree spatial index.

    - + Template parameter(s)
    @@ -175,7 +183,7 @@ The R-tree spatial index.
    - + Typedef(s)
    @@ -283,7 +291,7 @@ The R-tree spatial index.
    - + Constructor(s) and destructor
    @@ -411,7 +419,7 @@ The R-tree spatial index.
    - + Member(s)
    @@ -6956,7 +6964,7 @@ The R-tree spatial index. boost::geometry::index::translator::def

    - + The default translator.

    @@ -6973,7 +6981,7 @@ The default translator. Header

    - #include <.hpp> + #include <boost/geometry/extensions/index/translator/def.hpp>

    @@ -7030,7 +7038,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    @@ -7049,7 +7057,7 @@ The index translator. Header

    - #include <.hpp> + #include <boost/geometry/extensions/index/translator/index.hpp>

    diff --git a/doc/html/index.html b/doc/html/index.html index 98ca2b1ea..5bcf3e1c3 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: January 09, 2013 at 18:40:07 GMT

    Last revised: January 09, 2013 at 23:45:57 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index c731d21de..f5cad0bc9 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -12,7 +12,7 @@ import os, sys cmd = "doxygen_xml2qbk" cmd = cmd + " --xml xml/%s.xml" -cmd = cmd + " --start_include ." +cmd = cmd + " --start_include boost/" cmd = cmd + " --index_id_path %s" cmd = cmd + " --output_style alt" cmd = cmd + " > generated/%s.qbk" diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index b7f9d9e71..25d0c15c5 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -62,6 +62,7 @@ namespace boost { namespace geometry { namespace index { The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. +\par Parameters The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. @@ -74,6 +75,7 @@ bgi::runtime::linear, bgi::runtime::quadratic, bgi::runtime::rstar. +\par Translator The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point @@ -131,9 +133,8 @@ public: \param parameters The parameters object. \param translator The translator object. - \bgi_throws{ + \par Throws If allocator default constructor throws. - } */ inline explicit rtree(parameters_type parameters = parameters_type(), translator_type const& translator = translator_type()) @@ -152,9 +153,8 @@ public: \param translator The translator object. \param allocator The allocator object. - \bgi_throws{ + \par Throws If allocator copy constructor throws. - } */ inline rtree(parameters_type parameters, translator_type const& translator, @@ -176,10 +176,9 @@ public: \param translator The translator object. \param allocator The allocator object. - \bgi_throws{ + \par Throws If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails. - } */ template inline rtree(Iterator first, Iterator last, @@ -212,10 +211,9 @@ public: \param translator The translator object. \param allocator The allocator object. - \bgi_throws{ + \par Throws If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails. - } */ template inline explicit rtree(Range const& rng, @@ -243,9 +241,8 @@ public: /*! \brief The destructor. - \bgi_throws{ + \par Throws Nothing. - } */ inline ~rtree() { @@ -259,10 +256,9 @@ public: \param src The rtree which content will be copied. - \bgi_throws{ + \par Throws If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails. - } */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -285,10 +281,9 @@ public: \param src The rtree which content will be copied. \param allocator The allocator which will be used. - \bgi_throws{ + \par Throws If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails. - } */ inline rtree(rtree const& src, allocator_type const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -308,9 +303,8 @@ public: \param src The rtree which content will be moved. - \bgi_throws{ + \par Throws If allocator move constructor throws. - } */ inline rtree(BOOST_RV_REF(rtree) src) // TODO - use boost::move() @@ -333,10 +327,9 @@ public: \param src The rtree which content will be copied. - \bgi_throws{ + \par Throws If Value copy constructor throws. When nodes allocation fails. - } */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -358,9 +351,8 @@ public: \param src The rtree which content will be moved. - \bgi_throws{ + \par Throws Only if allocators aren't equal. If Value copy constructor throws. When nodes allocation fails. - } */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -400,9 +392,8 @@ public: \param other The rtree which content will be swapped with this rtree content. - \bgi_throws{ + \par Throws If allocators swap throws. - } */ void swap(rtree & other) { @@ -420,13 +411,12 @@ public: \param value The value which will be stored in the container. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. When nodes allocation fails. - } - \bgi_exception{ + + \par Exception-safety This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } */ inline void insert(value_type const& value) { @@ -442,13 +432,12 @@ public: \param first The beginning of the range of values. \param last The end of the range of values. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. When nodes allocation fails. - } - \bgi_exception{ + + \par Exception-safety This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } */ template inline void insert(Iterator first, Iterator last) @@ -465,13 +454,12 @@ public: \param rng The range of values. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. When nodes allocation fails. - } - \bgi_exception{ + + \par Exception-safety This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } */ template inline void insert(Range const& rng) @@ -494,13 +482,12 @@ public: \return 1 if the value was removed, 0 otherwise. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. When nodes allocation fails. - } - \bgi_exception{ + + \par Exception-safety This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } */ inline size_type remove(value_type const& value) { @@ -520,13 +507,12 @@ public: \return The number of removed values. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. When nodes allocation fails. - } - \bgi_exception{ + + \par Exception-safety This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } */ template inline size_type remove(Iterator first, Iterator last) @@ -548,13 +534,12 @@ public: \return The number of removed values. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. When nodes allocation fails. - } - \bgi_exception{ + + \par Exception-safety This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. - } */ template inline size_type remove(Range const& rng) @@ -583,9 +568,8 @@ public: \return The number of values found. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. - } */ template inline size_type spatial_query(Predicates const& pred, OutIter out_it) const @@ -620,9 +604,8 @@ public: \return The number of values found. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. - } */ template inline size_type nearest_query(DistancesPredicates const& dpred, value_type & v) const @@ -658,9 +641,8 @@ public: \return The number of values found. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. - } */ template inline size_type nearest_query(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -687,9 +669,8 @@ public: \return The number of values found. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. - } */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, OutIter out_it) const @@ -726,9 +707,8 @@ public: \return The number of values found. - \bgi_throws{ + \par Throws If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. - } */ template inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const @@ -741,9 +721,8 @@ public: \return The number of stored values. - \bgi_throws{ + \par Throws Nothing. - } */ inline size_type size() const { @@ -755,9 +734,8 @@ public: \return true if the container is empty. - \bgi_throws{ + \par Throws Nothing. - } */ inline bool empty() const { @@ -767,9 +745,8 @@ public: /*! \brief Removes all values stored in the container. - \bgi_throws{ + \par Throws Nothing. - } */ inline void clear() { @@ -785,9 +762,8 @@ public: \return The box containing all values stored in the container or an invalid box if there are no values in the container. - \bgi_throws{ + \par Throws Nothing. - } */ inline box_type box() const { @@ -816,9 +792,8 @@ public: \return The number of values found. - \bgi_throws{ + \par Throws Nothing. - } */ template size_type count(ValueOrIndexable const& vori) const @@ -839,9 +814,8 @@ public: \return The parameters object. - \bgi_throws{ + \par Throws Nothing. - } */ inline parameters_type const& parameters() const { @@ -853,9 +827,8 @@ public: \return The translator object. - \bgi_throws{ + \par Throws Nothing. - } */ inline translator_type const& translator() const { @@ -867,9 +840,8 @@ public: \return The allocator. - \bgi_throws{ + \par Throws If allocator copy constructor throws. - } */ allocator_type get_allocator() const { @@ -887,9 +859,8 @@ private: \param visitor The visitor object. - \bgi_exception{ - the same as Visitor::operator(). - } + \par Throws + If Visitor::operator() throws. */ template inline void apply_visitor(Visitor & visitor) const @@ -905,9 +876,8 @@ private: \return The number of stored objects. - \bgi_exception{ - nothrow - } + \par Throws + Nothing. */ inline size_type values_count() const { @@ -921,9 +891,8 @@ private: \return The depth of the R-tree. - \bgi_exception{ - nothrow - } + \par Throws + Nothing. */ inline size_type depth() const { @@ -938,9 +907,8 @@ private: \param value The value which will be stored in the container. - \bgi_exception{ + \par Exception-safety basic - } */ inline void raw_insert(value_type const& value) { @@ -969,9 +937,8 @@ private: \param value The value which will be removed from the container. - \bgi_exception{ + \par Exception-safety basic - } */ inline size_type raw_remove(value_type const& value) { @@ -999,9 +966,8 @@ private: /*! \brief Create an empty R-tree i.e. new empty root node and clear other attributes. - \bgi_exception{ + \par Exception-safety strong - } */ inline void raw_create() { @@ -1017,9 +983,8 @@ private: \param t The container which is going to be destroyed. - \bgi_exception{ + \par Exception-safety nothrow - } */ inline void raw_destroy(rtree & t) { @@ -1041,9 +1006,8 @@ private: \param src The source R-tree. \param dst The destination R-tree. - \bgi_exception{ + \par Exception-safety strong - } */ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { @@ -1075,9 +1039,8 @@ private: /*! \brief Find one value meeting distances and spatial predicates. - \bgi_exception{ + \par Exception-safety strong - } */ template inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const @@ -1115,9 +1078,8 @@ private: /*! \brief Find k values meeting distances and spatial predicates. - \bgi_exception{ + \par Exception-safety strong - } */ template inline size_type raw_nearest_k(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const From 42c7931bc74b8e2d920f40afbd66532f9f099afe Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 10 Jan 2013 20:12:40 +0000 Subject: [PATCH 276/366] doxygen_xml2qbk fixed brackets display in sections titles and generated tables. [SVN r82435] --- doc/generated/adaptors.qbk | 15 +- doc/generated/distance_predicates.qbk | 35 +-- doc/generated/inserters.qbk | 5 +- doc/generated/predicates.qbk | 35 +-- doc/generated/rtree.qbk | 151 +++++++------ doc/generated/rtree_functions.qbk | 75 ++++--- doc/generated/translator_index.qbk | 6 +- doc/html/geometry_index/r_tree/reference.html | 204 +----------------- doc/html/index.html | 2 +- .../doxygen_xml2qbk/quickbook_output.hpp | 58 ++--- 10 files changed, 230 insertions(+), 356 deletions(-) diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index b33e31f71..cfa647625 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -9,7 +9,9 @@ ] [section:function0 nearest_queried(DistancesPredicates const &, size_t, Predicates const &)] -The nearest query index adaptor generator. [heading Synopsis] +The nearest query index adaptor generator. + +[heading Synopsis] ``template detail::nearest_query boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k, @@ -23,10 +25,11 @@ detail::nearest_query boost::geometry::index::a [[ `Predicates const &` ][ `pred` ][Spatial predicates. ]] ] [endsect] -[br] [section:function1 nearest_queried(DistancesPredicates const &, size_t)] -The nearest query index adaptor generator. [heading Synopsis] +The nearest query index adaptor generator. + +[heading Synopsis] ``template detail::nearest_query boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)`` @@ -37,10 +40,11 @@ detail::nearest_query boost::geometry [[ `size_t` ][ `k` ][The number of values to find. ]] ] [endsect] -[br] [section:function2 spatial_queried(Predicates const &)] -The spatial query index adaptor generator. [heading Synopsis] +The spatial query index adaptor generator. + +[heading Synopsis] ``template detail::spatial_query boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)`` @@ -50,7 +54,6 @@ detail::spatial_query boost::geometry::index::adaptors::spatial_quer [[ `Predicates const &` ][ `pred` ][Spatial predicates. ]] ] [endsect] -[br] [endsect] diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index a8af3ab77..60f5b39d7 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -13,7 +13,9 @@ ] [section:function0 to_nearest(T const &)] -Generate to_nearest() Point-Indexable relationship. [heading Description] +Generate to_nearest() Point-Indexable relationship. + +[heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it should be the distance to the nearest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation.[heading Synopsis] ``template detail::to_nearest boost::geometry::index::to_nearest(T const & v)`` @@ -24,10 +26,11 @@ detail::to_nearest boost::geometry::index::to_nearest(T const & v)`` [[ `T const &` ][ `v` ][Point or bound value. ]] ] [endsect] -[br] [section:function1 to_centroid(T const &)] -Generate to_centroid() Point-Indexable relationship. [heading Description] +Generate to_centroid() Point-Indexable relationship. + +[heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v.[heading Synopsis] ``template detail::to_centroid boost::geometry::index::to_centroid(T const & v)`` @@ -38,10 +41,11 @@ detail::to_centroid boost::geometry::index::to_centroid(T const & v)`` [[ `T const &` ][ `v` ][Point or bound value. ]] ] [endsect] -[br] [section:function2 to_furthest(T const &)] -Generate to_furthest() Point-Indexable relationship. [heading Description] +Generate to_furthest() Point-Indexable relationship. + +[heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it should be the distance to the furthest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v.[heading Synopsis] ``template detail::to_furthest boost::geometry::index::to_furthest(T const & v)`` @@ -52,10 +56,11 @@ detail::to_furthest boost::geometry::index::to_furthest(T const & v)`` [[ `T const &` ][ `v` ][Point or bound value. ]] ] [endsect] -[br] [section:function3 unbounded(PointRelation const &)] -Generate unbounded() distance predicate. [heading Description] +Generate unbounded() distance predicate. + +[heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that there is no distance bounds and Values should be returned if distances between Point and Indexable are the smallest. Distance calculation is defined by PointRelation. This is default nearest predicate.[heading Synopsis] ``template detail::unbounded boost::geometry::index::unbounded(PointRelation const & pr)`` @@ -66,10 +71,11 @@ detail::unbounded boost::geometry::index::unbounded(PointRelation [[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] ] [endsect] -[br] [section:function4 min_bounded(PointRelation const &, MinRelation const &)] -Generate min_bounded() distance predicate. [heading Description] +Generate min_bounded() distance predicate. + +[heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance.[heading Synopsis] ``template detail::min_bounded boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)`` @@ -81,10 +87,11 @@ detail::min_bounded boost::geometry::index::min_boun [[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). ]] ] [endsect] -[br] [section:function5 max_bounded(PointRelation const &, MaxRelation const &)] -Generate max_bounded() distance predicate. [heading Description] +Generate max_bounded() distance predicate. + +[heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are closer than some distance.[heading Synopsis] ``template detail::max_bounded boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)`` @@ -96,10 +103,11 @@ detail::max_bounded boost::geometry::index::max_boun [[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). ]] ] [endsect] -[br] [section:function6 bounded(PointRelation const &, MinRelation const &, MaxRelation const &)] -Generate bounded() distance predicate. [heading Description] +Generate bounded() distance predicate. + +[heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance and closer than some other distance.[heading Synopsis] ``template boost::geometry::index: [[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). ]] ] [endsect] -[br] [endsect] diff --git a/doc/generated/inserters.qbk b/doc/generated/inserters.qbk index a9e3b78d1..6c8821b0f 100644 --- a/doc/generated/inserters.qbk +++ b/doc/generated/inserters.qbk @@ -7,7 +7,9 @@ ] [section:function0 inserter(Container &)] -Insert iterator generator. [heading Description] +Insert iterator generator. + +[heading Description] Returns insert iterator capable to insert values to the container (spatial index) which has member function insert(value_type const&) defined.[heading Synopsis] ``template insert_iterator boost::geometry::index::inserter(Container & c)`` @@ -20,7 +22,6 @@ insert_iterator boost::geometry::index::inserter(Container & c)`` [heading Returns] The insert iterator inserting values to the container. [endsect] -[br] [endsect] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 471df593e..7a644dc7f 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -13,14 +13,17 @@ ] [section:function0 empty()] -Generate empty predicate. [heading Synopsis] +Generate empty predicate. + +[heading Synopsis] ``detail::empty boost::geometry::index::empty()`` [endsect] -[br] [section:function1 value(ValuePredicate const &)] -Generate value predicate. [heading Description] +Generate value predicate. + +[heading Description] A wrapper around user-defined functor describing if Value should be returned by spatial query.[heading Synopsis] ``template detail::value boost::geometry::index::value(ValuePredicate const & vpred)`` @@ -31,10 +34,11 @@ detail::value boost::geometry::index::value(ValuePredicate const [[ `ValuePredicate const &` ][ `vpred` ][The functor. ]] ] [endsect] -[br] [section:function2 covered_by(Geometry const &)] -Generate covered_by() predicate. [heading Description] +Generate covered_by() predicate. + +[heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::covered_by(Indexable, Geometry) returns true.[heading Synopsis] ``template detail::covered_by boost::geometry::index::covered_by(Geometry const & g)`` @@ -45,10 +49,11 @@ detail::covered_by boost::geometry::index::covered_by(Geometry const & [[ `Geometry const &` ][ `g` ][The Geometry object. ]] ] [endsect] -[br] [section:function3 disjoint(Geometry const &)] -Generate disjoint() predicate. [heading Description] +Generate disjoint() predicate. + +[heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::disjoint(Indexable, Geometry) returns true.[heading Synopsis] ``template detail::disjoint boost::geometry::index::disjoint(Geometry const & g)`` @@ -59,10 +64,11 @@ detail::disjoint boost::geometry::index::disjoint(Geometry const & g)` [[ `Geometry const &` ][ `g` ][The Geometry object. ]] ] [endsect] -[br] [section:function4 intersects(Geometry const &)] -Generate intersects() predicate. [heading Description] +Generate intersects() predicate. + +[heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::intersects(Indexable, Geometry) returns true.[heading Synopsis] ``template detail::intersects boost::geometry::index::intersects(Geometry const & g)`` @@ -73,10 +79,11 @@ detail::intersects boost::geometry::index::intersects(Geometry const & [[ `Geometry const &` ][ `g` ][The Geometry object. ]] ] [endsect] -[br] [section:function5 overlaps(Geometry const &)] -Generate overlaps() predicate. [heading Description] +Generate overlaps() predicate. + +[heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::overlaps(Indexable, Geometry) returns true.[heading Synopsis] ``template detail::overlaps boost::geometry::index::overlaps(Geometry const & g)`` @@ -87,10 +94,11 @@ detail::overlaps boost::geometry::index::overlaps(Geometry const & g)` [[ `Geometry const &` ][ `g` ][The Geometry object. ]] ] [endsect] -[br] [section:function6 within(Geometry const &)] -Generate within() predicate. [heading Description] +Generate within() predicate. + +[heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::within(Indexable, Geometry) returns true.[heading Synopsis] ``template detail::within boost::geometry::index::within(Geometry const & g)`` @@ -101,7 +109,6 @@ detail::within boost::geometry::index::within(Geometry const & g)`` [[ `Geometry const &` ][ `g` ][The Geometry object. ]] ] [endsect] -[br] [endsect] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index db748cc04..4a677e091 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -88,9 +88,10 @@ class rtree [[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member29 `get_allocator()`]][Returns allocator used by the rtree. ]] ] -[br] [section:member0 rtree()] -The constructor. [heading Synopsis] +The constructor. + +[heading Synopsis] ``rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())`` [heading Parameters] @@ -103,10 +104,11 @@ The constructor. [heading Synopsis] If allocator default constructor throws. [endsect] -[br] [section:member1 rtree(parameters_type, translator_type const &, allocator_type)] -The constructor. [heading Synopsis] +The constructor. + +[heading Synopsis] ``rtree(parameters_type parameters, translator_type const & translator, allocator_type allocator)`` @@ -122,10 +124,11 @@ The constructor. [heading Synopsis] If allocator copy constructor throws. [endsect] -[br] [section:member2 rtree(Iterator, Iterator)] -The constructor. [heading Synopsis] +The constructor. + +[heading Synopsis] ``template rtree(Iterator first, Iterator last, @@ -146,10 +149,11 @@ rtree(Iterator first, If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails. [endsect] -[br] [section:member3 rtree(Range const &)] -The constructor. [heading Synopsis] +The constructor. + +[heading Synopsis] ``template rtree(Range const & rng, parameters_type parameters = parameters_type(), @@ -168,20 +172,22 @@ rtree(Range const & rng, If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails. [endsect] -[br] [section:member4 ~rtree()] -The destructor. [heading Synopsis] +The destructor. + +[heading Synopsis] ``~rtree()`` [heading Throws] Nothing. [endsect] -[br] [section:member5 rtree(rtree const &)] -The copy constructor. [heading Description] +The copy constructor. + +[heading Description] It uses parameters, translator and allocator from the source tree.[heading Synopsis] ``rtree(rtree const & src)`` @@ -194,10 +200,11 @@ It uses parameters, translator and allocator from the source tree.[heading Synop If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails. [endsect] -[br] [section:member6 rtree(rtree const &, allocator_type const &)] -The copy constructor. [heading Description] +The copy constructor. + +[heading Description] It uses Parameters and translator from the source tree.[heading Synopsis] ``rtree(rtree const & src, allocator_type const & allocator)`` @@ -211,10 +218,11 @@ It uses Parameters and translator from the source tree.[heading Synopsis] If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails. [endsect] -[br] [section:member7 rtree(rtree &&)] -The moving constructor. [heading Description] +The moving constructor. + +[heading Description] It uses parameters, translator and allocator from the source tree.[heading Synopsis] ``rtree(rtree && src)`` @@ -227,10 +235,11 @@ It uses parameters, translator and allocator from the source tree.[heading Synop If allocator move constructor throws. [endsect] -[br] [section:member8 operator=(const rtree &)] -The assignment operator. [heading Description] +The assignment operator. + +[heading Description] It uses parameters and translator from the source tree.[heading Synopsis] ``rtree & operator=(const rtree & src)`` @@ -243,10 +252,11 @@ It uses parameters and translator from the source tree.[heading Synopsis] If Value copy constructor throws. When nodes allocation fails. [endsect] -[br] [section:member9 operator=(rtree &&)] -The moving assignment. [heading Description] +The moving assignment. + +[heading Description] It uses parameters and translator from the source tree.[heading Synopsis] ``rtree & operator=(rtree && src)`` @@ -259,10 +269,11 @@ It uses parameters and translator from the source tree.[heading Synopsis] Only if allocators aren't equal. If Value copy constructor throws. When nodes allocation fails. [endsect] -[br] [section:member10 swap(rtree &)] -Swaps contents of two rtrees. [heading Description] +Swaps contents of two rtrees. + +[heading Description] Parameters, translator and allocators are swapped as well.[heading Synopsis] ``void swap(rtree & other)`` @@ -275,10 +286,11 @@ Parameters, translator and allocators are swapped as well.[heading Synopsis] If allocators swap throws. [endsect] -[br] [section:member11 insert(value_type const &)] -Insert a value to the index. [heading Synopsis] +Insert a value to the index. + +[heading Synopsis] ``void insert(value_type const & value)`` [heading Parameters] @@ -292,10 +304,11 @@ If Value copy constructor or copy assignment throws. When nodes allocation fails This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. [endsect] -[br] [section:member12 insert(Iterator, Iterator)] -Insert a range of values to the index. [heading Synopsis] +Insert a range of values to the index. + +[heading Synopsis] ``template void insert(Iterator first, Iterator last)`` @@ -311,10 +324,11 @@ If Value copy constructor or copy assignment throws. When nodes allocation fails This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. [endsect] -[br] [section:member13 insert(Range const &)] -Insert a range of values to the index. [heading Synopsis] +Insert a range of values to the index. + +[heading Synopsis] ``template void insert(Range const & rng)`` @@ -329,10 +343,11 @@ If Value copy constructor or copy assignment throws. When nodes allocation fails This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. [endsect] -[br] [section:member14 remove(value_type const &)] -Remove a value from the container. [heading Description] +Remove a value from the container. + +[heading Description] In contrast to the STL set/map erase() method this method removes only one value from the container.[heading Synopsis] ``size_type remove(value_type const & value)`` @@ -349,10 +364,11 @@ If Value copy constructor or copy assignment throws. When nodes allocation fails This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. [endsect] -[br] [section:member15 remove(Iterator, Iterator)] -Remove a range of values from the container. [heading Description] +Remove a range of values from the container. + +[heading Description] In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template size_type remove(Iterator first, Iterator last)`` @@ -371,10 +387,11 @@ If Value copy constructor or copy assignment throws. When nodes allocation fails This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. [endsect] -[br] [section:member16 remove(Range const &)] -Remove a range of values from the container. [heading Description] +Remove a range of values from the container. + +[heading Description] In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template size_type remove(Range const & rng)`` @@ -392,10 +409,11 @@ If Value copy constructor or copy assignment throws. When nodes allocation fails This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. [endsect] -[br] [section:member17 spatial_query(Predicates const &, OutIter)] -Finds values meeting spatial predicates, e.g. intersecting some Box. [heading Description] +Finds values meeting spatial predicates, e.g. intersecting some Box. + +[heading Description] Spatial predicates may be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] ``template size_type spatial_query(Predicates const & pred, OutIter out_it)`` @@ -412,10 +430,11 @@ The number of values found. If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. [endsect] -[br] [section:member18 nearest_query(DistancesPredicates const &, value_type &)] -Finds one value meeting distances predicates, e.g. nearest to some Point. [heading Description] +Finds one value meeting distances predicates, e.g. nearest to some Point. + +[heading Description] The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).[heading Synopsis] ``template size_type nearest_query(DistancesPredicates const & dpred, value_type & v)`` @@ -432,10 +451,11 @@ The number of values found. If Value copy constructor or copy assignment throws. [endsect] -[br] [section:member19 nearest_query(DistancesPredicates const &, Predicates const &, value_type &)] -Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. [heading Description] +Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. + +[heading Description] The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] @@ -457,10 +477,11 @@ The number of values found. If Value copy constructor or copy assignment throws. [endsect] -[br] [section:member20 nearest_query(DistancesPredicates const &, size_t, OutIter)] -Finds k values meeting distances predicates, e.g. k nearest values to some Point. [heading Description] +Finds k values meeting distances predicates, e.g. k nearest values to some Point. + +[heading Description] The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).[heading Synopsis] ``template size_type nearest_query(DistancesPredicates const & dpred, @@ -480,10 +501,11 @@ The number of values found. If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. [endsect] -[br] [section:member21 nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter)] -Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. [heading Description] +Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. + +[heading Description] The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] @@ -509,10 +531,11 @@ The number of values found. If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. [endsect] -[br] [section:member22 size()] -Returns the number of stored values. [heading Synopsis] +Returns the number of stored values. + +[heading Synopsis] ``size_type size()`` [heading Returns] @@ -521,10 +544,11 @@ The number of stored values. Nothing. [endsect] -[br] [section:member23 empty()] -Query if the container is empty. [heading Synopsis] +Query if the container is empty. + +[heading Synopsis] ``bool empty()`` [heading Returns] @@ -533,20 +557,22 @@ true if the container is empty. Nothing. [endsect] -[br] [section:member24 clear()] -Removes all values stored in the container. [heading Synopsis] +Removes all values stored in the container. + +[heading Synopsis] ``void clear()`` [heading Throws] Nothing. [endsect] -[br] [section:member25 box()] -Returns the box containing all values stored in the container. [heading Description] +Returns the box containing all values stored in the container. + +[heading Description] Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.[heading Synopsis] ``box_type box()`` @@ -556,10 +582,11 @@ The box containing all values stored in the container or an invalid box if there Nothing. [endsect] -[br] [section:member26 count(ValueOrIndexable const &)] -Count Values or Indexables stored in the container. [heading Description] +Count Values or Indexables stored in the container. + +[heading Description] For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter.[heading Synopsis] ``template size_type count(ValueOrIndexable const & vori)`` @@ -575,10 +602,11 @@ The number of values found. Nothing. [endsect] -[br] [section:member27 parameters()] -Returns parameters. [heading Synopsis] +Returns parameters. + +[heading Synopsis] ``parameters_type const & parameters()`` [heading Returns] @@ -587,10 +615,11 @@ The parameters object. Nothing. [endsect] -[br] [section:member28 translator()] -Returns the translator object. [heading Synopsis] +Returns the translator object. + +[heading Synopsis] ``translator_type const & translator()`` [heading Returns] @@ -599,10 +628,11 @@ The translator object. Nothing. [endsect] -[br] [section:member29 get_allocator()] -Returns allocator used by the rtree. [heading Synopsis] +Returns allocator used by the rtree. + +[heading Synopsis] ``allocator_type get_allocator()`` [heading Returns] @@ -611,7 +641,6 @@ The allocator. If allocator copy constructor throws. [endsect] -[br] [endsect] diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index e96a6d4c5..9c80b69bd 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -21,7 +21,9 @@ ] [section:function0 insert(rtree<...> &, Value const &)] -Insert a value to the index. [heading Synopsis] +Insert a value to the index. + +[heading Synopsis] ``template &, Iterator, Iterator)] -Insert a range of values to the index. [heading Synopsis] +Insert a range of values to the index. + +[heading Synopsis] ``template &, Range const &)] -Insert a range of values to the index. [heading Synopsis] +Insert a range of values to the index. + +[heading Synopsis] ``template &, Value const &)] -Remove a value from the container. [heading Description] +Remove a value from the container. + +[heading Description] Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.[heading Synopsis] ``template::size_type boost::geometry::index:: [heading Returns] 1 if value was removed, 0 otherwise. [endsect] -[br] [section:function4 remove(rtree<...> &, Iterator, Iterator)] -Remove a range of values from the container. [heading Description] +Remove a range of values from the container. + +[heading Description] Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template::size_type boost::geometry::index:: [heading Returns] The number of removed values. [endsect] -[br] [section:function5 remove(rtree<...> &, Range const &)] -Remove a range of values from the container. [heading Description] +Remove a range of values from the container. + +[heading Description] Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template::size_type boost::geometry::index:: [heading Returns] The number of removed values. [endsect] -[br] [section:function6 spatial_query(rtree<...> const &, Predicates const &, OutIter)] -Find values meeting spatial predicates. [heading Synopsis] +Find values meeting spatial predicates. + +[heading Synopsis] ``template const &, DistancesPredicates const &, Value &)] -Find the value meeting distances predicates. [heading Synopsis] +Find the value meeting distances predicates. + +[heading Synopsis] ``template const &, DistancesPredicates const &, Predicates const &, Value &)] -Find the value meeting distances and spatial predicates. [heading Synopsis] +Find the value meeting distances and spatial predicates. + +[heading Synopsis] ``template const &, DistancesPredicates const &, size_t, OutIter)] -Find k values meeting distances predicates. [heading Synopsis] +Find k values meeting distances predicates. + +[heading Synopsis] ``template const &, DistancesPredicates const &, size_t, Predicates const &, OutIter)] -Find k values meeting distances and spatial predicates. [heading Synopsis] +Find k values meeting distances and spatial predicates. + +[heading Synopsis] ``template &)] -Remove all values from the index. [heading Synopsis] +Remove all values from the index. + +[heading Synopsis] ``template &` ][ `tree` ][The spatial index. ]] ] [endsect] -[br] [section:function12 size(rtree<...> const &)] -Get the number of values stored in the index. [heading Synopsis] +Get the number of values stored in the index. + +[heading Synopsis] ``template const &)] -Query if there are no values stored in the index. [heading Synopsis] +Query if there are no values stored in the index. + +[heading Synopsis] ``template const &)] -Get the box containing all stored values or an invalid box if the index has no values. [heading Synopsis] +Get the box containing all stored values or an invalid box if the index has no values. + +[heading Synopsis] ``template::box_type boost::geometry::index::b [heading Returns] The box containing all stored values or an invalid box. [endsect] -[br] [endsect] diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 790900975..bf2c39ac7 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -31,9 +31,10 @@ class index [[[link geometry_index.r_tree.reference.translators.boost_geometry_index_translator_index.member0 `index(Container const &)`]][The constructor. ]] ] -[br] [section:member0 index(Container const &)] -The constructor. [heading Synopsis] +The constructor. + +[heading Synopsis] ``index(Container const & c)`` [heading Parameters] @@ -42,7 +43,6 @@ The constructor. [heading Synopsis] [[ `Container const &` ][ `c` ][The container which stores indexed values. ]] ] [endsect] -[br] [endsect] diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 40f4ef13a..d785c260a 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -45,7 +45,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    @@ -729,9 +729,6 @@ The R-tree spatial index. -

    -
    -

    rtree() @@ -820,9 +817,6 @@ The R-tree spatial index. If allocator default constructor throws.

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    ~rtree() @@ -1239,9 +1224,6 @@ The R-tree spatial index. Nothing.

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    size() @@ -3052,9 +2983,6 @@ The R-tree spatial index. Nothing.

    -

    -
    -

    empty() @@ -3086,9 +3014,6 @@ The R-tree spatial index. Nothing.

    -

    -
    -

    clear() @@ -3113,9 +3038,6 @@ The R-tree spatial index. Nothing.

    -

    -
    -

    box() @@ -3156,9 +3078,6 @@ The R-tree spatial index. Nothing.

    -

    -
    -

    -

    -
    -

    parameters() @@ -3281,9 +3197,6 @@ The R-tree spatial index. Nothing.

    -

    -
    -

    translator() @@ -3315,9 +3228,6 @@ The R-tree spatial index. Nothing.

    -

    -
    -

    get_allocator() @@ -3349,9 +3259,6 @@ The R-tree spatial index. If allocator copy constructor throws.

    -

    -
    -

    @@ -3685,9 +3592,6 @@ The R-tree spatial index.

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    @@ -5396,9 +5258,6 @@ The R-tree spatial index.

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    @@ -6059,9 +5900,6 @@ The R-tree spatial index.

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    -

    -
    -

    diff --git a/doc/html/index.html b/doc/html/index.html index 5bcf3e1c3..7d07e2e2a 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
    - +

    Last revised: January 09, 2013 at 23:45:57 GMT

    Last revised: January 10, 2013 at 20:11:29 GMT


    diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index c4f23981f..ce1aa7ffa 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -673,6 +673,11 @@ std::string remove_template_parameters(std::string const& name) return res; } +std::string replace_brackets(std::string const& str) +{ + return boost::replace_all_copy(boost::replace_all_copy(str, "[", "\\["), "]", "\\]"); +} + void quickbook_synopsis_short(function const& f, std::ostream& out) { switch(f.type) @@ -694,24 +699,21 @@ void quickbook_synopsis_short(function const& f, std::ostream& out) break; } - // Output the parameters - // Because we want to be able to skip, we cannot use the argstring + bool first = true; + BOOST_FOREACH(parameter const& p, f.parameters) { - bool first = true; - BOOST_FOREACH(parameter const& p, f.parameters) + if ( !p.skip && p.default_value.empty() ) { - if ( !p.skip && p.default_value.empty() ) - { - out << (first ? "(" : ", ") << remove_template_parameters(p.fulltype); - first = false; - } + out << (first ? "(" : ", ") << remove_template_parameters(p.fulltype); + first = false; } - - if (! first) - out << ")"; - else if (f.type != function_define) - out << "()"; } + + + if (! first) + out << ")"; + else if (f.type != function_define) + out << "()"; } void quickbook_output_function(std::vector const& functions, @@ -739,7 +741,7 @@ void quickbook_output_function(std::vector const& functions, out << "`"; if ( !config.index_id_path.empty() ) out << "]"; - out << "][" << f.brief_description << "]]" << std::endl; + out << "][" << replace_brackets(f.brief_description) << "]]" << std::endl; } } out << "]" << std::endl @@ -758,24 +760,29 @@ void quickbook_output_detail_function(std::vector const& functions, function const& f = functions[i]; if ( display_all || f.type == type ) { + // Section std::stringstream ss; quickbook_synopsis_short(f, ss); + out << "[section:" << qbk_id_prefix << i << " " << replace_brackets(ss.str()) << "]" << std::endl; - out << "[section:" << qbk_id_prefix << i << " " << ss.str() << "]" << std::endl; - - out << f.brief_description; + // Brief description + out << f.brief_description << std::endl; + out << std::endl; + // Detail description if ( !f.detailed_description.empty() ) { out << "[heading Description]" << std::endl; out << f.detailed_description; } + // Synopsis quickbook_markup(f.qbk_markup, markup_before, markup_synopsis, out); out << "[heading Synopsis]" << std::endl; quickbook_synopsis(f, out, true, true); quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out); + // Parameters if ( !f.parameters.empty() ) { out << "[heading Parameters]" << std::endl; @@ -785,22 +792,25 @@ void quickbook_output_detail_function(std::vector const& functions, { if (!p.skip) { - out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl; + out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << replace_brackets(p.brief_description) << "]]"<< std::endl; } } out << "]" << std::endl; } + // Return if ( !f.return_description.empty() ) { out << "[heading Returns]" << std::endl; out << f.return_description << std::endl; } + // QBK markup quickbook_markup(f.qbk_markup, markup_any, markup_default, out); + // Section end out << "[endsect]" << std::endl - << "[br]" << std::endl + //<< "[br]" << std::endl << std::endl; } } @@ -932,7 +942,7 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi out << p.fulltype.substr(6); else out << p.fulltype; - out << "`][" << p.brief_description << "]]" << std::endl; + out << "`][" << replace_brackets(p.brief_description) << "]]" << std::endl; } out << "]" << std::endl << std::endl; @@ -956,7 +966,7 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi continue; out << "[[`" << e.name; - out << "`][" << e.brief_description << "]]" << std::endl; + out << "`][" << replace_brackets(e.brief_description) << "]]" << std::endl; } out << "]" << std::endl << std::endl; @@ -988,8 +998,8 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi // Details start - if ( display_ctors || display_members ) - out << "[br]" << std::endl; + //if ( display_ctors || display_members ) + // out << "[br]" << std::endl; if (display_ctors && counts[function_constructor_destructor] > 0) quickbook_output_detail_function(cos.functions, function_constructor_destructor, config, "member", out); From 979eb9f53d7d64b5252cf10b359f1a6cbdf6fc81 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 11 Jan 2013 01:07:38 +0000 Subject: [PATCH 277/366] doxygen_xml2qbk moddified. Paragraphs and precondition are no longer stored in qbk_markups - stored in separate members. Added support for bold, verbatim, emphasis, computeroutput. [SVN r82443] --- .../doxygen_xml2qbk/doxygen_elements.hpp | 9 +++ .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 75 ++++++++++++------- .../doxygen_xml2qbk/quickbook_output.hpp | 36 +++++++-- 3 files changed, 86 insertions(+), 34 deletions(-) diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp index 3f6b9391c..e52918822 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -85,6 +85,12 @@ struct markup } }; +struct paragraph +{ + std::string title; + std::string text; +}; + // Base of a class/struct, function, define struct element : public base_element { @@ -103,6 +109,8 @@ struct element : public base_element std::vector template_parameters; std::vector parameters; + std::vector paragraphs; + element() : line(0) {} @@ -114,6 +122,7 @@ struct function : public element function_type type; std::string definition, argsstring; std::string return_type, return_description; + std::string precondition; bool unique; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index ff51567e7..69eb25fd2 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -77,28 +77,56 @@ static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& } else if ( boost::equals(name, "itemizedlist") ) { - contents += "\n\n"; + contents += "\n"; parse_para(node->first_node(), contents, skip); - contents += "\n[/]"; + contents += "\n"; parse_para(node->next_sibling(), contents, skip); return; } else if ( boost::equals(name, "listitem") ) { contents += "* "; - rapidxml::xml_node<>* li = node->first_node("para"); - contents += li ? li->value() : ""; + parse_para(node->first_node(), contents, skip); contents += "\n"; - parse_para(node->next_sibling(), contents, skip); + parse_para(node->next_sibling(), contents, skip); + return; + } + else if ( boost::equals(name, "verbatim") ) + { + contents += "\n``\n"; + parse_para(node->first_node(), contents, skip, false); + contents += "``\n"; + parse_para(node->next_sibling(), contents, skip, false); + return; + } + else if ( boost::equals(name, "bold") ) + { + contents += "[*"; + parse_para(node->first_node(), contents, skip, false); + contents += "]"; + parse_para(node->next_sibling(), contents, skip, false); + return; + } + else if ( boost::equals(name, "emphasis") ) + { + contents += "['"; + parse_para(node->first_node(), contents, skip, false); + contents += "]"; + parse_para(node->next_sibling(), contents, skip, false); + return; + } + else if ( boost::equals(name, "computeroutput") ) + { + contents += "[^"; + parse_para(node->first_node(), contents, skip, false); + contents += "]"; + parse_para(node->next_sibling(), contents, skip, false); return; } else if (! ( (boost::equals(name, "para") && first) || boost::equals(name, "ref") || boost::equals(name, "defval") - || boost::equals(name, "verbatim") - || boost::equals(name, "bold") - || boost::equals(name, "emphasis") || boost::equals(name, "linebreak") )) { @@ -364,26 +392,15 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi std::string kind = get_attribute(node, "kind"); if (kind == "par") { - rapidxml::xml_node<> * title_node = node->first_node("title"); - std::string title = title_node ? title_node->value() : ""; - - std::string m; - if ( title_node ) - m = std::string("[heading ") + title + "]\n"; - else - m = "\n\n"; + paragraph p; - parse_para(node->first_node("para"), m, el.skip); - m += "\n"; - - el.qbk_markup.push_back(markup(m)); - } - else if (kind == "pre") - { - std::string para; - parse_para(node->first_node("para"), para, el.skip); + rapidxml::xml_node<> * title_node = node->first_node("title"); + if ( title_node ) + p.title = title_node->value(); + + parse_para(node->first_node("para"), p.text, el.skip); - el.qbk_markup.push_back(markup(std::string("[heading Precondition]\n") + para)); + el.paragraphs.push_back(p); } } else if (full == ".param") @@ -432,12 +449,16 @@ static void parse_function(rapidxml::xml_node<>* node, configuration const& conf std::string kind = get_attribute(node, "kind"); if (kind == "return") { - get_contents(node->first_node(), f.return_description); + parse_para(node->first_node(), f.return_description, f.skip); } /*else if (kind == "param") { get_contents(node->first_node(), f.paragraphs); }*/ + else if (kind == "pre") + { + parse_para(node->first_node(), f.precondition, f.skip); + } } else if (full == ".detaileddescription.para.image") { diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index ce1aa7ffa..31ca80f06 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -741,7 +741,7 @@ void quickbook_output_function(std::vector const& functions, out << "`"; if ( !config.index_id_path.empty() ) out << "]"; - out << "][" << replace_brackets(f.brief_description) << "]]" << std::endl; + out << "][" << f.brief_description << "]]" << std::endl; } } out << "]" << std::endl @@ -763,7 +763,7 @@ void quickbook_output_detail_function(std::vector const& functions, // Section std::stringstream ss; quickbook_synopsis_short(f, ss); - out << "[section:" << qbk_id_prefix << i << " " << replace_brackets(ss.str()) << "]" << std::endl; + out << "[section:" << qbk_id_prefix << i << " " << replace_brackets(ss.str()) << "]" << std::endl; // Brief description out << f.brief_description << std::endl; @@ -785,18 +785,26 @@ void quickbook_output_detail_function(std::vector const& functions, // Parameters if ( !f.parameters.empty() ) { - out << "[heading Parameters]" << std::endl; + out << "[heading Parameter(s)]" << std::endl; out << "[table " << std::endl; out << "[[Type][Name][Description]]" << std::endl; BOOST_FOREACH(parameter const& p, f.parameters) { if (!p.skip) { - out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << replace_brackets(p.brief_description) << "]]"<< std::endl; + out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl; } } out << "]" << std::endl; - } + } + + // Precondition + if ( !f.precondition.empty() ) + { + out << "[heading Precondition(s)]" << std::endl; + out << f.precondition << std::endl; + out << std::endl; + } // Return if ( !f.return_description.empty() ) @@ -804,6 +812,20 @@ void quickbook_output_detail_function(std::vector const& functions, out << "[heading Returns]" << std::endl; out << f.return_description << std::endl; } + + // Additional paragraphs + if ( !f.paragraphs.empty() ) + { + BOOST_FOREACH(paragraph const& p, f.paragraphs) + { + if ( !p.title.empty() ) + out << "[heading " << p.title << "]" << std::endl; + else + out << "\n\n" << std::endl; + out << p.text << std::endl; + out << std::endl; + } + } // QBK markup quickbook_markup(f.qbk_markup, markup_any, markup_default, out); @@ -942,7 +964,7 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi out << p.fulltype.substr(6); else out << p.fulltype; - out << "`][" << replace_brackets(p.brief_description) << "]]" << std::endl; + out << "`][" << p.brief_description << "]]" << std::endl; } out << "]" << std::endl << std::endl; @@ -966,7 +988,7 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi continue; out << "[[`" << e.name; - out << "`][" << replace_brackets(e.brief_description) << "]]" << std::endl; + out << "`][" << e.brief_description << "]]" << std::endl; } out << "]" << std::endl << std::endl; From 4e972f038997306e77da778be0e4a9cd37eada81 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 11 Jan 2013 04:09:30 +0000 Subject: [PATCH 278/366] Fixed errors in doxygen_xml2qbk - lists support, additional paragraphs display. Added warnings and infos. Rtree docs improved, added text formatting, warnings etc. [SVN r82446] --- doc/generated/adaptors.qbk | 6 +- doc/generated/distance_predicates.qbk | 28 +- doc/generated/inserters.qbk | 2 +- doc/generated/predicates.qbk | 42 +- doc/generated/rtree.qbk | 397 ++++- doc/generated/rtree_functions.qbk | 36 +- doc/generated/translator_index.qbk | 2 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 20 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 1340 +++++++++++------ .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../doxygen_xml2qbk/doxygen_elements.hpp | 2 + .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 10 +- .../doxygen_xml2qbk/quickbook_output.hpp | 50 +- .../extensions/index/distance_predicates.hpp | 28 +- .../geometry/extensions/index/predicates.hpp | 24 +- .../geometry/extensions/index/rtree/rtree.hpp | 297 ++-- 22 files changed, 1556 insertions(+), 754 deletions(-) diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index cfa647625..fee8059b9 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -17,7 +17,7 @@ detail::nearest_query boost::geometry::index::a size_t k, Predicates const & pred)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `DistancesPredicates const &` ][ `dpred` ][Distance predicates. ]] @@ -33,7 +33,7 @@ The nearest query index adaptor generator. ``template detail::nearest_query boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `DistancesPredicates const &` ][ `dpred` ][Distance predicates. ]] @@ -48,7 +48,7 @@ The spatial query index adaptor generator. ``template detail::spatial_query boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Predicates const &` ][ `pred` ][Spatial predicates. ]] diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index 60f5b39d7..f21c18a46 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -20,7 +20,7 @@ Generate a nearest query Point and Value's Indexable relationship while calculat ``template detail::to_nearest boost::geometry::index::to_nearest(T const & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `T const &` ][ `v` ][Point or bound value. ]] @@ -35,7 +35,7 @@ Generate a nearest query Point and Value's Indexable relationship while calculat ``template detail::to_centroid boost::geometry::index::to_centroid(T const & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `T const &` ][ `v` ][Point or bound value. ]] @@ -50,7 +50,7 @@ Generate a nearest query Point and Value's Indexable relationship while calculat ``template detail::to_furthest boost::geometry::index::to_furthest(T const & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `T const &` ][ `v` ][Point or bound value. ]] @@ -65,7 +65,7 @@ Generate a distance predicate. This defines distances bounds which are used by k ``template detail::unbounded boost::geometry::index::unbounded(PointRelation const & pr)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] @@ -80,11 +80,11 @@ Generate a distance predicate. This defines distances bounds which are used by k ``template detail::min_bounded boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] -[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] -[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). ]] +[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] +[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] ] [endsect] @@ -96,11 +96,11 @@ Generate a distance predicate. This defines distances bounds which are used by k ``template detail::max_bounded boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] -[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] -[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). ]] +[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] +[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] ] [endsect] @@ -116,12 +116,12 @@ detail::bounded boost::geometry::index: MinRelation const & minr, MaxRelation const & maxr)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] -[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] -[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). ]] -[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). ]] +[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] +[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] +[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] ] [endsect] diff --git a/doc/generated/inserters.qbk b/doc/generated/inserters.qbk index 6c8821b0f..e7db996ad 100644 --- a/doc/generated/inserters.qbk +++ b/doc/generated/inserters.qbk @@ -14,7 +14,7 @@ Returns insert iterator capable to insert values to the container (spatial index ``template insert_iterator boost::geometry::index::inserter(Container & c)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Container &` ][ `c` ][The reference to the container (spatial index) to which values will be inserted.]] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 7a644dc7f..f4e20cac9 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -5,11 +5,11 @@ [[Function][Description]] [[[link geometry_index.r_tree.reference.group__predicates.function0 `empty()`]][Generate empty predicate. ]] [[[link geometry_index.r_tree.reference.group__predicates.function1 `value(ValuePredicate const &)`]][Generate value predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function2 `covered_by(Geometry const &)`]][Generate covered_by() predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function3 `disjoint(Geometry const &)`]][Generate disjoint() predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function4 `intersects(Geometry const &)`]][Generate intersects() predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function5 `overlaps(Geometry const &)`]][Generate overlaps() predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function6 `within(Geometry const &)`]][Generate within() predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function2 `covered_by(Geometry const &)`]][Generate [^covered_by()] predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function3 `disjoint(Geometry const &)`]][Generate [^disjoint()] predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function4 `intersects(Geometry const &)`]][Generate [^intersects()] predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function5 `overlaps(Geometry const &)`]][Generate [^overlaps()] predicate. ]] +[[[link geometry_index.r_tree.reference.group__predicates.function6 `within(Geometry const &)`]][Generate [^within()] predicate. ]] ] [section:function0 empty()] @@ -28,7 +28,7 @@ A wrapper around user-defined functor describing if Value should be returned by ``template detail::value boost::geometry::index::value(ValuePredicate const & vpred)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `ValuePredicate const &` ][ `vpred` ][The functor. ]] @@ -36,14 +36,14 @@ detail::value boost::geometry::index::value(ValuePredicate const [endsect] [section:function2 covered_by(Geometry const &)] -Generate covered_by() predicate. +Generate [^covered_by()] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::covered_by(Indexable, Geometry) returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::covered_by(Indexable, Geometry)] returns true.[heading Synopsis] ``template detail::covered_by boost::geometry::index::covered_by(Geometry const & g)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Geometry const &` ][ `g` ][The Geometry object. ]] @@ -51,14 +51,14 @@ detail::covered_by boost::geometry::index::covered_by(Geometry const & [endsect] [section:function3 disjoint(Geometry const &)] -Generate disjoint() predicate. +Generate [^disjoint()] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::disjoint(Indexable, Geometry) returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::disjoint(Indexable, Geometry)] returns true.[heading Synopsis] ``template detail::disjoint boost::geometry::index::disjoint(Geometry const & g)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Geometry const &` ][ `g` ][The Geometry object. ]] @@ -66,14 +66,14 @@ detail::disjoint boost::geometry::index::disjoint(Geometry const & g)` [endsect] [section:function4 intersects(Geometry const &)] -Generate intersects() predicate. +Generate [^intersects()] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::intersects(Indexable, Geometry) returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::intersects(Indexable, Geometry)] returns true.[heading Synopsis] ``template detail::intersects boost::geometry::index::intersects(Geometry const & g)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Geometry const &` ][ `g` ][The Geometry object. ]] @@ -81,14 +81,14 @@ detail::intersects boost::geometry::index::intersects(Geometry const & [endsect] [section:function5 overlaps(Geometry const &)] -Generate overlaps() predicate. +Generate [^overlaps()] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::overlaps(Indexable, Geometry) returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::overlaps(Indexable, Geometry)] returns true.[heading Synopsis] ``template detail::overlaps boost::geometry::index::overlaps(Geometry const & g)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Geometry const &` ][ `g` ][The Geometry object. ]] @@ -96,14 +96,14 @@ detail::overlaps boost::geometry::index::overlaps(Geometry const & g)` [endsect] [section:function6 within(Geometry const &)] -Generate within() predicate. +Generate [^within()] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::within(Indexable, Geometry) returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::within(Indexable, Geometry)] returns true.[heading Synopsis] ``template detail::within boost::geometry::index::within(Geometry const & g)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Geometry const &` ][ `g` ][The Geometry object. ]] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 4a677e091..6f5e38351 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -9,9 +9,32 @@ The R-tree spatial index. The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. [heading Parameters] -The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. Predefined algorithms with compile-time parameters are: bgi::linear, bgi::quadratic, bgi::rstar. Predefined algorithms with run-time parameters are: bgi::runtime::linear, bgi::runtime::quadratic, bgi::runtime::rstar. +The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. + + + + +Predefined algorithms with compile-time parameters are: + +* [^bgi::linear], +* [^bgi::quadratic], +* [^bgi::rstar]. + + + + + + +Predefined algorithms with run-time parameters are: + +* [^bgi::runtime::linear], +* [^bgi::runtime::quadratic], +* [^bgi::runtime::rstar]. + + + [heading Translator] -The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (which are Indexables). It also handles std::pair, pointers, smart pointers, and iterators. E.g. If std::pair is stored, the default translator translates from std::pair const& to Box const&. +The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (called Indexables). It also handles [^std::pair] and [^boost::tuple]. For example, if [^std::pair] is stored in the container, the default translator translates from [^std::pair const&] to [^Box const&]. [heading Header] `#include ` @@ -94,14 +117,14 @@ The constructor. [heading Synopsis] ``rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `parameters_type` ][ `parameters` ][The parameters object. ]] [[ `translator_type const &` ][ `translator` ][The translator object.]] ] [heading Throws] -If allocator default constructor throws. +If allocator default constructor throws. [endsect] @@ -113,7 +136,7 @@ The constructor. translator_type const & translator, allocator_type allocator)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `parameters_type` ][ `parameters` ][The parameters object. ]] @@ -121,7 +144,7 @@ The constructor. [[ `allocator_type` ][ `allocator` ][The allocator object.]] ] [heading Throws] -If allocator copy constructor throws. +If allocator copy constructor throws. [endsect] @@ -136,7 +159,7 @@ rtree(Iterator first, translator_type const & translator = translator_type(), allocator_type allocator = allocator_type())`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Iterator` ][ `first` ][The beginning of the range of Values. ]] @@ -146,7 +169,14 @@ rtree(Iterator first, [[ `allocator_type` ][ `allocator` ][The allocator object.]] ] [heading Throws] -If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails. + + +* If allocator copy constructor throws. +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When memory allocation for Node fails. + + [endsect] @@ -160,7 +190,7 @@ rtree(Range const & rng, translator_type const & translator = translator_type(), allocator_type allocator = allocator_type())`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Range const &` ][ `rng` ][The range of Values. ]] @@ -169,7 +199,14 @@ rtree(Range const & rng, [[ `allocator_type` ][ `allocator` ][The allocator object.]] ] [heading Throws] -If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails. + + +* If allocator copy constructor throws. +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When memory allocation for Node fails. + + [endsect] @@ -180,7 +217,7 @@ The destructor. ``~rtree()`` [heading Throws] -Nothing. +Nothing. [endsect] @@ -191,13 +228,20 @@ The copy constructor. It uses parameters, translator and allocator from the source tree.[heading Synopsis] ``rtree(rtree const & src)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree const &` ][ `src` ][The rtree which content will be copied.]] ] [heading Throws] -If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails. + + +* If allocator copy constructor throws. +* If Value copy constructor throws. +* If allocation throws. +* When memory allocation for Node fails. + + [endsect] @@ -208,14 +252,21 @@ The copy constructor. It uses Parameters and translator from the source tree.[heading Synopsis] ``rtree(rtree const & src, allocator_type const & allocator)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree const &` ][ `src` ][The rtree which content will be copied. ]] [[ `allocator_type const &` ][ `allocator` ][The allocator which will be used.]] ] [heading Throws] -If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails. + + +* If allocator copy constructor throws. +* If Value copy constructor throws. +* If allocation throws. +* When memory allocation for Node fails. + + [endsect] @@ -226,13 +277,13 @@ The moving constructor. It uses parameters, translator and allocator from the source tree.[heading Synopsis] ``rtree(rtree && src)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree &&` ][ `src` ][The rtree which content will be moved.]] ] [heading Throws] -If allocator move constructor throws. +If allocator move constructor throws. [endsect] @@ -243,13 +294,19 @@ The assignment operator. It uses parameters and translator from the source tree.[heading Synopsis] ``rtree & operator=(const rtree & src)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `const rtree &` ][ `src` ][The rtree which content will be copied.]] ] [heading Throws] -If Value copy constructor throws. When nodes allocation fails. + + +* If Value copy constructor throws. +* If allocation throws. +* When nodes allocation fails. + + [endsect] @@ -260,13 +317,19 @@ The moving assignment. It uses parameters and translator from the source tree.[heading Synopsis] ``rtree & operator=(rtree && src)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree &&` ][ `src` ][The rtree which content will be moved.]] ] [heading Throws] -Only if allocators aren't equal. If Value copy constructor throws. When nodes allocation fails. +Only if allocators aren't equal. + +* If Value copy constructor throws. +* If allocation throws. +* When nodes allocation fails. + + [endsect] @@ -277,13 +340,13 @@ Swaps contents of two rtrees. Parameters, translator and allocators are swapped as well.[heading Synopsis] ``void swap(rtree & other)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree &` ][ `other` ][The rtree which content will be swapped with this rtree content.]] ] [heading Throws] -If allocators swap throws. +If allocators swap throws. [endsect] @@ -293,15 +356,21 @@ Insert a value to the index. [heading Synopsis] ``void insert(value_type const & value)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `value_type const &` ][ `value` ][The value which will be stored in the container.]] ] [heading Throws] -If Value copy constructor or copy assignment throws. When nodes allocation fails. -[heading Exception-safety] -This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + + +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When nodes allocation fails. + + + +[warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. ] [endsect] @@ -312,16 +381,22 @@ Insert a range of values to the index. ``template void insert(Iterator first, Iterator last)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Iterator` ][ `first` ][The beginning of the range of values. ]] [[ `Iterator` ][ `last` ][The end of the range of values.]] ] [heading Throws] -If Value copy constructor or copy assignment throws. When nodes allocation fails. -[heading Exception-safety] -This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + + +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When nodes allocation fails. + + + +[warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. ] [endsect] @@ -332,15 +407,21 @@ Insert a range of values to the index. ``template void insert(Range const & rng)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Range const &` ][ `rng` ][The range of values.]] ] [heading Throws] -If Value copy constructor or copy assignment throws. When nodes allocation fails. -[heading Exception-safety] -This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + + +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When nodes allocation fails. + + + +[warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. ] [endsect] @@ -348,10 +429,10 @@ This operation is not thread safe. If it throws, the R-tree may be left in an in Remove a value from the container. [heading Description] -In contrast to the STL set/map erase() method this method removes only one value from the container.[heading Synopsis] +In contrast to the [^std::set] or [^std::map][^erase()] method this method removes only one value from the container.[heading Synopsis] ``size_type remove(value_type const & value)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `value_type const &` ][ `value` ][The value which will be removed from the container.]] @@ -359,9 +440,15 @@ In contrast to the STL set/map erase() method this method removes only one value [heading Returns] 1 if the value was removed, 0 otherwise. [heading Throws] -If Value copy constructor or copy assignment throws. When nodes allocation fails. -[heading Exception-safety] -This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + + +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When nodes allocation fails. + + + +[warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. ] [endsect] @@ -369,11 +456,11 @@ This operation is not thread safe. If it throws, the R-tree may be left in an in Remove a range of values from the container. [heading Description] -In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +In contrast to the [^std::set] or [^std::map][^erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template size_type remove(Iterator first, Iterator last)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Iterator` ][ `first` ][The beginning of the range of values. ]] @@ -382,9 +469,15 @@ size_type remove(Iterator first, Iterator last)`` [heading Returns] The number of removed values. [heading Throws] -If Value copy constructor or copy assignment throws. When nodes allocation fails. -[heading Exception-safety] -This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + + +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When nodes allocation fails. + + + +[warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. ] [endsect] @@ -392,11 +485,11 @@ This operation is not thread safe. If it throws, the R-tree may be left in an in Remove a range of values from the container. [heading Description] -In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +In contrast to the [^std::set] or [^std::map][^erase()] method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template size_type remove(Range const & rng)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Range const &` ][ `rng` ][The range of values.]] @@ -404,9 +497,15 @@ size_type remove(Range const & rng)`` [heading Returns] The number of removed values. [heading Throws] -If Value copy constructor or copy assignment throws. When nodes allocation fails. -[heading Exception-safety] -This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. + + +* If Value copy constructor or copy assignment throws. +* If allocation throws. +* When nodes allocation fails. + + + +[warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. ] [endsect] @@ -414,11 +513,28 @@ This operation is not thread safe. If it throws, the R-tree may be left in an in Finds values meeting spatial predicates, e.g. intersecting some Box. [heading Description] -Spatial predicates may be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] +[*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. + +It may be generated by one of the functions listed below: + +* [^bgi::covered_by(geometry)], +* [^bgi::disjoint(geometry)], +* [^bgi::intersects(geometry)] - default, +* [^bgi::overlaps(geometry)], +* [^bgi::within(geometry)], +* [^!bgi::covered_by(geometry)], +* [^!bgi::disjoint(geometry)], +* [^!bgi::intersects(geometry)], +* [^!bgi::overlaps(geometry)], +* [^!bgi::within(geometry)] +* [^bgi::value(func)]. + + +Those predicates may be passed together in [^std::pair<]...> or [^boost::tuple<]...>.[heading Synopsis] ``template size_type spatial_query(Predicates const & pred, OutIter out_it)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Predicates const &` ][ `pred` ][The spatial predicates or a Geometry. ]] @@ -427,7 +543,12 @@ size_type spatial_query(Predicates const & pred, OutIter out_it)`` [heading Returns] The number of values found. [heading Throws] -If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. + + +* If Value copy constructor or copy assignment throws. +* If OutIter dereference or increment throws. + + [endsect] @@ -435,11 +556,34 @@ If Value copy constructor or copy assignment throws. If OutIter dereference or i Finds one value meeting distances predicates, e.g. nearest to some Point. [heading Description] -The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).[heading Synopsis] +[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. + +It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: + +* bgi::to_nearest(Point) - default, +* bgi::to_centroid(Point), +* bgi::to_furthest(Point). + + +It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: + +* bgi::unbounded(PointRelation) - default, +* bgi::min_bounded(PointRelation, MinRelation), +* bgi::max_bounded(PointRelation, MaxRelation), +* bgi::bounded(PointRelation, MinRelation, MaxRelation). + + +MinRelation and MaxRelation describes bounds and can be generated by following functions: + +* bgi::to_nearest(some_distance), +* bgi::to_centroid(some_distance), +* bgi::to_furthest(some_distance). + +[heading Synopsis] ``template size_type nearest_query(DistancesPredicates const & dpred, value_type & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point.]] @@ -448,7 +592,7 @@ size_type nearest_query(DistancesPredicates const & dpred, value_type & v)`` [heading Returns] The number of values found. [heading Throws] -If Value copy constructor or copy assignment throws. +If Value copy constructor or copy assignment throws. [endsect] @@ -456,15 +600,53 @@ If Value copy constructor or copy assignment throws. Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. [heading Description] -The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). +[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. -The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] +It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: + +* bgi::to_nearest(Point) - default, +* bgi::to_centroid(Point), +* bgi::to_furthest(Point). + + +It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: + +* bgi::unbounded(PointRelation) - default, +* bgi::min_bounded(PointRelation, MinRelation), +* bgi::max_bounded(PointRelation, MaxRelation), +* bgi::bounded(PointRelation, MinRelation, MaxRelation). + + +MinRelation and MaxRelation describes bounds and can be generated by following functions: + +* bgi::to_nearest(some_distance), +* bgi::to_centroid(some_distance), +* bgi::to_furthest(some_distance). + +[*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. + +It may be generated by one of the functions listed below: + +* [^bgi::covered_by(geometry)], +* [^bgi::disjoint(geometry)], +* [^bgi::intersects(geometry)] - default, +* [^bgi::overlaps(geometry)], +* [^bgi::within(geometry)], +* [^!bgi::covered_by(geometry)], +* [^!bgi::disjoint(geometry)], +* [^!bgi::intersects(geometry)], +* [^!bgi::overlaps(geometry)], +* [^!bgi::within(geometry)] +* [^bgi::value(func)]. + + +Those predicates may be passed together in [^std::pair<]...> or [^boost::tuple<]...>.[heading Synopsis] ``template size_type nearest_query(DistancesPredicates const & dpred, Predicates const & pred, value_type & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point. ]] @@ -474,7 +656,7 @@ size_type nearest_query(DistancesPredicates const & dpred, [heading Returns] The number of values found. [heading Throws] -If Value copy constructor or copy assignment throws. +If Value copy constructor or copy assignment throws. [endsect] @@ -482,13 +664,36 @@ If Value copy constructor or copy assignment throws. Finds k values meeting distances predicates, e.g. k nearest values to some Point. [heading Description] -The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).[heading Synopsis] +[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. + +It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: + +* bgi::to_nearest(Point) - default, +* bgi::to_centroid(Point), +* bgi::to_furthest(Point). + + +It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: + +* bgi::unbounded(PointRelation) - default, +* bgi::min_bounded(PointRelation, MinRelation), +* bgi::max_bounded(PointRelation, MaxRelation), +* bgi::bounded(PointRelation, MinRelation, MaxRelation). + + +MinRelation and MaxRelation describes bounds and can be generated by following functions: + +* bgi::to_nearest(some_distance), +* bgi::to_centroid(some_distance), +* bgi::to_furthest(some_distance). + +[heading Synopsis] ``template size_type nearest_query(DistancesPredicates const & dpred, size_t k, OutIter out_it)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point. ]] @@ -498,7 +703,7 @@ size_type nearest_query(DistancesPredicates const & dpred, [heading Returns] The number of values found. [heading Throws] -If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. +If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. [endsect] @@ -506,9 +711,47 @@ If Value copy constructor or copy assignment throws. If OutIter dereference or i Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. [heading Description] -The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). +[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. -The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.[heading Synopsis] +It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: + +* bgi::to_nearest(Point) - default, +* bgi::to_centroid(Point), +* bgi::to_furthest(Point). + + +It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: + +* bgi::unbounded(PointRelation) - default, +* bgi::min_bounded(PointRelation, MinRelation), +* bgi::max_bounded(PointRelation, MaxRelation), +* bgi::bounded(PointRelation, MinRelation, MaxRelation). + + +MinRelation and MaxRelation describes bounds and can be generated by following functions: + +* bgi::to_nearest(some_distance), +* bgi::to_centroid(some_distance), +* bgi::to_furthest(some_distance). + +[*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. + +It may be generated by one of the functions listed below: + +* [^bgi::covered_by(geometry)], +* [^bgi::disjoint(geometry)], +* [^bgi::intersects(geometry)] - default, +* [^bgi::overlaps(geometry)], +* [^bgi::within(geometry)], +* [^!bgi::covered_by(geometry)], +* [^!bgi::disjoint(geometry)], +* [^!bgi::intersects(geometry)], +* [^!bgi::overlaps(geometry)], +* [^!bgi::within(geometry)] +* [^bgi::value(func)]. + + +Those predicates may be passed together in [^std::pair<]...> or [^boost::tuple<]...>.[heading Synopsis] ``template @@ -517,7 +760,7 @@ size_type nearest_query(DistancesPredicates const & dpred, Predicates const & pred, OutIter out_it)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point ]] @@ -528,7 +771,7 @@ size_type nearest_query(DistancesPredicates const & dpred, [heading Returns] The number of values found. [heading Throws] -If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. +If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. [endsect] @@ -541,7 +784,7 @@ Returns the number of stored values. [heading Returns] The number of stored values. [heading Throws] -Nothing. +Nothing. [endsect] @@ -554,7 +797,7 @@ Query if the container is empty. [heading Returns] true if the container is empty. [heading Throws] -Nothing. +Nothing. [endsect] @@ -565,7 +808,7 @@ Removes all values stored in the container. ``void clear()`` [heading Throws] -Nothing. +Nothing. [endsect] @@ -573,13 +816,13 @@ Nothing. Returns the box containing all values stored in the container. [heading Description] -Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.[heading Synopsis] +Returns the box containing all values stored in the container. If the container is empty the result of [^geometry::assign_inverse()] is returned.[heading Synopsis] ``box_type box()`` [heading Returns] The box containing all values stored in the container or an invalid box if there are no values in the container. [heading Throws] -Nothing. +Nothing. [endsect] @@ -591,7 +834,7 @@ For indexable_type it returns the number of values which indexables equals the p ``template size_type count(ValueOrIndexable const & vori)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `ValueOrIndexable const &` ][ `vori` ][The value or indexable which will be counted.]] @@ -599,7 +842,7 @@ size_type count(ValueOrIndexable const & vori)`` [heading Returns] The number of values found. [heading Throws] -Nothing. +Nothing. [endsect] @@ -612,7 +855,7 @@ Returns parameters. [heading Returns] The parameters object. [heading Throws] -Nothing. +Nothing. [endsect] @@ -625,7 +868,7 @@ Returns the translator object. [heading Returns] The translator object. [heading Throws] -Nothing. +Nothing. [endsect] @@ -638,7 +881,7 @@ Returns allocator used by the rtree. [heading Returns] The allocator. [heading Throws] -If allocator copy constructor throws. +If allocator copy constructor throws. [endsect] diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 9c80b69bd..329aa7e31 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -30,7 +30,7 @@ Insert a value to the index. typename Allocator> void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] @@ -51,7 +51,7 @@ void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator Iterator first, Iterator last)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] @@ -71,7 +71,7 @@ Insert a range of values to the index. typename Range> void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] @@ -83,14 +83,14 @@ void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator Remove a value from the container. [heading Description] -Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.[heading Synopsis] +Remove a value from the container. In contrast to the [^std::set] or [^std::map][^erase()] method this function removes only one value from the container.[heading Synopsis] ``template rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] @@ -104,7 +104,7 @@ rtree::size_type boost::geometry::index:: Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +Remove a range of values from the container. In contrast to the [^std::set] or [^std::map][^erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template::size_type boost::geometry::index:: Iterator first, Iterator last)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] @@ -129,7 +129,7 @@ The number of removed values. Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +Remove a range of values from the container. In contrast to the [^std::set] or [^std::map][^erase()] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] ``template rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] @@ -161,7 +161,7 @@ size_t boost::geometry::index::spatial_query(rtree< Value, Options, Translator, Predicates const & pred, OutIter out_it)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] @@ -185,7 +185,7 @@ size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, DistancesPredicates const & dpred, Value & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] @@ -211,7 +211,7 @@ size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Predicates const & pred, Value & v)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] @@ -238,7 +238,7 @@ size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, size_t k, OutIter out_it)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] @@ -267,7 +267,7 @@ size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Predicates const & pred, OutIter out_it)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] @@ -290,7 +290,7 @@ Remove all values from the index. typename Allocator> void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] @@ -307,7 +307,7 @@ Get the number of values stored in the index. typename Allocator> size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] @@ -326,7 +326,7 @@ Query if there are no values stored in the index. typename Allocator> bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] @@ -345,7 +345,7 @@ Get the box containing all stored values or an invalid box if the index has no v typename Allocator> rtree::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index bf2c39ac7..f01406fec 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -37,7 +37,7 @@ The constructor. [heading Synopsis] ``index(Container const & c)`` -[heading Parameters] +[heading Parameter(s)] [table [[Type][Name][Description]] [[ `Container const &` ][ `c` ][The container which stores indexed values. ]] 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 ece3dc4fb..9ca7cace5 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 a79271bfb..300395d3a 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -

    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 + 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 [2]. + close to some point in space [2].

    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

    -
      +
      • capable to store arbitrary Value type,
      • @@ -201,20 +201,20 @@
      -

      -

      [1] +


      +

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

      -

      [2] +

      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

      -

      [3] +

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

      -

      [4] +

      [4] 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 ffbfe87f5..d13849cbd 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index d785c260a..8f2622a00 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -45,12 +45,12 @@ boost::geometry::index::rtree

      - + The R-tree spatial index.

      - Description + Description

      The R-tree spatial index. This is self-balancing spatial index capable @@ -58,42 +58,67 @@ The R-tree spatial index.

      - Parameters + Parameters

      The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm - with specific parameters like min and max number of elements in node. Predefined - algorithms with compile-time parameters are: bgi::linear<MinElements, - MaxElements>, bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, - MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements - * 0.3>. Predefined algorithms with run-time parameters are: bgi::runtime::linear, - bgi::runtime::quadratic, bgi::runtime::rstar. + with specific parameters like min and max number of elements in node.

      +

      + Predefined algorithms with compile-time parameters are: +

      +
        +
      • + bgi::linear<MinElements, MaxElements>, +
      • +
      • + bgi::quadratic<MinElements, MaxElements>, +
      • +
      • + bgi::rstar<MinElements, MaxElements, OverlapCostThreshold + = 0, ReinsertedElements = MaxElements * 0.3>. +
      • +
      +

      + Predefined algorithms with run-time parameters are: +

      +
        +
      • + bgi::runtime::linear, +
      • +
      • + bgi::runtime::quadratic, +
      • +
      • + bgi::runtime::rstar. +
      • +
      - Translator + Translator

      The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or - Box concepts (which are Indexables). It also handles std::pair<Indexable, - T>, pointers, smart pointers, and iterators. E.g. If std::pair<Box, - int> is stored, the default translator translates from std::pair<Box, - int> const& to Box const&. + Box concepts (called Indexables). It also handles std::pair<Indexable, + T> and boost::tuple<Indexable, ...>. + For example, if std::pair<Box, int> is stored + in the container, the default translator translates from std::pair<Box, + int> const& to Box const&.

      - Header + Header

      #include <boost/geometry/extensions/index/rtree/rtree.hpp>

      - Synopsis + Synopsis

      @@ -110,7 +135,7 @@ The R-tree spatial index.

      - Template + Template parameter(s)
      @@ -184,7 +209,7 @@ The R-tree spatial index.
      - Typedef(s) + Typedef(s)
      @@ -292,7 +317,7 @@ The R-tree spatial index.
      - Constructor(s) + Constructor(s) and destructor
      @@ -420,7 +445,7 @@ The R-tree spatial index.
      - Member(s) + Member(s)
      @@ -738,7 +763,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -747,7 +772,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -811,7 +836,7 @@ The R-tree spatial index.
      - Throws + Throws

      If allocator default constructor throws. @@ -827,7 +852,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -838,7 +863,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -919,7 +944,7 @@ The R-tree spatial index.
      - Throws + Throws

      If allocator copy constructor throws. @@ -935,7 +960,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -949,7 +974,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1064,12 +1089,22 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If allocator copy constructor throws. If Value copy constructor or copy - assignment throws. When nodes allocation fails. -

      +
        +
      • + If allocator copy constructor throws. +
      • +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When memory allocation for Node fails. +
      • +
      @@ -1081,7 +1116,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -1094,7 +1129,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1193,12 +1228,22 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If allocator copy constructor throws. If Value copy constructor or copy - assignment throws. When nodes allocation fails. -

      +
        +
      • + If allocator copy constructor throws. +
      • +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When memory allocation for Node fails. +
      • +
      @@ -1209,7 +1254,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -1218,7 +1263,7 @@ The R-tree spatial index.

      - Throws + Throws

      Nothing. @@ -1234,14 +1279,14 @@ The R-tree spatial index.

      - Description + Description

      It uses parameters, translator and allocator from the source tree.

      - Synopsis + Synopsis

      @@ -1250,7 +1295,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1296,12 +1341,22 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If allocator copy constructor throws. If Value copy constructor throws. - When nodes allocation fails. -

      +
        +
      • + If allocator copy constructor throws. +
      • +
      • + If Value copy constructor throws. +
      • +
      • + If allocation throws. +
      • +
      • + When memory allocation for Node fails. +
      • +
      @@ -1313,14 +1368,14 @@ The R-tree spatial index.

      - Description + Description

      It uses Parameters and translator from the source tree.

      - Synopsis + Synopsis

      @@ -1329,7 +1384,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1394,12 +1449,22 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If allocator copy constructor throws. If Value copy constructor throws. - When nodes allocation fails. -

      +
        +
      • + If allocator copy constructor throws. +
      • +
      • + If Value copy constructor throws. +
      • +
      • + If allocation throws. +
      • +
      • + When memory allocation for Node fails. +
      • +
      @@ -1411,14 +1476,14 @@ The R-tree spatial index.

      - Description + Description

      It uses parameters, translator and allocator from the source tree.

      - Synopsis + Synopsis

      @@ -1427,7 +1492,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1472,7 +1537,7 @@ The R-tree spatial index.
      - Throws + Throws

      If allocator move constructor throws. @@ -1488,14 +1553,14 @@ The R-tree spatial index.

      - Description + Description

      It uses parameters and translator from the source tree.

      - Synopsis + Synopsis

      @@ -1504,7 +1569,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1550,11 +1615,19 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If Value copy constructor throws. When nodes allocation fails. -

      +
        +
      • + If Value copy constructor throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      @@ -1566,14 +1639,14 @@ The R-tree spatial index.

      - Description + Description

      It uses parameters and translator from the source tree.

      - Synopsis + Synopsis

      @@ -1582,7 +1655,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1627,12 +1700,22 @@ The R-tree spatial index.
      - Throws + Throws

      - Only if allocators aren't equal. If Value copy constructor throws. When - nodes allocation fails. + Only if allocators aren't equal.

      +
        +
      • + If Value copy constructor throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      @@ -1644,14 +1727,14 @@ The R-tree spatial index.

      - Description + Description

      Parameters, translator and allocators are swapped as well.

      - Synopsis + Synopsis

      @@ -1660,7 +1743,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1705,7 +1788,7 @@ The R-tree spatial index.
      - Throws + Throws

      If allocators swap throws. @@ -1721,7 +1804,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -1730,7 +1813,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1775,21 +1858,30 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If Value copy constructor or copy assignment throws. When nodes allocation - fails. -

      -
      - - Exception-safety -
      -

      - This operation is not thread safe. If it throws, the R-tree may be left - in an inconsistent state, elements must not be inserted or removed, methods - may return invalid data. -

      +
        +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      +
      + + + + + +
      [Warning]Warning

      + This operation is not thread safe. If it throws, the R-tree may be + left in an inconsistent state, elements must not be inserted or removed, + methods may return invalid data. +

      @@ -1801,7 +1893,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -1811,7 +1903,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1875,21 +1967,30 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If Value copy constructor or copy assignment throws. When nodes allocation - fails. -

      -
      - - Exception-safety -
      -

      - This operation is not thread safe. If it throws, the R-tree may be left - in an inconsistent state, elements must not be inserted or removed, methods - may return invalid data. -

      +
        +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      +
      + + + + + +
      [Warning]Warning

      + This operation is not thread safe. If it throws, the R-tree may be + left in an inconsistent state, elements must not be inserted or removed, + methods may return invalid data. +

      @@ -1901,7 +2002,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -1911,7 +2012,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -1957,21 +2058,30 @@ The R-tree spatial index.
      - Throws + Throws
      -

      - If Value copy constructor or copy assignment throws. When nodes allocation - fails. -

      -
      - - Exception-safety -
      -

      - This operation is not thread safe. If it throws, the R-tree may be left - in an inconsistent state, elements must not be inserted or removed, methods - may return invalid data. -

      +
        +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      +
      + + + + + +
      [Warning]Warning

      + This operation is not thread safe. If it throws, the R-tree may be + left in an inconsistent state, elements must not be inserted or removed, + methods may return invalid data. +

      @@ -1983,15 +2093,15 @@ The R-tree spatial index.

      - Description + Description

      - In contrast to the STL set/map erase() method this method removes only - one value from the container. + In contrast to the std::set or std::maperase() + method this method removes only one value from the container.

      - Synopsis + Synopsis

      @@ -2000,7 +2110,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2045,28 +2155,37 @@ The R-tree spatial index.
      - Returns + Returns

      1 if the value was removed, 0 otherwise.

      - Throws + Throws
      -

      - If Value copy constructor or copy assignment throws. When nodes allocation - fails. -

      -
      - - Exception-safety -
      -

      - This operation is not thread safe. If it throws, the R-tree may be left - in an inconsistent state, elements must not be inserted or removed, methods - may return invalid data. -

      +
        +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      +
      + + + + + +
      [Warning]Warning

      + This operation is not thread safe. If it throws, the R-tree may be + left in an inconsistent state, elements must not be inserted or removed, + methods may return invalid data. +

      @@ -2078,17 +2197,18 @@ The R-tree spatial index.

      - Description + Description

      - In contrast to the STL set/map erase() method it doesn't take iterators - pointing to values stored in this container. It removes values equal - to these passed as a range. Furthermore this method removes only one - value for each one passed in the range, not all equal values. + In contrast to the std::set or std::maperase() + method it doesn't take iterators pointing to values stored in this container. + It removes values equal to these passed as a range. Furthermore this + method removes only one value for each one passed in the range, not all + equal values.

      - Synopsis + Synopsis

      @@ -2098,7 +2218,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2162,28 +2282,37 @@ The R-tree spatial index.
      - Returns + Returns

      The number of removed values.

      - Throws + Throws
      -

      - If Value copy constructor or copy assignment throws. When nodes allocation - fails. -

      -
      - - Exception-safety -
      -

      - This operation is not thread safe. If it throws, the R-tree may be left - in an inconsistent state, elements must not be inserted or removed, methods - may return invalid data. -

      +
        +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      +
      + + + + + +
      [Warning]Warning

      + This operation is not thread safe. If it throws, the R-tree may be + left in an inconsistent state, elements must not be inserted or removed, + methods may return invalid data. +

      @@ -2195,16 +2324,17 @@ The R-tree spatial index.

      - Description + Description

      - In contrast to the STL set/map erase() method it removes values equal - to these passed as a range. Furthermore, this method removes only one - value for each one passed in the range, not all equal values. + In contrast to the std::set or std::maperase() + method it removes values equal to these passed as a range. Furthermore, + this method removes only one value for each one passed in the range, + not all equal values.

      - Synopsis + Synopsis

      @@ -2214,7 +2344,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2260,28 +2390,37 @@ The R-tree spatial index.
      - Returns + Returns

      The number of removed values.

      - Throws + Throws
      -

      - If Value copy constructor or copy assignment throws. When nodes allocation - fails. -

      -
      - - Exception-safety -
      -

      - This operation is not thread safe. If it throws, the R-tree may be left - in an inconsistent state, elements must not be inserted or removed, methods - may return invalid data. -

      +
        +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If allocation throws. +
      • +
      • + When nodes allocation fails. +
      • +
      +
      + + + + + +
      [Warning]Warning

      + This operation is not thread safe. If it throws, the R-tree may be + left in an inconsistent state, elements must not be inserted or removed, + methods may return invalid data. +

      @@ -2293,19 +2432,58 @@ The R-tree spatial index.

      - Description + Description

      - Spatial predicates may be a Geometry (in this case default predicate - - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), - bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), - !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), - !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). - Those predicates may be passed together in std::pair or boost::tuple. + Spatial predicates may be a Geometry. + In this case Values intersecting the Geometry are + returned. +

      +

      + It may be generated by one of the functions listed below: +

      +
        +
      • + bgi::covered_by(geometry), +
      • +
      • + bgi::disjoint(geometry), +
      • +
      • + bgi::intersects(geometry) - default, +
      • +
      • + bgi::overlaps(geometry), +
      • +
      • + bgi::within(geometry), +
      • +
      • + !bgi::covered_by(geometry), +
      • +
      • + !bgi::disjoint(geometry), +
      • +
      • + !bgi::intersects(geometry), +
      • +
      • + !bgi::overlaps(geometry), +
      • +
      • + !bgi::within(geometry) +
      • +
      • + bgi::value(func). +
      • +
      +

      + Those predicates may be passed together in std::pair<...> + or boost::tuple<...>.

      - Synopsis + Synopsis

      @@ -2315,7 +2493,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2380,19 +2558,23 @@ The R-tree spatial index.
      - Returns + Returns

      The number of values found.

      - Throws + Throws
      -

      - If Value copy constructor or copy assignment throws. If OutIter dereference - or increment throws. -

      +
        +
      • + If Value copy constructor or copy assignment throws. +
      • +
      • + If OutIter dereference or increment throws. +
      • +
      @@ -2404,24 +2586,64 @@ The R-tree spatial index.

      - Description + Description

      - The distances predicates may be a Point. This is default case where Value - which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + Distances predicates may be a Point. + In this the case the Value closest to Point is returned.

      +

      + It is possible to define how distance to Value is calculated. This is + done by passing PointRelation. It can be generated by following functions: +

      +
        +
      • + bgi::to_nearest(Point) - default, +
      • +
      • + bgi::to_centroid(Point), +
      • +
      • + bgi::to_furthest(Point). +
      • +
      +

      + It is possible to define define distances bounds, for example that some + distance must be between min_distance and max_distance. This is done + by passing DistancesPredicates which can be generated by following functions: +

      +
        +
      • + bgi::unbounded(PointRelation) - default, +
      • +
      • + bgi::min_bounded(PointRelation, MinRelation), +
      • +
      • + bgi::max_bounded(PointRelation, MaxRelation), +
      • +
      • + bgi::bounded(PointRelation, MinRelation, MaxRelation). +
      • +
      +

      + MinRelation and MaxRelation describes bounds and can be generated by + following functions: +

      +
        +
      • + bgi::to_nearest(some_distance), +
      • +
      • + bgi::to_centroid(some_distance), +
      • +
      • + bgi::to_furthest(some_distance). +
      • +
      - Synopsis + Synopsis

      @@ -2431,7 +2653,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2496,14 +2718,14 @@ The R-tree spatial index.
      - Returns + Returns

      The number of values found.

      - Throws + Throws

      If Value copy constructor or copy assignment throws. @@ -2520,32 +2742,111 @@ The R-tree spatial index.

      - Description + Description

      - The distances predicates may be a Point. This is default case where Value - which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + Distances predicates may be a Point. + In this the case the Value closest to Point is returned.

      - The spatial predicates. May be a Geometry (in this case default predicate - - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), - bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), - !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), - !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). - Those predicates may be passed together in std::pair or boost::tuple. + It is possible to define how distance to Value is calculated. This is + done by passing PointRelation. It can be generated by following functions: +

      +
        +
      • + bgi::to_nearest(Point) - default, +
      • +
      • + bgi::to_centroid(Point), +
      • +
      • + bgi::to_furthest(Point). +
      • +
      +

      + It is possible to define define distances bounds, for example that some + distance must be between min_distance and max_distance. This is done + by passing DistancesPredicates which can be generated by following functions: +

      +
        +
      • + bgi::unbounded(PointRelation) - default, +
      • +
      • + bgi::min_bounded(PointRelation, MinRelation), +
      • +
      • + bgi::max_bounded(PointRelation, MaxRelation), +
      • +
      • + bgi::bounded(PointRelation, MinRelation, MaxRelation). +
      • +
      +

      + MinRelation and MaxRelation describes bounds and can be generated by + following functions: +

      +
        +
      • + bgi::to_nearest(some_distance), +
      • +
      • + bgi::to_centroid(some_distance), +
      • +
      • + bgi::to_furthest(some_distance). +
      • +
      +

      + Spatial predicates may be a Geometry. + In this case Values intersecting the Geometry are + returned. +

      +

      + It may be generated by one of the functions listed below: +

      +
        +
      • + bgi::covered_by(geometry), +
      • +
      • + bgi::disjoint(geometry), +
      • +
      • + bgi::intersects(geometry) - default, +
      • +
      • + bgi::overlaps(geometry), +
      • +
      • + bgi::within(geometry), +
      • +
      • + !bgi::covered_by(geometry), +
      • +
      • + !bgi::disjoint(geometry), +
      • +
      • + !bgi::intersects(geometry), +
      • +
      • + !bgi::overlaps(geometry), +
      • +
      • + !bgi::within(geometry) +
      • +
      • + bgi::value(func). +
      • +
      +

      + Those predicates may be passed together in std::pair<...> + or boost::tuple<...>.

      - Synopsis + Synopsis

      @@ -2557,7 +2858,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2639,14 +2940,14 @@ The R-tree spatial index.
      - Returns + Returns

      The number of values found.

      - Throws + Throws

      If Value copy constructor or copy assignment throws. @@ -2663,24 +2964,64 @@ The R-tree spatial index.

      - Description + Description

      - The distances predicates. May be a Point. This is default case where - Value which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + Distances predicates may be a Point. + In this the case the Value closest to Point is returned.

      +

      + It is possible to define how distance to Value is calculated. This is + done by passing PointRelation. It can be generated by following functions: +

      +
        +
      • + bgi::to_nearest(Point) - default, +
      • +
      • + bgi::to_centroid(Point), +
      • +
      • + bgi::to_furthest(Point). +
      • +
      +

      + It is possible to define define distances bounds, for example that some + distance must be between min_distance and max_distance. This is done + by passing DistancesPredicates which can be generated by following functions: +

      +
        +
      • + bgi::unbounded(PointRelation) - default, +
      • +
      • + bgi::min_bounded(PointRelation, MinRelation), +
      • +
      • + bgi::max_bounded(PointRelation, MaxRelation), +
      • +
      • + bgi::bounded(PointRelation, MinRelation, MaxRelation). +
      • +
      +

      + MinRelation and MaxRelation describes bounds and can be generated by + following functions: +

      +
        +
      • + bgi::to_nearest(some_distance), +
      • +
      • + bgi::to_centroid(some_distance), +
      • +
      • + bgi::to_furthest(some_distance). +
      • +
      - Synopsis + Synopsis

      @@ -2692,7 +3033,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2774,14 +3115,14 @@ The R-tree spatial index.
      - Returns + Returns

      The number of values found.

      - Throws + Throws

      If Value copy constructor or copy assignment throws. If OutIter dereference @@ -2799,32 +3140,111 @@ The R-tree spatial index.

      - Description + Description

      - The distances predicates may be a Point. This is default case where Value - which nearest point is closest to Point is returned. May be a PointRelation - which define how distance to Value is calculated. This may be generated - by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). - DistancesPredicates may also define distances bounds. E.g. that some - distance must be between min_distance and max_distance. This may be generated - by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, - MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, - MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds - and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) - or bgi::to_furthest(dist_bound). + Distances predicates may be a Point. + In this the case the Value closest to Point is returned.

      - The spatial predicates. May be a Geometry (in this case default predicate - - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), - bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), - !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), - !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). - Those predicates may be passed together in std::pair or boost::tuple. + It is possible to define how distance to Value is calculated. This is + done by passing PointRelation. It can be generated by following functions: +

      +
        +
      • + bgi::to_nearest(Point) - default, +
      • +
      • + bgi::to_centroid(Point), +
      • +
      • + bgi::to_furthest(Point). +
      • +
      +

      + It is possible to define define distances bounds, for example that some + distance must be between min_distance and max_distance. This is done + by passing DistancesPredicates which can be generated by following functions: +

      +
        +
      • + bgi::unbounded(PointRelation) - default, +
      • +
      • + bgi::min_bounded(PointRelation, MinRelation), +
      • +
      • + bgi::max_bounded(PointRelation, MaxRelation), +
      • +
      • + bgi::bounded(PointRelation, MinRelation, MaxRelation). +
      • +
      +

      + MinRelation and MaxRelation describes bounds and can be generated by + following functions: +

      +
        +
      • + bgi::to_nearest(some_distance), +
      • +
      • + bgi::to_centroid(some_distance), +
      • +
      • + bgi::to_furthest(some_distance). +
      • +
      +

      + Spatial predicates may be a Geometry. + In this case Values intersecting the Geometry are + returned. +

      +

      + It may be generated by one of the functions listed below: +

      +
        +
      • + bgi::covered_by(geometry), +
      • +
      • + bgi::disjoint(geometry), +
      • +
      • + bgi::intersects(geometry) - default, +
      • +
      • + bgi::overlaps(geometry), +
      • +
      • + bgi::within(geometry), +
      • +
      • + !bgi::covered_by(geometry), +
      • +
      • + !bgi::disjoint(geometry), +
      • +
      • + !bgi::intersects(geometry), +
      • +
      • + !bgi::overlaps(geometry), +
      • +
      • + !bgi::within(geometry) +
      • +
      • + bgi::value(func). +
      • +
      +

      + Those predicates may be passed together in std::pair<...> + or boost::tuple<...>.

      - Synopsis + Synopsis

      @@ -2839,7 +3259,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -2938,14 +3358,14 @@ The R-tree spatial index.
      - Returns + Returns

      The number of values found.

      - Throws + Throws

      If Value copy constructor or copy assignment throws. If OutIter dereference @@ -2961,7 +3381,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -2970,14 +3390,14 @@ The R-tree spatial index.

      - Returns + Returns

      The number of stored values.

      - Throws + Throws

      Nothing. @@ -2992,7 +3412,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3001,14 +3421,14 @@ The R-tree spatial index.

      - Returns + Returns

      true if the container is empty.

      - Throws + Throws

      Nothing. @@ -3023,7 +3443,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3032,7 +3452,7 @@ The R-tree spatial index.

      - Throws + Throws

      Nothing. @@ -3047,15 +3467,16 @@ The R-tree spatial index.

      - Description + Description

      Returns the box containing all values stored in the container. If the - container is empty the result of geometry::assign_inverse() is returned. + container is empty the result of geometry::assign_inverse() + is returned.

      - Synopsis + Synopsis

      @@ -3064,7 +3485,7 @@ The R-tree spatial index.

      - Returns + Returns

      The box containing all values stored in the container or an invalid box @@ -3072,7 +3493,7 @@ The R-tree spatial index.

      - Throws + Throws

      Nothing. @@ -3088,7 +3509,7 @@ The R-tree spatial index.

      - Description + Description

      For indexable_type it returns the number of values which indexables equals @@ -3097,7 +3518,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3107,7 +3528,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -3153,14 +3574,14 @@ The R-tree spatial index.
      - Returns + Returns

      The number of values found.

      - Throws + Throws

      Nothing. @@ -3175,7 +3596,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3184,14 +3605,14 @@ The R-tree spatial index.

      - Returns + Returns

      The parameters object.

      - Throws + Throws

      Nothing. @@ -3206,7 +3627,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3215,14 +3636,14 @@ The R-tree spatial index.

      - Returns + Returns

      The translator object.

      - Throws + Throws

      Nothing. @@ -3237,7 +3658,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3246,14 +3667,14 @@ The R-tree spatial index.

      - Returns + Returns

      The allocator.

      - Throws + Throws

      If allocator copy constructor throws. @@ -3510,7 +3931,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3523,7 +3944,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -3602,7 +4023,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3618,7 +4039,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -3713,7 +4134,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -3727,7 +4148,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -3806,15 +4227,16 @@ The R-tree spatial index.

      - Description + Description

      - Remove a value from the container. In contrast to the STL set/map erase() - method this function removes only one value from the container. + Remove a value from the container. In contrast to the std::set + or std::maperase() method this + function removes only one value from the container.

      - Synopsis + Synopsis

      @@ -3827,7 +4249,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -3897,7 +4319,7 @@ The R-tree spatial index.
      - Returns + Returns

      1 if value was removed, 0 otherwise. @@ -3913,18 +4335,18 @@ The R-tree spatial index.

      - Description + Description

      - Remove a range of values from the container. In contrast to the STL set/map - erase() method it doesn't take iterators pointing to values stored in - this container. It removes values equal to these passed as a range. Furthermore - this function removes only one value for each one passed in the range, - not all equal values. + Remove a range of values from the container. In contrast to the std::set + or std::maperase() method it doesn't + take iterators pointing to values stored in this container. It removes + values equal to these passed as a range. Furthermore this function removes + only one value for each one passed in the range, not all equal values.

      - Synopsis + Synopsis

      @@ -3940,7 +4362,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4026,7 +4448,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of removed values. @@ -4042,17 +4464,17 @@ The R-tree spatial index.

      - Description + Description

      - Remove a range of values from the container. In contrast to the STL set/map - erase() method it removes values equal to these passed as a range. Furthermore - this method removes only one value for each one passed in the range, - not all equal values. + Remove a range of values from the container. In contrast to the std::set + or std::maperase() method it removes + values equal to these passed as a range. Furthermore this method removes + only one value for each one passed in the range, not all equal values.

      - Synopsis + Synopsis

      @@ -4066,7 +4488,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4136,7 +4558,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of removed values. @@ -4152,7 +4574,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4169,7 +4591,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4255,7 +4677,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of found values. @@ -4271,7 +4693,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4287,7 +4709,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4374,7 +4796,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of found values. @@ -4391,7 +4813,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4409,7 +4831,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4513,7 +4935,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of found values. @@ -4529,7 +4951,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4547,7 +4969,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4651,7 +5073,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of found values. @@ -4668,7 +5090,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4688,7 +5110,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4809,7 +5231,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of found values. @@ -4825,7 +5247,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4838,7 +5260,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4897,7 +5319,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4910,7 +5332,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -4960,7 +5382,7 @@ The R-tree spatial index.
      - Returns + Returns

      The number of values stored in the index. @@ -4976,7 +5398,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -4989,7 +5411,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5039,7 +5461,7 @@ The R-tree spatial index.
      - Returns + Returns

      true if there are no values in the index. @@ -5056,7 +5478,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -5069,7 +5491,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5119,7 +5541,7 @@ The R-tree spatial index.
      - Returns + Returns

      The box containing all stored values or an invalid box. @@ -5183,7 +5605,7 @@ The R-tree spatial index.

      - Generate covered_by() predicate. + Generate covered_by() predicate.

      @@ -5196,7 +5618,7 @@ The R-tree spatial index.

      - Generate disjoint() predicate. + Generate disjoint() predicate.

      @@ -5209,7 +5631,7 @@ The R-tree spatial index.

      - Generate intersects() predicate. + Generate intersects() predicate.

      @@ -5222,7 +5644,7 @@ The R-tree spatial index.

      - Generate overlaps() predicate. + Generate overlaps() predicate.

      @@ -5235,7 +5657,7 @@ The R-tree spatial index.

      - Generate within() predicate. + Generate within() predicate.

      @@ -5250,7 +5672,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -5268,7 +5690,7 @@ The R-tree spatial index.

      - Description + Description

      A wrapper around user-defined functor describing if Value should be returned @@ -5276,7 +5698,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -5286,7 +5708,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5336,20 +5758,20 @@ The R-tree spatial index. const &)

      - Generate covered_by() predicate. + Generate covered_by() predicate.

      - Description + Description

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::covered_by(Indexable, Geometry) + will be returned by the query if bg::covered_by(Indexable, Geometry) returns true.

      - Synopsis + Synopsis

      @@ -5359,7 +5781,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5410,20 +5832,20 @@ The R-tree spatial index. const &)

      - Generate disjoint() predicate. + Generate disjoint() predicate.

      - Description + Description

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::disjoint(Indexable, Geometry) returns - true. + will be returned by the query if bg::disjoint(Indexable, Geometry) + returns true.

      - Synopsis + Synopsis

      @@ -5433,7 +5855,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5484,20 +5906,20 @@ The R-tree spatial index. const &)

      - Generate intersects() predicate. + Generate intersects() predicate.

      - Description + Description

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::intersects(Indexable, Geometry) + will be returned by the query if bg::intersects(Indexable, Geometry) returns true.

      - Synopsis + Synopsis

      @@ -5507,7 +5929,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5558,20 +5980,20 @@ The R-tree spatial index. const &)

      - Generate overlaps() predicate. + Generate overlaps() predicate.

      - Description + Description

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::overlaps(Indexable, Geometry) returns - true. + will be returned by the query if bg::overlaps(Indexable, Geometry) + returns true.

      - Synopsis + Synopsis

      @@ -5581,7 +6003,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5632,20 +6054,20 @@ The R-tree spatial index. const &)

      - Generate within() predicate. + Generate within() predicate.

      - Description + Description

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::within(Indexable, Geometry) returns - true. + will be returned by the query if bg::within(Indexable, Geometry) + returns true.

      - Synopsis + Synopsis

      @@ -5655,7 +6077,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5832,7 +6254,7 @@ The R-tree spatial index.

      - Description + Description

      Generate a nearest query Point and Value's Indexable relationship while @@ -5845,7 +6267,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -5855,7 +6277,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5910,7 +6332,7 @@ The R-tree spatial index.

      - Description + Description

      Generate a nearest query Point and Value's Indexable relationship while @@ -5921,7 +6343,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -5931,7 +6353,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -5986,7 +6408,7 @@ The R-tree spatial index.

      - Description + Description

      Generate a nearest query Point and Value's Indexable relationship while @@ -5999,7 +6421,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6009,7 +6431,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -6064,7 +6486,7 @@ The R-tree spatial index.

      - Description + Description

      Generate a distance predicate. This defines distances bounds which are @@ -6075,7 +6497,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6085,7 +6507,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -6140,7 +6562,7 @@ The R-tree spatial index.

      - Description + Description

      Generate a distance predicate. This defines distances bounds which are @@ -6153,7 +6575,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6163,7 +6585,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -6202,8 +6624,8 @@ The R-tree spatial index. @@ -6220,8 +6642,8 @@ The R-tree spatial index. @@ -6238,7 +6660,7 @@ The R-tree spatial index.

      - Description + Description

      Generate a distance predicate. This defines distances bounds which are @@ -6251,7 +6673,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6261,7 +6683,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)

      - The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point).

      - The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), - bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). + The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance).

      @@ -6300,8 +6722,8 @@ The R-tree spatial index. @@ -6318,8 +6740,8 @@ The R-tree spatial index. @@ -6336,7 +6758,7 @@ The R-tree spatial index.

      - Description + Description

      Generate a distance predicate. This defines distances bounds which are @@ -6350,7 +6772,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6364,7 +6786,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)

      - The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point).

      - The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), - bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). + The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance).

      @@ -6403,8 +6825,8 @@ The R-tree spatial index. @@ -6421,8 +6843,8 @@ The R-tree spatial index. @@ -6439,8 +6861,8 @@ The R-tree spatial index. @@ -6523,7 +6945,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6535,7 +6957,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)

      - The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point).

      - The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), - bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). + The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance).

      - The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), - bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). + The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance).

      @@ -6626,7 +7048,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6636,7 +7058,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -6710,7 +7132,7 @@ The R-tree spatial index.

      - Synopsis + Synopsis

      @@ -6720,7 +7142,7 @@ The R-tree spatial index.

      - Parameters + Parameter(s)
      @@ -6775,12 +7197,12 @@ The R-tree spatial index. boost::geometry::index::translator::def

      - + The default translator.

      - Description + Description

      It translates Value object to Indexable object. The default version handles @@ -6789,14 +7211,14 @@ The default translator.

      - Header + Header

      #include <boost/geometry/extensions/index/translator/def.hpp>

      - Synopsis + Synopsis

      @@ -6810,7 +7232,7 @@ The default translator.

      - Template + Template parameter(s)
      @@ -6849,12 +7271,12 @@ The default translator. boost::geometry::index::translator::index

      - + The index translator.

      - Description + Description

      This translator translates from index of an element in an external Container @@ -6865,14 +7287,14 @@ The index translator.

      - Header + Header

      #include <boost/geometry/extensions/index/translator/index.hpp>

      - Synopsis + Synopsis

      @@ -6886,7 +7308,7 @@ The index translator.

      - Template + Template parameter(s)
      @@ -6921,7 +7343,7 @@ The index translator.
      - Constructor(s) + Constructor(s) and destructor
      @@ -6964,14 +7386,14 @@ The index translator. The constructor.

      - Synopsis + Synopsis

      index(Container const & c)

      - Parameters + Parameter(s)
      @@ -7061,7 +7483,7 @@ The index translator.

      - Description + Description

      Returns insert iterator capable to insert values to the container (spatial @@ -7069,7 +7491,7 @@ The index translator.

      - Synopsis + Synopsis

      @@ -7079,7 +7501,7 @@ The index translator.

      - Parameters + Parameter(s)
      @@ -7125,7 +7547,7 @@ The index translator.
      - Returns + Returns

      The insert iterator inserting values to the container. diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 9ec8f8b5c..2e4bf7514 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 - + @@ -150,7 +150,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 dc19fd16b..7fee097e3 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 7d07e2e2a..df77e0358 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: January 10, 2013 at 20:11:29 GMT

      Last revised: January 11, 2013 at 04:03:52 GMT


      diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp index e52918822..35d79a12e 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -110,6 +110,8 @@ struct element : public base_element std::vector parameters; std::vector paragraphs; + std::string warning; + std::string note; element() : line(0) diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index 69eb25fd2..cc08a6b79 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -77,7 +77,7 @@ static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& } else if ( boost::equals(name, "itemizedlist") ) { - contents += "\n"; + contents += "\n\n"; parse_para(node->first_node(), contents, skip); contents += "\n"; parse_para(node->next_sibling(), contents, skip); @@ -402,6 +402,14 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi el.paragraphs.push_back(p); } + else if (kind == "warning") + { + parse_para(node->first_node("para"), el.warning, el.skip); + } + else if (kind == "note") + { + parse_para(node->first_node("para"), el.note, el.skip); + } } else if (full == ".param") { diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 31ca80f06..79b859545 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -748,6 +748,37 @@ void quickbook_output_function(std::vector const& functions, << std::endl; } +void output_paragraphs_note_warning(element const& el, std::ostream & out) +{ + // Additional paragraphs + if ( !el.paragraphs.empty() ) + { + BOOST_FOREACH(paragraph const& p, el.paragraphs) + { + if ( !p.title.empty() ) + out << "[heading " << p.title << "]" << std::endl; + else + out << "\n\n" << std::endl; + out << p.text << std::endl; + out << std::endl; + } + } + + // Note + if ( !el.note.empty() ) + { + out << "[note " << el.note << "]" << std::endl; + out << std::endl; + } + + // Warning + if ( !el.warning.empty() ) + { + out << "[warning " << el.warning << "]" << std::endl; + out << std::endl; + } +} + void quickbook_output_detail_function(std::vector const& functions, function_type type, configuration const& config, @@ -813,19 +844,8 @@ void quickbook_output_detail_function(std::vector const& functions, out << f.return_description << std::endl; } - // Additional paragraphs - if ( !f.paragraphs.empty() ) - { - BOOST_FOREACH(paragraph const& p, f.paragraphs) - { - if ( !p.title.empty() ) - out << "[heading " << p.title << "]" << std::endl; - else - out << "\n\n" << std::endl; - out << p.text << std::endl; - out << std::endl; - } - } + // Additional paragraphs, note, warning + output_paragraphs_note_warning(f, out); // QBK markup quickbook_markup(f.qbk_markup, markup_any, markup_default, out); @@ -903,6 +923,10 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi quickbook_string_with_heading_if_present("Description", cos.detailed_description, out); + // Additional paragraphs, note, warning + output_paragraphs_note_warning(cos, out); + + // Markup quickbook_markup(cos.qbk_markup, markup_any, markup_default, out); // Header diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 5f4d53ed8..abf0b342d 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -288,10 +288,10 @@ Point but only if nearest points are further than some distance. \tparam PointRelation PointRelation type. \tparam MinRelation MinRelation type. -\param pr The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). -\param minr The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), - bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). +\param pr The point relation. This may be generated by \c bgi::to_nearest(Point), + \c bgi::to_centroid(Point) or \c bgi::to_furthest(Point). +\param minr The minimum bound relation. This may be generated by \c bgi::to_nearest(min_distance), + \c bgi::to_centroid(min_distance) or \c bgi::to_furthest(min_distance). */ template inline detail::min_bounded @@ -314,10 +314,10 @@ Point but only if nearest points are closer than some distance. \tparam PointRelation PointRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). -\param maxr The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), - bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). +\param pr The point relation. This may be generated by \c bgi::to_nearest(Point), + \c bgi::to_centroid(Point) or \c bgi::to_furthest(Point). +\param maxr The maximum bound relation. This may be generated by \c bgi::to_nearest(max_distance), + \c bgi::to_centroid(max_distance) or \c bgi::to_furthest(max_distance). */ template inline detail::max_bounded @@ -342,12 +342,12 @@ points are further than some distance and closer than some other distance. \tparam MinRelation MinRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). -\param minr The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), - bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). -\param maxr The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), - bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). +\param pr The point relation. This may be generated by \c bgi::to_nearest(Point), + \c bgi::to_centroid(Point) or \c bgi::to_furthest(Point). +\param minr The minimum bound relation. This may be generated by \c bgi::to_nearest(min_distance), + \c bgi::to_centroid(min_distance) or \c bgi::to_furthest(min_distance). +\param maxr The maximum bound relation. This may be generated by \c bgi::to_nearest(max_distance), + \c bgi::to_centroid(max_distance) or \c bgi::to_furthest(max_distance). */ template inline detail::bounded diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 78ba8df47..cae80e9fd 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -154,10 +154,10 @@ inline detail::value value(ValuePredicate const& vpred) } /*! -\brief Generate covered_by() predicate. +\brief Generate \c covered_by() predicate. Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::covered_by(Indexable, Geometry) +Value will be returned by the query if bg::covered_by(Indexable, Geometry) returns true. \ingroup predicates @@ -173,10 +173,10 @@ inline detail::covered_by covered_by(Geometry const& g) } /*! -\brief Generate disjoint() predicate. +\brief Generate \c disjoint() predicate. Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::disjoint(Indexable, Geometry) +Value will be returned by the query if bg::disjoint(Indexable, Geometry) returns true. \ingroup predicates @@ -192,10 +192,10 @@ inline detail::disjoint disjoint(Geometry const& g) } /*! -\brief Generate intersects() predicate. +\brief Generate \c intersects() predicate. Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::intersects(Indexable, Geometry) +Value will be returned by the query if bg::intersects(Indexable, Geometry) returns true. \ingroup predicates @@ -211,10 +211,10 @@ inline detail::intersects intersects(Geometry const& g) } /*! -\brief Generate overlaps() predicate. +\brief Generate \c overlaps() predicate. Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::overlaps(Indexable, Geometry) +Value will be returned by the query if bg::overlaps(Indexable, Geometry) returns true. \ingroup predicates @@ -230,10 +230,10 @@ inline detail::overlaps overlaps(Geometry const& g) } //*! -//\brief Generate touches() predicate. +//\brief Generate \c touches() predicate. // //Generate a predicate defining Value and Geometry relationship. -//Value will be returned by the query if bg::touches(Indexable, Geometry) +//Value will be returned by the query if bg::touches(Indexable, Geometry) //returns true. // //\ingroup predicates @@ -249,10 +249,10 @@ inline detail::overlaps overlaps(Geometry const& g) //} /*! -\brief Generate within() predicate. +\brief Generate \c within() predicate. Generate a predicate defining Value and Geometry relationship. -Value will be returned by the query if bg::within(Indexable, Geometry) +Value will be returned by the query if bg::within(Indexable, Geometry) returns true. \ingroup predicates diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 25d0c15c5..2615bf5c3 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -66,22 +66,26 @@ of Values and balancing algorithms. The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. + +\par Predefined algorithms with compile-time parameters are: -bgi::linear, -bgi::quadratic, -bgi::rstar. + \li bgi::linear, + \li bgi::quadratic, + \li bgi::rstar. + +\par Predefined algorithms with run-time parameters are: -bgi::runtime::linear, -bgi::runtime::quadratic, -bgi::runtime::rstar. + \li \c bgi::runtime::linear, + \li \c bgi::runtime::quadratic, + \li \c bgi::runtime::rstar. \par Translator The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point -or Box concepts (which are Indexables). It also handles std::pair, pointers, smart pointers, -and iterators. E.g. If std::pair is stored, the default translator translates from -std::pair const& to Box const&. +or Box concepts (called Indexables). It also handles std::pair and +boost::tuple. For example, if std::pair is stored in the +container, the default translator translates from std::pair const& to Box const&. \tparam Value The type of objects stored in the container. \tparam Parameters Compile-time parameters. @@ -177,8 +181,10 @@ public: \param allocator The allocator object. \par Throws - If allocator copy constructor throws. If Value copy constructor or copy assignment throws. - When nodes allocation fails. + \li If allocator copy constructor throws. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When memory allocation for Node fails. */ template inline rtree(Iterator first, Iterator last, @@ -212,8 +218,10 @@ public: \param allocator The allocator object. \par Throws - If allocator copy constructor throws. If Value copy constructor or copy assignment throws. - When nodes allocation fails. + \li If allocator copy constructor throws. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When memory allocation for Node fails. */ template inline explicit rtree(Range const& rng, @@ -257,8 +265,10 @@ public: \param src The rtree which content will be copied. \par Throws - If allocator copy constructor throws. If Value copy constructor throws. - When nodes allocation fails. + \li If allocator copy constructor throws. + \li If Value copy constructor throws. + \li If allocation throws. + \li When memory allocation for Node fails. */ inline rtree(rtree const& src) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -282,8 +292,10 @@ public: \param allocator The allocator which will be used. \par Throws - If allocator copy constructor throws. If Value copy constructor throws. - When nodes allocation fails. + \li If allocator copy constructor throws. + \li If Value copy constructor throws. + \li If allocation throws. + \li When memory allocation for Node fails. */ inline rtree(rtree const& src, allocator_type const& allocator) : m_translator(src.m_translator) // SHOULDN'T THROW @@ -328,8 +340,9 @@ public: \param src The rtree which content will be copied. \par Throws - If Value copy constructor throws. - When nodes allocation fails. + \li If Value copy constructor throws. + \li If allocation throws. + \li When nodes allocation fails. */ inline rtree & operator=(BOOST_COPY_ASSIGN_REF(rtree) src) { @@ -352,7 +365,10 @@ public: \param src The rtree which content will be moved. \par Throws - Only if allocators aren't equal. If Value copy constructor throws. When nodes allocation fails. + Only if allocators aren't equal. + \li If Value copy constructor throws. + \li If allocation throws. + \li When nodes allocation fails. */ inline rtree & operator=(BOOST_RV_REF(rtree) src) { @@ -412,9 +428,11 @@ public: \param value The value which will be stored in the container. \par Throws - If Value copy constructor or copy assignment throws. When nodes allocation fails. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When nodes allocation fails. - \par Exception-safety + \warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. */ @@ -433,9 +451,11 @@ public: \param last The end of the range of values. \par Throws - If Value copy constructor or copy assignment throws. When nodes allocation fails. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When nodes allocation fails. - \par Exception-safety + \warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. */ @@ -455,9 +475,11 @@ public: \param rng The range of values. \par Throws - If Value copy constructor or copy assignment throws. When nodes allocation fails. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When nodes allocation fails. - \par Exception-safety + \warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. */ @@ -475,7 +497,7 @@ public: /*! \brief Remove a value from the container. - In contrast to the STL set/map erase() method + In contrast to the \c std::set or \c std::map \c erase() method this method removes only one value from the container. \param value The value which will be removed from the container. @@ -483,9 +505,11 @@ public: \return 1 if the value was removed, 0 otherwise. \par Throws - If Value copy constructor or copy assignment throws. When nodes allocation fails. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When nodes allocation fails. - \par Exception-safety + \warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. */ @@ -497,7 +521,7 @@ public: /*! \brief Remove a range of values from the container. - In contrast to the STL set/map erase() method + In contrast to the \c std::set or \c std::map \c erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. @@ -508,9 +532,11 @@ public: \return The number of removed values. \par Throws - If Value copy constructor or copy assignment throws. When nodes allocation fails. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When nodes allocation fails. - \par Exception-safety + \warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. */ @@ -526,7 +552,7 @@ public: /*! \brief Remove a range of values from the container. - In contrast to the STL set/map erase() method + In contrast to the \c std::set or \c std::map \c erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values. @@ -535,9 +561,11 @@ public: \return The number of removed values. \par Throws - If Value copy constructor or copy assignment throws. When nodes allocation fails. + \li If Value copy constructor or copy assignment throws. + \li If allocation throws. + \li When nodes allocation fails. - \par Exception-safety + \warning This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data. */ @@ -554,13 +582,23 @@ public: /*! \brief Finds values meeting spatial predicates, e.g. intersecting some Box. - Spatial predicates may be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together in std::pair - or boost::tuple. + Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. + + It may be generated by one of the functions listed below: + \li \c bgi::covered_by(geometry), + \li \c bgi::disjoint(geometry), + \li \c bgi::intersects(geometry) - default, + \li \c bgi::overlaps(geometry), + \li \c bgi::within(geometry), + \li \c !bgi::covered_by(geometry), + \li \c !bgi::disjoint(geometry), + \li \c !bgi::intersects(geometry), + \li \c !bgi::overlaps(geometry), + \li \c !bgi::within(geometry) + \li \c bgi::value(func). + + Those predicates may be passed together in + \c std::pair<...> or \c boost::tuple<...>. \param pred The spatial predicates or a Geometry. \param out_it The output iterator of the result range. E.g. an iterator generated by @@ -569,7 +607,8 @@ public: \return The number of values found. \par Throws - If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. + \li If Value copy constructor or copy assignment throws. + \li If OutIter dereference or increment throws. */ template inline size_type spatial_query(Predicates const& pred, OutIter out_it) const @@ -588,15 +627,26 @@ public: /*! \brief Finds one value meeting distances predicates, e.g. nearest to some Point. - The distances predicates may be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. + + It is possible to define how distance to Value is calculated. This is done by passing PointRelation. + It can be generated by following functions: + \li bgi::to_nearest(Point) - default, + \li bgi::to_centroid(Point), + \li bgi::to_furthest(Point). + + It is possible to define define distances bounds, for example that some distance must be between + min_distance and max_distance. This is done by passing DistancesPredicates which can be generated + by following functions: + \li bgi::unbounded(PointRelation) - default, + \li bgi::min_bounded(PointRelation, MinRelation), + \li bgi::max_bounded(PointRelation, MaxRelation), + \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + + MinRelation and MaxRelation describes bounds and can be generated by following functions: + \li bgi::to_nearest(some_distance), + \li bgi::to_centroid(some_distance), + \li bgi::to_furthest(some_distance). \param dpred The distances predicates or a Point. @@ -617,23 +667,44 @@ public: \brief Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. - The distances predicates may be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. - The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together in std::pair - or boost::tuple. + It is possible to define how distance to Value is calculated. This is done by passing PointRelation. + It can be generated by following functions: + \li bgi::to_nearest(Point) - default, + \li bgi::to_centroid(Point), + \li bgi::to_furthest(Point). + + It is possible to define define distances bounds, for example that some distance must be between + min_distance and max_distance. This is done by passing DistancesPredicates which can be generated + by following functions: + \li bgi::unbounded(PointRelation) - default, + \li bgi::min_bounded(PointRelation, MinRelation), + \li bgi::max_bounded(PointRelation, MaxRelation), + \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + + MinRelation and MaxRelation describes bounds and can be generated by following functions: + \li bgi::to_nearest(some_distance), + \li bgi::to_centroid(some_distance), + \li bgi::to_furthest(some_distance). + + Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. + + It may be generated by one of the functions listed below: + \li \c bgi::covered_by(geometry), + \li \c bgi::disjoint(geometry), + \li \c bgi::intersects(geometry) - default, + \li \c bgi::overlaps(geometry), + \li \c bgi::within(geometry), + \li \c !bgi::covered_by(geometry), + \li \c !bgi::disjoint(geometry), + \li \c !bgi::intersects(geometry), + \li \c !bgi::overlaps(geometry), + \li \c !bgi::within(geometry) + \li \c bgi::value(func). + + Those predicates may be passed together in + \c std::pair<...> or \c boost::tuple<...>. \param dpred The distances predicates or a Point. \param pred The spatial predicates or a Geometry @@ -653,15 +724,26 @@ public: /*! \brief Finds k values meeting distances predicates, e.g. k nearest values to some Point. - The distances predicates. May be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. + + It is possible to define how distance to Value is calculated. This is done by passing PointRelation. + It can be generated by following functions: + \li bgi::to_nearest(Point) - default, + \li bgi::to_centroid(Point), + \li bgi::to_furthest(Point). + + It is possible to define define distances bounds, for example that some distance must be between + min_distance and max_distance. This is done by passing DistancesPredicates which can be generated + by following functions: + \li bgi::unbounded(PointRelation) - default, + \li bgi::min_bounded(PointRelation, MinRelation), + \li bgi::max_bounded(PointRelation, MaxRelation), + \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + + MinRelation and MaxRelation describes bounds and can be generated by following functions: + \li bgi::to_nearest(some_distance), + \li bgi::to_centroid(some_distance), + \li bgi::to_furthest(some_distance). \param dpred The distances predicates or a Point. \param k The max number of values. @@ -682,23 +764,44 @@ public: \brief Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. - The distances predicates may be a Point. This is default case where Value which - nearest point is closest to Point is returned. May be a PointRelation which define - how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances - bounds. E.g. that some distance must be between min_distance and max_distance. This may - be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), - bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). - MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), - bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound). + Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. - The spatial predicates. May be a Geometry (in this case default - predicate - intersects is used) or generated by bgi::covered_by(geometry), - bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), - bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), - !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) - or bgi::value(func). Those predicates may be passed together in std::pair - or boost::tuple. + It is possible to define how distance to Value is calculated. This is done by passing PointRelation. + It can be generated by following functions: + \li bgi::to_nearest(Point) - default, + \li bgi::to_centroid(Point), + \li bgi::to_furthest(Point). + + It is possible to define define distances bounds, for example that some distance must be between + min_distance and max_distance. This is done by passing DistancesPredicates which can be generated + by following functions: + \li bgi::unbounded(PointRelation) - default, + \li bgi::min_bounded(PointRelation, MinRelation), + \li bgi::max_bounded(PointRelation, MaxRelation), + \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + + MinRelation and MaxRelation describes bounds and can be generated by following functions: + \li bgi::to_nearest(some_distance), + \li bgi::to_centroid(some_distance), + \li bgi::to_furthest(some_distance). + + Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. + + It may be generated by one of the functions listed below: + \li \c bgi::covered_by(geometry), + \li \c bgi::disjoint(geometry), + \li \c bgi::intersects(geometry) - default, + \li \c bgi::overlaps(geometry), + \li \c bgi::within(geometry), + \li \c !bgi::covered_by(geometry), + \li \c !bgi::disjoint(geometry), + \li \c !bgi::intersects(geometry), + \li \c !bgi::overlaps(geometry), + \li \c !bgi::within(geometry) + \li \c bgi::value(func). + + Those predicates may be passed together in + \c std::pair<...> or \c boost::tuple<...>. \param dpred The distances predicates or a Point \param k The max number of values. @@ -757,7 +860,7 @@ public: \brief Returns the box containing all values stored in the container. Returns the box containing all values stored in the container. - If the container is empty the result of geometry::assign_inverse() is returned. + If the container is empty the result of \c geometry::assign_inverse() is returned. \return The box containing all values stored in the container or an invalid box if there are no values in the container. @@ -1170,7 +1273,7 @@ inline void insert(rtree & tree, Range co /*! \brief Remove a value from the container. -Remove a value from the container. In contrast to the STL set/map erase() method +Remove a value from the container. In contrast to the \c std::set or \c std::map \c erase() method this function removes only one value from the container. \ingroup rtree_functions @@ -1190,7 +1293,7 @@ remove(rtree & tree, Value const& v) /*! \brief Remove a range of values from the container. -Remove a range of values from the container. In contrast to the STL set/map erase() method +Remove a range of values from the container. In contrast to the \c std::set or \c std::map \c erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. @@ -1213,7 +1316,7 @@ remove(rtree & tree, Iterator first, Iter /*! \brief Remove a range of values from the container. -Remove a range of values from the container. In contrast to the STL set/map erase() method +Remove a range of values from the container. In contrast to the \c std::set or \c std::map \c erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. From fcf8257fd5c27329c2a5974982f201fb4cb07308 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 12 Jan 2013 03:47:45 +0000 Subject: [PATCH 279/366] doxygen_xml2qbk: added storing of ids, added parsing of refs and generation of qbk links. [SVN r82453] --- .../doxygen_xml2qbk/doxygen_elements.hpp | 4 +- .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 127 +++++++++++------- 2 files changed, 85 insertions(+), 46 deletions(-) diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp index 35d79a12e..08b50f5f1 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -31,9 +31,11 @@ struct base_element { std::string name; std::string brief_description; - + bool skip; + std::string id; + base_element(std::string const& n = "") : name(n) , skip(false) diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index cc08a6b79..3d8e316f9 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -62,7 +62,7 @@ This is used for different purposes within Doxygen. So we have to list explicitly either where to recurse, or where not to... */ -static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& skip, bool first = true) +static void parse_para(rapidxml::xml_node<>* node, configuration const& config, std::string& contents, bool& skip, bool first = true) { if (node != NULL) { @@ -78,54 +78,69 @@ static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& else if ( boost::equals(name, "itemizedlist") ) { contents += "\n\n"; - parse_para(node->first_node(), contents, skip); + parse_para(node->first_node(), config, contents, skip); contents += "\n"; - parse_para(node->next_sibling(), contents, skip); + parse_para(node->next_sibling(), config, contents, skip); return; } else if ( boost::equals(name, "listitem") ) { contents += "* "; - parse_para(node->first_node(), contents, skip); + parse_para(node->first_node(), config, contents, skip); contents += "\n"; - parse_para(node->next_sibling(), contents, skip); + parse_para(node->next_sibling(), config, contents, skip); return; } else if ( boost::equals(name, "verbatim") ) { contents += "\n``\n"; - parse_para(node->first_node(), contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false); contents += "``\n"; - parse_para(node->next_sibling(), contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false); return; } else if ( boost::equals(name, "bold") ) { contents += "[*"; - parse_para(node->first_node(), contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false); contents += "]"; - parse_para(node->next_sibling(), contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false); return; } else if ( boost::equals(name, "emphasis") ) { contents += "['"; - parse_para(node->first_node(), contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false); contents += "]"; - parse_para(node->next_sibling(), contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false); return; } else if ( boost::equals(name, "computeroutput") ) { contents += "[^"; - parse_para(node->first_node(), contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false); contents += "]"; - parse_para(node->next_sibling(), contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false); return; } + else if ( boost::equals(name, "ref") ) + { + // If alternative output is used - insert links + if ( config.output_style == "alt" ) + { + std::string refid = node->first_attribute("refid")->value(); + if ( !refid.empty() ) + { + contents += std::string("[link ") + refid + " "; + parse_para(node->first_node(), config, contents, skip, false); + contents += "]"; + parse_para(node->next_sibling(), config, contents, skip, false); + return; + } + } + } else if (! ( (boost::equals(name, "para") && first) - || boost::equals(name, "ref") || boost::equals(name, "defval") || boost::equals(name, "linebreak") )) @@ -143,13 +158,13 @@ static void parse_para(rapidxml::xml_node<>* node, std::string& contents, bool& //std::cout << "OTHER: " << node->name() << "=" << node->value() << std::endl; } - parse_para(node->first_node(), contents, skip, false); - parse_para(node->next_sibling(), contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false); } } -static void parse_parameter(rapidxml::xml_node<>* node, parameter& p) +static void parse_parameter(rapidxml::xml_node<>* node, configuration const& config, parameter& p) { // #define: Point // template: typenameCoordinateTypeCoordinateType @@ -167,25 +182,31 @@ static void parse_parameter(rapidxml::xml_node<>* node, parameter& p) boost::replace_all(p.type, "&", ""); boost::replace_all(p.type, "*", ""); boost::trim(p.type); + + if ( config.output_style == "alt" ) + { + p.fulltype.clear(); + parse_para(node->first_node(), config, p.fulltype, p.skip); + } } else if (name == "declname") p.name = node->value(); else if (name == "parametername") p.name = node->value(); else if (name == "defname") p.name = node->value(); else if (name == "defval") { - parse_para(node, p.default_value, p.skip); + parse_para(node, config, p.default_value, p.skip); } else if (name == "para") { - parse_para(node, p.brief_description, p.skip); + parse_para(node, config, p.brief_description, p.skip); } - parse_parameter(node->first_node(), p); - parse_parameter(node->next_sibling(), p); + parse_parameter(node->first_node(), config, p); + parse_parameter(node->next_sibling(), config, p); } } -static void parse_enumeration_value(rapidxml::xml_node<>* node, enumeration_value& value) +static void parse_enumeration_value(rapidxml::xml_node<>* node, configuration const& config, enumeration_value& value) { // green 2 // ... @@ -199,21 +220,21 @@ static void parse_enumeration_value(rapidxml::xml_node<>* node, enumeration_valu else if (node_name == "para") { // Parses both brief AND detailed into this description - parse_para(node, value.brief_description, value.skip); + parse_para(node, config, value.brief_description, value.skip); } else if (node_name == "initializer") { value.initializer = node->value(); } - parse_enumeration_value(node->first_node(), value); - parse_enumeration_value(node->next_sibling(), value); + parse_enumeration_value(node->first_node(), config, value); + parse_enumeration_value(node->next_sibling(), config, value); } } // Definition is a function or a class/struct template -static void parse_parameter_list(rapidxml::xml_node<>* node, Parameters& parameters) +static void parse_parameter_list(rapidxml::xml_node<>* node, configuration const& config, Parameters& parameters) { if (node != NULL) { @@ -222,7 +243,7 @@ static void parse_parameter_list(rapidxml::xml_node<>* node, Parameters& paramet if (name == "parameteritem") { parameter p; - parse_parameter(node->first_node(), p); + parse_parameter(node->first_node(), config, p); if (! p.name.empty()) { // Copy its description @@ -242,7 +263,7 @@ static void parse_parameter_list(rapidxml::xml_node<>* node, Parameters& paramet { // Element of 'templateparamlist.param (.type,.declname,.defname)' parameter p; - parse_parameter(node->first_node(), p); + parse_parameter(node->first_node(), config, p); // Doxygen handles templateparamlist param's differently: // @@ -269,8 +290,8 @@ static void parse_parameter_list(rapidxml::xml_node<>* node, Parameters& paramet add_or_set(parameters, p); } - parse_parameter_list(node->first_node(), parameters); - parse_parameter_list(node->next_sibling(), parameters); + parse_parameter_list(node->first_node(), config, parameters); + parse_parameter_list(node->next_sibling(), config, parameters); } } @@ -325,12 +346,12 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi if (full == ".briefdescription.para") { - parse_para(node, el.brief_description, el.skip); + parse_para(node, config, el.brief_description, el.skip); } else if (full == ".detaileddescription.para") { std::string para; - parse_para(node, para, el.skip); + parse_para(node, config, para, el.skip); if (!para.empty() && !el.detailed_description.empty()) { el.detailed_description += "\n\n"; @@ -369,7 +390,7 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi } else if (full == ".templateparamlist") { - parse_parameter_list(node->first_node(), el.template_parameters); + parse_parameter_list(node->first_node(), config, el.template_parameters); } else if (full == ".detaileddescription.para.parameterlist") { @@ -379,12 +400,12 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi // Parse parameters and their descriptions. // NOTE: they are listed here, but the order might not be the order in the function call std::vector parameters; - parse_parameter_list(node->first_node(), parameters); + parse_parameter_list(node->first_node(), config, parameters); copy_parameters_properties(parameters, el.parameters); } else if (kind == "templateparam") { - parse_parameter_list(node->first_node(), el.template_parameters); + parse_parameter_list(node->first_node(), config, el.template_parameters); } } else if (full == ".detaileddescription.para.simplesect") @@ -398,24 +419,24 @@ static void parse_element(rapidxml::xml_node<>* node, configuration const& confi if ( title_node ) p.title = title_node->value(); - parse_para(node->first_node("para"), p.text, el.skip); + parse_para(node->first_node("para"), config, p.text, el.skip); el.paragraphs.push_back(p); } else if (kind == "warning") { - parse_para(node->first_node("para"), el.warning, el.skip); + parse_para(node->first_node("para"), config, el.warning, el.skip); } else if (kind == "note") { - parse_para(node->first_node("para"), el.note, el.skip); + parse_para(node->first_node("para"), config, el.note, el.skip); } } else if (full == ".param") { // Parse one parameter, and add it to el.parameters parameter p; - parse_parameter(node->first_node(), p); + parse_parameter(node->first_node(), config, p); el.parameters.push_back(p); } @@ -445,19 +466,25 @@ static void parse_function(rapidxml::xml_node<>* node, configuration const& conf else if (full == ".param") { parameter p; - parse_parameter(node->first_node(), p); + parse_parameter(node->first_node(), config, p); add_or_set(f.parameters, p); } else if (full == ".type") { - get_contents(node->first_node(), f.return_type); + if ( config.output_style == "alt" ) + { + bool dummy_skip; + parse_para(node->first_node(), config, f.return_type, dummy_skip); + } + else + get_contents(node->first_node(), f.return_type); } else if (full == ".detaileddescription.para.simplesect") { std::string kind = get_attribute(node, "kind"); if (kind == "return") { - parse_para(node->first_node(), f.return_description, f.skip); + parse_para(node->first_node(), config, f.return_description, f.skip); } /*else if (kind == "param") { @@ -465,7 +492,7 @@ static void parse_function(rapidxml::xml_node<>* node, configuration const& conf }*/ else if (kind == "pre") { - parse_para(node->first_node(), f.precondition, f.skip); + parse_para(node->first_node(), config, f.precondition, f.skip); } } else if (full == ".detaileddescription.para.image") @@ -488,7 +515,7 @@ static void parse_enumeration(rapidxml::xml_node<>* node, configuration const& c else if (full == ".enumvalue") { enumeration_value value; - parse_enumeration_value(node->first_node(), value); + parse_enumeration_value(node->first_node(), config, value); e.enumeration_values.push_back(value); } @@ -553,10 +580,11 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum else if (nodename == "compounddef") { std::string kind = get_attribute(node, "kind"); + std::string id = get_attribute(node, "id"); if (kind == "group") { recurse = true; - doc.group_id = get_attribute(node, "id"); + doc.group_id = id; rapidxml::xml_node<> * n = node->first_node("title"); if ( n ) doc.group_title = n->value(); @@ -565,21 +593,25 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum { recurse = true; doc.cos.is_class = false; + doc.cos.id = id; parse_element(node->first_node(), config, "", doc.cos); } else if (kind == "class") { recurse = true; doc.cos.is_class = true; + doc.cos.id = id; parse_element(node->first_node(), config, "", doc.cos); } } else if (nodename == "memberdef") { std::string kind = get_attribute(node, "kind"); + std::string id = get_attribute(node, "id"); if (kind == "function") { function f; + f.id = id; parse_element(node->first_node(), config, "", f); parse_function(node->first_node(), config, "", f); if (member) @@ -601,6 +633,7 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum else if (kind == "define") { function f; + f.id = id; f.type = function_define; parse_element(node->first_node(), config, "", f); parse_function(node->first_node(), config, "", f); @@ -609,6 +642,7 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum else if (kind == "enum") { enumeration e; + e.id = id; parse_element(node->first_node(), config, "", e); parse_enumeration(node->first_node(), config, "", e); doc.enumerations.push_back(e); @@ -619,6 +653,8 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum { std::string name = parse_named_node(node->first_node(), "name"); doc.cos.typedefs.push_back(base_element(name)); + doc.cos.typedefs.back().id = id; + element dummy; parse_element(node->first_node(), config, "", dummy); doc.cos.typedefs.back().brief_description = dummy.brief_description; @@ -632,6 +668,7 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum { std::string name = parse_named_node(node->first_node(), "name"); doc.cos.variables.push_back(base_element(name)); + doc.cos.variables.back().id = id; } } From 17584a35d39333215370d2d45ec517bf97bc1d8d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 12 Jan 2013 03:49:19 +0000 Subject: [PATCH 280/366] Moddified rtree description - required by doxygen to properly generate links. [SVN r82454] --- .../geometry/extensions/index/rtree/rtree.hpp | 164 +++++++++--------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 2615bf5c3..cdadd40c9 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -69,15 +69,15 @@ with specific parameters like min and max number of elements in node. \par Predefined algorithms with compile-time parameters are: - \li bgi::linear, - \li bgi::quadratic, - \li bgi::rstar. +\li boost::geometry::index::linear, + \li boost::geometry::index::quadratic, + \li boost::geometry::index::rstar. \par Predefined algorithms with run-time parameters are: - \li \c bgi::runtime::linear, - \li \c bgi::runtime::quadratic, - \li \c bgi::runtime::rstar. + \li \c boost::geometry::index::runtime::linear, + \li \c boost::geometry::index::runtime::quadratic, + \li \c boost::geometry::index::runtime::rstar. \par Translator The Translator translates from Value to Indexable each time r-tree requires it. Which means that this @@ -585,20 +585,20 @@ public: Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. It may be generated by one of the functions listed below: - \li \c bgi::covered_by(geometry), - \li \c bgi::disjoint(geometry), - \li \c bgi::intersects(geometry) - default, - \li \c bgi::overlaps(geometry), - \li \c bgi::within(geometry), - \li \c !bgi::covered_by(geometry), - \li \c !bgi::disjoint(geometry), - \li \c !bgi::intersects(geometry), - \li \c !bgi::overlaps(geometry), - \li \c !bgi::within(geometry) - \li \c bgi::value(func). + \li \c boost::geometry::index::covered_by(), + \li \c boost::geometry::index::disjoint(), + \li \c boost::geometry::index::intersects() - default, + \li \c boost::geometry::index::overlaps(), + \li \c boost::geometry::index::within(), + \li ! boost::geometry::index::covered_by(), + \li ! boost::geometry::index::disjoint(), + \li ! boost::geometry::index::intersects(), + \li ! boost::geometry::index::overlaps(), + \li ! boost::geometry::index::within() + \li \c boost::geometry::index::value(). Those predicates may be passed together in - \c std::pair<...> or \c boost::tuple<...>. + \c std::pair or \c boost::tuple. \param pred The spatial predicates or a Geometry. \param out_it The output iterator of the result range. E.g. an iterator generated by @@ -631,22 +631,22 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li bgi::to_nearest(Point) - default, - \li bgi::to_centroid(Point), - \li bgi::to_furthest(Point). + \li boost::geometry::index::to_nearest() - default, + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li bgi::unbounded(PointRelation) - default, - \li bgi::min_bounded(PointRelation, MinRelation), - \li bgi::max_bounded(PointRelation, MaxRelation), - \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + \li boost::geometry::index::unbounded() - default, + \li boost::geometry::index::min_bounded(), + \li boost::geometry::index::max_bounded(), + \li boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li bgi::to_nearest(some_distance), - \li bgi::to_centroid(some_distance), - \li bgi::to_furthest(some_distance). + \li boost::geometry::index::to_nearest(), + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). \param dpred The distances predicates or a Point. @@ -671,40 +671,40 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li bgi::to_nearest(Point) - default, - \li bgi::to_centroid(Point), - \li bgi::to_furthest(Point). + \li boost::geometry::index::to_nearest() - default, + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li bgi::unbounded(PointRelation) - default, - \li bgi::min_bounded(PointRelation, MinRelation), - \li bgi::max_bounded(PointRelation, MaxRelation), - \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + \li boost::geometry::index::unbounded() - default, + \li boost::geometry::index::min_bounded(), + \li boost::geometry::index::max_bounded(), + \li boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li bgi::to_nearest(some_distance), - \li bgi::to_centroid(some_distance), - \li bgi::to_furthest(some_distance). + \li boost::geometry::index::to_nearest(), + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. It may be generated by one of the functions listed below: - \li \c bgi::covered_by(geometry), - \li \c bgi::disjoint(geometry), - \li \c bgi::intersects(geometry) - default, - \li \c bgi::overlaps(geometry), - \li \c bgi::within(geometry), - \li \c !bgi::covered_by(geometry), - \li \c !bgi::disjoint(geometry), - \li \c !bgi::intersects(geometry), - \li \c !bgi::overlaps(geometry), - \li \c !bgi::within(geometry) - \li \c bgi::value(func). + \li \c boost::geometry::index::covered_by(), + \li \c boost::geometry::index::disjoint(), + \li \c boost::geometry::index::intersects() - default, + \li \c boost::geometry::index::overlaps(), + \li \c boost::geometry::index::within(), + \li ! boost::geometry::index::covered_by(), + \li ! boost::geometry::index::disjoint(), + \li ! boost::geometry::index::intersects(), + \li ! boost::geometry::index::overlaps(), + \li ! boost::geometry::index::within() + \li \c boost::geometry::index::value(). Those predicates may be passed together in - \c std::pair<...> or \c boost::tuple<...>. + \c std::pair or \c boost::tuple. \param dpred The distances predicates or a Point. \param pred The spatial predicates or a Geometry @@ -728,22 +728,22 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li bgi::to_nearest(Point) - default, - \li bgi::to_centroid(Point), - \li bgi::to_furthest(Point). + \li boost::geometry::index::to_nearest() - default, + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li bgi::unbounded(PointRelation) - default, - \li bgi::min_bounded(PointRelation, MinRelation), - \li bgi::max_bounded(PointRelation, MaxRelation), - \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + \li boost::geometry::index::unbounded() - default, + \li boost::geometry::index::min_bounded(), + \li boost::geometry::index::max_bounded(), + \li boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li bgi::to_nearest(some_distance), - \li bgi::to_centroid(some_distance), - \li bgi::to_furthest(some_distance). + \li boost::geometry::index::to_nearest(), + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). \param dpred The distances predicates or a Point. \param k The max number of values. @@ -768,40 +768,40 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li bgi::to_nearest(Point) - default, - \li bgi::to_centroid(Point), - \li bgi::to_furthest(Point). + \li boost::geometry::index::to_nearest() - default, + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li bgi::unbounded(PointRelation) - default, - \li bgi::min_bounded(PointRelation, MinRelation), - \li bgi::max_bounded(PointRelation, MaxRelation), - \li bgi::bounded(PointRelation, MinRelation, MaxRelation). + \li boost::geometry::index::unbounded() - default, + \li boost::geometry::index::min_bounded(), + \li boost::geometry::index::max_bounded(), + \li boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li bgi::to_nearest(some_distance), - \li bgi::to_centroid(some_distance), - \li bgi::to_furthest(some_distance). + \li boost::geometry::index::to_nearest(), + \li boost::geometry::index::to_centroid(), + \li boost::geometry::index::to_furthest(). Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. It may be generated by one of the functions listed below: - \li \c bgi::covered_by(geometry), - \li \c bgi::disjoint(geometry), - \li \c bgi::intersects(geometry) - default, - \li \c bgi::overlaps(geometry), - \li \c bgi::within(geometry), - \li \c !bgi::covered_by(geometry), - \li \c !bgi::disjoint(geometry), - \li \c !bgi::intersects(geometry), - \li \c !bgi::overlaps(geometry), - \li \c !bgi::within(geometry) - \li \c bgi::value(func). + \li \c boost::geometry::index::covered_by(), + \li \c boost::geometry::index::disjoint(), + \li \c boost::geometry::index::intersects() - default, + \li \c boost::geometry::index::overlaps(), + \li \c boost::geometry::index::within(), + \li ! boost::geometry::index::covered_by(), + \li ! boost::geometry::index::disjoint(), + \li ! boost::geometry::index::intersects(), + \li ! boost::geometry::index::overlaps(), + \li ! boost::geometry::index::within() + \li \c boost::geometry::index::value(). Those predicates may be passed together in - \c std::pair<...> or \c boost::tuple<...>. + \c std::pair or \c boost::tuple. \param dpred The distances predicates or a Point \param k The max number of values. From 36440429e07bff2625f0197ccb465f5383aff2d7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 13 Jan 2013 15:35:10 +0000 Subject: [PATCH 281/366] rtree docs and doxygen_xml2qbk modified. rtree docs: fixed formatting, added rtree parameters info. doxygen_xml2qbk: added doxygen ref links support. removed index_id_path - no longer needed. [SVN r82479] --- doc/Doxyfile | 2 +- doc/generated/adaptors.qbk | 49 +- doc/generated/distance_predicates.qbk | 121 +- doc/generated/inserters.qbk | 13 +- doc/generated/predicates.qbk | 98 +- doc/generated/rtree.qbk | 640 ++-- doc/generated/rtree_functions.qbk | 399 ++- doc/generated/rtree_linear.qbk | 29 + doc/generated/rtree_quadratic.qbk | 29 + doc/generated/rtree_rstar.qbk | 34 + doc/generated/rtree_runtime_linear.qbk | 46 + doc/generated/rtree_runtime_quadratic.qbk | 46 + doc/generated/rtree_runtime_rstar.qbk | 51 + doc/generated/translator_def.qbk | 14 +- doc/generated/translator_index.qbk | 28 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 4 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 20 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 3090 ++++++++++------- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- doc/make_qbk.py | 25 +- doc/rtree.qbk | 12 + .../tools/doxygen_xml2qbk/configuration.hpp | 1 - .../doxygen_xml2qbk/doxygen_elements.hpp | 3 + .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 2 - .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 16 +- .../doxygen_xml2qbk/quickbook_output.hpp | 319 +- .../extensions/index/rtree/options.hpp | 103 +- .../geometry/extensions/index/rtree/rtree.hpp | 22 +- 33 files changed, 3224 insertions(+), 2016 deletions(-) create mode 100644 doc/generated/rtree_linear.qbk create mode 100644 doc/generated/rtree_quadratic.qbk create mode 100644 doc/generated/rtree_rstar.qbk create mode 100644 doc/generated/rtree_runtime_linear.qbk create mode 100644 doc/generated/rtree_runtime_quadratic.qbk create mode 100644 doc/generated/rtree_runtime_rstar.qbk diff --git a/doc/Doxyfile b/doc/Doxyfile index e50c9ab2b..9cfc96a6d 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -902,7 +902,7 @@ IGNORE_PREFIX = # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. -GENERATE_HTML = NO +GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index fee8059b9..298b89454 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -3,55 +3,64 @@ [section:group__adaptors Adaptors (boost::geometry::index::adaptors::)] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.group__adaptors.function0 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] -[[[link geometry_index.r_tree.reference.group__adaptors.function1 `nearest_queried(DistancesPredicates const &, size_t)`]][The nearest query index adaptor generator. ]] -[[[link geometry_index.r_tree.reference.group__adaptors.function2 `spatial_queried(Predicates const &)`]][The spatial query index adaptor generator. ]] +[[[link group__adaptors_1ga8e094e1f312fc00336a3536f51a69468 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] +[[[link group__adaptors_1ga3478395ded5855dc0b6c2f36a89de9f6 `nearest_queried(DistancesPredicates const &, size_t)`]][The nearest query index adaptor generator. ]] +[[[link group__adaptors_1ga3068771f0f9cca706269ec35a809db2a `spatial_queried(Predicates const &)`]][The spatial query index adaptor generator. ]] ] -[section:function0 nearest_queried(DistancesPredicates const &, size_t, Predicates const &)] +[#group__adaptors_1ga8e094e1f312fc00336a3536f51a69468] +[section nearest_queried(DistancesPredicates const &, size_t, Predicates const &)] The nearest query index adaptor generator. [heading Synopsis] -``template -detail::nearest_query boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, - size_t k, - Predicates const & pred)`` +[pre +`template<``typename DistancesPredicates``,` `typename Predicates``>` +`detail::nearest_query boost::geometry::index::adaptors::nearest_queried``(``DistancesPredicates const &` `dpred``,` + `size_t` `k``,` + `Predicates const &` `pred``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `DistancesPredicates const &` ][ `dpred` ][Distance predicates. ]] -[[ `size_t` ][ `k` ][The number of values to find. ]] -[[ `Predicates const &` ][ `pred` ][Spatial predicates. ]] +[[`DistancesPredicates const &`][ `dpred` ][Distance predicates. ]] +[[`size_t`][ `k` ][The number of values to find. ]] +[[`Predicates const &`][ `pred` ][Spatial predicates. ]] ] [endsect] -[section:function1 nearest_queried(DistancesPredicates const &, size_t)] +[#group__adaptors_1ga3478395ded5855dc0b6c2f36a89de9f6] +[section nearest_queried(DistancesPredicates const &, size_t)] The nearest query index adaptor generator. [heading Synopsis] -``template -detail::nearest_query boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)`` +[pre +`template<``typename DistancesPredicates``>` +`detail::nearest_query boost::geometry::index::adaptors::nearest_queried``(``DistancesPredicates const &` `dpred``,` `size_t` `k``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `DistancesPredicates const &` ][ `dpred` ][Distance predicates. ]] -[[ `size_t` ][ `k` ][The number of values to find. ]] +[[`DistancesPredicates const &`][ `dpred` ][Distance predicates. ]] +[[`size_t`][ `k` ][The number of values to find. ]] ] [endsect] -[section:function2 spatial_queried(Predicates const &)] +[#group__adaptors_1ga3068771f0f9cca706269ec35a809db2a] +[section spatial_queried(Predicates const &)] The spatial query index adaptor generator. [heading Synopsis] -``template -detail::spatial_query boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)`` +[pre +`template<``typename Predicates``>` +`detail::spatial_query boost::geometry::index::adaptors::spatial_queried``(``Predicates const &` `pred``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Predicates const &` ][ `pred` ][Spatial predicates. ]] +[[`Predicates const &`][ `pred` ][Spatial predicates. ]] ] [endsect] diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index f21c18a46..bf35fed97 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -3,125 +3,146 @@ [section:group__distance__predicates Distance predicates (boost::geometry::index::)] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.group__distance__predicates.function0 `to_nearest(T const &)`]][Generate to_nearest() Point-Indexable relationship. ]] -[[[link geometry_index.r_tree.reference.group__distance__predicates.function1 `to_centroid(T const &)`]][Generate to_centroid() Point-Indexable relationship. ]] -[[[link geometry_index.r_tree.reference.group__distance__predicates.function2 `to_furthest(T const &)`]][Generate to_furthest() Point-Indexable relationship. ]] -[[[link geometry_index.r_tree.reference.group__distance__predicates.function3 `unbounded(PointRelation const &)`]][Generate unbounded() distance predicate. ]] -[[[link geometry_index.r_tree.reference.group__distance__predicates.function4 `min_bounded(PointRelation const &, MinRelation const &)`]][Generate min_bounded() distance predicate. ]] -[[[link geometry_index.r_tree.reference.group__distance__predicates.function5 `max_bounded(PointRelation const &, MaxRelation const &)`]][Generate max_bounded() distance predicate. ]] -[[[link geometry_index.r_tree.reference.group__distance__predicates.function6 `bounded(PointRelation const &, MinRelation const &, MaxRelation const &)`]][Generate bounded() distance predicate. ]] +[[[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] Point-Indexable relationship. ]] +[[[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 `to_centroid(T const &)`]][Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] Point-Indexable relationship. ]] +[[[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 `to_furthest(T const &)`]][Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] Point-Indexable relationship. ]] +[[[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db `unbounded(PointRelation const &)`]][Generate [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db unbounded()] distance predicate. ]] +[[[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 `min_bounded(PointRelation const &, MinRelation const &)`]][Generate [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 min_bounded()] distance predicate. ]] +[[[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 `max_bounded(PointRelation const &, MaxRelation const &)`]][Generate [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 max_bounded()] distance predicate. ]] +[[[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 `bounded(PointRelation const &, MinRelation const &, MaxRelation const &)`]][Generate [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 bounded()] distance predicate. ]] ] -[section:function0 to_nearest(T const &)] -Generate to_nearest() Point-Indexable relationship. +[#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636] +[section to_nearest(T const &)] +Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] Point-Indexable relationship. [heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it should be the distance to the nearest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation.[heading Synopsis] -``template -detail::to_nearest boost::geometry::index::to_nearest(T const & v)`` +[pre +`template<``typename T``>` +`detail::to_nearest boost::geometry::index::to_nearest``(``T const &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `T const &` ][ `v` ][Point or bound value. ]] +[[`T const &`][ `v` ][Point or bound value. ]] ] [endsect] -[section:function1 to_centroid(T const &)] -Generate to_centroid() Point-Indexable relationship. +[#group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0] +[section to_centroid(T const &)] +Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] Point-Indexable relationship. [heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v.[heading Synopsis] -``template -detail::to_centroid boost::geometry::index::to_centroid(T const & v)`` +[pre +`template<``typename T``>` +`detail::to_centroid boost::geometry::index::to_centroid``(``T const &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `T const &` ][ `v` ][Point or bound value. ]] +[[`T const &`][ `v` ][Point or bound value. ]] ] [endsect] -[section:function2 to_furthest(T const &)] -Generate to_furthest() Point-Indexable relationship. +[#group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02] +[section to_furthest(T const &)] +Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] Point-Indexable relationship. [heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it should be the distance to the furthest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v.[heading Synopsis] -``template -detail::to_furthest boost::geometry::index::to_furthest(T const & v)`` +[pre +`template<``typename T``>` +`detail::to_furthest boost::geometry::index::to_furthest``(``T const &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `T const &` ][ `v` ][Point or bound value. ]] +[[`T const &`][ `v` ][Point or bound value. ]] ] [endsect] -[section:function3 unbounded(PointRelation const &)] -Generate unbounded() distance predicate. +[#group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db] +[section unbounded(PointRelation const &)] +Generate [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db unbounded()] distance predicate. [heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that there is no distance bounds and Values should be returned if distances between Point and Indexable are the smallest. Distance calculation is defined by PointRelation. This is default nearest predicate.[heading Synopsis] -``template -detail::unbounded boost::geometry::index::unbounded(PointRelation const & pr)`` +[pre +`template<``typename PointRelation``>` +`detail::unbounded boost::geometry::index::unbounded``(``PointRelation const &` `pr``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] ] [endsect] -[section:function4 min_bounded(PointRelation const &, MinRelation const &)] -Generate min_bounded() distance predicate. +[#group__distance__predicates_1ga39c7c94776ab840e164848e53d376098] +[section min_bounded(PointRelation const &, MinRelation const &)] +Generate [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 min_bounded()] distance predicate. [heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance.[heading Synopsis] -``template -detail::min_bounded boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)`` +[pre +`template<``typename PointRelation``,` `typename MinRelation``>` +`detail::min_bounded boost::geometry::index::min_bounded``(``PointRelation const &` `pr``,` `MinRelation const &` `minr``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] -[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] +[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] ] [endsect] -[section:function5 max_bounded(PointRelation const &, MaxRelation const &)] -Generate max_bounded() distance predicate. +[#group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079] +[section max_bounded(PointRelation const &, MaxRelation const &)] +Generate [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 max_bounded()] distance predicate. [heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are closer than some distance.[heading Synopsis] -``template -detail::max_bounded boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)`` +[pre +`template<``typename PointRelation``,` `typename MaxRelation``>` +`detail::max_bounded boost::geometry::index::max_bounded``(``PointRelation const &` `pr``,` `MaxRelation const &` `maxr``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] -[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] +[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] ] [endsect] -[section:function6 bounded(PointRelation const &, MinRelation const &, MaxRelation const &)] -Generate bounded() distance predicate. +[#group__distance__predicates_1ga20621ca608b1420c38182346b965f347] +[section bounded(PointRelation const &, MinRelation const &, MaxRelation const &)] +Generate [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 bounded()] distance predicate. [heading Description] Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance and closer than some other distance.[heading Synopsis] -``template -detail::bounded boost::geometry::index::bounded(PointRelation const & pr, - MinRelation const & minr, - MaxRelation const & maxr)`` +[pre +`template<``typename PointRelation``,` + `typename MinRelation``,` + `typename MaxRelation``>` +`detail::bounded boost::geometry::index::bounded``(``PointRelation const &` `pr``,` + `MinRelation const &` `minr``,` + `MaxRelation const &` `maxr``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `PointRelation const &` ][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] -[[ `MinRelation const &` ][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] -[[ `MaxRelation const &` ][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] +[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] +[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] ] [endsect] diff --git a/doc/generated/inserters.qbk b/doc/generated/inserters.qbk index e7db996ad..83ee2e194 100644 --- a/doc/generated/inserters.qbk +++ b/doc/generated/inserters.qbk @@ -3,21 +3,24 @@ [section:group__inserters Inserters (boost::geometry::index::)] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.group__inserters.function0 `inserter(Container &)`]][Insert iterator generator. ]] +[[[link group__inserters_1gab22c33d31b9805250e54ee6d6d240a47 `inserter(Container &)`]][Insert iterator generator. ]] ] -[section:function0 inserter(Container &)] +[#group__inserters_1gab22c33d31b9805250e54ee6d6d240a47] +[section inserter(Container &)] Insert iterator generator. [heading Description] Returns insert iterator capable to insert values to the container (spatial index) which has member function insert(value_type const&) defined.[heading Synopsis] -``template -insert_iterator boost::geometry::index::inserter(Container & c)`` +[pre +`template<``typename Container``>` +`insert_iterator boost::geometry::index::inserter``(``Container &` `c``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Container &` ][ `c` ][The reference to the container (spatial index) to which values will be inserted.]] +[[`Container &`][ `c` ][The reference to the container (spatial index) to which values will be inserted.]] ] [heading Returns] The insert iterator inserting values to the container. diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index f4e20cac9..4db049b63 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -3,110 +3,132 @@ [section:group__predicates Spatial predicates (boost::geometry::index::)] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.group__predicates.function0 `empty()`]][Generate empty predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function1 `value(ValuePredicate const &)`]][Generate value predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function2 `covered_by(Geometry const &)`]][Generate [^covered_by()] predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function3 `disjoint(Geometry const &)`]][Generate [^disjoint()] predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function4 `intersects(Geometry const &)`]][Generate [^intersects()] predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function5 `overlaps(Geometry const &)`]][Generate [^overlaps()] predicate. ]] -[[[link geometry_index.r_tree.reference.group__predicates.function6 `within(Geometry const &)`]][Generate [^within()] predicate. ]] +[[[link group__predicates_1ga150fd87dc53e5472f8905bb5827428e2 `empty()`]][Generate empty predicate. ]] +[[[link group__predicates_1ga5c93efac97377136564623cbaf35d880 `value(ValuePredicate const &)`]][Generate value predicate. ]] +[[[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 `covered_by(Geometry const &)`]][Generate [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 covered_by()]] predicate. ]] +[[[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d `disjoint(Geometry const &)`]][Generate [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d disjoint()]] predicate. ]] +[[[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 `intersects(Geometry const &)`]][Generate [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 intersects()]] predicate. ]] +[[[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 `overlaps(Geometry const &)`]][Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. ]] +[[[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d `within(Geometry const &)`]][Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. ]] ] -[section:function0 empty()] +[#group__predicates_1ga150fd87dc53e5472f8905bb5827428e2] +[section empty()] Generate empty predicate. [heading Synopsis] -``detail::empty boost::geometry::index::empty()`` +[pre + +`detail::empty boost::geometry::index::empty``()` +] [endsect] -[section:function1 value(ValuePredicate const &)] +[#group__predicates_1ga5c93efac97377136564623cbaf35d880] +[section value(ValuePredicate const &)] Generate value predicate. [heading Description] A wrapper around user-defined functor describing if Value should be returned by spatial query.[heading Synopsis] -``template -detail::value boost::geometry::index::value(ValuePredicate const & vpred)`` +[pre +`template<``typename ValuePredicate``>` +`detail::value boost::geometry::index::value``(``ValuePredicate const &` `vpred``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `ValuePredicate const &` ][ `vpred` ][The functor. ]] +[[`ValuePredicate const &`][ `vpred` ][The functor. ]] ] [endsect] -[section:function2 covered_by(Geometry const &)] -Generate [^covered_by()] predicate. +[#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61] +[section covered_by(Geometry const &)] +Generate [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 covered_by()]] predicate. [heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::covered_by(Indexable, Geometry)] returns true.[heading Synopsis] -``template -detail::covered_by boost::geometry::index::covered_by(Geometry const & g)`` +[pre +`template<``typename Geometry``>` +`detail::covered_by boost::geometry::index::covered_by``(``Geometry const &` `g``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +[[`Geometry const &`][ `g` ][The Geometry object. ]] ] [endsect] -[section:function3 disjoint(Geometry const &)] -Generate [^disjoint()] predicate. +[#group__predicates_1ga351bb3b82e019ff45adf789385b8007d] +[section disjoint(Geometry const &)] +Generate [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d disjoint()]] predicate. [heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::disjoint(Indexable, Geometry)] returns true.[heading Synopsis] -``template -detail::disjoint boost::geometry::index::disjoint(Geometry const & g)`` +[pre +`template<``typename Geometry``>` +`detail::disjoint boost::geometry::index::disjoint``(``Geometry const &` `g``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +[[`Geometry const &`][ `g` ][The Geometry object. ]] ] [endsect] -[section:function4 intersects(Geometry const &)] -Generate [^intersects()] predicate. +[#group__predicates_1ga7301c50e0272976b9f1434536383e6d0] +[section intersects(Geometry const &)] +Generate [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 intersects()]] predicate. [heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::intersects(Indexable, Geometry)] returns true.[heading Synopsis] -``template -detail::intersects boost::geometry::index::intersects(Geometry const & g)`` +[pre +`template<``typename Geometry``>` +`detail::intersects boost::geometry::index::intersects``(``Geometry const &` `g``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +[[`Geometry const &`][ `g` ][The Geometry object. ]] ] [endsect] -[section:function5 overlaps(Geometry const &)] -Generate [^overlaps()] predicate. +[#group__predicates_1ga5511236f56be1defcccbf11e742ccd88] +[section overlaps(Geometry const &)] +Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. [heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::overlaps(Indexable, Geometry)] returns true.[heading Synopsis] -``template -detail::overlaps boost::geometry::index::overlaps(Geometry const & g)`` +[pre +`template<``typename Geometry``>` +`detail::overlaps boost::geometry::index::overlaps``(``Geometry const &` `g``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +[[`Geometry const &`][ `g` ][The Geometry object. ]] ] [endsect] -[section:function6 within(Geometry const &)] -Generate [^within()] predicate. +[#group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d] +[section within(Geometry const &)] +Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. [heading Description] Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::within(Indexable, Geometry)] returns true.[heading Synopsis] -``template -detail::within boost::geometry::index::within(Geometry const & g)`` +[pre +`template<``typename Geometry``>` +`detail::within boost::geometry::index::within``(``Geometry const &` `g``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Geometry const &` ][ `g` ][The Geometry object. ]] +[[`Geometry const &`][ `g` ][The Geometry object. ]] ] [endsect] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 6f5e38351..9c545d4a4 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -1,5 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/classboost_1_1geometry_1_1index_1_1rtree.xml] +[#classboost_1_1geometry_1_1index_1_1rtree] [section:boost_geometry_index_rtree boost::geometry::index::rtree] '''boostgeometryindexrtree''' @@ -16,9 +17,9 @@ The user must pass a type defining the Parameters which will be used in rtree cr Predefined algorithms with compile-time parameters are: -* [^bgi::linear], -* [^bgi::quadratic], -* [^bgi::rstar]. +* [^[link structboost_1_1geometry_1_1index_1_1linear boost::geometry::index::linear]], +* [^[link structboost_1_1geometry_1_1index_1_1quadratic boost::geometry::index::quadratic]], +* [^[link structboost_1_1geometry_1_1index_1_1rstar boost::geometry::index::rstar]]. @@ -27,9 +28,9 @@ Predefined algorithms with compile-time parameters are: Predefined algorithms with run-time parameters are: -* [^bgi::runtime::linear], -* [^bgi::runtime::quadratic], -* [^bgi::runtime::rstar]. +* [^[link classboost_1_1geometry_1_1index_1_1runtime_1_1linear boost::geometry::index::runtime::linear]], +* [^[link classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic boost::geometry::index::runtime::quadratic]], +* [^[link classboost_1_1geometry_1_1index_1_1runtime_1_1rstar boost::geometry::index::runtime::rstar]]. @@ -40,15 +41,16 @@ The Translator translates from Value to Indexable each time r-tree requires it. `#include ` [heading Synopsis] -``template, - typename Allocator = std::allocator> -class rtree -{ - // ... -}; -`` +[pre +`template<``typename Value``,` + `typename Parameters``,` + `typename Translator` = [^[link structboost_1_1geometry_1_1index_1_1translator_1_1def translator::def]]```,` + `typename Allocator` = `std::allocator``>` +`class rtree` +`{` +` // ...` +`};` +] [heading Template parameter(s)] [table @@ -62,111 +64,122 @@ class rtree [heading Typedef(s)] [table [[Type] [Description]] -[[`value_type`][The type of Value stored in the container. ]] -[[`parameters_type`][R-tree parameters type. ]] -[[`translator_type`][Value to Indexable Translator type. ]] -[[`allocator_type`][The type of allocator used by the container. ]] -[[`size_type`][Unsigned integral type used by the container. ]] -[[`indexable_type`][The Indexable type to which Value is translated. ]] -[[`box_type`][The Box type used by the R-tree. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb] `value_type`][The type of Value stored in the container. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a] `parameters_type`][R-tree parameters type. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91] `translator_type`][Value to Indexable Translator type. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d] `allocator_type`][The type of allocator used by the container. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6] `size_type`][Unsigned integral type used by the container. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1ac011da09678f034a7fab487a9b973bfc] `indexable_type`][The Indexable type to which Value is translated. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d] `box_type`][The Box type used by the R-tree. ]] ] [heading Constructor(s) and destructor] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member0 `rtree()`]][The constructor. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member1 `rtree(parameters_type, translator_type const &, allocator_type)`]][The constructor. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member2 `rtree(Iterator, Iterator)`]][The constructor. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member3 `rtree(Range const &)`]][The constructor. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member4 `~rtree()`]][The destructor. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member5 `rtree(rtree const &)`]][The copy constructor. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member6 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member7 `rtree(rtree &&)`]][The moving constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b `rtree()`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a2cadbaa3a7157f7503eef3f2f6b889aa `rtree(parameters_type, translator_type const &, allocator_type)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a64c67e0dec7ccce2dc52d918436c62e5 `rtree(Iterator, Iterator)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a0d15842e8bb86a87f073ffabb7cabd21 `rtree(Range const &)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae8b10914ec434d1ee6877f5e1000b674 `~rtree()`]][The destructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a006904b4e7dcef1fd1efcb70a010964f `rtree(rtree const &)`]][The copy constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ac59521aa9a9b69104fa25c0f7b705354 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a050fca8af38fe25548d4c22830b55bf2 `rtree(rtree &&)`]][The moving constructor. ]] ] [heading Member(s)] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member8 `operator=(const rtree &)`]][The assignment operator. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member9 `operator=(rtree &&)`]][The moving assignment. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member10 `swap(rtree &)`]][Swaps contents of two rtrees. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member11 `insert(value_type const &)`]][Insert a value to the index. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member12 `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member13 `insert(Range const &)`]][Insert a range of values to the index. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member14 `remove(value_type const &)`]][Remove a value from the container. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member15 `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member16 `remove(Range const &)`]][Remove a range of values from the container. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member17 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member18 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member19 `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member20 `nearest_query(DistancesPredicates const &, size_t, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member21 `nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member22 `size()`]][Returns the number of stored values. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member23 `empty()`]][Query if the container is empty. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member24 `clear()`]][Removes all values stored in the container. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member25 `box()`]][Returns the box containing all values stored in the container. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member26 `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member27 `parameters()`]][Returns parameters. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member28 `translator()`]][Returns the translator object. ]] -[[[link geometry_index.r_tree.reference.boost_geometry_index_rtree.member29 `get_allocator()`]][Returns allocator used by the rtree. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1adf62005332a5fa9119ff03185e0c5143 `box()`]][Returns the box containing all values stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1abcbe5bb1a70a7fec518fe4dd8baa750c `translator()`]][Returns the translator object. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] ] -[section:member0 rtree()] +[#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b] +[section rtree()] The constructor. [heading Synopsis] -``rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())`` +[pre + +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `parameters_type` ][ `parameters` ][The parameters object. ]] -[[ `translator_type const &` ][ `translator` ][The translator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object.]] ] [heading Throws] If allocator default constructor throws. [endsect] -[section:member1 rtree(parameters_type, translator_type const &, allocator_type)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a2cadbaa3a7157f7503eef3f2f6b889aa] +[section rtree(parameters_type, translator_type const &, allocator_type)] The constructor. [heading Synopsis] -``rtree(parameters_type parameters, - translator_type const & translator, - allocator_type allocator)`` +[pre + +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `parameters_type` ][ `parameters` ][The parameters object. ]] -[[ `translator_type const &` ][ `translator` ][The translator object. ]] -[[ `allocator_type` ][ `allocator` ][The allocator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] ] [heading Throws] If allocator copy constructor throws. [endsect] -[section:member2 rtree(Iterator, Iterator)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a64c67e0dec7ccce2dc52d918436c62e5] +[section rtree(Iterator, Iterator)] The constructor. [heading Synopsis] -``template -rtree(Iterator first, - Iterator last, - parameters_type parameters = parameters_type(), - translator_type const & translator = translator_type(), - allocator_type allocator = allocator_type())`` +[pre +`template<``typename Iterator``>` +`rtree``(``Iterator` `first``,` + `Iterator` `last``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Iterator` ][ `first` ][The beginning of the range of Values. ]] -[[ `Iterator` ][ `last` ][The end of the range of Values. ]] -[[ `parameters_type` ][ `parameters` ][The parameters object. ]] -[[ `translator_type const &` ][ `translator` ][The translator object. ]] -[[ `allocator_type` ][ `allocator` ][The allocator object.]] +[[`Iterator`][ `first` ][The beginning of the range of Values. ]] +[[`Iterator`][ `last` ][The end of the range of Values. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] ] [heading Throws] @@ -180,23 +193,26 @@ rtree(Iterator first, [endsect] -[section:member3 rtree(Range const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a0d15842e8bb86a87f073ffabb7cabd21] +[section rtree(Range const &)] The constructor. [heading Synopsis] -``template -rtree(Range const & rng, - parameters_type parameters = parameters_type(), - translator_type const & translator = translator_type(), - allocator_type allocator = allocator_type())`` +[pre +`template<``typename Range``>` +`rtree``(``Range const &` `rng``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Range const &` ][ `rng` ][The range of Values. ]] -[[ `parameters_type` ][ `parameters` ][The parameters object. ]] -[[ `translator_type const &` ][ `translator` ][The translator object. ]] -[[ `allocator_type` ][ `allocator` ][The allocator object.]] +[[`Range const &`][ `rng` ][The range of Values. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] ] [heading Throws] @@ -210,28 +226,36 @@ rtree(Range const & rng, [endsect] -[section:member4 ~rtree()] +[#classboost_1_1geometry_1_1index_1_1rtree_1ae8b10914ec434d1ee6877f5e1000b674] +[section ~rtree()] The destructor. [heading Synopsis] -``~rtree()`` +[pre + +`~rtree``()` +] [heading Throws] Nothing. [endsect] -[section:member5 rtree(rtree const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a006904b4e7dcef1fd1efcb70a010964f] +[section rtree(rtree const &)] The copy constructor. [heading Description] It uses parameters, translator and allocator from the source tree.[heading Synopsis] -``rtree(rtree const & src)`` +[pre + +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` const &` `src``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree const &` ][ `src` ][The rtree which content will be copied.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` const &`][ `src` ][The rtree which content will be copied.]] ] [heading Throws] @@ -245,18 +269,22 @@ It uses parameters, translator and allocator from the source tree.[heading Synop [endsect] -[section:member6 rtree(rtree const &, allocator_type const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1ac59521aa9a9b69104fa25c0f7b705354] +[section rtree(rtree const &, allocator_type const &)] The copy constructor. [heading Description] It uses Parameters and translator from the source tree.[heading Synopsis] -``rtree(rtree const & src, allocator_type const & allocator)`` +[pre + +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` const &` `src``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &` `allocator``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree const &` ][ `src` ][The rtree which content will be copied. ]] -[[ `allocator_type const &` ][ `allocator` ][The allocator which will be used.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` const &`][ `src` ][The rtree which content will be copied. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &`][ `allocator` ][The allocator which will be used.]] ] [heading Throws] @@ -270,34 +298,42 @@ It uses Parameters and translator from the source tree.[heading Synopsis] [endsect] -[section:member7 rtree(rtree &&)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a050fca8af38fe25548d4c22830b55bf2] +[section rtree(rtree &&)] The moving constructor. [heading Description] It uses parameters, translator and allocator from the source tree.[heading Synopsis] -``rtree(rtree && src)`` +[pre + +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&` `src``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree &&` ][ `src` ][The rtree which content will be moved.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&`][ `src` ][The rtree which content will be moved.]] ] [heading Throws] If allocator move constructor throws. [endsect] -[section:member8 operator=(const rtree &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179] +[section operator=(const rtree &)] The assignment operator. [heading Description] It uses parameters and translator from the source tree.[heading Synopsis] -``rtree & operator=(const rtree & src)`` +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &` `operator=``(``const `[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &` `src``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `const rtree &` ][ `src` ][The rtree which content will be copied.]] +[[`const `[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &`][ `src` ][The rtree which content will be copied.]] ] [heading Throws] @@ -310,17 +346,21 @@ It uses parameters and translator from the source tree.[heading Synopsis] [endsect] -[section:member9 operator=(rtree &&)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be] +[section operator=(rtree &&)] The moving assignment. [heading Description] It uses parameters and translator from the source tree.[heading Synopsis] -``rtree & operator=(rtree && src)`` +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &` `operator=``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&` `src``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree &&` ][ `src` ][The rtree which content will be moved.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&`][ `src` ][The rtree which content will be moved.]] ] [heading Throws] Only if allocators aren't equal. @@ -333,33 +373,41 @@ Only if allocators aren't equal. [endsect] -[section:member10 swap(rtree &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73] +[section swap(rtree &)] Swaps contents of two rtrees. [heading Description] Parameters, translator and allocators are swapped as well.[heading Synopsis] -``void swap(rtree & other)`` +[pre + +`void` `swap``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &` `other``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree &` ][ `other` ][The rtree which content will be swapped with this rtree content.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &`][ `other` ][The rtree which content will be swapped with this rtree content.]] ] [heading Throws] If allocators swap throws. [endsect] -[section:member11 insert(value_type const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c] +[section insert(value_type const &)] Insert a value to the index. [heading Synopsis] -``void insert(value_type const & value)`` +[pre + +`void` `insert``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &` `value``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `value_type const &` ][ `value` ][The value which will be stored in the container.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &`][ `value` ][The value which will be stored in the container.]] ] [heading Throws] @@ -374,18 +422,21 @@ Insert a value to the index. [endsect] -[section:member12 insert(Iterator, Iterator)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d] +[section insert(Iterator, Iterator)] Insert a range of values to the index. [heading Synopsis] -``template -void insert(Iterator first, Iterator last)`` +[pre +`template<``typename Iterator``>` +`void` `insert``(``Iterator` `first``,` `Iterator` `last``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] -[[ `Iterator` ][ `last` ][The end of the range of values.]] +[[`Iterator`][ `first` ][The beginning of the range of values. ]] +[[`Iterator`][ `last` ][The end of the range of values.]] ] [heading Throws] @@ -400,17 +451,20 @@ void insert(Iterator first, Iterator last)`` [endsect] -[section:member13 insert(Range const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2] +[section insert(Range const &)] Insert a range of values to the index. [heading Synopsis] -``template -void insert(Range const & rng)`` +[pre +`template<``typename Range``>` +`void` `insert``(``Range const &` `rng``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Range const &` ][ `rng` ][The range of values.]] +[[`Range const &`][ `rng` ][The range of values.]] ] [heading Throws] @@ -425,17 +479,21 @@ void insert(Range const & rng)`` [endsect] -[section:member14 remove(value_type const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a] +[section remove(value_type const &)] Remove a value from the container. [heading Description] -In contrast to the [^std::set] or [^std::map][^erase()] method this method removes only one value from the container.[heading Synopsis] -``size_type remove(value_type const & value)`` +In contrast to the [^std::set] or [^std::map erase()] method this method removes only one value from the container.[heading Synopsis] +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &` `value``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `value_type const &` ][ `value` ][The value which will be removed from the container.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &`][ `value` ][The value which will be removed from the container.]] ] [heading Returns] 1 if the value was removed, 0 otherwise. @@ -452,19 +510,22 @@ In contrast to the [^std::set] or [^std::map][^erase()] method this method remov [endsect] -[section:member15 remove(Iterator, Iterator)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd] +[section remove(Iterator, Iterator)] Remove a range of values from the container. [heading Description] -In contrast to the [^std::set] or [^std::map][^erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] -``template -size_type remove(Iterator first, Iterator last)`` +In contrast to the [^std::set] or [^std::map erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +[pre +`template<``typename Iterator``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(``Iterator` `first``,` `Iterator` `last``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] -[[ `Iterator` ][ `last` ][The end of the range of values.]] +[[`Iterator`][ `first` ][The beginning of the range of values. ]] +[[`Iterator`][ `last` ][The end of the range of values.]] ] [heading Returns] The number of removed values. @@ -481,18 +542,21 @@ The number of removed values. [endsect] -[section:member16 remove(Range const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c] +[section remove(Range const &)] Remove a range of values from the container. [heading Description] -In contrast to the [^std::set] or [^std::map][^erase()] method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] -``template -size_type remove(Range const & rng)`` +In contrast to the [^std::set] or [^std::map erase()] method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +[pre +`template<``typename Range``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(``Range const &` `rng``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Range const &` ][ `rng` ][The range of values.]] +[[`Range const &`][ `rng` ][The range of values.]] ] [heading Returns] The number of removed values. @@ -509,7 +573,8 @@ The number of removed values. [endsect] -[section:member17 spatial_query(Predicates const &, OutIter)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920] +[section spatial_query(Predicates const &, OutIter)] Finds values meeting spatial predicates, e.g. intersecting some Box. [heading Description] @@ -517,28 +582,30 @@ Finds values meeting spatial predicates, e.g. intersecting some Box. It may be generated by one of the functions listed below: -* [^bgi::covered_by(geometry)], -* [^bgi::disjoint(geometry)], -* [^bgi::intersects(geometry)] - default, -* [^bgi::overlaps(geometry)], -* [^bgi::within(geometry)], -* [^!bgi::covered_by(geometry)], -* [^!bgi::disjoint(geometry)], -* [^!bgi::intersects(geometry)], -* [^!bgi::overlaps(geometry)], -* [^!bgi::within(geometry)] -* [^bgi::value(func)]. +* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], +* [^! [link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^! [link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^! [link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^! [link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^! [link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] +* [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. -Those predicates may be passed together in [^std::pair<]...> or [^boost::tuple<]...>.[heading Synopsis] -``template -size_type spatial_query(Predicates const & pred, OutIter out_it)`` +Those predicates may be passed together in [^std::pair] or [^boost::tuple].[heading Synopsis] +[pre +`template<``typename Predicates``,` `typename OutIter``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Predicates const &` ][ `pred` ][The spatial predicates or a Geometry. ]] -[[ `OutIter` ][ `out_it` ][The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container)]] +[[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] +[[`OutIter`][ `out_it` ][The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container)]] ] [heading Returns] The number of values found. @@ -552,7 +619,8 @@ The number of values found. [endsect] -[section:member18 nearest_query(DistancesPredicates const &, value_type &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909] +[section nearest_query(DistancesPredicates const &, value_type &)] Finds one value meeting distances predicates, e.g. nearest to some Point. [heading Description] @@ -560,34 +628,36 @@ Finds one value meeting distances predicates, e.g. nearest to some Point. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* bgi::to_nearest(Point) - default, -* bgi::to_centroid(Point), -* bgi::to_furthest(Point). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* bgi::unbounded(PointRelation) - default, -* bgi::min_bounded(PointRelation, MinRelation), -* bgi::max_bounded(PointRelation, MaxRelation), -* bgi::bounded(PointRelation, MinRelation, MaxRelation). +* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, +* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], +* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], +* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* bgi::to_nearest(some_distance), -* bgi::to_centroid(some_distance), -* bgi::to_furthest(some_distance). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. [heading Synopsis] -``template -size_type nearest_query(DistancesPredicates const & dpred, value_type & v)`` +[pre +`template<``typename DistancesPredicates``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point.]] -[[ `value_type &` ][ `v` ][The reference to the object which will contain the result.]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &`][ `v` ][The reference to the object which will contain the result.]] ] [heading Returns] The number of values found. @@ -596,7 +666,8 @@ If Value copy constructor or copy assignment throws. [endsect] -[section:member19 nearest_query(DistancesPredicates const &, Predicates const &, value_type &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc] +[section nearest_query(DistancesPredicates const &, Predicates const &, value_type &)] Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. [heading Description] @@ -604,54 +675,56 @@ Finds one value meeting distances predicates and spatial predicates, e.g. neares It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* bgi::to_nearest(Point) - default, -* bgi::to_centroid(Point), -* bgi::to_furthest(Point). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* bgi::unbounded(PointRelation) - default, -* bgi::min_bounded(PointRelation, MinRelation), -* bgi::max_bounded(PointRelation, MaxRelation), -* bgi::bounded(PointRelation, MinRelation, MaxRelation). +* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, +* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], +* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], +* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* bgi::to_nearest(some_distance), -* bgi::to_centroid(some_distance), -* bgi::to_furthest(some_distance). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. [*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. It may be generated by one of the functions listed below: -* [^bgi::covered_by(geometry)], -* [^bgi::disjoint(geometry)], -* [^bgi::intersects(geometry)] - default, -* [^bgi::overlaps(geometry)], -* [^bgi::within(geometry)], -* [^!bgi::covered_by(geometry)], -* [^!bgi::disjoint(geometry)], -* [^!bgi::intersects(geometry)], -* [^!bgi::overlaps(geometry)], -* [^!bgi::within(geometry)] -* [^bgi::value(func)]. +* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], +* [^! [link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^! [link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^! [link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^! [link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^! [link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] +* [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. -Those predicates may be passed together in [^std::pair<]...> or [^boost::tuple<]...>.[heading Synopsis] -``template -size_type nearest_query(DistancesPredicates const & dpred, - Predicates const & pred, - value_type & v)`` +Those predicates may be passed together in [^std::pair] or [^boost::tuple].[heading Synopsis] +[pre +`template<``typename DistancesPredicates``,` `typename Predicates``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` + `Predicates const &` `pred``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point. ]] -[[ `Predicates const &` ][ `pred` ][The spatial predicates or a Geometry ]] -[[ `value_type &` ][ `v` ][The reference to the object which will contain the result.]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] +[[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &`][ `v` ][The reference to the object which will contain the result.]] ] [heading Returns] The number of values found. @@ -660,7 +733,8 @@ If Value copy constructor or copy assignment throws. [endsect] -[section:member20 nearest_query(DistancesPredicates const &, size_t, OutIter)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d] +[section nearest_query(DistancesPredicates const &, size_type, OutIter)] Finds k values meeting distances predicates, e.g. k nearest values to some Point. [heading Description] @@ -668,37 +742,39 @@ Finds k values meeting distances predicates, e.g. k nearest values to some Point It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* bgi::to_nearest(Point) - default, -* bgi::to_centroid(Point), -* bgi::to_furthest(Point). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* bgi::unbounded(PointRelation) - default, -* bgi::min_bounded(PointRelation, MinRelation), -* bgi::max_bounded(PointRelation, MaxRelation), -* bgi::bounded(PointRelation, MinRelation, MaxRelation). +* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, +* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], +* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], +* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* bgi::to_nearest(some_distance), -* bgi::to_centroid(some_distance), -* bgi::to_furthest(some_distance). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. [heading Synopsis] -``template -size_type nearest_query(DistancesPredicates const & dpred, - size_t k, - OutIter out_it)`` +[pre +`template<``typename DistancesPredicates``,` `typename OutIter``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `k``,` + `OutIter` `out_it``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point. ]] -[[ `size_t` ][ `k` ][The max number of values. ]] -[[ `OutIter` ][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]]][ `k` ][The max number of values. ]] +[[`OutIter`][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] ] [heading Returns] The number of values found. @@ -707,7 +783,8 @@ If Value copy constructor or copy assignment throws. If OutIter dereference or i [endsect] -[section:member21 nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301] +[section nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)] Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. [heading Description] @@ -715,58 +792,60 @@ Finds k values meeting distances predicates and spatial predicates, e.g. k neare It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* bgi::to_nearest(Point) - default, -* bgi::to_centroid(Point), -* bgi::to_furthest(Point). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* bgi::unbounded(PointRelation) - default, -* bgi::min_bounded(PointRelation, MinRelation), -* bgi::max_bounded(PointRelation, MaxRelation), -* bgi::bounded(PointRelation, MinRelation, MaxRelation). +* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, +* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], +* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], +* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* bgi::to_nearest(some_distance), -* bgi::to_centroid(some_distance), -* bgi::to_furthest(some_distance). +* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], +* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], +* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. [*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. It may be generated by one of the functions listed below: -* [^bgi::covered_by(geometry)], -* [^bgi::disjoint(geometry)], -* [^bgi::intersects(geometry)] - default, -* [^bgi::overlaps(geometry)], -* [^bgi::within(geometry)], -* [^!bgi::covered_by(geometry)], -* [^!bgi::disjoint(geometry)], -* [^!bgi::intersects(geometry)], -* [^!bgi::overlaps(geometry)], -* [^!bgi::within(geometry)] -* [^bgi::value(func)]. +* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], +* [^! [link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^! [link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^! [link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^! [link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^! [link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] +* [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. -Those predicates may be passed together in [^std::pair<]...> or [^boost::tuple<]...>.[heading Synopsis] -``template -size_type nearest_query(DistancesPredicates const & dpred, - size_t k, - Predicates const & pred, - OutIter out_it)`` +Those predicates may be passed together in [^std::pair] or [^boost::tuple].[heading Synopsis] +[pre +`template<``typename DistancesPredicates``,` + `typename Predicates``,` + `typename OutIter``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `k``,` + `Predicates const &` `pred``,` + `OutIter` `out_it``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates or a Point ]] -[[ `size_t` ][ `k` ][The max number of values. ]] -[[ `Predicates const &` ][ `pred` ][The spatial predicates or a Geometry. ]] -[[ `OutIter` ][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]]][ `k` ][The max number of values. ]] +[[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] +[[`OutIter`][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] ] [heading Returns] The number of values found. @@ -775,11 +854,15 @@ If Value copy constructor or copy assignment throws. If OutIter dereference or i [endsect] -[section:member22 size()] +[#classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd] +[section size()] Returns the number of stored values. [heading Synopsis] -``size_type size()`` +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()` +] [heading Returns] The number of stored values. @@ -788,11 +871,15 @@ Nothing. [endsect] -[section:member23 empty()] +[#classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c] +[section empty()] Query if the container is empty. [heading Synopsis] -``bool empty()`` +[pre + +`bool` `empty``()` +] [heading Returns] true if the container is empty. @@ -801,23 +888,31 @@ Nothing. [endsect] -[section:member24 clear()] +[#classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09] +[section clear()] Removes all values stored in the container. [heading Synopsis] -``void clear()`` +[pre + +`void` `clear``()` +] [heading Throws] Nothing. [endsect] -[section:member25 box()] +[#classboost_1_1geometry_1_1index_1_1rtree_1adf62005332a5fa9119ff03185e0c5143] +[section box()] Returns the box containing all values stored in the container. [heading Description] Returns the box containing all values stored in the container. If the container is empty the result of [^geometry::assign_inverse()] is returned.[heading Synopsis] -``box_type box()`` +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d box_type]] `box``()` +] [heading Returns] The box containing all values stored in the container or an invalid box if there are no values in the container. @@ -826,18 +921,21 @@ Nothing. [endsect] -[section:member26 count(ValueOrIndexable const &)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee] +[section count(ValueOrIndexable const &)] Count Values or Indexables stored in the container. [heading Description] For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter.[heading Synopsis] -``template -size_type count(ValueOrIndexable const & vori)`` +[pre +`template<``typename ValueOrIndexable``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `ValueOrIndexable const &` ][ `vori` ][The value or indexable which will be counted.]] +[[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]] ] [heading Returns] The number of values found. @@ -846,11 +944,15 @@ Nothing. [endsect] -[section:member27 parameters()] +[#classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606] +[section parameters()] Returns parameters. [heading Synopsis] -``parameters_type const & parameters()`` +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()` +] [heading Returns] The parameters object. @@ -859,11 +961,15 @@ Nothing. [endsect] -[section:member28 translator()] +[#classboost_1_1geometry_1_1index_1_1rtree_1abcbe5bb1a70a7fec518fe4dd8baa750c] +[section translator()] Returns the translator object. [heading Synopsis] -``translator_type const & translator()`` +[pre + +`const `[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` &` `translator``()` +] [heading Returns] The translator object. @@ -872,11 +978,15 @@ Nothing. [endsect] -[section:member29 get_allocator()] +[#classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff] +[section get_allocator()] Returns allocator used by the rtree. [heading Synopsis] -``allocator_type get_allocator()`` +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()` +] [heading Returns] The allocator. diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 329aa7e31..1e4901a5d 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -3,352 +3,397 @@ [section:group__rtree__functions Functions related to the rtree (boost::geometry::index::)] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function0 `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function1 `insert(rtree<...> &, Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function2 `insert(rtree<...> &, Range const &)`]][Insert a range of values to the index. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function3 `remove(rtree<...> &, Value const &)`]][Remove a value from the container. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function4 `remove(rtree<...> &, Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function5 `remove(rtree<...> &, Range const &)`]][Remove a range of values from the container. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function6 `spatial_query(rtree<...> const &, Predicates const &, OutIter)`]][Find values meeting spatial predicates. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function7 `nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)`]][Find the value meeting distances predicates. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function8 `nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)`]][Find the value meeting distances and spatial predicates. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function9 `nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, OutIter)`]][Find k values meeting distances predicates. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function10 `nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, Predicates const &, OutIter)`]][Find k values meeting distances and spatial predicates. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function11 `clear(rtree<...> &)`]][Remove all values from the index. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function12 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function13 `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] -[[[link geometry_index.r_tree.reference.group__rtree__functions.function14 `box(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] +[[[link group__rtree__functions_1gaf8f4fa09c12b96ace3bbb38823a9191b `insert(rtree<...> &, Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[[link group__rtree__functions_1ga97ec330c1c021a1ac2d896a488c2eb9c `insert(rtree<...> &, Range const &)`]][Insert a range of values to the index. ]] +[[[link group__rtree__functions_1gad40492a5b99c3eebbd51901574762527 `remove(rtree<...> &, Value const &)`]][Remove a value from the container. ]] +[[[link group__rtree__functions_1ga0219361de8b15c539af3f9bd027938ce `remove(rtree<...> &, Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[[link group__rtree__functions_1ga5885d6c90a91f238f72ab9b5ef24daf9 `remove(rtree<...> &, Range const &)`]][Remove a range of values from the container. ]] +[[[link group__rtree__functions_1gadcec162d2391c2c9cc4215a5578d1721 `spatial_query(rtree<...> const &, Predicates const &, OutIter)`]][Find values meeting spatial predicates. ]] +[[[link group__rtree__functions_1gacabbd521b88b67a700e1246e5889d343 `nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)`]][Find the value meeting distances predicates. ]] +[[[link group__rtree__functions_1gaf963f417d4ab54a2782928020dd8c3ad `nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)`]][Find the value meeting distances and spatial predicates. ]] +[[[link group__rtree__functions_1ga74550ecb22e4ac69a445c1a6b0be9a1b `nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, OutIter)`]][Find k values meeting distances predicates. ]] +[[[link group__rtree__functions_1ga8057af533a3e28e09337bab2c7a146aa `nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, Predicates const &, OutIter)`]][Find k values meeting distances and spatial predicates. ]] +[[[link group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c `clear(rtree<...> &)`]][Remove all values from the index. ]] +[[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] +[[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] +[[[link group__rtree__functions_1ga46aead88abd7f18f0e1eedb991bbb39d `box(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] ] -[section:function0 insert(rtree<...> &, Value const &)] +[#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc] +[section insert(rtree<...> &, Value const &)] Insert a value to the index. [heading Synopsis] -``template -void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`void boost::geometry::index::insert``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Value const &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] -[[ `Value const &` ][ `v` ][The value which will be stored in the index. ]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`Value const &`][ `v` ][The value which will be stored in the index. ]] ] [endsect] -[section:function1 insert(rtree<...> &, Iterator, Iterator)] +[#group__rtree__functions_1gaf8f4fa09c12b96ace3bbb38823a9191b] +[section insert(rtree<...> &, Iterator, Iterator)] Insert a range of values to the index. [heading Synopsis] -``template -void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, - Iterator first, - Iterator last)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Iterator``>` +`void boost::geometry::index::insert``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` + `Iterator` `first``,` + `Iterator` `last``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] -[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] -[[ `Iterator` ][ `last` ][The end of the range of values. ]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`Iterator`][ `first` ][The beginning of the range of values. ]] +[[`Iterator`][ `last` ][The end of the range of values. ]] ] [endsect] -[section:function2 insert(rtree<...> &, Range const &)] +[#group__rtree__functions_1ga97ec330c1c021a1ac2d896a488c2eb9c] +[section insert(rtree<...> &, Range const &)] Insert a range of values to the index. [heading Synopsis] -``template -void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Range``>` +`void boost::geometry::index::insert``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Range const &` `rng``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] -[[ `Range const &` ][ `rng` ][The range of values. ]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`Range const &`][ `rng` ][The range of values. ]] ] [endsect] -[section:function3 remove(rtree<...> &, Value const &)] +[#group__rtree__functions_1gad40492a5b99c3eebbd51901574762527] +[section remove(rtree<...> &, Value const &)] Remove a value from the container. [heading Description] -Remove a value from the container. In contrast to the [^std::set] or [^std::map][^erase()] method this function removes only one value from the container.[heading Synopsis] -``template -rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)`` +Remove a value from the container. In contrast to the [^std::set] or [^std::map erase()] method this function removes only one value from the container.[heading Synopsis] +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Value const &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] -[[ `Value const &` ][ `v` ][The value which will be removed from the index.]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`Value const &`][ `v` ][The value which will be removed from the index.]] ] [heading Returns] 1 if value was removed, 0 otherwise. [endsect] -[section:function4 remove(rtree<...> &, Iterator, Iterator)] +[#group__rtree__functions_1ga0219361de8b15c539af3f9bd027938ce] +[section remove(rtree<...> &, Iterator, Iterator)] Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the [^std::set] or [^std::map][^erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.[heading Synopsis] -``template -rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, - Iterator first, - Iterator last)`` +Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Iterator``>` +`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` + `Iterator` `first``,` + `Iterator` `last``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] -[[ `Iterator` ][ `first` ][The beginning of the range of values. ]] -[[ `Iterator` ][ `last` ][The end of the range of values.]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`Iterator`][ `first` ][The beginning of the range of values. ]] +[[`Iterator`][ `last` ][The end of the range of values.]] ] [heading Returns] The number of removed values. [endsect] -[section:function5 remove(rtree<...> &, Range const &)] +[#group__rtree__functions_1ga5885d6c90a91f238f72ab9b5ef24daf9] +[section remove(rtree<...> &, Range const &)] Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the [^std::set] or [^std::map][^erase()] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] -``template -rtree::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)`` +Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Range``>` +`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Range const &` `rng``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] -[[ `Range const &` ][ `rng` ][The range of values.]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`Range const &`][ `rng` ][The range of values.]] ] [heading Returns] The number of removed values. [endsect] -[section:function6 spatial_query(rtree<...> const &, Predicates const &, OutIter)] +[#group__rtree__functions_1gadcec162d2391c2c9cc4215a5578d1721] +[section spatial_query(rtree<...> const &, Predicates const &, OutIter)] Find values meeting spatial predicates. [heading Synopsis] -``template -size_t boost::geometry::index::spatial_query(rtree< Value, Options, Translator, Allocator > const & tree, - Predicates const & pred, - OutIter out_it)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Predicates``,` + `typename OutIter``>` +`size_t boost::geometry::index::spatial_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` + `Predicates const &` `pred``,` + `OutIter` `out_it``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] -[[ `Predicates const &` ][ `pred` ][The spatial predicates. ]] -[[ `OutIter` ][ `out_it` ][The output iterator of the result range.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`Predicates const &`][ `pred` ][The spatial predicates. ]] +[[`OutIter`][ `out_it` ][The output iterator of the result range.]] ] [heading Returns] The number of found values. [endsect] -[section:function7 nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)] +[#group__rtree__functions_1gacabbd521b88b67a700e1246e5889d343] +[section nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)] Find the value meeting distances predicates. [heading Synopsis] -``template -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, - DistancesPredicates const & dpred, - Value & v)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename DistancesPredicates``>` +`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` + `DistancesPredicates const &` `dpred``,` + `Value &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] -[[ `Value &` ][ `v` ][The result.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] +[[`Value &`][ `v` ][The result.]] ] [heading Returns] The number of found values. [endsect] -[section:function8 nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)] +[#group__rtree__functions_1gaf963f417d4ab54a2782928020dd8c3ad] +[section nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)] Find the value meeting distances and spatial predicates. [heading Synopsis] -``template -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, - DistancesPredicates const & dpred, - Predicates const & pred, - Value & v)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename DistancesPredicates``,` + `typename Predicates``>` +`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` + `DistancesPredicates const &` `dpred``,` + `Predicates const &` `pred``,` + `Value &` `v``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] -[[ `Predicates const &` ][ `pred` ][The spatial predicates. ]] -[[ `Value &` ][ `v` ][The result.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] +[[`Predicates const &`][ `pred` ][The spatial predicates. ]] +[[`Value &`][ `v` ][The result.]] ] [heading Returns] The number of found values. [endsect] -[section:function9 nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, OutIter)] +[#group__rtree__functions_1ga74550ecb22e4ac69a445c1a6b0be9a1b] +[section nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, OutIter)] Find k values meeting distances predicates. [heading Synopsis] -``template -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, - DistancesPredicates const & dpred, - size_t k, - OutIter out_it)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename DistancesPredicates``,` + `typename OutIter``>` +`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` + `DistancesPredicates const &` `dpred``,` + `typename rtree< Value, Options, Translator, Allocator >::size_type` `k``,` + `OutIter` `out_it``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] -[[ `size_t` ][ `k` ][The max number of values. ]] -[[ `OutIter` ][ `out_it` ][The output iterator of the result range.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] +[[`typename rtree< Value, Options, Translator, Allocator >::size_type`][ `k` ][The max number of values. ]] +[[`OutIter`][ `out_it` ][The output iterator of the result range.]] ] [heading Returns] The number of found values. [endsect] -[section:function10 nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, Predicates const &, OutIter)] +[#group__rtree__functions_1ga8057af533a3e28e09337bab2c7a146aa] +[section nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, Predicates const &, OutIter)] Find k values meeting distances and spatial predicates. [heading Synopsis] -``template -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree, - DistancesPredicates const & dpred, - size_t k, - Predicates const & pred, - OutIter out_it)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename DistancesPredicates``,` + `typename Predicates``,` + `typename OutIter``>` +`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` + `DistancesPredicates const &` `dpred``,` + `typename rtree< Value, Options, Translator, Allocator >::size_type` `k``,` + `Predicates const &` `pred``,` + `OutIter` `out_it``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index. ]] -[[ `DistancesPredicates const &` ][ `dpred` ][The distances predicates. ]] -[[ `size_t` ][ `k` ][The max number of values. ]] -[[ `Predicates const &` ][ `pred` ][The spatial predicates. ]] -[[ `OutIter` ][ `out_it` ][The output iterator of the result range.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] +[[`typename rtree< Value, Options, Translator, Allocator >::size_type`][ `k` ][The max number of values. ]] +[[`Predicates const &`][ `pred` ][The spatial predicates. ]] +[[`OutIter`][ `out_it` ][The output iterator of the result range.]] ] [heading Returns] The number of found values. [endsect] -[section:function11 clear(rtree<...> &)] +[#group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c] +[section clear(rtree<...> &)] Remove all values from the index. [heading Synopsis] -``template -void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`void boost::geometry::index::clear``(``rtree< Value, Options, Translator, Allocator > &` `tree``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > &` ][ `tree` ][The spatial index. ]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] ] [endsect] -[section:function12 size(rtree<...> const &)] +[#group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7] +[section size(rtree<...> const &)] Get the number of values stored in the index. [heading Synopsis] -``template -size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`size_t boost::geometry::index::size``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index.]] ] [heading Returns] The number of values stored in the index. [endsect] -[section:function13 empty(rtree<...> const &)] +[#group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e] +[section empty(rtree<...> const &)] Query if there are no values stored in the index. [heading Synopsis] -``template -bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`bool boost::geometry::index::empty``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index.]] ] [heading Returns] true if there are no values in the index. [endsect] -[section:function14 box(rtree<...> const &)] +[#group__rtree__functions_1ga46aead88abd7f18f0e1eedb991bbb39d] +[section box(rtree<...> const &)] Get the box containing all stored values or an invalid box if the index has no values. [heading Synopsis] -``template -rtree::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)`` +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`rtree::box_type boost::geometry::index::box``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `rtree< Value, Options, Translator, Allocator > const &` ][ `tree` ][The spatial index.]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index.]] ] [heading Returns] The box containing all stored values or an invalid box. diff --git a/doc/generated/rtree_linear.qbk b/doc/generated/rtree_linear.qbk new file mode 100644 index 000000000..3f32de605 --- /dev/null +++ b/doc/generated/rtree_linear.qbk @@ -0,0 +1,29 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/structboost_1_1geometry_1_1index_1_1linear.xml] +[#structboost_1_1geometry_1_1index_1_1linear] +[section:boost_geometry_index_linear boost::geometry::index::linear] + +'''boostgeometryindexlinear''' +Linear r-tree creation algorithm parameters. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre +`template<``size_t MaxElements``,` `size_t MinElements``>` +`struct linear` +`{` +` // ...` +`};` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`size_t MaxElements`][Maximum number of elements in nodes. ]] +[[`size_t MinElements`][Minimum number of elements in nodes. ]] +] + +[endsect] + diff --git a/doc/generated/rtree_quadratic.qbk b/doc/generated/rtree_quadratic.qbk new file mode 100644 index 000000000..b4a3233b2 --- /dev/null +++ b/doc/generated/rtree_quadratic.qbk @@ -0,0 +1,29 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/structboost_1_1geometry_1_1index_1_1quadratic.xml] +[#structboost_1_1geometry_1_1index_1_1quadratic] +[section:boost_geometry_index_quadratic boost::geometry::index::quadratic] + +'''boostgeometryindexquadratic''' +Quadratic r-tree creation algorithm parameters. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre +`template<``size_t MaxElements``,` `size_t MinElements``>` +`struct quadratic` +`{` +` // ...` +`};` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`size_t MaxElements`][Maximum number of elements in nodes. ]] +[[`size_t MinElements`][Minimum number of elements in nodes. ]] +] + +[endsect] + diff --git a/doc/generated/rtree_rstar.qbk b/doc/generated/rtree_rstar.qbk new file mode 100644 index 000000000..78244048c --- /dev/null +++ b/doc/generated/rtree_rstar.qbk @@ -0,0 +1,34 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/structboost_1_1geometry_1_1index_1_1rstar.xml] +[#structboost_1_1geometry_1_1index_1_1rstar] +[section:boost_geometry_index_rstar boost::geometry::index::rstar] + +'''boostgeometryindexrstar''' +R*-tree creation algorithm parameters. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre +`template<``size_t MaxElements``,` + `size_t MinElements``,` + `size_t OverlapCostThreshold` = `0``,` + `size_t ReinsertedElements` = [^[link structboost_1_1geometry_1_1index_1_1options_1_1detail_1_1default__rstar__reinserted__elements options::detail::default_rstar_reinserted_elements]]`::value``>` +`struct rstar` +`{` +` // ...` +`};` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`size_t MaxElements`][Maximum number of elements in nodes. ]] +[[`size_t MinElements`][Minimum number of elements in nodes. ]] +[[`size_t OverlapCostThreshold`][The number of leaf node children elements above which nearly minimum overlap cost is calculated instead of minimum overlap cost. If 0 minimum overlap cost is always calculated. ]] +[[`size_t ReinsertedElements`][Number of elements reinserted by forced reinsertions algorithm. ]] +] + +[endsect] + diff --git a/doc/generated/rtree_runtime_linear.qbk b/doc/generated/rtree_runtime_linear.qbk new file mode 100644 index 000000000..d3dd181f0 --- /dev/null +++ b/doc/generated/rtree_runtime_linear.qbk @@ -0,0 +1,46 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1linear.xml] +[#classboost_1_1geometry_1_1index_1_1runtime_1_1linear] +[section:boost_geometry_index_runtime_linear boost::geometry::index::runtime::linear] + +'''boostgeometryindexruntimelinear''' +Linear r-tree creation algorithm parameters. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre + +`class linear` +`{` +` // ...` +`};` +] + +[heading Constructor(s) and destructor] +[table +[[Function][Description]] +[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1linear_1a31efc1a8faba0fd037066bc1bc72b6fd `linear(size_t, size_t)`]][The constructor. ]] +] + +[#classboost_1_1geometry_1_1index_1_1runtime_1_1linear_1a31efc1a8faba0fd037066bc1bc72b6fd] +[section linear(size_t, size_t)] +The constructor. + +[heading Synopsis] +[pre + +`linear``(``size_t` `max_elements``,` `size_t` `min_elements``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`size_t`][ `max_elements` ][Maximum number of elements in nodes. ]] +[[`size_t`][ `min_elements` ][Minimum number of elements in nodes. ]] +] +[endsect] + +[endsect] + diff --git a/doc/generated/rtree_runtime_quadratic.qbk b/doc/generated/rtree_runtime_quadratic.qbk new file mode 100644 index 000000000..1d52f8f47 --- /dev/null +++ b/doc/generated/rtree_runtime_quadratic.qbk @@ -0,0 +1,46 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic.xml] +[#classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic] +[section:boost_geometry_index_runtime_quadratic boost::geometry::index::runtime::quadratic] + +'''boostgeometryindexruntimequadratic''' +Quadratic r-tree creation algorithm parameters. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre + +`class quadratic` +`{` +` // ...` +`};` +] + +[heading Constructor(s) and destructor] +[table +[[Function][Description]] +[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic_1ae14911a22f8f91807254c58744b81563 `quadratic(size_t, size_t)`]][The constructor. ]] +] + +[#classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic_1ae14911a22f8f91807254c58744b81563] +[section quadratic(size_t, size_t)] +The constructor. + +[heading Synopsis] +[pre + +`quadratic``(``size_t` `max_elements``,` `size_t` `min_elements``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`size_t`][ `max_elements` ][Maximum number of elements in nodes. ]] +[[`size_t`][ `min_elements` ][Minimum number of elements in nodes. ]] +] +[endsect] + +[endsect] + diff --git a/doc/generated/rtree_runtime_rstar.qbk b/doc/generated/rtree_runtime_rstar.qbk new file mode 100644 index 000000000..de5330903 --- /dev/null +++ b/doc/generated/rtree_runtime_rstar.qbk @@ -0,0 +1,51 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1rstar.xml] +[#classboost_1_1geometry_1_1index_1_1runtime_1_1rstar] +[section:boost_geometry_index_runtime_rstar boost::geometry::index::runtime::rstar] + +'''boostgeometryindexruntimerstar''' +R*-tree creation algorithm parameters. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre + +`class rstar` +`{` +` // ...` +`};` +] + +[heading Constructor(s) and destructor] +[table +[[Function][Description]] +[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1add502ea66da6579bb3556d20b46b428e `rstar(size_t, size_t)`]][The constructor. ]] +] + +[#classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1add502ea66da6579bb3556d20b46b428e] +[section rstar(size_t, size_t)] +The constructor. + +[heading Synopsis] +[pre + +`rstar``(``size_t` `max_elements``,` + `size_t` `min_elements``,` + `size_t` `overlap_cost_threshold` = `0``,` + `size_t` `reinserted_elements` = `detail::default_rstar_reinserted_elements()``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`size_t`][ `max_elements` ][Maximum number of elements in nodes. ]] +[[`size_t`][ `min_elements` ][Minimum number of elements in nodes. ]] +[[`size_t`][ `overlap_cost_threshold` ][The number of leaf node children elements above which nearly minimum overlap cost is calculated instead of minimum overlap cost. If 0 minimum overlap cost is always calculated. ]] +[[`size_t`][ `reinserted_elements` ][Number of elements reinserted by forced reinsertions algorithm. ]] +] +[endsect] + +[endsect] + diff --git a/doc/generated/translator_def.qbk b/doc/generated/translator_def.qbk index 2ea3d579b..d16613078 100644 --- a/doc/generated/translator_def.qbk +++ b/doc/generated/translator_def.qbk @@ -1,5 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/structboost_1_1geometry_1_1index_1_1translator_1_1def.xml] +[#structboost_1_1geometry_1_1index_1_1translator_1_1def] [section:boost_geometry_index_translator_def boost::geometry::index::translator::def] '''boostgeometryindextranslatordef''' @@ -12,12 +13,13 @@ It translates Value object to Indexable object. The default version handles Valu `#include ` [heading Synopsis] -``template -struct def -{ - // ... -}; -`` +[pre +`template<``typename Value``>` +`struct def` +`{` +` // ...` +`};` +] [heading Template parameter(s)] [table diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index f01406fec..1d2ce0ca6 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -1,23 +1,25 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/classboost_1_1geometry_1_1index_1_1translator_1_1index.xml] +[#classboost_1_1geometry_1_1index_1_1translator_1_1index] [section:boost_geometry_index_translator_index boost::geometry::index::translator::index] '''boostgeometryindextranslatorindex''' The index translator. [heading Description] -This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size\u005ftype) defined. Index translator uses translator::def<...> to translate from Container::value\u005ftype to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. +This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size\u005ftype) defined. Index translator uses [link structboost_1_1geometry_1_1index_1_1translator_1_1def translator::def]<...> to translate from Container::value\u005ftype to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. [heading Header] `#include ` [heading Synopsis] -``template -class index -{ - // ... -}; -`` +[pre +`template<``typename Container``>` +`class index` +`{` +` // ...` +`};` +] [heading Template parameter(s)] [table @@ -28,19 +30,23 @@ class index [heading Constructor(s) and destructor] [table [[Function][Description]] -[[[link geometry_index.r_tree.reference.translators.boost_geometry_index_translator_index.member0 `index(Container const &)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1translator_1_1index_1a87e7e498c20aa3bf38e350a6ab19e736 `index(Container const &)`]][The constructor. ]] ] -[section:member0 index(Container const &)] +[#classboost_1_1geometry_1_1index_1_1translator_1_1index_1a87e7e498c20aa3bf38e350a6ab19e736] +[section index(Container const &)] The constructor. [heading Synopsis] -``index(Container const & c)`` +[pre + +`index``(``Container const &` `c``)` +] [heading Parameter(s)] [table [[Type][Name][Description]] -[[ `Container const &` ][ `c` ][The container which stores indexed values. ]] +[[`Container const &`][ `c` ][The container which stores indexed values. ]] ] [endsect] 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 9ca7cace5..15d0dabb0 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -79,6 +79,8 @@
      boost::geometry::index::rtree
      Functions related to the rtree (boost::geometry::index::)
      +
      R-tree + parameters
      Spatial predicates (boost::geometry::index::)
      Distance 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 300395d3a..a79271bfb 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 - + @@ -55,7 +55,7 @@

      rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
       
      -
        +
        • Value - type of object which will be stored in the container,
        • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

          -
            +
            • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

              -
                +
                • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                  If comparison of two Values is required, the default translator:

                  -
                    +
                    • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index b0b2ee116..89d93898c 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                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 + 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 [2]. + close to some point in space [2].

                The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

                -
                  +
                  • capable to store arbitrary Value type,
                  • @@ -201,20 +201,20 @@
                  -

                  -

                  [1] +


                  +

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

                  -

                  [2] +

                  [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                  -

                  [3] +

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

                  -

                  [4] +

                  [4] 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 d13849cbd..ffbfe87f5 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index 8f2622a00..3348703fc 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -29,6 +29,8 @@
                  boost::geometry::index::rtree
                  Functions related to the rtree (boost::geometry::index::)
                  +
                  R-tree + parameters
                  Spatial predicates (boost::geometry::index::)
                  Distance @@ -42,15 +44,15 @@

                  - + The R-tree spatial index.

                  - Description + Description

                  The R-tree spatial index. This is self-balancing spatial index capable @@ -58,7 +60,7 @@ The R-tree spatial index.

                  - Parameters + Parameters

                  The user must pass a type defining the Parameters which will be used in @@ -68,35 +70,34 @@ The R-tree spatial index.

                  Predefined algorithms with compile-time parameters are:

                  -
                    +

                    Predefined algorithms with run-time parameters are:

                    -
                      +
                      - Translator + Translator

                      The Translator translates from Value to Indexable each time r-tree requires @@ -111,31 +112,27 @@ The R-tree spatial index.

                      - Header + Header

                      #include <boost/geometry/extensions/index/rtree/rtree.hpp>

                      - Synopsis + Synopsis
                      -

                      -

                      -
                      template<typename Value,
                      -         typename Parameters,
                      -         typename Translator = translator::def<Value>,
                      -         typename Allocator = std::allocator<Value>>
                      -class rtree
                      -{
                      -  // ...
                      -};
                      +
                      template<typename Value,
                      +         typename Parameters,
                      +         typename Translator = translator::def<Value>,
                      +         typename Allocator = std::allocator<Value>>
                      +class rtree
                      +{
                      +  // ...
                      +};
                       
                      -

                      -

                      - Template + Template parameter(s)
                      @@ -209,7 +206,7 @@ The R-tree spatial index.
                      - Typedef(s) + Typedef(s)
                      @@ -232,7 +229,7 @@ The R-tree spatial index.

                      - value_type + value_type

                      @@ -244,7 +241,7 @@ The R-tree spatial index.

                      - parameters_type + parameters_type

                      @@ -256,7 +253,7 @@ The R-tree spatial index.

                      - translator_type + translator_type

                      @@ -268,7 +265,7 @@ The R-tree spatial index.

                      - allocator_type + allocator_type

                      @@ -280,7 +277,7 @@ The R-tree spatial index.

                      - size_type + size_type

                      @@ -292,7 +289,7 @@ The R-tree spatial index.

                      - indexable_type + indexable_type

                      @@ -304,7 +301,7 @@ The R-tree spatial index.

                      - box_type + box_type

                      @@ -317,7 +314,7 @@ The R-tree spatial index.
                      - Constructor(s) + Constructor(s) and destructor
                      @@ -341,7 +338,7 @@ The R-tree spatial index. @@ -380,7 +377,7 @@ The R-tree spatial index. @@ -393,7 +390,7 @@ The R-tree spatial index. @@ -418,7 +415,7 @@ The R-tree spatial index.

                      - rtree() + rtree()

                      @@ -353,7 +350,7 @@ The R-tree spatial index.

                      - rtree(parameters_type, + rtree(parameters_type, translator_type const &, allocator_type)

                      @@ -367,7 +364,7 @@ The R-tree spatial index.

                      - rtree(Iterator, + rtree(Iterator, Iterator)

                      - rtree(Range const + rtree(Range const &)

                      - ~rtree() + ~rtree()

                      @@ -405,7 +402,7 @@ The R-tree spatial index.

                      - rtree(rtree const + rtree(rtree const &)

                      - rtree(rtree const + rtree(rtree const &, allocator_type const &)

                      @@ -432,7 +429,7 @@ The R-tree spatial index.

                      - rtree(rtree &&) + rtree(rtree &&)

                      @@ -445,7 +442,7 @@ The R-tree spatial index.
                      - Member(s) + Member(s)
                      @@ -468,7 +465,7 @@ The R-tree spatial index. @@ -481,7 +478,7 @@ The R-tree spatial index. @@ -518,7 +515,7 @@ The R-tree spatial index. @@ -531,7 +528,7 @@ The R-tree spatial index. @@ -544,7 +541,7 @@ The R-tree spatial index. @@ -557,7 +554,7 @@ The R-tree spatial index. @@ -570,7 +567,7 @@ The R-tree spatial index. @@ -583,7 +580,7 @@ The R-tree spatial index. @@ -597,7 +594,7 @@ The R-tree spatial index. @@ -719,7 +716,7 @@ The R-tree spatial index.

                      - operator=(const rtree + operator=(const rtree &)

                      - operator=(rtree &&) + operator=(rtree &&)

                      @@ -493,7 +490,7 @@ The R-tree spatial index.

                      - swap(rtree &) + swap(rtree &)

                      @@ -505,7 +502,7 @@ The R-tree spatial index.

                      - insert(value_type const + insert(value_type const &)

                      - insert(Iterator, + insert(Iterator, Iterator)

                      - insert(Range const + insert(Range const &)

                      - remove(value_type const + remove(value_type const &)

                      - remove(Iterator, + remove(Iterator, Iterator)

                      - remove(Range const + remove(Range const &)

                      - spatial_query(Predicates const + spatial_query(Predicates const &, OutIter)

                      - nearest_query(DistancesPredicates const + nearest_query(DistancesPredicates const &, value_type &)

                      @@ -612,7 +609,7 @@ The R-tree spatial index.

                      - nearest_query(DistancesPredicates const + nearest_query(DistancesPredicates const &, Predicates const &, value_type &) @@ -628,8 +625,8 @@ The R-tree spatial index.

                      - nearest_query(DistancesPredicates const - &, size_t, OutIter) + nearest_query(DistancesPredicates const + &, size_type, OutIter)

                      @@ -642,8 +639,8 @@ The R-tree spatial index.

                      - nearest_query(DistancesPredicates const - &, size_t, Predicates + nearest_query(DistancesPredicates const + &, size_type, Predicates const &, OutIter)

                      @@ -658,7 +655,7 @@ The R-tree spatial index.

                      - size() + size()

                      @@ -670,7 +667,7 @@ The R-tree spatial index.

                      - empty() + empty()

                      @@ -682,7 +679,7 @@ The R-tree spatial index.

                      - clear() + clear()

                      @@ -694,7 +691,7 @@ The R-tree spatial index.

                      - box() + box()

                      @@ -706,7 +703,7 @@ The R-tree spatial index.

                      - count(ValueOrIndexable const + count(ValueOrIndexable const &)

                      - parameters() + parameters()

                      @@ -731,7 +728,7 @@ The R-tree spatial index.

                      - translator() + translator()

                      @@ -743,7 +740,7 @@ The R-tree spatial index.

                      - get_allocator() + get_allocator()

                      @@ -756,23 +753,20 @@ The R-tree spatial index.

                      The constructor.

                      - - Synopsis + + Synopsis
                      -

                      -

                      -
                      rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                      -

                      -

                      +
                      rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                      +
                      - - Parameter(s) + + Parameter(s)
                      @@ -801,7 +795,7 @@ The R-tree spatial index.

                      - parameters_type + parameters_type

                      @@ -818,7 +812,8 @@ The R-tree spatial index.

                      - translator_type const & + translator_type + const &

                      @@ -835,8 +830,8 @@ The R-tree spatial index.
                      - - Throws + + Throws

                      If allocator default constructor throws. @@ -844,26 +839,23 @@ The R-tree spatial index.

                      The constructor.

                      - - Synopsis + + Synopsis
                      -

                      -

                      -
                      rtree(parameters_type parameters,
                      -      translator_type const & translator,
                      -      allocator_type allocator)
                      -

                      -

                      +
                      rtree(parameters_type parameters,
                      +      translator_type const & translator,
                      +      allocator_type allocator)
                      +
                      - - Parameter(s) + + Parameter(s)
                      @@ -892,7 +884,7 @@ The R-tree spatial index.

                      - parameters_type + parameters_type

                      @@ -909,7 +901,8 @@ The R-tree spatial index.

                      - translator_type const & + translator_type + const &

                      @@ -926,7 +919,7 @@ The R-tree spatial index.

                      - allocator_type + allocator_type

                      @@ -943,8 +936,8 @@ The R-tree spatial index.
                      - - Throws + + Throws

                      If allocator copy constructor throws. @@ -952,29 +945,26 @@ The R-tree spatial index.

                      The constructor.

                      - - Synopsis + + Synopsis
                      -

                      -

                      -
                      template<typename Iterator>
                      -rtree(Iterator first,
                      -      Iterator last,
                      -      parameters_type parameters = parameters_type(),
                      -      translator_type const & translator = translator_type(),
                      -      allocator_type allocator = allocator_type())
                      -

                      -

                      +
                      template<typename Iterator>
                      +rtree(Iterator first,
                      +      Iterator last,
                      +      parameters_type parameters = parameters_type(),
                      +      translator_type const & translator = translator_type(),
                      +      allocator_type allocator = allocator_type())
                      +
                      - - Parameter(s) + + Parameter(s)
                      @@ -1037,7 +1027,7 @@ The R-tree spatial index.

                      - parameters_type + parameters_type

                      @@ -1054,7 +1044,8 @@ The R-tree spatial index.

                      - translator_type const & + translator_type + const &

                      @@ -1071,7 +1062,7 @@ The R-tree spatial index.

                      - allocator_type + allocator_type

                      @@ -1088,10 +1079,10 @@ The R-tree spatial index.
                      - - Throws + + Throws
                      -
                        +
                        • If allocator copy constructor throws.
                        • @@ -1108,28 +1099,25 @@ The R-tree spatial index.

                        The constructor.

                        - - Synopsis + + Synopsis
                        -

                        -

                        -
                        template<typename Range>
                        -rtree(Range const & rng,
                        -      parameters_type parameters = parameters_type(),
                        -      translator_type const & translator = translator_type(),
                        -      allocator_type allocator = allocator_type())
                        -

                        -

                        +
                        template<typename Range>
                        +rtree(Range const & rng,
                        +      parameters_type parameters = parameters_type(),
                        +      translator_type const & translator = translator_type(),
                        +      allocator_type allocator = allocator_type())
                        +
                        - - Parameter(s) + + Parameter(s)
                        @@ -1176,7 +1164,7 @@ The R-tree spatial index.

                        - parameters_type + parameters_type

                        @@ -1193,7 +1181,8 @@ The R-tree spatial index.

                        - translator_type const & + translator_type + const &

                        @@ -1210,7 +1199,7 @@ The R-tree spatial index.

                        - allocator_type + allocator_type

                        @@ -1227,10 +1216,10 @@ The R-tree spatial index.
                        - - Throws + + Throws
                        -
                          +
                          • If allocator copy constructor throws.
                          • @@ -1247,23 +1236,20 @@ The R-tree spatial index.

                          The destructor.

                          - - Synopsis + + Synopsis
                          -

                          -

                          -
                          ~rtree()
                          -

                          -

                          +
                          ~rtree()
                          +
                          - - Throws + + Throws

                          Nothing. @@ -1271,31 +1257,28 @@ The R-tree spatial index.

                          The copy constructor.

                          - - Description + + Description

                          It uses parameters, translator and allocator from the source tree.

                          - - Synopsis + + Synopsis
                          -

                          -

                          -
                          rtree(rtree const & src)
                          -

                          -

                          +
                          rtree(rtree const & src)
                          +
                          - - Parameter(s) + + Parameter(s)
                          @@ -1323,8 +1306,8 @@ The R-tree spatial index.

                          - rtree const - & + rtree + const &

                          @@ -1340,10 +1323,10 @@ The R-tree spatial index.
                          - - Throws + + Throws
                          -
                            +
                            • If allocator copy constructor throws.
                            • @@ -1360,31 +1343,28 @@ The R-tree spatial index.

                            The copy constructor.

                            - - Description + + Description

                            It uses Parameters and translator from the source tree.

                            - - Synopsis + + Synopsis
                            -

                            -

                            -
                            rtree(rtree const & src, allocator_type const & allocator)
                            -

                            -

                            +
                            rtree(rtree const & src, allocator_type const & allocator)
                            +
                            - - Parameter(s) + + Parameter(s)
                            @@ -1413,8 +1393,8 @@ The R-tree spatial index.

                            - rtree const - & + rtree + const &

                            @@ -1431,7 +1411,8 @@ The R-tree spatial index.

                            - allocator_type const & + allocator_type + const &

                            @@ -1448,10 +1429,10 @@ The R-tree spatial index.
                            - - Throws + + Throws
                            -
                              +
                              • If allocator copy constructor throws.
                              • @@ -1468,31 +1449,28 @@ The R-tree spatial index.

                              The moving constructor.

                              - - Description + + Description

                              It uses parameters, translator and allocator from the source tree.

                              - - Synopsis + + Synopsis
                              -

                              -

                              -
                              rtree(rtree && src)
                              -

                              -

                              +
                              rtree(rtree && src)
                              +
                              - - Parameter(s) + + Parameter(s)
                              @@ -1520,7 +1498,8 @@ The R-tree spatial index.

                              - rtree && + rtree + &&

                              @@ -1536,8 +1515,8 @@ The R-tree spatial index.
                              - - Throws + + Throws

                              If allocator move constructor throws. @@ -1545,31 +1524,28 @@ The R-tree spatial index.

                              The assignment operator.

                              - - Description + + Description

                              It uses parameters and translator from the source tree.

                              - - Synopsis + + Synopsis
                              -

                              -

                              -
                              rtree & operator=(const rtree & src)
                              -

                              -

                              +
                              rtree & operator=(const rtree & src)
                              +
                              - - Parameter(s) + + Parameter(s)
                              @@ -1597,7 +1573,7 @@ The R-tree spatial index. @@ -1614,10 +1590,10 @@ The R-tree spatial index.

                              - const rtree + const rtree &

                              - - Throws + + Throws
                              -
                                +
                                • If Value copy constructor throws.
                                • @@ -1631,31 +1607,28 @@ The R-tree spatial index.

                                The moving assignment.

                                - - Description + + Description

                                It uses parameters and translator from the source tree.

                                - - Synopsis + + Synopsis
                                -

                                -

                                -
                                rtree & operator=(rtree && src)
                                -

                                -

                                +
                                rtree & operator=(rtree && src)
                                +
                                - - Parameter(s) + + Parameter(s)
                                @@ -1683,7 +1656,8 @@ The R-tree spatial index.

                                - rtree && + rtree + &&

                                @@ -1699,13 +1673,13 @@ The R-tree spatial index.
                                - - Throws + + Throws

                                Only if allocators aren't equal.

                                -
                                  +
                                  • If Value copy constructor throws.
                                  • @@ -1719,31 +1693,28 @@ The R-tree spatial index.

                                  Swaps contents of two rtrees.

                                  - - Description + + Description

                                  Parameters, translator and allocators are swapped as well.

                                  - - Synopsis + + Synopsis
                                  -

                                  -

                                  -
                                  void swap(rtree & other)
                                  -

                                  -

                                  +
                                  void swap(rtree & other)
                                  +
                                  - - Parameter(s) + + Parameter(s)
                                  @@ -1771,7 +1742,8 @@ The R-tree spatial index.

                                  - rtree & + rtree + &

                                  @@ -1787,8 +1759,8 @@ The R-tree spatial index.
                                  - - Throws + + Throws

                                  If allocators swap throws. @@ -1796,24 +1768,21 @@ The R-tree spatial index.

                                  Insert a value to the index.

                                  - - Synopsis + + Synopsis
                                  -

                                  -

                                  -
                                  void insert(value_type const & value)
                                  -

                                  -

                                  +
                                  void insert(value_type const & value)
                                  +
                                  - - Parameter(s) + + Parameter(s)
                                  @@ -1841,7 +1810,8 @@ The R-tree spatial index.

                                  - value_type const & + value_type + const &

                                  @@ -1857,10 +1827,10 @@ The R-tree spatial index.
                                  - - Throws + + Throws
                                  -
                                    +
                                    • If Value copy constructor or copy assignment throws.
                                    • @@ -1885,25 +1855,22 @@ The R-tree spatial index.

                                    Insert a range of values to the index.

                                    - - Synopsis + + Synopsis
                                    -

                                    -

                                    -
                                    template<typename Iterator>
                                    -void insert(Iterator first, Iterator last)
                                    -

                                    -

                                    +
                                    template<typename Iterator>
                                    +void insert(Iterator first, Iterator last)
                                    +
                                    - - Parameter(s) + + Parameter(s)
                                    @@ -1966,10 +1933,10 @@ The R-tree spatial index.
                                    - - Throws + + Throws
                                    -
                                      +
                                      • If Value copy constructor or copy assignment throws.
                                      • @@ -1994,25 +1961,22 @@ The R-tree spatial index.

                                      Insert a range of values to the index.

                                      - - Synopsis + + Synopsis
                                      -

                                      -

                                      -
                                      template<typename Range>
                                      -void insert(Range const & rng)
                                      -

                                      -

                                      +
                                      template<typename Range>
                                      +void insert(Range const & rng)
                                      +
                                      - - Parameter(s) + + Parameter(s)
                                      @@ -2057,10 +2021,10 @@ The R-tree spatial index.
                                      - - Throws + + Throws
                                      -
                                        +
                                        • If Value copy constructor or copy assignment throws.
                                        • @@ -2085,32 +2049,29 @@ The R-tree spatial index.

                                        Remove a value from the container.

                                        - - Description + + Description

                                        - In contrast to the std::set or std::maperase() + In contrast to the std::set or std::map erase() method this method removes only one value from the container.

                                        - - Synopsis + + Synopsis
                                        -

                                        -

                                        -
                                        size_type remove(value_type const & value)
                                        -

                                        -

                                        +
                                        size_type remove(value_type const & value)
                                        +
                                        - - Parameter(s) + + Parameter(s)
                                        @@ -2138,7 +2099,8 @@ The R-tree spatial index.

                                        - value_type const & + value_type + const &

                                        @@ -2154,17 +2116,17 @@ The R-tree spatial index.
                                        - - Returns + + Returns

                                        1 if the value was removed, 0 otherwise.

                                        - - Throws + + Throws
                                        -
                                          +
                                          • If Value copy constructor or copy assignment throws.
                                          • @@ -2189,36 +2151,33 @@ The R-tree spatial index.

                                          Remove a range of values from the container.

                                          - - Description + + Description

                                          - In contrast to the std::set or std::maperase() + In contrast to the std::set or std::map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

                                          - - Synopsis + + Synopsis
                                          -

                                          -

                                          -
                                          template<typename Iterator>
                                          -size_type remove(Iterator first, Iterator last)
                                          -

                                          -

                                          +
                                          template<typename Iterator>
                                          +size_type remove(Iterator first, Iterator last)
                                          +
                                          - - Parameter(s) + + Parameter(s)
                                          @@ -2281,17 +2240,17 @@ The R-tree spatial index.
                                          - - Returns + + Returns

                                          The number of removed values.

                                          - - Throws + + Throws
                                          -
                                            +
                                            • If Value copy constructor or copy assignment throws.
                                            • @@ -2316,35 +2275,32 @@ The R-tree spatial index.

                                            Remove a range of values from the container.

                                            - - Description + + Description

                                            - In contrast to the std::set or std::maperase() + In contrast to the std::set or std::map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.

                                            - - Synopsis + + Synopsis
                                            -

                                            -

                                            -
                                            template<typename Range>
                                            -size_type remove(Range const & rng)
                                            -

                                            -

                                            +
                                            template<typename Range>
                                            +size_type remove(Range const & rng)
                                            +
                                            - - Parameter(s) + + Parameter(s)
                                            @@ -2389,17 +2345,17 @@ The R-tree spatial index.
                                            - - Returns + + Returns

                                            The number of removed values.

                                            - - Throws + + Throws
                                            -
                                              +
                                              • If Value copy constructor or copy assignment throws.
                                              • @@ -2424,15 +2380,15 @@ The R-tree spatial index.

                                              Finds values meeting spatial predicates, e.g. intersecting some Box.

                                              - - Description + + Description

                                              Spatial predicates may be a Geometry. @@ -2442,58 +2398,56 @@ The R-tree spatial index.

                                              It may be generated by one of the functions listed below:

                                              -
                                                +

                                                - Those predicates may be passed together in std::pair<...> - or boost::tuple<...>. + Those predicates may be passed together in std::pair + or boost::tuple.

                                                - - Synopsis + + Synopsis
                                                -

                                                -

                                                -
                                                template<typename Predicates, typename OutIter>
                                                -size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                -

                                                -

                                                +
                                                template<typename Predicates, typename OutIter>
                                                +size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                +
                                                - - Parameter(s) + + Parameter(s)
                                                @@ -2557,17 +2511,17 @@ The R-tree spatial index.
                                                - - Returns + + Returns

                                                The number of values found.

                                                - - Throws + + Throws
                                                -
                                                  +
                                                  • If Value copy constructor or copy assignment throws.
                                                  • @@ -2578,15 +2532,15 @@ The R-tree spatial index.

                                                  Finds one value meeting distances predicates, e.g. nearest to some Point.

                                                  - - Description + + Description

                                                  Distances predicates may be a Point. @@ -2596,15 +2550,16 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                  -
                                                    +

                                                    @@ -2612,48 +2567,46 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                    -
                                                      +

                                                      MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                      -

                                                      @@ -2741,8 +2695,8 @@ The R-tree spatial index. e.g. nearest to some Point and intersecting some Box.

                                                      - - Description + + Description

                                                      Distances predicates may be a Point. @@ -2752,15 +2706,16 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                      -
                                                        +

                                                        @@ -2768,33 +2723,34 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                        -
                                                          +

                                                          MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                          -
                                                            +

                                                            @@ -2805,60 +2761,58 @@ The R-tree spatial index.

                                                            It may be generated by one of the functions listed below:

                                                            -

                                                            Finds k values meeting distances predicates, e.g. k nearest values to some Point.

                                                            - - Description + + Description

                                                            Distances predicates may be a Point. @@ -2974,15 +2929,16 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                            -
                                                              +

                                                              @@ -2990,50 +2946,48 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                              -
                                                                +

                                                                MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                -

                                                                Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box.

                                                                - - Description + + Description

                                                                Distances predicates may be a Point. @@ -3150,15 +3104,16 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                -
                                                                  +

                                                                  @@ -3166,33 +3121,34 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                  -
                                                                    +

                                                                    MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                    -
                                                                      +

                                                                      @@ -3203,63 +3159,61 @@ The R-tree spatial index.

                                                                      It may be generated by one of the functions listed below:

                                                                      -

                                                                      Returns the number of stored values.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      size_type size()
                                                                      -

                                                                      -

                                                                      +
                                                                      size_type size()
                                                                      +
                                                                      - - Returns + + Returns

                                                                      The number of stored values.

                                                                      - - Throws + + Throws

                                                                      Nothing. @@ -3405,30 +3356,27 @@ The R-tree spatial index.

                                                                      Query if the container is empty.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      bool empty()
                                                                      -

                                                                      -

                                                                      +
                                                                      bool empty()
                                                                      +
                                                                      - - Returns + + Returns

                                                                      true if the container is empty.

                                                                      - - Throws + + Throws

                                                                      Nothing. @@ -3436,23 +3384,20 @@ The R-tree spatial index.

                                                                      Removes all values stored in the container.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      void clear()
                                                                      -

                                                                      -

                                                                      +
                                                                      void clear()
                                                                      +
                                                                      - - Throws + + Throws

                                                                      Nothing. @@ -3460,14 +3405,14 @@ The R-tree spatial index.

                                                                      Returns the box containing all values stored in the container.

                                                                      - - Description + + Description

                                                                      Returns the box containing all values stored in the container. If the @@ -3475,25 +3420,22 @@ The R-tree spatial index. is returned.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      box_type box()
                                                                      -

                                                                      -

                                                                      +
                                                                      box_type box()
                                                                      +
                                                                      - - Returns + + Returns

                                                                      The box containing all values stored in the container or an invalid box if there are no values in the container.

                                                                      - - Throws + + Throws

                                                                      Nothing. @@ -3501,15 +3443,15 @@ The R-tree spatial index.

                                                                      Count Values or Indexables stored in the container.

                                                                      - - Description + + Description

                                                                      For indexable_type it returns the number of values which indexables equals @@ -3517,18 +3459,15 @@ The R-tree spatial index. the parameter.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename ValueOrIndexable>
                                                                      -size_type count(ValueOrIndexable const & vori)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename ValueOrIndexable>
                                                                      +size_type count(ValueOrIndexable const & vori)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -3573,15 +3512,15 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of values found.

                                                                      - - Throws + + Throws

                                                                      Nothing. @@ -3589,30 +3528,27 @@ The R-tree spatial index.

                                                                      Returns parameters.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      parameters_type const & parameters()
                                                                      -

                                                                      -

                                                                      +
                                                                      parameters_type const & parameters()
                                                                      +
                                                                      - - Returns + + Returns

                                                                      The parameters object.

                                                                      - - Throws + + Throws

                                                                      Nothing. @@ -3620,30 +3556,27 @@ The R-tree spatial index.

                                                                      Returns the translator object.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      translator_type const & translator()
                                                                      -

                                                                      -

                                                                      +
                                                                      const translator_type & translator()
                                                                      +
                                                                      - - Returns + + Returns

                                                                      The translator object.

                                                                      - - Throws + + Throws

                                                                      Nothing. @@ -3651,30 +3584,27 @@ The R-tree spatial index.

                                                                      Returns allocator used by the rtree.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      allocator_type get_allocator()
                                                                      -

                                                                      -

                                                                      +
                                                                      allocator_type get_allocator()
                                                                      +
                                                                      - - Returns + + Returns

                                                                      The allocator.

                                                                      - - Throws + + Throws

                                                                      If allocator copy constructor throws. @@ -3707,7 +3637,7 @@ The R-tree spatial index.

                                                                      - insert(rtree<...> + insert(rtree<...> &, Value const &)

                                                                      @@ -3721,7 +3651,7 @@ The R-tree spatial index.

                                                                      - insert(rtree<...> + insert(rtree<...> &, Iterator, Iterator)

                                                                      @@ -3734,7 +3664,7 @@ The R-tree spatial index.

                                                                      - insert(rtree<...> + insert(rtree<...> &, Range const &)

                                                                      @@ -3748,7 +3678,7 @@ The R-tree spatial index.

                                                                      - remove(rtree<...> + remove(rtree<...> &, Value const &)

                                                                      @@ -3762,7 +3692,7 @@ The R-tree spatial index.

                                                                      - remove(rtree<...> + remove(rtree<...> &, Iterator, Iterator)

                                                                      @@ -3775,7 +3705,7 @@ The R-tree spatial index.

                                                                      - remove(rtree<...> + remove(rtree<...> &, Range const &)

                                                                      @@ -3789,7 +3719,7 @@ The R-tree spatial index.

                                                                      - spatial_query(rtree<...> + spatial_query(rtree<...> const &, Predicates const &, OutIter) @@ -3804,7 +3734,7 @@ The R-tree spatial index.

                                                                      - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, Value &) @@ -3819,7 +3749,7 @@ The R-tree spatial index.

                                                                      - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const @@ -3836,11 +3766,10 @@ The R-tree spatial index.

                                                                      - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, - size_t, - OutIter) + typename rtree<...>::size_type, OutIter)

                                                                      @@ -3852,12 +3781,12 @@ The R-tree spatial index.

                                                                      - nearest_query(rtree<...> + nearest_query(rtree<...> const &, DistancesPredicates const &, - size_t, - Predicates const - &, OutIter) + typename rtree<...>::size_type, Predicates + const &, + OutIter)

                                                                      @@ -3869,7 +3798,7 @@ The R-tree spatial index.

                                                                      - clear(rtree<...> + clear(rtree<...> &)

                                                                      @@ -3882,7 +3811,7 @@ The R-tree spatial index.

                                                                      - size(rtree<...> + size(rtree<...> const &)

                                                                      @@ -3895,7 +3824,7 @@ The R-tree spatial index.

                                                                      - empty(rtree<...> + empty(rtree<...> const &)

                                                                      @@ -3908,7 +3837,7 @@ The R-tree spatial index.

                                                                      - box(rtree<...> + box(rtree<...> const &)

                                                                      @@ -3923,28 +3852,25 @@ The R-tree spatial index.

                                                                      Insert a value to the index.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator>
                                                                      -void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator>
                                                                      +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4015,31 +3941,28 @@ The R-tree spatial index.

                                                                      Insert a range of values to the index.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename Iterator>
                                                                      -void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree,
                                                                      -                                    Iterator first,
                                                                      -                                    Iterator last)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename Iterator>
                                                                      +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree,
                                                                      +                                    Iterator first,
                                                                      +                                    Iterator last)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4126,29 +4049,26 @@ The R-tree spatial index.

                                                                      Insert a range of values to the index.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename Range>
                                                                      -void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename Range>
                                                                      +void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4219,37 +4139,34 @@ The R-tree spatial index.

                                                                      Remove a value from the container.

                                                                      - - Description + + Description

                                                                      Remove a value from the container. In contrast to the std::set - or std::maperase() method this - function removes only one value from the container. + or std::map erase() method this function removes only + one value from the container.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator>
                                                                      -rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator>
                                                                      +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4318,8 +4235,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      1 if value was removed, 0 otherwise. @@ -4327,42 +4244,39 @@ The R-tree spatial index.

                                                                      Remove a range of values from the container.

                                                                      - - Description + + Description

                                                                      Remove a range of values from the container. In contrast to the std::set - or std::maperase() method it doesn't - take iterators pointing to values stored in this container. It removes - values equal to these passed as a range. Furthermore this function removes - only one value for each one passed in the range, not all equal values. + or std::map erase() method it doesn't take iterators + pointing to values stored in this container. It removes values equal + to these passed as a range. Furthermore this function removes only one + value for each one passed in the range, not all equal values.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename Iterator>
                                                                      -rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree,
                                                                      -                                                                                       Iterator first,
                                                                      -                                                                                       Iterator last)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename Iterator>
                                                                      +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree,
                                                                      +                                                                                       Iterator first,
                                                                      +                                                                                       Iterator last)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4447,8 +4361,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of removed values. @@ -4456,39 +4370,36 @@ The R-tree spatial index.

                                                                      Remove a range of values from the container.

                                                                      - - Description + + Description

                                                                      Remove a range of values from the container. In contrast to the std::set - or std::maperase() method it removes - values equal to these passed as a range. Furthermore this method removes - only one value for each one passed in the range, not all equal values. + or std::map erase() method it removes values equal + to these passed as a range. Furthermore this method removes only one + value for each one passed in the range, not all equal values.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename Range>
                                                                      -rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename Range>
                                                                      +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4557,8 +4468,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of removed values. @@ -4566,32 +4477,29 @@ The R-tree spatial index.

                                                                      Find values meeting spatial predicates.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename Predicates,
                                                                      -         typename OutIter>
                                                                      -size_t boost::geometry::index::spatial_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      -                                             Predicates const & pred,
                                                                      -                                             OutIter out_it)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename Predicates,
                                                                      +         typename OutIter>
                                                                      +size_t boost::geometry::index::spatial_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      +                                             Predicates const & pred,
                                                                      +                                             OutIter out_it)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4676,8 +4584,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of found values. @@ -4685,31 +4593,28 @@ The R-tree spatial index.

                                                                      Find the value meeting distances predicates.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename DistancesPredicates>
                                                                      -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      -                                             DistancesPredicates const & dpred,
                                                                      -                                             Value & v)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename DistancesPredicates>
                                                                      +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      +                                             DistancesPredicates const & dpred,
                                                                      +                                             Value & v)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4795,8 +4700,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of found values. @@ -4804,7 +4709,7 @@ The R-tree spatial index.

                                                                      @@ -4812,26 +4717,23 @@ The R-tree spatial index. Find the value meeting distances and spatial predicates.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename DistancesPredicates,
                                                                      -         typename Predicates>
                                                                      -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      -                                             DistancesPredicates const & dpred,
                                                                      -                                             Predicates const & pred,
                                                                      -                                             Value & v)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename DistancesPredicates,
                                                                      +         typename Predicates>
                                                                      +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      +                                             DistancesPredicates const & dpred,
                                                                      +                                             Predicates const & pred,
                                                                      +                                             Value & v)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -4934,8 +4836,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of found values. @@ -4943,33 +4845,31 @@ The R-tree spatial index.

                                                                      Find k values meeting distances predicates.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename DistancesPredicates,
                                                                      -         typename OutIter>
                                                                      -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      -                                             DistancesPredicates const & dpred,
                                                                      -                                             size_t k,
                                                                      -                                             OutIter out_it)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename DistancesPredicates,
                                                                      +         typename OutIter>
                                                                      +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      +                                             DistancesPredicates const & dpred,
                                                                      +                                             typename rtree< Value, Options, Translator, Allocator >::size_type k,
                                                                      +                                             OutIter out_it)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5038,7 +4938,8 @@ The R-tree spatial index.

                                                                      - size_t + typename rtree< Value, Options, Translator, Allocator + >::size_type

                                                                      @@ -5072,8 +4973,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of found values. @@ -5081,36 +4982,33 @@ The R-tree spatial index.

                                                                      Find k values meeting distances and spatial predicates.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator,
                                                                      -         typename DistancesPredicates,
                                                                      -         typename Predicates,
                                                                      -         typename OutIter>
                                                                      -size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      -                                             DistancesPredicates const & dpred,
                                                                      -                                             size_t k,
                                                                      -                                             Predicates const & pred,
                                                                      -                                             OutIter out_it)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator,
                                                                      +         typename DistancesPredicates,
                                                                      +         typename Predicates,
                                                                      +         typename OutIter>
                                                                      +size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                                                      +                                             DistancesPredicates const & dpred,
                                                                      +                                             typename rtree< Value, Options, Translator, Allocator >::size_type k,
                                                                      +                                             Predicates const & pred,
                                                                      +                                             OutIter out_it)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5179,7 +5077,8 @@ The R-tree spatial index.

                                                                      - size_t + typename rtree< Value, Options, Translator, Allocator + >::size_type

                                                                      @@ -5230,8 +5129,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of found values. @@ -5239,28 +5138,25 @@ The R-tree spatial index.

                                                                      Remove all values from the index.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator>
                                                                      -void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator>
                                                                      +void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5311,28 +5207,25 @@ The R-tree spatial index.

                                                                      Get the number of values stored in the index.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator>
                                                                      -size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator>
                                                                      +size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5381,8 +5274,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of values stored in the index. @@ -5390,28 +5283,25 @@ The R-tree spatial index.

                                                                      Query if there are no values stored in the index.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator>
                                                                      -bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator>
                                                                      +bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5460,8 +5350,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      true if there are no values in the index. @@ -5469,7 +5359,7 @@ The R-tree spatial index.

                                                                      @@ -5477,21 +5367,18 @@ The R-tree spatial index. has no values.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value,
                                                                      -         typename Options,
                                                                      -         typename Translator,
                                                                      -         typename Allocator>
                                                                      -rtree<Value, Options, Translator, Allocator>::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Value,
                                                                      +         typename Options,
                                                                      +         typename Translator,
                                                                      +         typename Allocator>
                                                                      +rtree<Value, Options, Translator, Allocator>::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5540,8 +5427,8 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The box containing all stored values or an invalid box. @@ -5550,6 +5437,713 @@ The R-tree spatial index.

                                                                      +
                                                                      + +

                                                                      + +Linear r-tree creation algorithm parameters. +

                                                                      +
                                                                      + + Header +
                                                                      +

                                                                      + #include <boost/geometry/extensions/index/rtree/options.hpp> +

                                                                      +
                                                                      + + Synopsis +
                                                                      +
                                                                      template<size_t MaxElements, size_t MinElements>
                                                                      +struct linear
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                      +
                                                                      +
                                                                      + + Template + parameter(s) +
                                                                      +
                                                                      ++++ + + + + + + + + + + + + + + +
                                                                      +

                                                                      + Parameter +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + size_t MaxElements +

                                                                      +
                                                                      +

                                                                      + Maximum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t MinElements +

                                                                      +
                                                                      +

                                                                      + Minimum number of elements in nodes. +

                                                                      +
                                                                      +
                                                                      +
                                                                      + +

                                                                      + +Quadratic r-tree creation algorithm parameters. +

                                                                      +
                                                                      + + Header +
                                                                      +

                                                                      + #include <boost/geometry/extensions/index/rtree/options.hpp> +

                                                                      +
                                                                      + + Synopsis +
                                                                      +
                                                                      template<size_t MaxElements, size_t MinElements>
                                                                      +struct quadratic
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                      +
                                                                      +
                                                                      + + Template + parameter(s) +
                                                                      +
                                                                      ++++ + + + + + + + + + + + + + + +
                                                                      +

                                                                      + Parameter +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + size_t MaxElements +

                                                                      +
                                                                      +

                                                                      + Maximum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t MinElements +

                                                                      +
                                                                      +

                                                                      + Minimum number of elements in nodes. +

                                                                      +
                                                                      +
                                                                      +
                                                                      + +

                                                                      + +R*-tree creation algorithm parameters. +

                                                                      +
                                                                      + + Header +
                                                                      +

                                                                      + #include <boost/geometry/extensions/index/rtree/options.hpp> +

                                                                      +
                                                                      + + Synopsis +
                                                                      +
                                                                      template<size_t MaxElements,
                                                                      +         size_t MinElements,
                                                                      +         size_t OverlapCostThreshold = 0,
                                                                      +         size_t ReinsertedElements = options::detail::default_rstar_reinserted_elements<MaxElements>::value>
                                                                      +struct rstar
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                      +
                                                                      +
                                                                      + + Template + parameter(s) +
                                                                      +
                                                                      ++++ + + + + + + + + + + + + + + + + + + + + + + +
                                                                      +

                                                                      + Parameter +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + size_t MaxElements +

                                                                      +
                                                                      +

                                                                      + Maximum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t MinElements +

                                                                      +
                                                                      +

                                                                      + Minimum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t OverlapCostThreshold +

                                                                      +
                                                                      +

                                                                      + The number of leaf node children elements above which nearly + minimum overlap cost is calculated instead of minimum overlap + cost. If 0 minimum overlap cost is always calculated. +

                                                                      +
                                                                      +

                                                                      + size_t ReinsertedElements +

                                                                      +
                                                                      +

                                                                      + Number of elements reinserted by forced reinsertions algorithm. +

                                                                      +
                                                                      +
                                                                      +
                                                                      + +

                                                                      + +Linear r-tree creation algorithm parameters. +

                                                                      +
                                                                      + + Header +
                                                                      +

                                                                      + #include <boost/geometry/extensions/index/rtree/options.hpp> +

                                                                      +
                                                                      + + Synopsis +
                                                                      +
                                                                      class linear
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                      +
                                                                      +
                                                                      + + Constructor(s) + and destructor +
                                                                      +
                                                                      ++++ + + + + + + + + +
                                                                      +

                                                                      + Function +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + linear(size_t, + size_t) +

                                                                      +
                                                                      +

                                                                      + The constructor. +

                                                                      +
                                                                      +
                                                                      + +

                                                                      + The constructor. +

                                                                      + + Synopsis +
                                                                      linear(size_t max_elements, size_t min_elements)
                                                                      +
                                                                      + + Parameter(s) +
                                                                      +++++ + + + + + + + + + + + + + + + + + +
                                                                      +

                                                                      + Type +

                                                                      +
                                                                      +

                                                                      + Name +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + max_elements +

                                                                      +
                                                                      +

                                                                      + Maximum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + min_elements +

                                                                      +
                                                                      +

                                                                      + Minimum number of elements in nodes. +

                                                                      +
                                                                      +
                                                                      +
                                                                      +
                                                                      + +

                                                                      + +Quadratic r-tree creation algorithm parameters. +

                                                                      +
                                                                      + + Header +
                                                                      +

                                                                      + #include <boost/geometry/extensions/index/rtree/options.hpp> +

                                                                      +
                                                                      + + Synopsis +
                                                                      +
                                                                      class quadratic
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                      +
                                                                      +
                                                                      + + Constructor(s) + and destructor +
                                                                      +
                                                                      ++++ + + + + + + + + +
                                                                      +

                                                                      + Function +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + quadratic(size_t, + size_t) +

                                                                      +
                                                                      +

                                                                      + The constructor. +

                                                                      +
                                                                      +
                                                                      + +

                                                                      + The constructor. +

                                                                      + + Synopsis +
                                                                      quadratic(size_t max_elements, size_t min_elements)
                                                                      +
                                                                      + + Parameter(s) +
                                                                      +++++ + + + + + + + + + + + + + + + + + +
                                                                      +

                                                                      + Type +

                                                                      +
                                                                      +

                                                                      + Name +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + max_elements +

                                                                      +
                                                                      +

                                                                      + Maximum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + min_elements +

                                                                      +
                                                                      +

                                                                      + Minimum number of elements in nodes. +

                                                                      +
                                                                      +
                                                                      +
                                                                      +
                                                                      + +

                                                                      + +R*-tree creation algorithm parameters. +

                                                                      +
                                                                      + + Header +
                                                                      +

                                                                      + #include <boost/geometry/extensions/index/rtree/options.hpp> +

                                                                      +
                                                                      + + Synopsis +
                                                                      +
                                                                      class rstar
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                      +
                                                                      +
                                                                      + + Constructor(s) + and destructor +
                                                                      +
                                                                      ++++ + + + + + + + + +
                                                                      +

                                                                      + Function +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + rstar(size_t, + size_t) +

                                                                      +
                                                                      +

                                                                      + The constructor. +

                                                                      +
                                                                      +
                                                                      + +

                                                                      + The constructor. +

                                                                      + + Synopsis +
                                                                      rstar(size_t max_elements,
                                                                      +      size_t min_elements,
                                                                      +      size_t overlap_cost_threshold = 0,
                                                                      +      size_t reinserted_elements = detail::default_rstar_reinserted_elements())
                                                                      +
                                                                      + + Parameter(s) +
                                                                      +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                      +

                                                                      + Type +

                                                                      +
                                                                      +

                                                                      + Name +

                                                                      +
                                                                      +

                                                                      + Description +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + max_elements +

                                                                      +
                                                                      +

                                                                      + Maximum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + min_elements +

                                                                      +
                                                                      +

                                                                      + Minimum number of elements in nodes. +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + overlap_cost_threshold +

                                                                      +
                                                                      +

                                                                      + The number of leaf node children elements above which nearly + minimum overlap cost is calculated instead of minimum overlap + cost. If 0 minimum overlap cost is always calculated. +

                                                                      +
                                                                      +

                                                                      + size_t +

                                                                      +
                                                                      +

                                                                      + reinserted_elements +

                                                                      +
                                                                      +

                                                                      + Number of elements reinserted by forced reinsertions algorithm. +

                                                                      +
                                                                      +
                                                                      +
                                                                      +
                                                                      +
                                                                      + @@ -5574,7 +6168,7 @@ The R-tree spatial index.

                                                                      - empty() + empty()

                                                                      @@ -5586,7 +6180,7 @@ The R-tree spatial index.

                                                                      - value(ValuePredicate const + value(ValuePredicate const &)

                                                                      @@ -5599,65 +6193,70 @@ The R-tree spatial index.

                                                                      - covered_by(Geometry const + covered_by(Geometry const &)

                                                                      - Generate covered_by() predicate. + Generate covered_by() + predicate.

                                                                      - disjoint(Geometry const + disjoint(Geometry const &)

                                                                      - Generate disjoint() predicate. + Generate disjoint() + predicate.

                                                                      - intersects(Geometry const + intersects(Geometry const &)

                                                                      - Generate intersects() predicate. + Generate intersects() + predicate.

                                                                      - overlaps(Geometry const + overlaps(Geometry const &)

                                                                      - Generate overlaps() predicate. + Generate overlaps() + predicate.

                                                                      - within(Geometry const + within(Geometry const &)

                                                                      - Generate within() predicate. + Generate within() + predicate.

                                                                      @@ -5665,50 +6264,44 @@ The R-tree spatial index.

                                                                      Generate empty predicate.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      detail::empty boost::geometry::index::empty()
                                                                      -

                                                                      -

                                                                      +
                                                                      detail::empty boost::geometry::index::empty()
                                                                      +

                                                                      Generate value predicate.

                                                                      - - Description + + Description

                                                                      A wrapper around user-defined functor describing if Value should be returned by spatial query.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename ValuePredicate>
                                                                      -detail::value<ValuePredicate> boost::geometry::index::value(ValuePredicate const & vpred)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename ValuePredicate>
                                                                      +detail::value<ValuePredicate> boost::geometry::index::value(ValuePredicate const & vpred)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5754,15 +6347,16 @@ The R-tree spatial index.

                                                                      - Generate covered_by() predicate. + Generate covered_by() + predicate.

                                                                      - - Description + + Description

                                                                      Generate a predicate defining Value and Geometry relationship. Value @@ -5770,18 +6364,15 @@ The R-tree spatial index. returns true.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Geometry>
                                                                      -detail::covered_by<Geometry> boost::geometry::index::covered_by(Geometry const & g)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Geometry>
                                                                      +detail::covered_by<Geometry> boost::geometry::index::covered_by(Geometry const & g)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5828,15 +6419,16 @@ The R-tree spatial index.

                                                                      - Generate disjoint() predicate. + Generate disjoint() + predicate.

                                                                      - - Description + + Description

                                                                      Generate a predicate defining Value and Geometry relationship. Value @@ -5844,18 +6436,15 @@ The R-tree spatial index. returns true.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Geometry>
                                                                      -detail::disjoint<Geometry> boost::geometry::index::disjoint(Geometry const & g)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Geometry>
                                                                      +detail::disjoint<Geometry> boost::geometry::index::disjoint(Geometry const & g)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5902,15 +6491,16 @@ The R-tree spatial index.

                                                                      - Generate intersects() predicate. + Generate intersects() + predicate.

                                                                      - - Description + + Description

                                                                      Generate a predicate defining Value and Geometry relationship. Value @@ -5918,18 +6508,15 @@ The R-tree spatial index. returns true.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Geometry>
                                                                      -detail::intersects<Geometry> boost::geometry::index::intersects(Geometry const & g)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Geometry>
                                                                      +detail::intersects<Geometry> boost::geometry::index::intersects(Geometry const & g)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -5976,15 +6563,16 @@ The R-tree spatial index.

                                                                      - Generate overlaps() predicate. + Generate overlaps() + predicate.

                                                                      - - Description + + Description

                                                                      Generate a predicate defining Value and Geometry relationship. Value @@ -5992,18 +6580,15 @@ The R-tree spatial index. returns true.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Geometry>
                                                                      -detail::overlaps<Geometry> boost::geometry::index::overlaps(Geometry const & g)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Geometry>
                                                                      +detail::overlaps<Geometry> boost::geometry::index::overlaps(Geometry const & g)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6050,15 +6635,16 @@ The R-tree spatial index.

                                                                      - Generate within() predicate. + Generate within() + predicate.

                                                                      - - Description + + Description

                                                                      Generate a predicate defining Value and Geometry relationship. Value @@ -6066,18 +6652,15 @@ The R-tree spatial index. returns true.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Geometry>
                                                                      -detail::within<Geometry> boost::geometry::index::within(Geometry const & g)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Geometry>
                                                                      +detail::within<Geometry> boost::geometry::index::within(Geometry const & g)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6149,87 +6732,93 @@ The R-tree spatial index. @@ -6246,15 +6836,16 @@ The R-tree spatial index.

                                                                      - to_nearest(T const + to_nearest(T const &)

                                                                      - Generate to_nearest() Point-Indexable relationship. + Generate to_nearest() + Point-Indexable relationship.

                                                                      - to_centroid(T const + to_centroid(T const &)

                                                                      - Generate to_centroid() Point-Indexable relationship. + Generate to_centroid() + Point-Indexable relationship.

                                                                      - to_furthest(T const + to_furthest(T const &)

                                                                      - Generate to_furthest() Point-Indexable relationship. + Generate to_furthest() + Point-Indexable relationship.

                                                                      - unbounded(PointRelation const + unbounded(PointRelation const &)

                                                                      - Generate unbounded() distance predicate. + Generate unbounded() + distance predicate.

                                                                      - min_bounded(PointRelation const + min_bounded(PointRelation const &, MinRelation const &)

                                                                      - Generate min_bounded() distance predicate. + Generate min_bounded() + distance predicate.

                                                                      - max_bounded(PointRelation const + max_bounded(PointRelation const &, MaxRelation const &)

                                                                      - Generate max_bounded() distance predicate. + Generate max_bounded() + distance predicate.

                                                                      - bounded(PointRelation const + bounded(PointRelation const &, MinRelation const &, MaxRelation const @@ -6238,7 +6827,8 @@ The R-tree spatial index.

                                                                      - Generate bounded() distance predicate. + Generate bounded() + distance predicate.

                                                                      - Generate to_nearest() Point-Indexable relationship. + Generate to_nearest() + Point-Indexable relationship.

                                                                      - - Description + + Description

                                                                      Generate a nearest query Point and Value's Indexable relationship while @@ -6266,18 +6857,15 @@ The R-tree spatial index. or further than value v. This is default relation.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename T>
                                                                      -detail::to_nearest<T> boost::geometry::index::to_nearest(T const & v)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename T>
                                                                      +detail::to_nearest<T> boost::geometry::index::to_nearest(T const & v)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6324,15 +6912,16 @@ The R-tree spatial index.

                                                                      - Generate to_centroid() Point-Indexable relationship. + Generate to_centroid() + Point-Indexable relationship.

                                                                      - - Description + + Description

                                                                      Generate a nearest query Point and Value's Indexable relationship while @@ -6342,18 +6931,15 @@ The R-tree spatial index. that Indexable's centroid should be closer or further than value v.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename T>
                                                                      -detail::to_centroid<T> boost::geometry::index::to_centroid(T const & v)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename T>
                                                                      +detail::to_centroid<T> boost::geometry::index::to_centroid(T const & v)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6400,15 +6986,16 @@ The R-tree spatial index.

                                                                      - Generate to_furthest() Point-Indexable relationship. + Generate to_furthest() + Point-Indexable relationship.

                                                                      - - Description + + Description

                                                                      Generate a nearest query Point and Value's Indexable relationship while @@ -6420,18 +7007,15 @@ The R-tree spatial index. be closer or further than value v.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename T>
                                                                      -detail::to_furthest<T> boost::geometry::index::to_furthest(T const & v)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename T>
                                                                      +detail::to_furthest<T> boost::geometry::index::to_furthest(T const & v)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6478,15 +7062,16 @@ The R-tree spatial index.

                                                                      - Generate unbounded() distance predicate. + Generate unbounded() + distance predicate.

                                                                      - - Description + + Description

                                                                      Generate a distance predicate. This defines distances bounds which are @@ -6496,18 +7081,15 @@ The R-tree spatial index. is default nearest predicate.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename PointRelation>
                                                                      -detail::unbounded<PointRelation> boost::geometry::index::unbounded(PointRelation const & pr)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename PointRelation>
                                                                      +detail::unbounded<PointRelation> boost::geometry::index::unbounded(PointRelation const & pr)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6554,15 +7136,16 @@ The R-tree spatial index.

                                                                      - Generate min_bounded() distance predicate. + Generate min_bounded() + distance predicate.

                                                                      - - Description + + Description

                                                                      Generate a distance predicate. This defines distances bounds which are @@ -6574,18 +7157,15 @@ The R-tree spatial index. distance.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename PointRelation, typename MinRelation>
                                                                      -detail::min_bounded<PointRelation, MinRelation> boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename PointRelation, typename MinRelation>
                                                                      +detail::min_bounded<PointRelation, MinRelation> boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6652,15 +7232,16 @@ The R-tree spatial index.

                                                                      - Generate max_bounded() distance predicate. + Generate max_bounded() + distance predicate.

                                                                      - - Description + + Description

                                                                      Generate a distance predicate. This defines distances bounds which are @@ -6672,18 +7253,15 @@ The R-tree spatial index. distance.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename PointRelation, typename MaxRelation>
                                                                      -detail::max_bounded<PointRelation, MaxRelation> boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename PointRelation, typename MaxRelation>
                                                                      +detail::max_bounded<PointRelation, MaxRelation> boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6750,15 +7328,16 @@ The R-tree spatial index.

                                                                      - Generate bounded() distance predicate. + Generate bounded() + distance predicate.

                                                                      - - Description + + Description

                                                                      Generate a distance predicate. This defines distances bounds which are @@ -6771,22 +7350,19 @@ The R-tree spatial index. than some other distance.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename PointRelation,
                                                                      -         typename MinRelation,
                                                                      -         typename MaxRelation>
                                                                      -detail::bounded<PointRelation, MinRelation, MaxRelation> boost::geometry::index::bounded(PointRelation const & pr,
                                                                      -                                                                                         MinRelation const & minr,
                                                                      -                                                                                         MaxRelation const & maxr)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename PointRelation,
                                                                      +         typename MinRelation,
                                                                      +         typename MaxRelation>
                                                                      +detail::bounded<PointRelation, MinRelation, MaxRelation> boost::geometry::index::bounded(PointRelation const & pr,
                                                                      +                                                                                         MinRelation const & minr,
                                                                      +                                                                                         MaxRelation const & maxr)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -6896,7 +7472,7 @@ The R-tree spatial index. @@ -6923,7 +7499,7 @@ The R-tree spatial index. @@ -6937,27 +7513,24 @@ The R-tree spatial index.

                                                                      - nearest_queried(DistancesPredicates const + nearest_queried(DistancesPredicates const &, size_t, Predicates const &)

                                                                      @@ -6910,7 +7486,7 @@ The R-tree spatial index.

                                                                      - nearest_queried(DistancesPredicates const + nearest_queried(DistancesPredicates const &, size_t)

                                                                      - spatial_queried(Predicates const + spatial_queried(Predicates const &)

                                                                      The nearest query index adaptor generator.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename DistancesPredicates, typename Predicates>
                                                                      -detail::nearest_query<DistancesPredicates, Predicates> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred,
                                                                      -                                                                                                         size_t k,
                                                                      -                                                                                                         Predicates const & pred)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename DistancesPredicates, typename Predicates>
                                                                      +detail::nearest_query<DistancesPredicates, Predicates> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred,
                                                                      +                                                                                                         size_t k,
                                                                      +                                                                                                         Predicates const & pred)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -7040,25 +7613,22 @@ The R-tree spatial index.

                                                                      The nearest query index adaptor generator.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename DistancesPredicates>
                                                                      -detail::nearest_query<DistancesPredicates, index::detail::empty> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename DistancesPredicates>
                                                                      +detail::nearest_query<DistancesPredicates, index::detail::empty> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -7124,25 +7694,22 @@ The R-tree spatial index.

                                                                      The spatial query index adaptor generator.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Predicates>
                                                                      -detail::spatial_query<Predicates> boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Predicates>
                                                                      +detail::spatial_query<Predicates> boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -7194,15 +7761,15 @@ The R-tree spatial index.

                                                                      - + The default translator.

                                                                      - Description + Description

                                                                      It translates Value object to Indexable object. The default version handles @@ -7211,28 +7778,24 @@ The default translator.

                                                                      - Header + Header

                                                                      #include <boost/geometry/extensions/index/translator/def.hpp>

                                                                      - Synopsis + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Value>
                                                                      -struct def
                                                                      -{
                                                                      -  // ...
                                                                      -};
                                                                      +
                                                                      template<typename Value>
                                                                      +struct def
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                       
                                                                      -

                                                                      -

                                                                      - Template + Template parameter(s)
                                                                      @@ -7268,47 +7831,44 @@ The default translator.

                                                                      - + The index translator.

                                                                      - Description + Description

                                                                      This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size_type) defined. - Index translator uses translator::def<...> to translate from Container::value_type - to the Indexable which means that it can handle Indexables, std::pairs - and boost::tuples stored in an external Container. + Index translator uses translator::def<...> + to translate from Container::value_type to the Indexable which means + that it can handle Indexables, std::pairs and boost::tuples stored in + an external Container.

                                                                      - Header + Header

                                                                      #include <boost/geometry/extensions/index/translator/index.hpp>

                                                                      - Synopsis + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Container>
                                                                      -class index
                                                                      -{
                                                                      -  // ...
                                                                      -};
                                                                      +
                                                                      template<typename Container>
                                                                      +class index
                                                                      +{
                                                                      +  // ...
                                                                      +};
                                                                       
                                                                      -

                                                                      -

                                                                      - Template + Template parameter(s)
                                                                      @@ -7343,7 +7903,7 @@ The index translator.
                                                                      - Constructor(s) + Constructor(s) and destructor
                                                                      @@ -7366,7 +7926,7 @@ The index translator. @@ -7379,21 +7939,18 @@ The index translator.

                                                                      - index(Container const + index(Container const &)

                                                                      The constructor.

                                                                      - - Synopsis -

                                                                      -

                                                                      -
                                                                      index(Container const & c)
                                                                      -

                                                                      -

                                                                      - - Parameter(s) + + Synopsis +
                                                                      index(Container const & c)
                                                                      +
                                                                      + + Parameter(s)
                                                                      @@ -7463,7 +8020,7 @@ The index translator.

                                                                      - inserter(Container &) + inserter(Container &)

                                                                      @@ -7475,33 +8032,30 @@ The index translator.

                                                                      Insert iterator generator.

                                                                      - - Description + + Description

                                                                      Returns insert iterator capable to insert values to the container (spatial index) which has member function insert(value_type const&) defined.

                                                                      - - Synopsis + + Synopsis
                                                                      -

                                                                      -

                                                                      -
                                                                      template<typename Container>
                                                                      -insert_iterator<Container> boost::geometry::index::inserter(Container & c)
                                                                      -

                                                                      -

                                                                      +
                                                                      template<typename Container>
                                                                      +insert_iterator<Container> boost::geometry::index::inserter(Container & c)
                                                                      +
                                                                      - - Parameter(s) + + Parameter(s)
                                                                      @@ -7546,8 +8100,8 @@ The index translator.
                                                                      - - Returns + + Returns

                                                                      The insert iterator inserting values to the container. diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 2e4bf7514..9ec8f8b5c 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 - + @@ -150,7 +150,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 7fee097e3..dc19fd16b 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 df77e0358..ba1ccfdcd 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: January 11, 2013 at 04:03:52 GMT

                                                                      Last revised: January 13, 2013 at 15:29:29 GMT


                                                                      diff --git a/doc/make_qbk.py b/doc/make_qbk.py index f5cad0bc9..c17eae014 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -13,18 +13,25 @@ import os, sys cmd = "doxygen_xml2qbk" cmd = cmd + " --xml xml/%s.xml" cmd = cmd + " --start_include boost/" -cmd = cmd + " --index_id_path %s" cmd = cmd + " --output_style alt" cmd = cmd + " > generated/%s.qbk" os.system("doxygen Doxyfile") -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "geometry_index.r_tree.reference", "rtree")) -os.system(cmd % ("group__rtree__functions", "geometry_index.r_tree.reference", "rtree_functions")) -os.system(cmd % ("group__predicates", "geometry_index.r_tree.reference", "predicates")) -os.system(cmd % ("group__distance__predicates", "geometry_index.r_tree.reference", "distance_predicates")) -os.system(cmd % ("group__adaptors", "geometry_index.r_tree.reference", "adaptors")) -os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_1_1def", "geometry_index.r_tree.reference.translators", "translator_def")) -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1translator_1_1index", "geometry_index.r_tree.reference.translators", "translator_index")) -os.system(cmd % ("group__inserters", "geometry_index.r_tree.reference", "inserters")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1rtree", "rtree")) +os.system(cmd % ("group__rtree__functions", "rtree_functions")) + +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1linear", "rtree_linear")) +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1quadratic", "rtree_quadratic")) +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1rstar", "rtree_rstar")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1linear", "rtree_runtime_linear")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic", "rtree_runtime_quadratic")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1rstar", "rtree_runtime_rstar")) + +os.system(cmd % ("group__predicates", "predicates")) +os.system(cmd % ("group__distance__predicates", "distance_predicates")) +os.system(cmd % ("group__adaptors", "adaptors")) +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_1_1def", "translator_def")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1translator_1_1index", "translator_index")) +os.system(cmd % ("group__inserters", "inserters")) os.system("b2") diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 8e69ffa18..ee42c8a74 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -21,6 +21,18 @@ [include generated/rtree.qbk] [include generated/rtree_functions.qbk] + +[section:parameters R-tree parameters] + +[include generated/rtree_linear.qbk] +[include generated/rtree_quadratic.qbk] +[include generated/rtree_rstar.qbk] +[include generated/rtree_runtime_linear.qbk] +[include generated/rtree_runtime_quadratic.qbk] +[include generated/rtree_runtime_rstar.qbk] + +[endsect] + [include generated/predicates.qbk] [include generated/distance_predicates.qbk] [include generated/adaptors.qbk] diff --git a/doc/src/tools/doxygen_xml2qbk/configuration.hpp b/doc/src/tools/doxygen_xml2qbk/configuration.hpp index 3b107abdb..1747cf813 100644 --- a/doc/src/tools/doxygen_xml2qbk/configuration.hpp +++ b/doc/src/tools/doxygen_xml2qbk/configuration.hpp @@ -29,7 +29,6 @@ struct configuration std::string skip_namespace; std::string output_style; - std::string index_id_path; }; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp index 08b50f5f1..123041039 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -49,6 +49,7 @@ struct parameter : public base_element std::string type; std::string default_value; // for template parameters std::string fulltype; // post-processed + std::string fulltype_without_links; }; struct enumeration_value : public base_element @@ -128,6 +129,8 @@ struct function : public element std::string return_type, return_description; std::string precondition; + std::string return_type_without_links; + bool unique; function() diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp index b6c229a04..6f24f36c7 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -78,8 +78,6 @@ int main(int argc, char** argv) ("output_style", po::value(&config.output_style), "Docbook output style. Value:'alt'") - ("index_id_path", po::value(&config.index_id_path), - "The QBK index ID path") ; po::variables_map varmap; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index 3d8e316f9..3a1429f8f 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -131,9 +131,12 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, std::string refid = node->first_attribute("refid")->value(); if ( !refid.empty() ) { - contents += std::string("[link ") + refid + " "; - parse_para(node->first_node(), config, contents, skip, false); - contents += "]"; + std::string str; + parse_para(node->first_node(), config, str, skip, false); + boost::replace_all(str, "\\", "\\\\"); + boost::replace_all(str, "[", "\\["); + boost::replace_all(str, "]", "\\]"); + contents += std::string("[link ") + refid + " " + str + "]"; parse_para(node->next_sibling(), config, contents, skip, false); return; } @@ -185,6 +188,7 @@ static void parse_parameter(rapidxml::xml_node<>* node, configuration const& con if ( config.output_style == "alt" ) { + p.fulltype_without_links = p.fulltype; p.fulltype.clear(); parse_para(node->first_node(), config, p.fulltype, p.skip); } @@ -471,13 +475,15 @@ static void parse_function(rapidxml::xml_node<>* node, configuration const& conf } else if (full == ".type") { + get_contents(node->first_node(), f.return_type); + if ( config.output_style == "alt" ) { + f.return_type_without_links = f.return_type; bool dummy_skip; + f.return_type.clear(); parse_para(node->first_node(), config, f.return_type, dummy_skip); } - else - get_contents(node->first_node(), f.return_type); } else if (full == ".detaileddescription.para.simplesect") { diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 79b859545..ab4d20d54 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -58,29 +58,17 @@ std::string qbk_escaped(std::string const& s) -void quickbook_template_parameter_list(std::vector const& parameters, std::ostream& out, bool multiline = false, bool show_defaults = true) +void quickbook_template_parameter_list(std::vector const& parameters, std::ostream& out) { - std::string next_param; - if ( multiline ) - { - if ( 2 < parameters.size() ) - next_param = std::string(",\n") + " "; - else - next_param = ", "; - } - else - next_param = ", "; - - if (!parameters.empty()) { out << "template<" ; bool first = true; BOOST_FOREACH(parameter const& p, parameters) { - out << (first ? "" : next_param.c_str()) << p.fulltype; + out << (first ? "" : ", ") << p.fulltype; - if ( show_defaults && !p.default_value.empty() ) + if ( !p.default_value.empty() ) out << " = " << p.default_value; first = false; @@ -90,39 +78,30 @@ void quickbook_template_parameter_list(std::vector const& parameters, } -void quickbook_synopsis(function const& f, std::ostream& out, bool multiline = false, bool show_defaults = true) +void quickbook_synopsis(function const& f, std::ostream& out) { out << "``"; - quickbook_template_parameter_list(f.template_parameters, out, multiline, show_defaults); + quickbook_template_parameter_list(f.template_parameters, out); - unsigned offset = 1; // '(' switch(f.type) { case function_constructor_destructor : out << f.name; - offset += f.name.size(); break; case function_member : out << f.return_type << " " << f.name; - offset += f.return_type.size() + 1 + f.name.size(); break; case function_free : out << f.definition; - offset += f.definition.size(); break; case function_define : out << "#define " << f.name; - offset += 8 + f.name.size(); break; case function_unknown : // do nothing break; } - - std::string after_parameter(", "); - if ( multiline && 2 < f.parameters.size() ) - after_parameter = std::string(",\n") + std::string(offset, ' '); - + // Output the parameters // Because we want to be able to skip, we cannot use the argstring { @@ -132,7 +111,7 @@ void quickbook_synopsis(function const& f, std::ostream& out, bool multiline = f if (! p.skip) { out - << (first ? "(" : after_parameter) + << (first ? "(" : ", ") << p.fulltype << (p.fulltype.empty() ? "" : " ") << p.name << (p.default_value.empty() ? "" : " = ") @@ -538,7 +517,7 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s quickbook_markup(cos.qbk_markup, markup_before, markup_synopsis, out); out << "[heading Synopsis]" << std::endl << "``"; - quickbook_template_parameter_list(cos.template_parameters, out, false); + quickbook_template_parameter_list(cos.template_parameters, out); out << (cos.is_class ? "class" : "struct") << " " << short_name << std::endl; @@ -651,14 +630,14 @@ std::string remove_template_parameters(std::string const& name) if ( next_begin == next_end ) { - res += name.substr(prev_i, next_begin); + res += name.substr(prev_i, next_begin - prev_i); break; } else if ( next_begin < next_end ) { i = next_begin + 1; if ( blocks_counter == 0 ) - res += name.substr(prev_i, next_begin) + "<...>"; + res += name.substr(prev_i, next_begin - prev_i) + "<...>"; blocks_counter++; } else @@ -704,7 +683,7 @@ void quickbook_synopsis_short(function const& f, std::ostream& out) { if ( !p.skip && p.default_value.empty() ) { - out << (first ? "(" : ", ") << remove_template_parameters(p.fulltype); + out << (first ? "(" : ", ") << remove_template_parameters(p.fulltype_without_links); first = false; } } @@ -719,7 +698,6 @@ void quickbook_synopsis_short(function const& f, std::ostream& out) void quickbook_output_function(std::vector const& functions, function_type type, configuration const& config, - std::string const& qbk_id_prefix, std::ostream& out, bool display_all = false) { @@ -732,16 +710,9 @@ void quickbook_output_function(std::vector const& functions, if (display_all || f.type == type) { - out << "[["; - if ( !config.index_id_path.empty() ) - out << "[link " << config.index_id_path - << "." << qbk_id_prefix << i << " "; - out << "`"; + out << "[[[link " << f.id << " `"; quickbook_synopsis_short(f, out); - out << "`"; - if ( !config.index_id_path.empty() ) - out << "]"; - out << "][" << f.brief_description << "]]" << std::endl; + out << "`]][" << f.brief_description << "]]" << std::endl; } } out << "]" << std::endl @@ -779,10 +750,204 @@ void output_paragraphs_note_warning(element const& el, std::ostream & out) } } +void inline_str_with_links(std::string const& str, std::ostream & out) +{ + typedef std::string::size_type ST; + + bool link_started = false; + bool first = true; + for ( ST i = 0 ; i < str.size() ; ++i ) + { + if ( !link_started ) + { + if ( str[i] == '[' && str.substr(i, 6) == "[link " ) + { + if ( !first ) + { + out << "`"; + first = true; + } + link_started = true; + out << "[^[link "; + i += 5; // (+ 6 - 1) + } + else + { + if ( first ) + { + out << "`"; + first = false; + } + out << str[i]; + } + } + else + { + if ( str[i] == '\\' ) + { + out << str[i]; + ++i; + if ( i < str.size() ) + out << str[i]; + } + else if ( str[i] == ']' ) + { + out << "]]"; + link_started = false; + } + else + out << str[i]; + } + } + + if ( !first ) + out << "`"; + if ( link_started ) + out << "]]"; +} + +void quickbook_template_parameter_list_alt(std::vector const& parameters, std::ostream& out) +{ + std::string next_param; + + if ( 2 < parameters.size() ) + next_param = std::string("`,`\n") + " "; + else + next_param = "`,` "; + + if (!parameters.empty()) + { + out << "`template<`" ; + bool first = true; + BOOST_FOREACH(parameter const& p, parameters) + { + out << (first ? "" : next_param.c_str()); + inline_str_with_links(p.fulltype, out); + + if ( !p.default_value.empty() ) + { + out << " = "; + inline_str_with_links(p.default_value, out); + } + + first = false; + } + out << "`>`"; + } +} + +void quickbook_synopsis_alt(function const& f, std::ostream& out) +{ + out << "[pre\n"; + quickbook_template_parameter_list_alt(f.template_parameters, out); + out << "\n"; + + unsigned offset = 1; // '(' + switch(f.type) + { + case function_constructor_destructor : + out << "`" << f.name << "`"; + offset += f.name.size(); + break; + case function_member : + inline_str_with_links(f.return_type, out); + out << " `" << f.name << "`"; + offset += f.return_type_without_links.size() + 1 + f.name.size(); + break; + case function_free : + inline_str_with_links(f.definition, out); + offset += f.definition.size(); + break; + case function_define : + out << "`#define " << f.name << "`"; + offset += 8 + f.name.size(); + break; + case function_unknown : + // do nothing + break; + } + + std::string par_end("`,` "); + if ( 2 < f.parameters.size() ) + par_end = std::string("`,`\n") + std::string(offset, ' '); + + // Output the parameters + // Because we want to be able to skip, we cannot use the argstring + { + bool first = true; + BOOST_FOREACH(parameter const& p, f.parameters) + { + if (! p.skip) + { + out << (first ? "`(`" : par_end); + if ( !p.fulltype.empty() ) + { + inline_str_with_links(p.fulltype, out); + out << " "; + } + out << "`" << p.name << "`"; + if ( !p.default_value.empty() ) + { + out << " = "; + inline_str_with_links(p.default_value, out); + } + first = false; + } + } + if (! first) + { + out << "`)`\n"; + } + else if (f.type != function_define) + { + out << "`()`\n"; + } + } + + out << "]" + << std::endl + << std::endl; +} + +void quickbook_synopsis_alt(class_or_struct const& cos, configuration const& config, std::ostream & out) +{ + std::string short_name = namespace_skipped(cos.fullname, config); + + out << "[pre\n"; + + quickbook_template_parameter_list_alt(cos.template_parameters, out); + out << "\n"; + + out << (cos.is_class ? "`class " : "`struct "); + out << short_name.substr(short_name.find_last_of("::") + 1) << "`" << std::endl; + + if (! cos.base_classes.empty()) + { + out << "` : "; + bool first = true; + BOOST_FOREACH(base_class const& bc, cos.base_classes) + { + if (! first) + { + out << std::endl << " , "; + } + out << output_if_different(bc.derivation, "private") + << output_if_different(bc.virtuality, "non-virtual") + << namespace_skipped(bc.name, config); + first = false; + } + out << "`" << std::endl; + } + + out << "`{`" << std::endl + << "` // ...`" << std::endl + << "`};`" << std::endl + << "]" << std::endl << std::endl; +} + void quickbook_output_detail_function(std::vector const& functions, function_type type, configuration const& config, - std::string const& qbk_id_prefix, std::ostream& out, bool display_all = false) { @@ -794,7 +959,9 @@ void quickbook_output_detail_function(std::vector const& functions, // Section std::stringstream ss; quickbook_synopsis_short(f, ss); - out << "[section:" << qbk_id_prefix << i << " " << replace_brackets(ss.str()) << "]" << std::endl; + if ( config.output_style == "alt" && !f.id.empty() ) + out << "[#" << f.id << "]" << std::endl; + out << "[section " << replace_brackets(ss.str()) << "]" << std::endl; // Brief description out << f.brief_description << std::endl; @@ -810,7 +977,7 @@ void quickbook_output_detail_function(std::vector const& functions, // Synopsis quickbook_markup(f.qbk_markup, markup_before, markup_synopsis, out); out << "[heading Synopsis]" << std::endl; - quickbook_synopsis(f, out, true, true); + quickbook_synopsis_alt(f, out); quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out); // Parameters @@ -823,7 +990,9 @@ void quickbook_output_detail_function(std::vector const& functions, { if (!p.skip) { - out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl; + out << "[["; + inline_str_with_links(p.fulltype, out); + out << "][ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl; } } out << "]" << std::endl; @@ -860,16 +1029,13 @@ void quickbook_output_detail_function(std::vector const& functions, void quickbook_output_alt(documentation const& doc, configuration const& config, std::ostream& out) { - std::string id_prefix("function"); - if ( !doc.group_id.empty() ) { - id_prefix = doc.group_id + ".function"; std::cout << "[section:" << doc.group_id << " " << doc.group_title << "]" << std::endl; } - quickbook_output_function(doc.functions, function_constructor_destructor, config, id_prefix, out, true); - quickbook_output_detail_function(doc.functions, function_unknown, config, "function", out, true); + quickbook_output_function(doc.functions, function_constructor_destructor, config, out, true); + quickbook_output_detail_function(doc.functions, function_unknown, config, out, true); if ( !doc.group_id.empty() ) { @@ -908,9 +1074,9 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi std::string short_name = namespace_skipped(cos.fullname, config); std::string section_name = to_section_name(short_name); - // Write the parsed function - out << "[section:" << section_name << " " << short_name << "]" << std::endl - << std::endl; + if ( config.output_style == "alt" && !cos.id.empty() ) + out << "[#" << cos.id << "]" << std::endl; + out << "[section:" << section_name << " " << short_name << "]" << std::endl << std::endl; quickbook_output_indexterm(short_name, out); @@ -936,34 +1102,8 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi // Class synposis quickbook_markup(cos.qbk_markup, markup_before, markup_synopsis, out); - out << "[heading Synopsis]" << std::endl - << "``"; - quickbook_template_parameter_list(cos.template_parameters, out, true, true); - out << (cos.is_class ? "class " : "struct "); - out << short_name.substr(short_name.find_last_of("::") + 1) << std::endl; - - if (! cos.base_classes.empty()) - { - out << " : "; - bool first = true; - BOOST_FOREACH(base_class const& bc, cos.base_classes) - { - if (! first) - { - out << std::endl << " , "; - } - out << output_if_different(bc.derivation, "private") - << output_if_different(bc.virtuality, "non-virtual") - << namespace_skipped(bc.name, config); - first = false; - } - out << std::endl; - } - - out << "{" << std::endl - << " // ..." << std::endl - << "};" << std::endl - << "``" << std::endl << std::endl; + out << "[heading Synopsis]" << std::endl; + quickbook_synopsis_alt(cos, config, out); quickbook_markup(cos.qbk_markup, markup_after, markup_synopsis, out); // Template parameters @@ -1011,8 +1151,11 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi if ( e.brief_description.empty() ) continue; - out << "[[`" << e.name; - out << "`][" << e.brief_description << "]]" << std::endl; + out << "[["; + if ( !e.id.empty() ) + out << "[#" << e.id << "]" << " "; + out << "`" << e.name << "`"; + out << "][" << e.brief_description << "]]" << std::endl; } out << "]" << std::endl << std::endl; @@ -1033,13 +1176,13 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi if (display_ctors && counts[function_constructor_destructor] > 0) { out << "[heading Constructor(s) and destructor]" << std::endl; - quickbook_output_function(cos.functions, function_constructor_destructor, config, section_name + ".member", out); + quickbook_output_function(cos.functions, function_constructor_destructor, config, out); } if (display_members && counts[function_member] > 0) { out << "[heading Member(s)]" << std::endl; - quickbook_output_function(cos.functions, function_member, config, section_name + ".member", out); + quickbook_output_function(cos.functions, function_member, config, out); } // Details start @@ -1048,9 +1191,9 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi // out << "[br]" << std::endl; if (display_ctors && counts[function_constructor_destructor] > 0) - quickbook_output_detail_function(cos.functions, function_constructor_destructor, config, "member", out); + quickbook_output_detail_function(cos.functions, function_constructor_destructor, config, out); if (display_members && counts[function_member] > 0) - quickbook_output_detail_function(cos.functions, function_member, config, "member", out); + quickbook_output_detail_function(cos.functions, function_member, config, out); // Details end diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index 9fdded50c..cf1544bc8 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -45,7 +45,7 @@ struct node_s_mem_static_tag {}; // m_max_elems_per_node = 2; /*! -Linear r-tree creation algorithm parameters. +\brief Linear r-tree creation algorithm parameters. \tparam MaxElements Maximum number of elements in nodes. \tparam MinElements Minimum number of elements in nodes. @@ -61,7 +61,7 @@ struct linear }; /*! -Quadratic r-tree creation algorithm parameters. +\brief Quadratic r-tree creation algorithm parameters. \tparam MaxElements Maximum number of elements in nodes. \tparam MinElements Minimum number of elements in nodes. @@ -87,7 +87,7 @@ struct default_rstar_reinserted_elements }} // namespace options::detail /*! -Quadratic r-tree creation algorithm parameters. +\brief R*-tree creation algorithm parameters. \tparam MaxElements Maximum number of elements in nodes. \tparam MinElements Minimum number of elements in nodes. @@ -116,36 +116,54 @@ struct rstar namespace runtime { +/*! +\brief Linear r-tree creation algorithm parameters. +*/ class linear { public: - linear(size_t max_elements_, size_t min_elements_) - : max_elements(max_elements_) - , min_elements(min_elements_) + /*! + \brief The constructor. + + \param max_elements Maximum number of elements in nodes. + \param min_elements Minimum number of elements in nodes. + */ + linear(size_t max_elements, size_t min_elements) + : m_max_elements(max_elements) + , m_min_elements(min_elements) {} - size_t get_max_elements() const { return max_elements; } - size_t get_min_elements() const { return min_elements; } + size_t get_max_elements() const { return m_max_elements; } + size_t get_min_elements() const { return m_min_elements; } private: - size_t max_elements; - size_t min_elements; + size_t m_max_elements; + size_t m_min_elements; }; +/*! +\brief Quadratic r-tree creation algorithm parameters. +*/ class quadratic { public: - quadratic(size_t max_elements_, size_t min_elements_) - : max_elements(max_elements_) - , min_elements(min_elements_) + /*! + \brief The constructor. + + \param max_elements Maximum number of elements in nodes. + \param min_elements Minimum number of elements in nodes. + */ + quadratic(size_t max_elements, size_t min_elements) + : m_max_elements(max_elements) + , m_min_elements(min_elements) {} - size_t get_max_elements() const { return max_elements; } - size_t get_min_elements() const { return min_elements; } + size_t get_max_elements() const { return m_max_elements; } + size_t get_min_elements() const { return m_min_elements; } private: - size_t max_elements; - size_t min_elements; + size_t m_max_elements; + size_t m_min_elements; }; namespace detail { @@ -157,33 +175,46 @@ inline size_t default_rstar_reinserted_elements() } // namespace options::detail +/*! +\brief R*-tree creation algorithm parameters. +*/ class rstar { public: - rstar(size_t max_elements_, - size_t min_elements_, - size_t overlap_cost_threshold_ = 0, - 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( - detail::default_rstar_reinserted_elements() == reinserted_elements_ ? - (max_elements_ * 3) / 10 : - reinserted_elements_ + /*! + \brief The constructor. + + \param max_elements Maximum number of elements in nodes. + \param min_elements Minimum number of elements in nodes. + \param overlap_cost_threshold The number of leaf node children elements above which + nearly minimum overlap cost is calculated instead of minimum + overlap cost. If 0 minimum overlap cost is always calculated. + \param reinserted_elements Number of elements reinserted by forced reinsertions algorithm. + */ + rstar(size_t max_elements, + size_t min_elements, + size_t overlap_cost_threshold = 0, + size_t reinserted_elements = detail::default_rstar_reinserted_elements()) + : m_max_elements(max_elements) + , m_min_elements(min_elements) + , m_overlap_cost_threshold(overlap_cost_threshold) + , m_reinserted_elements( + detail::default_rstar_reinserted_elements() == reinserted_elements ? + (max_elements * 3) / 10 : + reinserted_elements ) {} - size_t get_max_elements() const { return max_elements; } - size_t get_min_elements() const { return min_elements; } - size_t get_overlap_cost_threshold() const { return overlap_cost_threshold; } - size_t get_reinserted_elements() const { return reinserted_elements; } + size_t get_max_elements() const { return m_max_elements; } + size_t get_min_elements() const { return m_min_elements; } + size_t get_overlap_cost_threshold() const { return m_overlap_cost_threshold; } + size_t get_reinserted_elements() const { return m_reinserted_elements; } private: - size_t max_elements; - size_t min_elements; - size_t overlap_cost_threshold; - size_t reinserted_elements; + size_t m_max_elements; + size_t m_min_elements; + size_t m_overlap_cost_threshold; + size_t m_reinserted_elements; }; } diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index cdadd40c9..cd64fa24e 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -497,7 +497,7 @@ public: /*! \brief Remove a value from the container. - In contrast to the \c std::set or \c std::map \c erase() method + In contrast to the \c std::set or std::map erase() method this method removes only one value from the container. \param value The value which will be removed from the container. @@ -521,7 +521,7 @@ public: /*! \brief Remove a range of values from the container. - In contrast to the \c std::set or \c std::map \c erase() method + In contrast to the \c std::set or std::map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. @@ -552,7 +552,7 @@ public: /*! \brief Remove a range of values from the container. - In contrast to the \c std::set or \c std::map \c erase() method + In contrast to the \c std::set or std::map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values. @@ -755,7 +755,7 @@ public: If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. */ template - inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, OutIter out_it) const + inline size_type nearest_query(DistancesPredicates const& dpred, size_type k, OutIter out_it) const { return raw_nearest_k(dpred, k, detail::empty(), out_it); } @@ -814,7 +814,7 @@ public: If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. */ template - inline size_type nearest_query(DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) const + inline size_type nearest_query(DistancesPredicates const& dpred, size_type k, Predicates const& pred, OutIter out_it) const { return raw_nearest_k(dpred, k, pred, out_it); } @@ -933,7 +933,7 @@ public: \par Throws Nothing. */ - inline translator_type const& translator() const + inline const translator_type & translator() const { return m_translator; } @@ -1273,7 +1273,7 @@ inline void insert(rtree & tree, Range co /*! \brief Remove a value from the container. -Remove a value from the container. In contrast to the \c std::set or \c std::map \c erase() method +Remove a value from the container. In contrast to the \c std::set or std::map erase() method this function removes only one value from the container. \ingroup rtree_functions @@ -1293,7 +1293,7 @@ remove(rtree & tree, Value const& v) /*! \brief Remove a range of values from the container. -Remove a range of values from the container. In contrast to the \c std::set or \c std::map \c erase() method +Remove a range of values from the container. In contrast to the \c std::set or std::map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. @@ -1316,7 +1316,7 @@ remove(rtree & tree, Iterator first, Iter /*! \brief Remove a range of values from the container. -Remove a range of values from the container. In contrast to the \c std::set or \c std::map \c erase() method +Remove a range of values from the container. In contrast to the \c std::set or std::map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. @@ -1399,7 +1399,7 @@ inline size_t nearest_query(rtree const& \return The number of found values. */ template -inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, size_t k, OutIter out_it) +inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, typename rtree::size_type k, OutIter out_it) { return tree.nearest_query(dpred, k, out_it); } @@ -1418,7 +1418,7 @@ inline size_t nearest_query(rtree const& \return The number of found values. */ template -inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, size_t k, Predicates const& pred, OutIter out_it) +inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, typename rtree::size_type k, Predicates const& pred, OutIter out_it) { return tree.nearest_query(dpred, k, pred, out_it); } From 79940890844da8a11110e8844230eeae298ab566 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 13 Jan 2013 20:02:19 +0000 Subject: [PATCH 282/366] Rtree docs improved. [SVN r82483] --- doc/generated/rtree.qbk | 82 +++--- doc/generated/rtree_functions.qbk | 48 ++-- doc/html/geometry_index/r_tree/reference.html | 250 +++++++++++++----- doc/html/index.html | 2 +- .../geometry/extensions/index/rtree/rtree.hpp | 113 +++++--- 5 files changed, 325 insertions(+), 170 deletions(-) diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 9c545d4a4..aa8040098 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -7,7 +7,7 @@ The R-tree spatial index. [heading Description] -The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms. +This is self-balancing spatial index capable to store various types of Values and balancing algorithms. [heading Parameters] The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. @@ -628,24 +628,24 @@ Finds one value meeting distances predicates, e.g. nearest to some Point. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, -* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], -* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], -* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. +* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, +* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], +* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], +* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. [heading Synopsis] [pre @@ -675,24 +675,24 @@ Finds one value meeting distances predicates and spatial predicates, e.g. neares It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, -* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], -* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], -* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. +* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, +* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], +* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], +* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. [*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. @@ -742,24 +742,24 @@ Finds k values meeting distances predicates, e.g. k nearest values to some Point It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, -* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], -* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], -* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. +* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, +* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], +* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], +* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. [heading Synopsis] [pre @@ -792,24 +792,24 @@ Finds k values meeting distances predicates and spatial predicates, e.g. k neare It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()] - default, -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: -* [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()] - default, -* [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()], -* [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()], -* [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]. +* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, +* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], +* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], +* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. MinRelation and MaxRelation describes bounds and can be generated by following functions: -* [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()], -* [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()], -* [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]. +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. [*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 1e4901a5d..963721dc8 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -24,7 +24,8 @@ [section insert(rtree<...> &, Value const &)] Insert a value to the index. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c rtree::insert(value_type const&)]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -45,7 +46,8 @@ Insert a value to the index. [section insert(rtree<...> &, Iterator, Iterator)] Insert a range of values to the index. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d rtree::insert(Iterator, Iterator)]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -70,7 +72,8 @@ Insert a range of values to the index. [section insert(rtree<...> &, Range const &)] Insert a range of values to the index. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 rtree::insert(Range const&)]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -93,7 +96,9 @@ Insert a range of values to the index. Remove a value from the container. [heading Description] -Remove a value from the container. In contrast to the [^std::set] or [^std::map erase()] method this function removes only one value from the container.[heading Synopsis] +Remove a value from the container. In contrast to the [^std::set] or [^std::map erase()] method this function removes only one value from the container. + +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a rtree::remove(value_type const&)]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -117,7 +122,9 @@ Remove a value from the container. In contrast to the [^std::set] or [^std::map Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. + +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd rtree::remove(Iterator, Iterator)]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -145,7 +152,9 @@ The number of removed values. Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. + +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c rtree::remove(Range const&)]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -169,7 +178,8 @@ The number of removed values. [section spatial_query(rtree<...> const &, Predicates const &, OutIter)] Find values meeting spatial predicates. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 rtree::spatial_query]] with parameters [^(Predicates const&, OutIter)].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -197,7 +207,8 @@ The number of found values. [section nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)] Find the value meeting distances predicates. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const& dpred, value_type & v)].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -224,7 +235,8 @@ The number of found values. [section nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)] Find the value meeting distances and spatial predicates. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const& dpred, Predicates const& pred, value_type & v)].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -254,7 +266,8 @@ The number of found values. [section nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, OutIter)] Find k values meeting distances predicates. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const & dpred, size_type k, OutIter out_it)].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -284,7 +297,8 @@ The number of found values. [section nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, Predicates const &, OutIter)] Find k values meeting distances and spatial predicates. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const & dpred, size_type k, Predicates const & pred, OutIter out_it)].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -317,7 +331,8 @@ The number of found values. [section clear(rtree<...> &)] Remove all values from the index. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 rtree::clear()]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -337,7 +352,8 @@ Remove all values from the index. [section size(rtree<...> const &)] Get the number of values stored in the index. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd rtree::size()]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -359,7 +375,8 @@ The number of values stored in the index. [section empty(rtree<...> const &)] Query if there are no values stored in the index. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c rtree::empty()]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -381,7 +398,8 @@ true if there are no values in the index. [section box(rtree<...> const &)] Get the box containing all stored values or an invalid box if the index has no values. -[heading Synopsis] +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1adf62005332a5fa9119ff03185e0c5143 rtree::box()]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 3348703fc..0a4f70eeb 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                                                                      - + The R-tree spatial index.

                                                                      @@ -55,8 +55,8 @@ The R-tree spatial index. Description

                                                                      - The R-tree spatial index. This is self-balancing spatial index capable - to store various types of Values and balancing algorithms. + This is self-balancing spatial index capable to store various types of + Values and balancing algorithms.

                                                                      @@ -2552,14 +2552,14 @@ The R-tree spatial index.

                                                                      @@ -2569,17 +2569,17 @@ The R-tree spatial index.

                                                                      @@ -2588,13 +2588,13 @@ The R-tree spatial index.

                                                                      @@ -2708,14 +2708,14 @@ The R-tree spatial index.

                                                                      @@ -2725,17 +2725,17 @@ The R-tree spatial index.

                                                                      @@ -2744,13 +2744,13 @@ The R-tree spatial index.

                                                                      @@ -2931,14 +2931,14 @@ The R-tree spatial index.

                                                                      @@ -2948,17 +2948,17 @@ The R-tree spatial index.

                                                                      @@ -2967,13 +2967,13 @@ The R-tree spatial index.

                                                                      @@ -3106,14 +3106,14 @@ The R-tree spatial index.

                                                                      @@ -3123,17 +3123,17 @@ The R-tree spatial index.

                                                                      @@ -3142,13 +3142,13 @@ The R-tree spatial index.

                                                                      @@ -3860,6 +3860,14 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::insert(value_type + const&). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -3869,7 +3877,7 @@ The R-tree spatial index.
                                                                       void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -3949,6 +3957,14 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::insert(Iterator, + Iterator). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -3961,7 +3977,7 @@ The R-tree spatial index.
                                                                                                           Iterator last)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -4057,6 +4073,14 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::insert(Range + const&). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -4067,7 +4091,7 @@ The R-tree spatial index.
                                                                       void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -4154,6 +4178,10 @@ The R-tree spatial index. or std::map erase() method this function removes only one value from the container.

                                                                      +

                                                                      + It calls rtree::remove(value_type + const&). +

                                                                      Synopsis @@ -4261,6 +4289,10 @@ The R-tree spatial index. to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

                                                                      +

                                                                      + It calls rtree::remove(Iterator, + Iterator). +

                                                                      Synopsis @@ -4386,6 +4418,10 @@ The R-tree spatial index. to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

                                                                      +

                                                                      + It calls rtree::remove(Range + const&). +

                                                                      Synopsis @@ -4485,6 +4521,14 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::spatial_query + with parameters (Predicates const&, OutIter). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -4498,7 +4542,7 @@ The R-tree spatial index.
                                                                                                                    OutIter out_it)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -4584,7 +4628,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -4601,6 +4645,15 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::nearest_query + with parameters (DistancesPredicates const& dpred, value_type + & v). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -4613,7 +4666,7 @@ The R-tree spatial index.
                                                                                                                    Value & v)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -4700,7 +4753,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -4718,6 +4771,15 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::nearest_query + with parameters (DistancesPredicates const& dpred, Predicates + const& pred, value_type & v). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -4732,7 +4794,7 @@ The R-tree spatial index.
                                                                                                                    Value & v)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -4836,7 +4898,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -4854,6 +4916,15 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::nearest_query + with parameters (DistancesPredicates const & dpred, size_type + k, OutIter out_it). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -4868,7 +4939,7 @@ The R-tree spatial index.
                                                                                                                    OutIter out_it)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -4973,7 +5044,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -4991,6 +5062,15 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::nearest_query + with parameters (DistancesPredicates const & dpred, size_type + k, Predicates const & pred, OutIter out_it). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -5007,7 +5087,7 @@ The R-tree spatial index.
                                                                                                                    OutIter out_it)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -5129,7 +5209,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -5146,6 +5226,13 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::clear(). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -5155,7 +5242,7 @@ The R-tree spatial index.
                                                                       void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -5215,6 +5302,13 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::size(). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -5224,7 +5318,7 @@ The R-tree spatial index.
                                                                       size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -5274,7 +5368,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -5291,6 +5385,13 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::empty(). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -5300,7 +5401,7 @@ The R-tree spatial index.
                                                                       bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -5350,7 +5451,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -5368,6 +5469,13 @@ The R-tree spatial index.

                                                                      + Description +
                                                                      +

                                                                      + It calls rtree::box(). +

                                                                      +
                                                                      + Synopsis
                                                                      template<typename Value,
                                                                      @@ -5377,7 +5485,7 @@ The R-tree spatial index.
                                                                       rtree<Value, Options, Translator, Allocator>::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)
                                                                       
                                                                      - + Parameter(s)
                                                                      @@ -5427,7 +5535,7 @@ The R-tree spatial index.
                                                                      - + Returns

                                                                      @@ -5445,7 +5553,7 @@ The R-tree spatial index. boost::geometry::index::linear

                                                                - + Linear r-tree creation algorithm parameters.

                                                                @@ -5520,7 +5628,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                                                            - + Quadratic r-tree creation algorithm parameters.

                                                            @@ -5595,7 +5703,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                                                        - + R*-tree creation algorithm parameters.

                                                        @@ -5699,7 +5807,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

                                                    - + Linear r-tree creation algorithm parameters.

                                                    @@ -5835,7 +5943,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

                                                - + Quadratic r-tree creation algorithm parameters.

                                                @@ -5971,7 +6079,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

                                            - + R*-tree creation algorithm parameters.

                                            @@ -7764,7 +7872,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

                                          - + The default translator.

                                          @@ -7834,7 +7942,7 @@ The default translator. boost::geometry::index::translator::index

                                      - + The index translator.

                                      diff --git a/doc/html/index.html b/doc/html/index.html index ba1ccfdcd..78950d3cb 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
                                    - +

                                    Last revised: January 13, 2013 at 15:29:29 GMT

                                    Last revised: January 13, 2013 at 20:01:19 GMT


                                    diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index cd64fa24e..468ccf456 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -59,8 +59,7 @@ namespace boost { namespace geometry { namespace index { /*! \brief The R-tree spatial index. -The R-tree spatial index. This is self-balancing spatial index capable to store various types -of Values and balancing algorithms. +This is self-balancing spatial index capable to store various types of Values and balancing algorithms. \par Parameters The user must pass a type defining the Parameters which will @@ -631,22 +630,22 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li boost::geometry::index::to_nearest() - default, - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest() - default, + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li boost::geometry::index::unbounded() - default, - \li boost::geometry::index::min_bounded(), - \li boost::geometry::index::max_bounded(), - \li boost::geometry::index::bounded(). + \li \c boost::geometry::index::unbounded() - default, + \li \c boost::geometry::index::min_bounded(), + \li \c boost::geometry::index::max_bounded(), + \li \c boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li boost::geometry::index::to_nearest(), - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest(), + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). \param dpred The distances predicates or a Point. @@ -671,22 +670,22 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li boost::geometry::index::to_nearest() - default, - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest() - default, + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li boost::geometry::index::unbounded() - default, - \li boost::geometry::index::min_bounded(), - \li boost::geometry::index::max_bounded(), - \li boost::geometry::index::bounded(). + \li \c boost::geometry::index::unbounded() - default, + \li \c boost::geometry::index::min_bounded(), + \li \c boost::geometry::index::max_bounded(), + \li \c boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li boost::geometry::index::to_nearest(), - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest(), + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. @@ -728,22 +727,22 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li boost::geometry::index::to_nearest() - default, - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest() - default, + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li boost::geometry::index::unbounded() - default, - \li boost::geometry::index::min_bounded(), - \li boost::geometry::index::max_bounded(), - \li boost::geometry::index::bounded(). + \li \c boost::geometry::index::unbounded() - default, + \li \c boost::geometry::index::min_bounded(), + \li \c boost::geometry::index::max_bounded(), + \li \c boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li boost::geometry::index::to_nearest(), - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest(), + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). \param dpred The distances predicates or a Point. \param k The max number of values. @@ -768,22 +767,22 @@ public: It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - \li boost::geometry::index::to_nearest() - default, - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest() - default, + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - \li boost::geometry::index::unbounded() - default, - \li boost::geometry::index::min_bounded(), - \li boost::geometry::index::max_bounded(), - \li boost::geometry::index::bounded(). + \li \c boost::geometry::index::unbounded() - default, + \li \c boost::geometry::index::min_bounded(), + \li \c boost::geometry::index::max_bounded(), + \li \c boost::geometry::index::bounded(). MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li boost::geometry::index::to_nearest(), - \li boost::geometry::index::to_centroid(), - \li boost::geometry::index::to_furthest(). + \li \c boost::geometry::index::to_nearest(), + \li \c boost::geometry::index::to_centroid(), + \li \c boost::geometry::index::to_furthest(). Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. @@ -1230,6 +1229,8 @@ private: /*! \brief Insert a value to the index. +It calls rtree::insert(value_type const&). + \ingroup rtree_functions \param tree The spatial index. @@ -1244,6 +1245,8 @@ inline void insert(rtree & tree, Value co /*! \brief Insert a range of values to the index. +It calls rtree::insert(Iterator, Iterator). + \ingroup rtree_functions \param tree The spatial index. @@ -1259,6 +1262,8 @@ inline void insert(rtree & tree, Iterator /*! \brief Insert a range of values to the index. +It calls rtree::insert(Range const&). + \ingroup rtree_functions \param tree The spatial index. @@ -1276,6 +1281,8 @@ inline void insert(rtree & tree, Range co Remove a value from the container. In contrast to the \c std::set or std::map erase() method this function removes only one value from the container. +It calls rtree::remove(value_type const&). + \ingroup rtree_functions \param tree The spatial index. @@ -1298,6 +1305,8 @@ it doesn't take iterators pointing to values stored in this container. It remove to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. +It calls rtree::remove(Iterator, Iterator). + \ingroup rtree_functions \param tree The spatial index. @@ -1320,6 +1329,8 @@ Remove a range of values from the container. In contrast to the \c std::set or < it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. +It calls rtree::remove(Range const&). + \ingroup rtree_functions \param tree The spatial index. @@ -1337,6 +1348,8 @@ remove(rtree & tree, Range const& rng) /*! \brief Find values meeting spatial predicates. +It calls \c rtree::spatial_query with parameters (Predicates const&, OutIter). + \ingroup rtree_functions \param tree The spatial index. @@ -1354,6 +1367,8 @@ inline size_t spatial_query(rtree const& /*! \brief Find the value meeting distances predicates. +It calls \c rtree::nearest_query with parameters (DistancesPredicates const& dpred, value_type & v). + \ingroup rtree_functions \param tree The spatial index. @@ -1371,6 +1386,8 @@ inline size_t nearest_query(rtree const& /*! \brief Find the value meeting distances and spatial predicates. +It calls \c rtree::nearest_query with parameters (DistancesPredicates const& dpred, Predicates const& pred, value_type & v). + \ingroup rtree_functions \param tree The spatial index. @@ -1389,6 +1406,8 @@ inline size_t nearest_query(rtree const& /*! \brief Find k values meeting distances predicates. +It calls \c rtree::nearest_query with parameters (DistancesPredicates const & dpred, size_type k, OutIter out_it). + \ingroup rtree_functions \param tree The spatial index. @@ -1407,6 +1426,8 @@ inline size_t nearest_query(rtree const& /*! \brief Find k values meeting distances and spatial predicates. +It calls \c rtree::nearest_query with parameters (DistancesPredicates const & dpred, size_type k, Predicates const & pred, OutIter out_it). + \ingroup rtree_functions \param tree The spatial index. @@ -1426,6 +1447,8 @@ inline size_t nearest_query(rtree const& /*! \brief Remove all values from the index. +It calls \c rtree::clear(). + \ingroup rtree_functions \param tree The spatial index. @@ -1439,6 +1462,8 @@ inline void clear(rtree & tree) /*! \brief Get the number of values stored in the index. +It calls \c rtree::size(). + \ingroup rtree_functions \param tree The spatial index. @@ -1454,6 +1479,8 @@ inline size_t size(rtree const& tree) /*! \brief Query if there are no values stored in the index. +It calls \c rtree::empty(). + \ingroup rtree_functions \param tree The spatial index. @@ -1469,6 +1496,8 @@ inline bool empty(rtree const& tree) /*! \brief Get the box containing all stored values or an invalid box if the index has no values. +It calls \c rtree::box(). + \ingroup rtree_functions \param tree The spatial index. From 83c187c90ff7f2d0e279a8c31978d93608db810c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 14 Jan 2013 12:20:26 +0000 Subject: [PATCH 283/366] doxygen_qbk2xml: fixed text style blocks generation for special cases [SVN r82488] --- .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 56 +++++++++++-------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index 3a1429f8f..d7b0345f4 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -62,7 +62,7 @@ This is used for different purposes within Doxygen. So we have to list explicitly either where to recurse, or where not to... */ -static void parse_para(rapidxml::xml_node<>* node, configuration const& config, std::string& contents, bool& skip, bool first = true) +static void parse_para(rapidxml::xml_node<>* node, configuration const& config, std::string& contents, bool& skip, bool first = true, bool in_block = false) { if (node != NULL) { @@ -78,49 +78,49 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, else if ( boost::equals(name, "itemizedlist") ) { contents += "\n\n"; - parse_para(node->first_node(), config, contents, skip); + parse_para(node->first_node(), config, contents, skip, true, in_block); contents += "\n"; - parse_para(node->next_sibling(), config, contents, skip); + parse_para(node->next_sibling(), config, contents, skip, true, in_block); return; } else if ( boost::equals(name, "listitem") ) { contents += "* "; - parse_para(node->first_node(), config, contents, skip); + parse_para(node->first_node(), config, contents, skip, true, in_block); contents += "\n"; - parse_para(node->next_sibling(), config, contents, skip); + parse_para(node->next_sibling(), config, contents, skip, true, in_block); return; } else if ( boost::equals(name, "verbatim") ) { contents += "\n``\n"; - parse_para(node->first_node(), config, contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false, in_block); contents += "``\n"; - parse_para(node->next_sibling(), config, contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false, in_block); return; } else if ( boost::equals(name, "bold") ) { contents += "[*"; - parse_para(node->first_node(), config, contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false, true); contents += "]"; - parse_para(node->next_sibling(), config, contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false, in_block); return; } else if ( boost::equals(name, "emphasis") ) { contents += "['"; - parse_para(node->first_node(), config, contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false, true); contents += "]"; - parse_para(node->next_sibling(), config, contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false, in_block); return; } else if ( boost::equals(name, "computeroutput") ) { contents += "[^"; - parse_para(node->first_node(), config, contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false, true); contents += "]"; - parse_para(node->next_sibling(), config, contents, skip, false); + parse_para(node->next_sibling(), config, contents, skip, false, in_block); return; } else if ( boost::equals(name, "ref") ) @@ -131,13 +131,10 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, std::string refid = node->first_attribute("refid")->value(); if ( !refid.empty() ) { - std::string str; - parse_para(node->first_node(), config, str, skip, false); - boost::replace_all(str, "\\", "\\\\"); - boost::replace_all(str, "[", "\\["); - boost::replace_all(str, "]", "\\]"); - contents += std::string("[link ") + refid + " " + str + "]"; - parse_para(node->next_sibling(), config, contents, skip, false); + contents += std::string("[link ") + refid + " "; + parse_para(node->first_node(), config, contents, skip, false, true); + contents += "]"; + parse_para(node->next_sibling(), config, contents, skip, false, in_block); return; } } @@ -153,7 +150,20 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, } else if (node->type() == rapidxml::node_data) { - contents += node->value(); + std::string str = node->value(); + + if ( str.find("aaa") != std::string::npos ) + { + int a = 10; + } + + if ( in_block ) + { + boost::replace_all(str, "\\", "\\\\"); + boost::replace_all(str, "[", "\\["); + boost::replace_all(str, "]", "\\]"); + } + contents += str; //std::cout << "DATA: " << node->name() << "=" << node->value() << std::endl; } else @@ -161,8 +171,8 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, //std::cout << "OTHER: " << node->name() << "=" << node->value() << std::endl; } - parse_para(node->first_node(), config, contents, skip, false); - parse_para(node->next_sibling(), config, contents, skip, false); + parse_para(node->first_node(), config, contents, skip, false, in_block); + parse_para(node->next_sibling(), config, contents, skip, false, in_block); } } From 9c13998f628eac43b6a12875ddf80e300647d6c1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 14 Jan 2013 17:40:31 +0000 Subject: [PATCH 284/366] doxygen_xml2qbk - Keywords coloring in paragraphs added - data inside computeroutput which is not inside other block is translated to `...`. Reference updated. [SVN r82492] --- doc/generated/distance_predicates.qbk | 14 +- doc/generated/predicates.qbk | 10 +- doc/generated/rtree.qbk | 60 ++--- doc/generated/rtree_functions.qbk | 16 +- doc/html/geometry_index/r_tree/reference.html | 221 +++++++++--------- doc/html/index.html | 2 +- .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 54 +++-- 7 files changed, 195 insertions(+), 182 deletions(-) diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index bf35fed97..556a1264b 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -98,8 +98,8 @@ Generate a distance predicate. This defines distances bounds which are used by k [heading Parameter(s)] [table [[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] -[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^`bgi::to_nearest(Point)`], [^`bgi::to_centroid(Point)`] or [^`bgi::to_furthest(Point)`]. ]] +[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^`bgi::to_nearest(min_distance)`], [^`bgi::to_centroid(min_distance)`] or [^`bgi::to_furthest(min_distance)`]. ]] ] [endsect] @@ -117,8 +117,8 @@ Generate a distance predicate. This defines distances bounds which are used by k [heading Parameter(s)] [table [[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] -[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^`bgi::to_nearest(Point)`], [^`bgi::to_centroid(Point)`] or [^`bgi::to_furthest(Point)`]. ]] +[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^`bgi::to_nearest(max_distance)`], [^`bgi::to_centroid(max_distance)`] or [^`bgi::to_furthest(max_distance)`]. ]] ] [endsect] @@ -140,9 +140,9 @@ Generate a distance predicate. This defines distances bounds which are used by k [heading Parameter(s)] [table [[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^bgi::to_nearest(Point)], [^bgi::to_centroid(Point)] or [^bgi::to_furthest(Point)]. ]] -[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^bgi::to_nearest(min_distance)], [^bgi::to_centroid(min_distance)] or [^bgi::to_furthest(min_distance)]. ]] -[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^bgi::to_nearest(max_distance)], [^bgi::to_centroid(max_distance)] or [^bgi::to_furthest(max_distance)]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^`bgi::to_nearest(Point)`], [^`bgi::to_centroid(Point)`] or [^`bgi::to_furthest(Point)`]. ]] +[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^`bgi::to_nearest(min_distance)`], [^`bgi::to_centroid(min_distance)`] or [^`bgi::to_furthest(min_distance)`]. ]] +[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^`bgi::to_nearest(max_distance)`], [^`bgi::to_centroid(max_distance)`] or [^`bgi::to_furthest(max_distance)`]. ]] ] [endsect] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 4db049b63..acb289d5c 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -47,7 +47,7 @@ A wrapper around user-defined functor describing if Value should be returned by Generate [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 covered_by()]] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::covered_by(Indexable, Geometry)] returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::covered_by(Indexable, Geometry)`] returns true.[heading Synopsis] [pre `template<``typename Geometry``>` `detail::covered_by boost::geometry::index::covered_by``(``Geometry const &` `g``)` @@ -65,7 +65,7 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret Generate [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d disjoint()]] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::disjoint(Indexable, Geometry)] returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::disjoint(Indexable, Geometry)`] returns true.[heading Synopsis] [pre `template<``typename Geometry``>` `detail::disjoint boost::geometry::index::disjoint``(``Geometry const &` `g``)` @@ -83,7 +83,7 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret Generate [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 intersects()]] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::intersects(Indexable, Geometry)] returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::intersects(Indexable, Geometry)`] returns true.[heading Synopsis] [pre `template<``typename Geometry``>` `detail::intersects boost::geometry::index::intersects``(``Geometry const &` `g``)` @@ -101,7 +101,7 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::overlaps(Indexable, Geometry)] returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::overlaps(Indexable, Geometry)`] returns true.[heading Synopsis] [pre `template<``typename Geometry``>` `detail::overlaps boost::geometry::index::overlaps``(``Geometry const &` `g``)` @@ -119,7 +119,7 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. [heading Description] -Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^bg::within(Indexable, Geometry)] returns true.[heading Synopsis] +Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::within(Indexable, Geometry)`] returns true.[heading Synopsis] [pre `template<``typename Geometry``>` `detail::within boost::geometry::index::within``(``Geometry const &` `g``)` diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index aa8040098..c1cc80373 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -35,7 +35,7 @@ Predefined algorithms with run-time parameters are: [heading Translator] -The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (called Indexables). It also handles [^std::pair] and [^boost::tuple]. For example, if [^std::pair] is stored in the container, the default translator translates from [^std::pair const&] to [^Box const&]. +The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (called Indexables). It also handles [^`std::pair`] and [^`boost::tuple`]. For example, if [^`std::pair`] is stored in the container, the default translator translates from [^`std::pair const&`] to [^`Box const&`]. [heading Header] `#include ` @@ -484,7 +484,7 @@ Insert a range of values to the index. Remove a value from the container. [heading Description] -In contrast to the [^std::set] or [^std::map erase()] method this method removes only one value from the container.[heading Synopsis] +In contrast to the [^`std::set`] or [^`std::map erase()`] method this method removes only one value from the container.[heading Synopsis] [pre [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &` `value``)` @@ -515,7 +515,7 @@ In contrast to the [^std::set] or [^std::map erase()] method this method removes Remove a range of values from the container. [heading Description] -In contrast to the [^std::set] or [^std::map erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +In contrast to the [^`std::set`] or [^`std::map erase()`] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] [pre `template<``typename Iterator``>` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(``Iterator` `first``,` `Iterator` `last``)` @@ -547,7 +547,7 @@ The number of removed values. Remove a range of values from the container. [heading Description] -In contrast to the [^std::set] or [^std::map erase()] method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] +In contrast to the [^`std::set`] or [^`std::map erase()`] method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] [pre `template<``typename Range``>` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(``Range const &` `rng``)` @@ -578,7 +578,7 @@ The number of removed values. Finds values meeting spatial predicates, e.g. intersecting some Box. [heading Description] -[*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. +[*Spatial predicates] may be a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. It may be generated by one of the functions listed below: @@ -587,15 +587,15 @@ It may be generated by one of the functions listed below: * [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, * [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], -* [^! [link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^! [link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^! [link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^! [link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^! [link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] +* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] * [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. -Those predicates may be passed together in [^std::pair] or [^boost::tuple].[heading Synopsis] +Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] [pre `template<``typename Predicates``,` `typename OutIter``>` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)` @@ -624,7 +624,7 @@ The number of values found. Finds one value meeting distances predicates, e.g. nearest to some Point. [heading Description] -[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. +[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: @@ -671,7 +671,7 @@ If Value copy constructor or copy assignment throws. Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. [heading Description] -[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. +[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: @@ -694,7 +694,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f * [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], * [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. -[*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. +[*Spatial predicates] may be a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. It may be generated by one of the functions listed below: @@ -703,15 +703,15 @@ It may be generated by one of the functions listed below: * [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, * [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], -* [^! [link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^! [link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^! [link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^! [link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^! [link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] +* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] * [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. -Those predicates may be passed together in [^std::pair] or [^boost::tuple].[heading Synopsis] +Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] [pre `template<``typename DistancesPredicates``,` `typename Predicates``>` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` @@ -738,7 +738,7 @@ If Value copy constructor or copy assignment throws. Finds k values meeting distances predicates, e.g. k nearest values to some Point. [heading Description] -[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. +[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: @@ -788,7 +788,7 @@ If Value copy constructor or copy assignment throws. If OutIter dereference or i Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. [heading Description] -[*Distances predicates] may be a [^Point]. In this the case the Value closest to [^Point] is returned. +[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: @@ -811,7 +811,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f * [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], * [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. -[*Spatial predicates] may be a [^Geometry]. In this case Values intersecting the [^Geometry] are returned. +[*Spatial predicates] may be a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. It may be generated by one of the functions listed below: @@ -820,15 +820,15 @@ It may be generated by one of the functions listed below: * [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, * [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], -* [^! [link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^! [link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^! [link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^! [link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^! [link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] +* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] * [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. -Those predicates may be passed together in [^std::pair] or [^boost::tuple].[heading Synopsis] +Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] [pre `template<``typename DistancesPredicates``,` `typename Predicates``,` @@ -908,7 +908,7 @@ Nothing. Returns the box containing all values stored in the container. [heading Description] -Returns the box containing all values stored in the container. If the container is empty the result of [^geometry::assign_inverse()] is returned.[heading Synopsis] +Returns the box containing all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis] [pre [^[link classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d box_type]] `box``()` diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 963721dc8..17d1d17d3 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -96,7 +96,7 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d Remove a value from the container. [heading Description] -Remove a value from the container. In contrast to the [^std::set] or [^std::map erase()] method this function removes only one value from the container. +Remove a value from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method this function removes only one value from the container. It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a rtree::remove(value_type const&)]].[heading Synopsis] [pre @@ -122,7 +122,7 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f8941 Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. +Remove a range of values from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd rtree::remove(Iterator, Iterator)]].[heading Synopsis] [pre @@ -152,7 +152,7 @@ The number of removed values. Remove a range of values from the container. [heading Description] -Remove a range of values from the container. In contrast to the [^std::set] or [^std::map erase()] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. +Remove a range of values from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c rtree::remove(Range const&)]].[heading Synopsis] [pre @@ -179,7 +179,7 @@ The number of removed values. Find values meeting spatial predicates. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 rtree::spatial_query]] with parameters [^(Predicates const&, OutIter)].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 rtree::spatial_query]] with parameters [^`(Predicates const&, OutIter)`].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -208,7 +208,7 @@ The number of found values. Find the value meeting distances predicates. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const& dpred, value_type & v)].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const& dpred, value_type & v)`].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -236,7 +236,7 @@ The number of found values. Find the value meeting distances and spatial predicates. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const& dpred, Predicates const& pred, value_type & v)].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const& dpred, Predicates const& pred, value_type & v)`].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -267,7 +267,7 @@ The number of found values. Find k values meeting distances predicates. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const & dpred, size_type k, OutIter out_it)].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const & dpred, size_type k, OutIter out_it)`].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -298,7 +298,7 @@ The number of found values. Find k values meeting distances and spatial predicates. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^(DistancesPredicates const & dpred, size_type k, Predicates const & pred, OutIter out_it)].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const & dpred, size_type k, Predicates const & pred, OutIter out_it)`].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 0a4f70eeb..e98967daa 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                                  - + The R-tree spatial index.

                                  @@ -104,11 +104,13 @@ The R-tree spatial index. it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or - Box concepts (called Indexables). It also handles std::pair<Indexable, - T> and boost::tuple<Indexable, ...>. - For example, if std::pair<Box, int> is stored - in the container, the default translator translates from std::pair<Box, - int> const& to Box const&. + Box concepts (called Indexables). It also handles std::pair<Indexable, + T> + and boost::tuple<Indexable, + ...>. For example, + if std::pair<Box, int> + is stored in the container, the default translator translates from std::pair<Box, int> const& + to Box const&.

                                  @@ -2060,8 +2062,9 @@ The R-tree spatial index. Description

                                  - In contrast to the std::set or std::map erase() - method this method removes only one value from the container. + In contrast to the std::set + or std::map erase() method this method removes + only one value from the container.

                                  @@ -2162,11 +2165,11 @@ The R-tree spatial index. Description

                                  - In contrast to the std::set or std::map erase() - method it doesn't take iterators pointing to values stored in this container. - It removes values equal to these passed as a range. Furthermore this - method removes only one value for each one passed in the range, not all - equal values. + In contrast to the std::set + or std::map erase() method it doesn't take iterators + pointing to values stored in this container. It removes values equal + to these passed as a range. Furthermore this method removes only one + value for each one passed in the range, not all equal values.

                                  @@ -2286,10 +2289,10 @@ The R-tree spatial index. Description

                                  - In contrast to the std::set or std::map erase() - method it removes values equal to these passed as a range. Furthermore, - this method removes only one value for each one passed in the range, - not all equal values. + In contrast to the std::set + or std::map erase() method it removes values + equal to these passed as a range. Furthermore, this method removes only + one value for each one passed in the range, not all equal values.

                                  @@ -2391,9 +2394,9 @@ The R-tree spatial index. Description

                                  - Spatial predicates may be a Geometry. - In this case Values intersecting the Geometry are - returned. + Spatial predicates may be a Geometry. In this case Values + intersecting the Geometry + are returned.

                                  It may be generated by one of the functions listed below: @@ -2416,27 +2419,27 @@ The R-tree spatial index. boost::geometry::index::within(),

                                • - ! boost::geometry::index::covered_by(), + ! boost::geometry::index::covered_by(),
                                • - ! boost::geometry::index::disjoint(), + ! boost::geometry::index::disjoint(),
                                • - ! boost::geometry::index::intersects(), + ! boost::geometry::index::intersects(),
                                • - ! boost::geometry::index::overlaps(), + ! boost::geometry::index::overlaps(),
                                • - ! boost::geometry::index::within() + ! boost::geometry::index::within()
                                • boost::geometry::index::value().

                                - Those predicates may be passed together in std::pair - or boost::tuple. + Those predicates may be passed together in std::pair + or boost::tuple.

                                @@ -2543,8 +2546,9 @@ The R-tree spatial index. Description

                                - Distances predicates may be a Point. - In this the case the Value closest to Point is returned. + Distances predicates may be a Point. In this the case the + Value closest to Point + is returned.

                                It is possible to define how distance to Value is calculated. This is @@ -2699,8 +2703,9 @@ The R-tree spatial index. Description

                                - Distances predicates may be a Point. - In this the case the Value closest to Point is returned. + Distances predicates may be a Point. In this the case the + Value closest to Point + is returned.

                                It is possible to define how distance to Value is calculated. This is @@ -2754,9 +2759,9 @@ The R-tree spatial index.

                              - Spatial predicates may be a Geometry. - In this case Values intersecting the Geometry are - returned. + Spatial predicates may be a Geometry. In this case Values + intersecting the Geometry + are returned.

                              It may be generated by one of the functions listed below: @@ -2779,27 +2784,27 @@ The R-tree spatial index. boost::geometry::index::within(),

                            • - ! boost::geometry::index::covered_by(), + ! boost::geometry::index::covered_by(),
                            • - ! boost::geometry::index::disjoint(), + ! boost::geometry::index::disjoint(),
                            • - ! boost::geometry::index::intersects(), + ! boost::geometry::index::intersects(),
                            • - ! boost::geometry::index::overlaps(), + ! boost::geometry::index::overlaps(),
                            • - ! boost::geometry::index::within() + ! boost::geometry::index::within()
                            • boost::geometry::index::value().

                            - Those predicates may be passed together in std::pair - or boost::tuple. + Those predicates may be passed together in std::pair + or boost::tuple.

                            @@ -2922,8 +2927,9 @@ The R-tree spatial index. Description

                            - Distances predicates may be a Point. - In this the case the Value closest to Point is returned. + Distances predicates may be a Point. In this the case the + Value closest to Point + is returned.

                            It is possible to define how distance to Value is calculated. This is @@ -3097,8 +3103,9 @@ The R-tree spatial index. Description

                            - Distances predicates may be a Point. - In this the case the Value closest to Point is returned. + Distances predicates may be a Point. In this the case the + Value closest to Point + is returned.

                            It is possible to define how distance to Value is calculated. This is @@ -3152,9 +3159,9 @@ The R-tree spatial index.

                          - Spatial predicates may be a Geometry. - In this case Values intersecting the Geometry are - returned. + Spatial predicates may be a Geometry. In this case Values + intersecting the Geometry + are returned.

                          It may be generated by one of the functions listed below: @@ -3177,27 +3184,27 @@ The R-tree spatial index. boost::geometry::index::within(),

                        • - ! boost::geometry::index::covered_by(), + ! boost::geometry::index::covered_by(),
                        • - ! boost::geometry::index::disjoint(), + ! boost::geometry::index::disjoint(),
                        • - ! boost::geometry::index::intersects(), + ! boost::geometry::index::intersects(),
                        • - ! boost::geometry::index::overlaps(), + ! boost::geometry::index::overlaps(),
                        • - ! boost::geometry::index::within() + ! boost::geometry::index::within()
                        • boost::geometry::index::value().

                        - Those predicates may be passed together in std::pair - or boost::tuple. + Those predicates may be passed together in std::pair + or boost::tuple.

                        @@ -3416,8 +3423,7 @@ The R-tree spatial index.

                        Returns the box containing all values stored in the container. If the - container is empty the result of geometry::assign_inverse() - is returned. + container is empty the result of geometry::assign_inverse() is returned.

                        @@ -4174,9 +4180,8 @@ The R-tree spatial index. Description

                        - Remove a value from the container. In contrast to the std::set - or std::map erase() method this function removes only - one value from the container. + Remove a value from the container. In contrast to the std::set or std::map erase() method this function removes + only one value from the container.

                        It calls rtree::remove(value_type @@ -4283,8 +4288,7 @@ The R-tree spatial index. Description

                        - Remove a range of values from the container. In contrast to the std::set - or std::map erase() method it doesn't take iterators + Remove a range of values from the container. In contrast to the std::set or std::map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. @@ -4413,10 +4417,9 @@ The R-tree spatial index. Description

                        - Remove a range of values from the container. In contrast to the std::set - or std::map erase() method it removes values equal - to these passed as a range. Furthermore this method removes only one - value for each one passed in the range, not all equal values. + Remove a range of values from the container. In contrast to the std::set or std::map erase() method it removes values + equal to these passed as a range. Furthermore this method removes only + one value for each one passed in the range, not all equal values.

                        It calls rtree::remove(Range @@ -4525,7 +4528,7 @@ The R-tree spatial index.

                        It calls rtree::spatial_query - with parameters (Predicates const&, OutIter). + with parameters (Predicates const&, OutIter).

                        @@ -4649,8 +4652,8 @@ The R-tree spatial index.

                        It calls rtree::nearest_query - with parameters (DistancesPredicates const& dpred, value_type - & v). + with parameters (DistancesPredicates const& dpred, value_type + & v).

                        @@ -4775,8 +4778,11 @@ The R-tree spatial index.

                        It calls rtree::nearest_query - with parameters (DistancesPredicates const& dpred, Predicates - const& pred, value_type & v). + with parameters (DistancesPredicates const& dpred, Predicates + const& + pred, + value_type & + v).

                        @@ -4920,8 +4926,10 @@ The R-tree spatial index.

                        It calls rtree::nearest_query - with parameters (DistancesPredicates const & dpred, size_type - k, OutIter out_it). + with parameters (DistancesPredicates const + & dpred, size_type + k, + OutIter out_it).

                        @@ -5066,8 +5074,12 @@ The R-tree spatial index.

                        It calls rtree::nearest_query - with parameters (DistancesPredicates const & dpred, size_type - k, Predicates const & pred, OutIter out_it). + with parameters (DistancesPredicates const + & dpred, size_type + k, + Predicates const + & pred, OutIter + out_it).

                        @@ -5553,7 +5565,7 @@ The R-tree spatial index. boost::geometry::index::linear

                      - + Linear r-tree creation algorithm parameters.

                      @@ -5628,7 +5640,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                  - + Quadratic r-tree creation algorithm parameters.

                  @@ -5703,7 +5715,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                  - + R*-tree creation algorithm parameters.

                  @@ -5807,7 +5819,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

              - + Linear r-tree creation algorithm parameters.

              @@ -5943,7 +5955,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

        - + Quadratic r-tree creation algorithm parameters.

        @@ -6079,7 +6091,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

      - + R*-tree creation algorithm parameters.

      @@ -6468,8 +6480,7 @@ R*-tree creation algorithm parameters.

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::covered_by(Indexable, Geometry) - returns true. + will be returned by the query if bg::covered_by(Indexable, Geometry) returns true.

      @@ -6540,8 +6551,7 @@ R*-tree creation algorithm parameters.

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::disjoint(Indexable, Geometry) - returns true. + will be returned by the query if bg::disjoint(Indexable, Geometry) returns true.

      @@ -6612,8 +6622,7 @@ R*-tree creation algorithm parameters.

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::intersects(Indexable, Geometry) - returns true. + will be returned by the query if bg::intersects(Indexable, Geometry) returns true.

      @@ -6684,8 +6693,7 @@ R*-tree creation algorithm parameters.

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::overlaps(Indexable, Geometry) - returns true. + will be returned by the query if bg::overlaps(Indexable, Geometry) returns true.

      @@ -6756,8 +6764,7 @@ R*-tree creation algorithm parameters.

      Generate a predicate defining Value and Geometry relationship. Value - will be returned by the query if bg::within(Indexable, Geometry) - returns true. + will be returned by the query if bg::within(Indexable, Geometry) returns true.

      @@ -7312,8 +7319,8 @@ R*-tree creation algorithm parameters.

      - The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point).

      @@ -7330,8 +7337,8 @@ R*-tree creation algorithm parameters.

      - The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), - bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). + The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance).

      @@ -7408,8 +7415,8 @@ R*-tree creation algorithm parameters.

      - The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point).

      @@ -7426,8 +7433,8 @@ R*-tree creation algorithm parameters.

      - The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), - bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). + The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance).

      @@ -7509,8 +7516,8 @@ R*-tree creation algorithm parameters.

      - The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). + The point relation. This may be generated by bgi::to_nearest(Point), + bgi::to_centroid(Point) or bgi::to_furthest(Point).

      @@ -7527,8 +7534,8 @@ R*-tree creation algorithm parameters.

      - The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), - bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance). + The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), + bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance).

      @@ -7545,8 +7552,8 @@ R*-tree creation algorithm parameters.

      - The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), - bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance). + The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), + bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance).

      @@ -7872,7 +7879,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

      - + The default translator.

      @@ -7942,7 +7949,7 @@ The default translator. boost::geometry::index::translator::index

      - + The index translator.

      diff --git a/doc/html/index.html b/doc/html/index.html index 78950d3cb..7c92506e6 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -56,7 +56,7 @@
      - +

      Last revised: January 13, 2013 at 20:01:19 GMT

      Last revised: January 14, 2013 at 17:39:48 GMT


      diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index d7b0345f4..43b2bd8df 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -62,7 +62,14 @@ This is used for different purposes within Doxygen. So we have to list explicitly either where to recurse, or where not to... */ -static void parse_para(rapidxml::xml_node<>* node, configuration const& config, std::string& contents, bool& skip, bool first = true, bool in_block = false) +enum text_block +{ + not_in_block, + in_code_block, + in_block +}; + +static void parse_para(rapidxml::xml_node<>* node, configuration const& config, std::string& contents, bool& skip, bool first = true, text_block tb = not_in_block) { if (node != NULL) { @@ -78,49 +85,49 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, else if ( boost::equals(name, "itemizedlist") ) { contents += "\n\n"; - parse_para(node->first_node(), config, contents, skip, true, in_block); + parse_para(node->first_node(), config, contents, skip, true, tb); contents += "\n"; - parse_para(node->next_sibling(), config, contents, skip, true, in_block); + parse_para(node->next_sibling(), config, contents, skip, true, tb); return; } else if ( boost::equals(name, "listitem") ) { contents += "* "; - parse_para(node->first_node(), config, contents, skip, true, in_block); + parse_para(node->first_node(), config, contents, skip, true, tb); contents += "\n"; - parse_para(node->next_sibling(), config, contents, skip, true, in_block); + parse_para(node->next_sibling(), config, contents, skip, true, tb); return; } else if ( boost::equals(name, "verbatim") ) { contents += "\n``\n"; - parse_para(node->first_node(), config, contents, skip, false, in_block); + parse_para(node->first_node(), config, contents, skip, false, tb); contents += "``\n"; - parse_para(node->next_sibling(), config, contents, skip, false, in_block); + parse_para(node->next_sibling(), config, contents, skip, false, tb); return; } else if ( boost::equals(name, "bold") ) { contents += "[*"; - parse_para(node->first_node(), config, contents, skip, false, true); + parse_para(node->first_node(), config, contents, skip, false, in_block); contents += "]"; - parse_para(node->next_sibling(), config, contents, skip, false, in_block); + parse_para(node->next_sibling(), config, contents, skip, false, tb); return; } else if ( boost::equals(name, "emphasis") ) { contents += "['"; - parse_para(node->first_node(), config, contents, skip, false, true); + parse_para(node->first_node(), config, contents, skip, false, in_block); contents += "]"; - parse_para(node->next_sibling(), config, contents, skip, false, in_block); + parse_para(node->next_sibling(), config, contents, skip, false, tb); return; } else if ( boost::equals(name, "computeroutput") ) { contents += "[^"; - parse_para(node->first_node(), config, contents, skip, false, true); + parse_para(node->first_node(), config, contents, skip, false, tb == in_block ? in_block : in_code_block); contents += "]"; - parse_para(node->next_sibling(), config, contents, skip, false, in_block); + parse_para(node->next_sibling(), config, contents, skip, false, tb); return; } else if ( boost::equals(name, "ref") ) @@ -132,9 +139,9 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, if ( !refid.empty() ) { contents += std::string("[link ") + refid + " "; - parse_para(node->first_node(), config, contents, skip, false, true); + parse_para(node->first_node(), config, contents, skip, false, in_block); contents += "]"; - parse_para(node->next_sibling(), config, contents, skip, false, in_block); + parse_para(node->next_sibling(), config, contents, skip, false, tb); return; } } @@ -151,18 +158,17 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, else if (node->type() == rapidxml::node_data) { std::string str = node->value(); - - if ( str.find("aaa") != std::string::npos ) - { - int a = 10; - } - - if ( in_block ) + if ( tb == in_block ) { boost::replace_all(str, "\\", "\\\\"); boost::replace_all(str, "[", "\\["); boost::replace_all(str, "]", "\\]"); } + else if ( tb == in_code_block ) + { + if ( str.find('`') == std::string::npos ) + str = std::string("`") + str + "`"; + } contents += str; //std::cout << "DATA: " << node->name() << "=" << node->value() << std::endl; } @@ -171,8 +177,8 @@ static void parse_para(rapidxml::xml_node<>* node, configuration const& config, //std::cout << "OTHER: " << node->name() << "=" << node->value() << std::endl; } - parse_para(node->first_node(), config, contents, skip, false, in_block); - parse_para(node->next_sibling(), config, contents, skip, false, in_block); + parse_para(node->first_node(), config, contents, skip, false, tb); + parse_para(node->next_sibling(), config, contents, skip, false, tb); } } From 9cd5626c9068737184e49d45728d6af0a50c9a04 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Jan 2013 04:08:16 +0000 Subject: [PATCH 285/366] rtree - added move ctor taking allocator distance predicates - docs improved doxygen_xml2qbk - group output finished (enums, defines and functions) [SVN r82509] --- doc/generated/adaptors.qbk | 1 + doc/generated/distance_predicates.qbk | 17 +- doc/generated/inserters.qbk | 1 + doc/generated/predicates.qbk | 1 + doc/generated/rtree.qbk | 32 +- doc/generated/rtree_functions.qbk | 1 + doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 20 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 801 +++++++++++------- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 2 +- .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 2 +- .../doxygen_xml2qbk/quickbook_output.hpp | 190 ++++- .../extensions/index/distance_predicates.hpp | 32 +- .../geometry/extensions/index/rtree/rtree.hpp | 37 +- 20 files changed, 751 insertions(+), 412 deletions(-) diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index 298b89454..4bfedeaa6 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__adaptors.xml] [section:group__adaptors Adaptors (boost::geometry::index::adaptors::)] +[heading Functions] [table [[Function][Description]] [[[link group__adaptors_1ga8e094e1f312fc00336a3536f51a69468 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index 556a1264b..d64066de2 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__distance__predicates.xml] [section:group__distance__predicates Distance predicates (boost::geometry::index::)] +[heading Functions] [table [[Function][Description]] [[[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] Point-Indexable relationship. ]] @@ -80,7 +81,7 @@ Generate a distance predicate. This defines distances bounds which are used by k [heading Parameter(s)] [table [[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 index::to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 index::to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 index::to_furthest()]] with [^`Point`] passed as a parameter. ]] ] [endsect] @@ -98,8 +99,8 @@ Generate a distance predicate. This defines distances bounds which are used by k [heading Parameter(s)] [table [[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^`bgi::to_nearest(Point)`], [^`bgi::to_centroid(Point)`] or [^`bgi::to_furthest(Point)`]. ]] -[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^`bgi::to_nearest(min_distance)`], [^`bgi::to_centroid(min_distance)`] or [^`bgi::to_furthest(min_distance)`]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with [^`Point`] passed as a parameter. ]] +[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] ] [endsect] @@ -117,8 +118,8 @@ Generate a distance predicate. This defines distances bounds which are used by k [heading Parameter(s)] [table [[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^`bgi::to_nearest(Point)`], [^`bgi::to_centroid(Point)`] or [^`bgi::to_furthest(Point)`]. ]] -[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^`bgi::to_nearest(max_distance)`], [^`bgi::to_centroid(max_distance)`] or [^`bgi::to_furthest(max_distance)`]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with [^`Point`] passed as a parameter. ]] +[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] ] [endsect] @@ -140,9 +141,9 @@ Generate a distance predicate. This defines distances bounds which are used by k [heading Parameter(s)] [table [[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^`bgi::to_nearest(Point)`], [^`bgi::to_centroid(Point)`] or [^`bgi::to_furthest(Point)`]. ]] -[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^`bgi::to_nearest(min_distance)`], [^`bgi::to_centroid(min_distance)`] or [^`bgi::to_furthest(min_distance)`]. ]] -[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^`bgi::to_nearest(max_distance)`], [^`bgi::to_centroid(max_distance)`] or [^`bgi::to_furthest(max_distance)`]. ]] +[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with [^`Point`] passed as a parameter. ]] +[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] +[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] ] [endsect] diff --git a/doc/generated/inserters.qbk b/doc/generated/inserters.qbk index 83ee2e194..6f619857d 100644 --- a/doc/generated/inserters.qbk +++ b/doc/generated/inserters.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__inserters.xml] [section:group__inserters Inserters (boost::geometry::index::)] +[heading Functions] [table [[Function][Description]] [[[link group__inserters_1gab22c33d31b9805250e54ee6d6d240a47 `inserter(Container &)`]][Insert iterator generator. ]] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index acb289d5c..fcdc627ec 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__predicates.xml] [section:group__predicates Spatial predicates (boost::geometry::index::)] +[heading Functions] [table [[Function][Description]] [[[link group__predicates_1ga150fd87dc53e5472f8905bb5827428e2 `empty()`]][Generate empty predicate. ]] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index c1cc80373..ee99b1f53 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -84,6 +84,7 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[[link classboost_1_1geometry_1_1index_1_1rtree_1a006904b4e7dcef1fd1efcb70a010964f `rtree(rtree const &)`]][The copy constructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1ac59521aa9a9b69104fa25c0f7b705354 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1a050fca8af38fe25548d4c22830b55bf2 `rtree(rtree &&)`]][The moving constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae0b4e031554daa6e6e8d3a0f95630260 `rtree(rtree &&, allocator_type const &)`]][The moving constructor. ]] ] [heading Member(s)] @@ -315,7 +316,36 @@ It uses parameters, translator and allocator from the source tree.[heading Synop [[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&`][ `src` ][The rtree which content will be moved.]] ] [heading Throws] -If allocator move constructor throws. +Nothing. + +[endsect] + +[#classboost_1_1geometry_1_1index_1_1rtree_1ae0b4e031554daa6e6e8d3a0f95630260] +[section rtree(rtree &&, allocator_type const &)] +The moving constructor. + +[heading Description] +It uses parameters and translator from the source tree.[heading Synopsis] +[pre + +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&` `src``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &` `allocator``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&`][ `src` ][The rtree which content will be moved. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &`][ `allocator` ][The allocator.]] +] +[heading Throws] + + +* If allocator copy constructor throws. +* If Value copy constructor throws (only if allocators aren't equal). +* If allocation throws (only if allocators aren't equal). +* When memory allocation for Node fails (only if allocators aren't equal). + + [endsect] diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 17d1d17d3..50dc8a0fc 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__rtree__functions.xml] [section:group__rtree__functions Functions related to the rtree (boost::geometry::index::)] +[heading Functions] [table [[Function][Description]] [[[link group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] 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 15d0dabb0..67dc200d8 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 a79271bfb..300395d3a 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 - + @@ -55,7 +55,7 @@

      rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
       
      -
        +
        • Value - type of object which will be stored in the container,
        • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

          -
            +
            • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

              -
                +
                • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                  If comparison of two Values is required, the default translator:

                  -
                    +
                    • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 89d93898c..b0b2ee116 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                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 + 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 [2]. + close to some point in space [2].

                The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -180,7 +180,7 @@

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

                -
                  +
                  • capable to store arbitrary Value type,
                  • @@ -201,20 +201,20 @@
                  -

                  -

                  [1] +


                  +

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

                  -

                  [2] +

                  [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                  -

                  [3] +

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

                  -

                  [4] +

                  [4] 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 ffbfe87f5..d13849cbd 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index e98967daa..d71acb5e3 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -47,12 +47,12 @@ boost::geometry::index::rtree

                  - + The R-tree spatial index.

                  - Description + Description

                  This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

                  - Parameters + Parameters

                  The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

                  Predefined algorithms with compile-time parameters are:

                  -
                    +
                    • boost::geometry::index::linear,
                    • @@ -84,7 +84,7 @@ The R-tree spatial index.

                      Predefined algorithms with run-time parameters are:

                      -
                        +
                        - Translator + Translator

                        The Translator translates from Value to Indexable each time r-tree requires @@ -114,14 +114,14 @@ The R-tree spatial index.

                        - Header + Header

                        #include <boost/geometry/extensions/index/rtree/rtree.hpp>

                        - Synopsis + Synopsis
                        template<typename Value,
                                  typename Parameters,
                        @@ -134,7 +134,7 @@ The R-tree spatial index.
                         
                        - Template + Template parameter(s)
                        @@ -208,7 +208,7 @@ The R-tree spatial index.
                        - Typedef(s) + Typedef(s)
                        @@ -316,7 +316,7 @@ The R-tree spatial index.
                        - Constructor(s) + Constructor(s) and destructor
                        @@ -440,11 +440,25 @@ The R-tree spatial index.

                        + + + +
                        +

                        + rtree(rtree &&, + allocator_type const + &) +

                        +
                        +

                        + The moving constructor. +

                        +
                        - Member(s) + Member(s)
                        @@ -762,13 +776,13 @@ The R-tree spatial index.

                        - Synopsis + Synopsis
                        rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                         
                        - Parameter(s) + Parameter(s)
                        @@ -833,7 +847,7 @@ The R-tree spatial index.
                        - Throws + Throws

                        If allocator default constructor throws. @@ -849,7 +863,7 @@ The R-tree spatial index.

                        - Synopsis + Synopsis
                        rtree(parameters_type parameters,
                               translator_type const & translator,
                        @@ -857,7 +871,7 @@ The R-tree spatial index.
                         
                        - Parameter(s) + Parameter(s)
                        @@ -939,7 +953,7 @@ The R-tree spatial index.
                        - Throws + Throws

                        If allocator copy constructor throws. @@ -955,7 +969,7 @@ The R-tree spatial index.

                        - Synopsis + Synopsis
                        template<typename Iterator>
                         rtree(Iterator first,
                        @@ -966,7 +980,7 @@ The R-tree spatial index.
                         
                        - Parameter(s) + Parameter(s)
                        @@ -1082,9 +1096,9 @@ The R-tree spatial index.
                        - Throws + Throws
                        -
                          +
                          • If allocator copy constructor throws.
                          • @@ -1109,7 +1123,7 @@ The R-tree spatial index.

                            - Synopsis + Synopsis
                            template<typename Range>
                             rtree(Range const & rng,
                            @@ -1119,7 +1133,7 @@ The R-tree spatial index.
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1219,9 +1233,9 @@ The R-tree spatial index.
                            - Throws + Throws
                            -
                              +
                              • If allocator copy constructor throws.
                              • @@ -1245,13 +1259,13 @@ The R-tree spatial index.

                                - Synopsis + Synopsis
                                ~rtree()
                                 
                                - Throws + Throws

                                Nothing. @@ -1267,20 +1281,20 @@ The R-tree spatial index.

                                - Description + Description

                                It uses parameters, translator and allocator from the source tree.

                                - Synopsis + Synopsis
                                rtree(rtree const & src)
                                 
                                - Parameter(s) + Parameter(s)
                                @@ -1326,9 +1340,9 @@ The R-tree spatial index.
                                - Throws + Throws
                                -
                                  +
                                  • If allocator copy constructor throws.
                                  • @@ -1353,20 +1367,20 @@ The R-tree spatial index.

                                    - Description + Description

                                    It uses Parameters and translator from the source tree.

                                    - Synopsis + Synopsis
                                    rtree(rtree const & src, allocator_type const & allocator)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1432,9 +1446,9 @@ The R-tree spatial index.
                                    - Throws + Throws
                                    -
                                      +
                                      +

                                      + The moving constructor. +

                                      +
                                      + + Description +
                                      +

                                      + It uses parameters and translator from the source tree. +

                                      +
                                      + + Synopsis +
                                      +
                                      rtree(rtree && src, allocator_type const & allocator)
                                      +
                                      +
                                      + + Parameter(s) +
                                      +
                                      +++++ + + + + + + + + + + + + + + + + + +
                                      +

                                      + Type +

                                      +
                                      +

                                      + Name +

                                      +
                                      +

                                      + Description +

                                      +
                                      +

                                      + rtree + && +

                                      +
                                      +

                                      + src +

                                      +
                                      +

                                      + The rtree which content will be moved. +

                                      +
                                      +

                                      + allocator_type + const & +

                                      +
                                      +

                                      + allocator +

                                      +
                                      +

                                      + The allocator. +

                                      +
                                      +
                                      + + Throws +
                                      +
                                        +
                                      • + If allocator copy constructor throws. +
                                      • +
                                      • + If Value copy constructor throws (only if allocators aren't equal). +
                                      • +
                                      • + If allocation throws (only if allocators aren't equal). +
                                      • +
                                      • + When memory allocation for Node fails (only if allocators aren't + equal). +
                                      • +
                                      +
                                      +
                                      + @@ -1534,20 +1655,20 @@ The R-tree spatial index.

                                      - Description + Description

                                      It uses parameters and translator from the source tree.

                                      - Synopsis + Synopsis
                                      rtree & operator=(const rtree & src)
                                       
                                      - Parameter(s) + Parameter(s)
                                      @@ -1593,9 +1714,9 @@ The R-tree spatial index.
                                      - Throws + Throws
                                      -
                                        +
                                        • If Value copy constructor throws.
                                        • @@ -1617,20 +1738,20 @@ The R-tree spatial index.

                                          - Description + Description

                                          It uses parameters and translator from the source tree.

                                          - Synopsis + Synopsis
                                          rtree & operator=(rtree && src)
                                           
                                          - Parameter(s) + Parameter(s)
                                          @@ -1676,12 +1797,12 @@ The R-tree spatial index.
                                          - Throws + Throws

                                          Only if allocators aren't equal.

                                          -
                                            +
                                            • If Value copy constructor throws.
                                            • @@ -1703,20 +1824,20 @@ The R-tree spatial index.

                                              - Description + Description

                                              Parameters, translator and allocators are swapped as well.

                                              - Synopsis + Synopsis
                                              void swap(rtree & other)
                                               
                                              - Parameter(s) + Parameter(s)
                                              @@ -1762,7 +1883,7 @@ The R-tree spatial index.
                                              - Throws + Throws

                                              If allocators swap throws. @@ -1778,13 +1899,13 @@ The R-tree spatial index.

                                              - Synopsis + Synopsis
                                              void insert(value_type const & value)
                                               
                                              - Parameter(s) + Parameter(s)
                                              @@ -1830,9 +1951,9 @@ The R-tree spatial index.
                                              - Throws + Throws
                                              -
                                                +
                                                • If Value copy constructor or copy assignment throws.
                                                • @@ -1865,14 +1986,14 @@ The R-tree spatial index.

                                                  - Synopsis + Synopsis
                                                  template<typename Iterator>
                                                   void insert(Iterator first, Iterator last)
                                                   
                                                  - Parameter(s) + Parameter(s)
                                                  @@ -1936,9 +2057,9 @@ The R-tree spatial index.
                                                  - Throws + Throws
                                                  -
                                                    +
                                                    • If Value copy constructor or copy assignment throws.
                                                    • @@ -1971,14 +2092,14 @@ The R-tree spatial index.

                                                      - Synopsis + Synopsis
                                                      template<typename Range>
                                                       void insert(Range const & rng)
                                                       
                                                      - Parameter(s) + Parameter(s)
                                                      @@ -2024,9 +2145,9 @@ The R-tree spatial index.
                                                      - Throws + Throws
                                                      -
                                                        +
                                                        • If Value copy constructor or copy assignment throws.
                                                        • @@ -2059,7 +2180,7 @@ The R-tree spatial index.

                                                          - Description + Description

                                                          In contrast to the std::set @@ -2068,13 +2189,13 @@ The R-tree spatial index.

                                                          - Synopsis + Synopsis
                                                          size_type remove(value_type const & value)
                                                           
                                                          - Parameter(s) + Parameter(s)
                                                          @@ -2120,16 +2241,16 @@ The R-tree spatial index.
                                                          - Returns + Returns

                                                          1 if the value was removed, 0 otherwise.

                                                          - Throws + Throws
                                                          -
                                                            +
                                                            • If Value copy constructor or copy assignment throws.
                                                            • @@ -2162,7 +2283,7 @@ The R-tree spatial index.

                                                              - Description + Description

                                                              In contrast to the std::set @@ -2173,14 +2294,14 @@ The R-tree spatial index.

                                                              - Synopsis + Synopsis
                                                              template<typename Iterator>
                                                               size_type remove(Iterator first, Iterator last)
                                                               
                                                              - Parameter(s) + Parameter(s)
                                                              @@ -2244,16 +2365,16 @@ The R-tree spatial index.
                                                              - Returns + Returns

                                                              The number of removed values.

                                                              - Throws + Throws
                                                              -
                                                                +
                                                                • If Value copy constructor or copy assignment throws.
                                                                • @@ -2286,7 +2407,7 @@ The R-tree spatial index.

                                                                  - Description + Description

                                                                  In contrast to the std::set @@ -2296,14 +2417,14 @@ The R-tree spatial index.

                                                                  - Synopsis + Synopsis
                                                                  template<typename Range>
                                                                   size_type remove(Range const & rng)
                                                                   
                                                                  - Parameter(s) + Parameter(s)
                                                                  @@ -2349,16 +2470,16 @@ The R-tree spatial index.
                                                                  - Returns + Returns

                                                                  The number of removed values.

                                                                  - Throws + Throws
                                                                  -
                                                                    +
                                                                    • If Value copy constructor or copy assignment throws.
                                                                    • @@ -2391,7 +2512,7 @@ The R-tree spatial index.

                                                                      - Description + Description

                                                                      Spatial predicates may be a Geometry. In this case Values @@ -2401,7 +2522,7 @@ The R-tree spatial index.

                                                                      It may be generated by one of the functions listed below:

                                                                      -
                                                                        +
                                                                        • boost::geometry::index::covered_by(),
                                                                        • @@ -2443,14 +2564,14 @@ The R-tree spatial index.

                                                                          - Synopsis + Synopsis
                                                                          template<typename Predicates, typename OutIter>
                                                                           size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                                           
                                                                          - Parameter(s) + Parameter(s)
                                                                          @@ -2515,16 +2636,16 @@ The R-tree spatial index.
                                                                          - Returns + Returns

                                                                          The number of values found.

                                                                          - Throws + Throws
                                                                          -
                                                                            +
                                                                            • If Value copy constructor or copy assignment throws.
                                                                            • @@ -2543,7 +2664,7 @@ The R-tree spatial index.

                                                                              - Description + Description

                                                                              Distances predicates may be a Point. In this the case the @@ -2554,7 +2675,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                              -
                                                                                +
                                                                                • boost::geometry::index::to_nearest() - default, @@ -2571,7 +2692,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                  -
                                                                                    +
                                                                                    • boost::geometry::index::unbounded() - default, @@ -2590,7 +2711,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                      -
                                                                                        +
                                                                                        - Synopsis + Synopsis
                                                                                        template<typename DistancesPredicates>
                                                                                         size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
                                                                                         
                                                                                        - Parameter(s) + Parameter(s)
                                                                                        @@ -2676,14 +2797,14 @@ The R-tree spatial index.
                                                                                        - Returns + Returns

                                                                                        The number of values found.

                                                                                        - Throws + Throws

                                                                                        If Value copy constructor or copy assignment throws. @@ -2700,7 +2821,7 @@ The R-tree spatial index.

                                                                                        - Description + Description

                                                                                        Distances predicates may be a Point. In this the case the @@ -2711,7 +2832,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                        -
                                                                                          +
                                                                                          • boost::geometry::index::to_nearest() - default, @@ -2728,7 +2849,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                            -
                                                                                              +
                                                                                              • boost::geometry::index::unbounded() - default, @@ -2747,7 +2868,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                -
                                                                                                  +
                                                                                                  • boost::geometry::index::to_nearest(),
                                                                                                  • @@ -2766,7 +2887,7 @@ The R-tree spatial index.

                                                                                                    It may be generated by one of the functions listed below:

                                                                                                    -
                                                                                                      +
                                                                                                      • boost::geometry::index::covered_by(),
                                                                                                      • @@ -2808,7 +2929,7 @@ The R-tree spatial index.

                                                                                                        - Synopsis + Synopsis
                                                                                                        template<typename DistancesPredicates, typename Predicates>
                                                                                                         size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                        @@ -2817,7 +2938,7 @@ The R-tree spatial index.
                                                                                                         
                                                                                                        - Parameter(s) + Parameter(s)
                                                                                                        @@ -2900,14 +3021,14 @@ The R-tree spatial index.
                                                                                                        - Returns + Returns

                                                                                                        The number of values found.

                                                                                                        - Throws + Throws

                                                                                                        If Value copy constructor or copy assignment throws. @@ -2924,7 +3045,7 @@ The R-tree spatial index.

                                                                                                        - Description + Description

                                                                                                        Distances predicates may be a Point. In this the case the @@ -2935,7 +3056,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                        -
                                                                                                          +
                                                                                                          • boost::geometry::index::to_nearest() - default, @@ -2952,7 +3073,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                            -
                                                                                                              +
                                                                                                              • boost::geometry::index::unbounded() - default, @@ -2971,7 +3092,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                                -
                                                                                                                  +
                                                                                                                  - Synopsis + Synopsis
                                                                                                                  template<typename DistancesPredicates, typename OutIter>
                                                                                                                   size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                                  @@ -2993,7 +3114,7 @@ The R-tree spatial index.
                                                                                                                   
                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                  @@ -3075,14 +3196,14 @@ The R-tree spatial index.
                                                                                                                  - Returns + Returns

                                                                                                                  The number of values found.

                                                                                                                  - Throws + Throws

                                                                                                                  If Value copy constructor or copy assignment throws. If OutIter dereference @@ -3100,7 +3221,7 @@ The R-tree spatial index.

                                                                                                                  - Description + Description

                                                                                                                  Distances predicates may be a Point. In this the case the @@ -3111,7 +3232,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                                  -
                                                                                                                  - +

                                                                                                                  Last revised: January 14, 2013 at 17:39:48 GMT

                                                                                                                  Last revised: January 16, 2013 at 04:04:59 GMT


                                                                                                                  diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp index 6f24f36c7..2f0f4622b 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -182,7 +182,7 @@ int main(int argc, char** argv) quickbook_output_alt(doc.cos, config, std::cout); } - if ( !doc.functions.empty() ) + if ( !doc.group_id.empty() ) quickbook_output_alt(doc, config, std::cout); } } diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index 43b2bd8df..d4ab6a089 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -659,7 +659,7 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum f.type = function_define; parse_element(node->first_node(), config, "", f); parse_function(node->first_node(), config, "", f); - doc.functions.push_back(f); + doc.defines.push_back(f); } else if (kind == "enum") { diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index ab4d20d54..6a4093c77 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -474,9 +474,9 @@ void quickbook_output(enumeration const& e, configuration const& config, std::os } void quickbook_output_function(std::vector const& functions, - function_type type, - std::string const& title, - configuration const& config, std::ostream& out) + function_type type, + std::string const& title, + configuration const& config, std::ostream& out) { std::string returns = type == function_constructor_destructor ? "" : " [Returns]"; out << "[heading " << title << "(s)]" << std::endl @@ -615,7 +615,9 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s } - +// ----------------------------------------------------------------------------------------------- // +// ALT +// ----------------------------------------------------------------------------------------------- // std::string remove_template_parameters(std::string const& name) @@ -657,26 +659,29 @@ std::string replace_brackets(std::string const& str) return boost::replace_all_copy(boost::replace_all_copy(str, "[", "\\["), "]", "\\]"); } +void quickbook_output_enumerations(std::vector const& enumerations, + configuration const& config, + std::ostream& out) +{ + out << "[table" << std::endl + << "[[Enumeration][Description]]" << std::endl; + + for ( size_t i = 0 ; i < enumerations.size() ; ++i ) + { + enumeration const& e = enumerations[i]; + + out << "[[[link " << e.id << " `"; + out << e.name; + out << "`]][" << e.brief_description << "]]" << std::endl; + } + out << "]" << std::endl + << std::endl; +} + void quickbook_synopsis_short(function const& f, std::ostream& out) { - switch(f.type) - { - case function_constructor_destructor : + if ( f.type != function_unknown ) out << f.name; - break; - case function_member : - out << f.name; - break; - case function_free : - out << f.name; - break; - case function_define : - out << "#define " << f.name; - break; - case function_unknown : - // do nothing - break; - } bool first = true; BOOST_FOREACH(parameter const& p, f.parameters) @@ -695,14 +700,15 @@ void quickbook_synopsis_short(function const& f, std::ostream& out) out << "()"; } -void quickbook_output_function(std::vector const& functions, +void quickbook_output_functions(std::vector const& functions, function_type type, configuration const& config, std::ostream& out, - bool display_all = false) + bool display_all = false, + std::string const& ColTitle = "Function") { out << "[table" << std::endl - << "[[Function][Description]]" << std::endl; + << "[[" << ColTitle << "][Description]]" << std::endl; for ( size_t i = 0 ; i < functions.size() ; ++i ) { @@ -945,11 +951,39 @@ void quickbook_synopsis_alt(class_or_struct const& cos, configuration const& con << "]" << std::endl << std::endl; } -void quickbook_output_detail_function(std::vector const& functions, - function_type type, - configuration const& config, - std::ostream& out, - bool display_all = false) +void quickbook_synopsis_alt(enumeration const& e, std::ostream& out) +{ + std::string values_separator = + e.enumeration_values.size() <= 2 ? + std::string(", ") : + ( std::string(",\n") + std::string(e.name.size() + 7, ' ') ); + + out << "``enum " << e.name << " "; + bool first = true; + BOOST_FOREACH(enumeration_value const& value, e.enumeration_values) + { + out << (first ? "{" : values_separator.c_str()); + out << value.name; + if ( !value.initializer.empty() ) + { + out << " = " << boost::trim_copy(value.initializer); + } + first = false; + } + if (! first) + { + out << "};"; + } + out << "``" + << std::endl + << std::endl; +} + +void quickbook_output_functions_details(std::vector const& functions, + function_type type, + configuration const& config, + std::ostream& out, + bool display_all = false) { for ( size_t i = 0 ; i < functions.size() ; ++i ) { @@ -959,8 +993,7 @@ void quickbook_output_detail_function(std::vector const& functions, // Section std::stringstream ss; quickbook_synopsis_short(f, ss); - if ( config.output_style == "alt" && !f.id.empty() ) - out << "[#" << f.id << "]" << std::endl; + out << "[#" << f.id << "]" << std::endl; out << "[section " << replace_brackets(ss.str()) << "]" << std::endl; // Brief description @@ -985,14 +1018,22 @@ void quickbook_output_detail_function(std::vector const& functions, { out << "[heading Parameter(s)]" << std::endl; out << "[table " << std::endl; - out << "[[Type][Name][Description]]" << std::endl; + out << "["; + if ( f.type != function_define ) + out << "[Type]"; + out << "[Name][Description]]" << std::endl; BOOST_FOREACH(parameter const& p, f.parameters) { if (!p.skip) { - out << "[["; - inline_str_with_links(p.fulltype, out); - out << "][ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl; + out << "["; + if ( f.type != function_define ) + { + out << "["; + inline_str_with_links(p.fulltype, out); + out << "]"; + } + out << "[ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl; } } out << "]" << std::endl; @@ -1027,6 +1068,50 @@ void quickbook_output_detail_function(std::vector const& functions, } } +void quickbook_output_enumeration_details(enumeration const& e, configuration const& config, std::ostream& out) +{ + out << "[#" << e.id << "]\n"; + out << "[section " << e.name << "]" << std::endl + << std::endl; + + out << e.brief_description << std::endl; + out << std::endl; + + if ( !e.detailed_description.empty() ) + { + out << "[heading Description]\n\n"; + out << e.detailed_description << "\n\n"; + } + + // Additional paragraphs, note, warning + output_paragraphs_note_warning(e, out); + + quickbook_markup(e.qbk_markup, markup_any, markup_default, out); + + // Synopsis + quickbook_markup(e.qbk_markup, markup_before, markup_synopsis, out); + out << "[heading Synopsis]" << std::endl; + quickbook_synopsis_alt(e, out); + quickbook_markup(e.qbk_markup, markup_after, markup_synopsis, out); + + + out << "[heading Values]" << std::endl + << std::endl; + + out << "[table" << std::endl << "["; + out << "[Value] [Description] ]" << std::endl; + + BOOST_FOREACH(enumeration_value const& value, e.enumeration_values) + { + out << "[[" << value.name << "] [" << value.brief_description << "]]\n"; + } + out << "]\n\n\n"; + + out << std::endl; + out << "[endsect]" << std::endl; + out << std::endl; +} + void quickbook_output_alt(documentation const& doc, configuration const& config, std::ostream& out) { if ( !doc.group_id.empty() ) @@ -1034,8 +1119,31 @@ void quickbook_output_alt(documentation const& doc, configuration const& config, std::cout << "[section:" << doc.group_id << " " << doc.group_title << "]" << std::endl; } - quickbook_output_function(doc.functions, function_constructor_destructor, config, out, true); - quickbook_output_detail_function(doc.functions, function_unknown, config, out, true); + if ( !doc.enumerations.empty() ) + { + std::cout << "[heading Enumerations]\n"; + quickbook_output_enumerations(doc.enumerations, config, out); + } + + if ( !doc.defines.empty() ) + { + std::cout << "[heading Defines]\n"; + quickbook_output_functions(doc.defines, function_unknown, config, out, true, "Define"); + } + + if ( !doc.functions.empty() ) + { + std::cout << "[heading Functions]\n"; + quickbook_output_functions(doc.functions, function_unknown, config, out, true, "Function"); + } + + BOOST_FOREACH(enumeration const& e, doc.enumerations) + { + quickbook_output_enumeration_details(e, config, out); + } + + quickbook_output_functions_details(doc.defines, function_unknown, config, out, true); + quickbook_output_functions_details(doc.functions, function_unknown, config, out, true); if ( !doc.group_id.empty() ) { @@ -1176,13 +1284,13 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi if (display_ctors && counts[function_constructor_destructor] > 0) { out << "[heading Constructor(s) and destructor]" << std::endl; - quickbook_output_function(cos.functions, function_constructor_destructor, config, out); + quickbook_output_functions(cos.functions, function_constructor_destructor, config, out); } if (display_members && counts[function_member] > 0) { out << "[heading Member(s)]" << std::endl; - quickbook_output_function(cos.functions, function_member, config, out); + quickbook_output_functions(cos.functions, function_member, config, out); } // Details start @@ -1191,9 +1299,9 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi // out << "[br]" << std::endl; if (display_ctors && counts[function_constructor_destructor] > 0) - quickbook_output_detail_function(cos.functions, function_constructor_destructor, config, out); + quickbook_output_functions_details(cos.functions, function_constructor_destructor, config, out); if (display_members && counts[function_member] > 0) - quickbook_output_detail_function(cos.functions, function_member, config, out); + quickbook_output_functions_details(cos.functions, function_member, config, out); // Details end diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index abf0b342d..57fd3e60d 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -264,8 +264,8 @@ by PointRelation. This is default nearest predicate. \tparam PointRelation PointRelation type. -\param pr The point relation. This may be generated by bgi::to_nearest(Point), - bgi::to_centroid(Point) or bgi::to_furthest(Point). +\param pr The point relation. This may be generated by \c index::to_nearest(), + \c index::to_centroid() or \c index::to_furthest() with \c Point passed as a parameter. */ template inline detail::unbounded @@ -288,10 +288,10 @@ Point but only if nearest points are further than some distance. \tparam PointRelation PointRelation type. \tparam MinRelation MinRelation type. -\param pr The point relation. This may be generated by \c bgi::to_nearest(Point), - \c bgi::to_centroid(Point) or \c bgi::to_furthest(Point). -\param minr The minimum bound relation. This may be generated by \c bgi::to_nearest(min_distance), - \c bgi::to_centroid(min_distance) or \c bgi::to_furthest(min_distance). +\param pr The point relation. This may be generated by \c to_nearest(), + \c to_centroid() or \c to_furthest() with \c Point passed as a parameter. +\param minr The minimum bound relation. This may be generated by \c to_nearest(), + \c to_centroid() or \c to_furthest() with distance value passed as a parameter. */ template inline detail::min_bounded @@ -314,10 +314,10 @@ Point but only if nearest points are closer than some distance. \tparam PointRelation PointRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by \c bgi::to_nearest(Point), - \c bgi::to_centroid(Point) or \c bgi::to_furthest(Point). -\param maxr The maximum bound relation. This may be generated by \c bgi::to_nearest(max_distance), - \c bgi::to_centroid(max_distance) or \c bgi::to_furthest(max_distance). +\param pr The point relation. This may be generated by \c to_nearest(), + \c to_centroid() or \c to_furthest() with \c Point passed as a parameter. +\param maxr The maximum bound relation. This may be generated by \c to_nearest(), + \c to_centroid() or \c to_furthest() with distance value passed as a parameter. */ template inline detail::max_bounded @@ -342,12 +342,12 @@ points are further than some distance and closer than some other distance. \tparam MinRelation MinRelation type. \tparam MaxRelation MaxRelation type. -\param pr The point relation. This may be generated by \c bgi::to_nearest(Point), - \c bgi::to_centroid(Point) or \c bgi::to_furthest(Point). -\param minr The minimum bound relation. This may be generated by \c bgi::to_nearest(min_distance), - \c bgi::to_centroid(min_distance) or \c bgi::to_furthest(min_distance). -\param maxr The maximum bound relation. This may be generated by \c bgi::to_nearest(max_distance), - \c bgi::to_centroid(max_distance) or \c bgi::to_furthest(max_distance). +\param pr The point relation. This may be generated by \c to_nearest(), + \c to_centroid() or \c to_furthest() with \c Point passed as a parameter. +\param minr The minimum bound relation. This may be generated by \c to_nearest(), + \c to_centroid() or \c to_furthest() with distance value passed as a parameter. +\param maxr The maximum bound relation. This may be generated by \c to_nearest(), + \c to_centroid() or \c to_furthest() with distance value passed as a parameter. */ template inline detail::bounded diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 468ccf456..17f6153e1 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -315,7 +315,7 @@ public: \param src The rtree which content will be moved. \par Throws - If allocator move constructor throws. + Nothing. */ inline rtree(BOOST_RV_REF(rtree) src) // TODO - use boost::move() @@ -331,6 +331,41 @@ public: src.m_root = 0; } + /*! + \brief The moving constructor. + + It uses parameters and translator from the source tree. + + \param src The rtree which content will be moved. + \param allocator The allocator. + + \par Throws + \li If allocator copy constructor throws. + \li If Value copy constructor throws (only if allocators aren't equal). + \li If allocation throws (only if allocators aren't equal). + \li When memory allocation for Node fails (only if allocators aren't equal). + */ + inline rtree(BOOST_RV_REF(rtree) src, allocator_type const& allocator) +// TODO - use boost::move() + : m_translator(src.m_translator) // SHOULDN'T THROW + , m_parameters(src.m_parameters) + , m_allocators(allocator) + , m_values_count(0) + , m_leafs_level(0) + , m_root(0) + { + if ( src.m_allocators.allocator == allocator ) + { + boost::swap(m_values_count, src.m_values_count); + boost::swap(m_leafs_level, src.m_leafs_level); + boost::swap(m_root, src.m_root); + } + else + { + this->raw_copy(src, *this, false); + } + } + /*! \brief The assignment operator. From 74db796accb93f57b827ce324dd7fc509c08d852 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Jan 2013 14:39:01 +0000 Subject: [PATCH 286/366] rtree: added bg::envelope() and bg::return_envelope(). doxygen_qbk2xml: added template parameters to detailed function output. [SVN r82510] --- doc/generated/distance_predicates.qbk | 46 + doc/generated/predicates.qbk | 36 + doc/generated/rtree_functions.qbk | 57 +- doc/html/geometry_index/r_tree.html | 2 +- .../geometry_index/r_tree/introduction.html | 23 + doc/html/geometry_index/r_tree/reference.html | 783 +++++++++++++++++- doc/html/index.html | 5 +- doc/index.qbk | 2 +- doc/rtree/introduction.qbk | 10 + .../doxygen_xml2qbk/quickbook_output.hpp | 76 +- .../geometry/extensions/index/rtree/rtree.hpp | 43 +- 11 files changed, 1038 insertions(+), 45 deletions(-) diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index d64066de2..66cd264f7 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -24,6 +24,12 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_nearest boost::geometry::index::to_nearest``(``T const &` `v``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -42,6 +48,12 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_centroid boost::geometry::index::to_centroid``(``T const &` `v``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -60,6 +72,12 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_furthest boost::geometry::index::to_furthest``(``T const &` `v``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -78,6 +96,12 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::unbounded boost::geometry::index::unbounded``(``PointRelation const &` `pr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -96,6 +120,13 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::min_bounded boost::geometry::index::min_bounded``(``PointRelation const &` `pr``,` `MinRelation const &` `minr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type. ]] +[[`MinRelation`][MinRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -115,6 +146,13 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::max_bounded boost::geometry::index::max_bounded``(``PointRelation const &` `pr``,` `MaxRelation const &` `maxr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type. ]] +[[`MaxRelation`][MaxRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -138,6 +176,14 @@ Generate a distance predicate. This defines distances bounds which are used by k `MaxRelation const &` `maxr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type. ]] +[[`MinRelation`][MinRelation type. ]] +[[`MaxRelation`][MaxRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index fcdc627ec..3d01a4ace 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -36,6 +36,12 @@ A wrapper around user-defined functor describing if Value should be returned by `detail::value boost::geometry::index::value``(``ValuePredicate const &` `vpred``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`ValuePredicate`][Functor type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -54,6 +60,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::covered_by boost::geometry::index::covered_by``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -72,6 +84,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::disjoint boost::geometry::index::disjoint``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -90,6 +108,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::intersects boost::geometry::index::intersects``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -108,6 +132,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::overlaps boost::geometry::index::overlaps``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -126,6 +156,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::within boost::geometry::index::within``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 50dc8a0fc..82e6440cd 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -1,6 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__rtree__functions.xml] -[section:group__rtree__functions Functions related to the rtree (boost::geometry::index::)] +[section:group__rtree__functions Functions related to the rtree] [heading Functions] [table [[Function][Description]] @@ -19,6 +19,8 @@ [[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] [[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] [[[link group__rtree__functions_1ga46aead88abd7f18f0e1eedb991bbb39d `box(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1gab3425094aa846b167789ac76114696f6 `envelope(index::rtree<...> const &, Box &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1gaab92d20f98edefccee1e76c1349a5127 `return_envelope(index::rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] ] [#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc] @@ -418,5 +420,58 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1adf62005332a5fa9119ff The box containing all stored values or an invalid box. [endsect] +[#group__rtree__functions_1gab3425094aa846b167789ac76114696f6] +[section envelope(index::rtree<...> const &, Box &)] +Get the box containing all stored values or an invalid box if the index has no values. + +[heading Description] +It calls [^[link group__rtree__functions_1ga46aead88abd7f18f0e1eedb991bbb39d rtree::box()]].[heading Synopsis] +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Box``>` +`void boost::geometry::envelope``(``index::rtree< Value, Options, Translator, Allocator > const &` `tree``,` `Box &` `box``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`index::rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`Box &`][ `box` ][The object to which box containing all stored values or an invalid box will be assigned. ]] +] +[endsect] + +[#group__rtree__functions_1gaab92d20f98edefccee1e76c1349a5127] +[section return_envelope(index::rtree<...> const &)] +Get the box containing all stored values or an invalid box if the index has no values. + +[heading Description] +It calls [^[link group__rtree__functions_1ga46aead88abd7f18f0e1eedb991bbb39d rtree::box()]].[heading Synopsis] +[pre +`template<``typename Box``,` + `typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`Box boost::geometry::return_envelope``(``index::rtree< Value, Options, Translator, Allocator > const &` `tree``)` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Box`][The type of returned Box.]] +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`index::rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index.]] +] +[heading Returns] +The box containing all stored values or an invalid box. +[endsect] + [endsect] diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 67dc200d8..4023fd111 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -78,7 +78,7 @@
                                                                                                                  boost::geometry::index::rtree
                                                                                                                  Functions - related to the rtree (boost::geometry::index::)
                                                                                                                  + related to the rtree
                                                                                                                  R-tree parameters
                                                                                                                  Spatial diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index b0b2ee116..a7cd00cb0 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -177,6 +177,11 @@
                                                                                                                +
                                                                                                                + + Implementation + details +

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

                                                                                                                @@ -200,6 +205,24 @@ one.
                                                                                                              +
                                                                                                              + + Contributors +
                                                                                                              +

                                                                                                              + The spatial index was originally started by Federico J. Fernandez during + the Google-Of-Summer project 2008, mentored by Hartmut Kaiser. +

                                                                                                              +
                                                                                                              + + Spatial + thanks +
                                                                                                              +

                                                                                                              + I'd like to thank Barend Gehrels, Bruno Lalande, Lucanus J. Simonson for + their support and ideas, as well as the members of the Boost.Geometry mailing + list for their help. +



                                                                                                              [1] diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index d71acb5e3..5be95ab9e 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -28,7 +28,7 @@

                                                                                                              - + The R-tree spatial index.

                                                                                                              @@ -3740,8 +3740,8 @@ The R-tree spatial index.
                                                                                                            @@ -3979,6 +3979,35 @@ The R-tree spatial index.

                                                                                                            + + +

                                                                                                            + envelope(index::rtree<...> + const &, + Box &) +

                                                                                                            + + +

                                                                                                            + Get the box containing all stored values or an invalid box if + the index has no values. +

                                                                                                            + + + + +

                                                                                                            + return_envelope(index::rtree<...> + const &) +

                                                                                                            + + +

                                                                                                            + Get the box containing all stored values or an invalid box if + the index has no values. +

                                                                                                            + +
                                                                                                            @@ -5679,6 +5708,224 @@ The R-tree spatial index. The box containing all stored values or an invalid box.

                                                                                                            +
                                                                                                            + +

                                                                                                            + Get the box containing all stored values or an invalid box if the index + has no values. +

                                                                                                            +
                                                                                                            + + Description +
                                                                                                            +

                                                                                                            + It calls rtree::box(). +

                                                                                                            +
                                                                                                            + + Synopsis +
                                                                                                            +
                                                                                                            template<typename Value,
                                                                                                            +         typename Options,
                                                                                                            +         typename Translator,
                                                                                                            +         typename Allocator,
                                                                                                            +         typename Box>
                                                                                                            +void boost::geometry::envelope(index::rtree< Value, Options, Translator, Allocator > const & tree, Box & box)
                                                                                                            +
                                                                                                            +
                                                                                                            + + Parameter(s) +
                                                                                                            +
                                                                                                            +++++ + + + + + + + + + + + + + + + + + +
                                                                                                            +

                                                                                                            + Type +

                                                                                                            +
                                                                                                            +

                                                                                                            + Name +

                                                                                                            +
                                                                                                            +

                                                                                                            + Description +

                                                                                                            +
                                                                                                            +

                                                                                                            + index::rtree< + Value, + Options, + Translator, + Allocator > + const & +

                                                                                                            +
                                                                                                            +

                                                                                                            + tree +

                                                                                                            +
                                                                                                            +

                                                                                                            + The spatial index. +

                                                                                                            +
                                                                                                            +

                                                                                                            + Box & +

                                                                                                            +
                                                                                                            +

                                                                                                            + box +

                                                                                                            +
                                                                                                            +

                                                                                                            + The object to which box containing all stored values or an + invalid box will be assigned. +

                                                                                                            +
                                                                                                            +
                                                                                                            +
                                                                                                            + +

                                                                                                            + Get the box containing all stored values or an invalid box if the index + has no values. +

                                                                                                            +
                                                                                                            + + Description +
                                                                                                            +

                                                                                                            + It calls rtree::box(). +

                                                                                                            +
                                                                                                            + + Synopsis +
                                                                                                            +
                                                                                                            template<typename Box,
                                                                                                            +         typename Value,
                                                                                                            +         typename Options,
                                                                                                            +         typename Translator,
                                                                                                            +         typename Allocator>
                                                                                                            +Box boost::geometry::return_envelope(index::rtree< Value, Options, Translator, Allocator > const & tree)
                                                                                                            +
                                                                                                            +
                                                                                                            + + Template + parameter(s) +
                                                                                                            +
                                                                                                            ++++ + + + + + + + + +
                                                                                                            +

                                                                                                            + Parameter +

                                                                                                            +
                                                                                                            +

                                                                                                            + Description +

                                                                                                            +
                                                                                                            +

                                                                                                            + Box +

                                                                                                            +
                                                                                                            +

                                                                                                            + The type of returned Box. +

                                                                                                            +
                                                                                                            +
                                                                                                            + + Parameter(s) +
                                                                                                            +
                                                                                                            +++++ + + + + + + + + + + +
                                                                                                            +

                                                                                                            + Type +

                                                                                                            +
                                                                                                            +

                                                                                                            + Name +

                                                                                                            +
                                                                                                            +

                                                                                                            + Description +

                                                                                                            +
                                                                                                            +

                                                                                                            + index::rtree< + Value, + Options, + Translator, + Allocator > + const & +

                                                                                                            +
                                                                                                            +

                                                                                                            + tree +

                                                                                                            +
                                                                                                            +

                                                                                                            + The spatial index. +

                                                                                                            +
                                                                                                            +
                                                                                                            + + Returns +
                                                                                                            +

                                                                                                            + The box containing all stored values or an invalid box. +

                                                                                                            +

                                                                                                          @@ -5690,7 +5937,7 @@ The R-tree spatial index. boost::geometry::index::linear

                                                                                                          - + Linear r-tree creation algorithm parameters.

                                                                                                          @@ -5765,7 +6012,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                                                                                                      - + Quadratic r-tree creation algorithm parameters.

                                                                                                      @@ -5840,7 +6087,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                                                                                                - + R*-tree creation algorithm parameters.

                                                                                                @@ -5944,7 +6191,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

                                                                                          - + Linear r-tree creation algorithm parameters.

                                                                                          @@ -6080,7 +6327,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

                                                                                    - + Quadratic r-tree creation algorithm parameters.

                                                                                    @@ -6216,7 +6463,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

                                                                              - + R*-tree creation algorithm parameters.

                                                                              @@ -6550,6 +6797,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + ValuePredicate +

    +
    +

    + Functor type. +

    +
    +
    + Parameter(s)
    @@ -6620,6 +6902,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6691,6 +7008,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6762,6 +7114,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6833,6 +7220,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6904,6 +7326,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -7113,6 +7570,42 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + T +

    +
    +

    + Type of wrapped object. This may be a Point for PointRelation + or some Value for MinRelation or MaxRelation +

    +
    +
    + Parameter(s)
    @@ -7187,6 +7680,42 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + T +

    +
    +

    + Type of wrapped object. This may be a Point for PointRelation + or some Value for MinRelation or MaxRelation +

    +
    +
    + Parameter(s)
    @@ -7263,6 +7792,42 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + T +

    +
    +

    + Type of wrapped object. This may be a Point for PointRelation + or some Value for MinRelation or MaxRelation +

    +
    +
    + Parameter(s)
    @@ -7337,6 +7902,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +
    + Parameter(s)
    @@ -7416,6 +8016,55 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +

    + MinRelation +

    +
    +

    + MinRelation type. +

    +
    +
    + Parameter(s)
    @@ -7517,6 +8166,55 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +

    + MaxRelation +

    +
    +

    + MaxRelation type. +

    +
    +
    + Parameter(s)
    @@ -7623,6 +8321,67 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +

    + MinRelation +

    +
    +

    + MinRelation type. +

    +
    +

    + MaxRelation +

    +
    +

    + MaxRelation type. +

    +
    +
    + Parameter(s)
    @@ -8036,7 +8795,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -8106,7 +8865,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    diff --git a/doc/html/index.html b/doc/html/index.html index 9ce8370a5..668160e15 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -25,9 +25,6 @@

    Adam Wulkiewicz

    -

    -Federico J. Fernandez -

    @@ -56,7 +53,7 @@
    - +

    Last revised: January 16, 2013 at 04:04:59 GMT

    Last revised: January 16, 2013 at 14:36:02 GMT


    diff --git a/doc/index.qbk b/doc/index.qbk index 7ece7bf60..fb2a6ba2b 100644 --- a/doc/index.qbk +++ b/doc/index.qbk @@ -10,7 +10,7 @@ [library Geometry Index [quickbook 1.5] - [authors [Wulkiewicz, Adam],[Fernandez, Federico J.]] + [authors [Wulkiewicz, Adam]] [copyright 2011-2012 Adam Wulkiewicz, 2008 Federico J. Fernandez] [purpose Documentation of Boost.Geometry Index library] [license diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index e08d5a72a..c55196dbe 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -42,6 +42,8 @@ and vice versa. Example structures of trees created by use of three different al [[*100k knn queries*] [3.49s] [1.59s] [0.84s]] ] +[heading Implementation details] + Key features of this implementation of the __rtree__ are: * capable to store arbitrary __value__ type, @@ -50,6 +52,14 @@ Key features of this implementation of the __rtree__ are: * parameters (including maximal and minimal number of elements) may be passed as compile- or run-time parameters - compile-time version is faster, * advanced queries - e.g. search for 5 nearest values further than some minimal distance and intersecting some region but not within the other one. +[heading Contributors] + +The spatial index was originally started by Federico J. Fernandez during the Google-Of-Summer project 2008, mentored by Hartmut Kaiser. + +[heading Spatial thanks] + +I'd like to thank Barend Gehrels, Bruno Lalande, Lucanus J. Simonson for their support and ideas, as well as the members of the Boost.Geometry mailing list for their help. + [endsect] diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 6a4093c77..854ca4330 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -979,6 +979,30 @@ void quickbook_synopsis_alt(enumeration const& e, std::ostream& out) << std::endl; } +template +bool has_brief_description(Range const& rng) +{ + typedef typename Range::value_type V; + BOOST_FOREACH(V const& bc, rng) + { + if ( !bc.brief_description.empty() ) + return true; + } + return false; +} + +template +bool has_brief_description(Range const& rng, function_type t) +{ + typedef typename Range::value_type V; + BOOST_FOREACH(V const& bc, rng) + { + if ( bc.type == t && !bc.brief_description.empty() ) + return true; + } + return false; +} + void quickbook_output_functions_details(std::vector const& functions, function_type type, configuration const& config, @@ -1013,8 +1037,33 @@ void quickbook_output_functions_details(std::vector const& functions, quickbook_synopsis_alt(f, out); quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out); + // Template parameters + if ( !f.template_parameters.empty() && has_brief_description(f.template_parameters) ) + { + out << "[heading Template parameter(s)]" << std::endl + << "[table" << std::endl + << "[[Parameter] [Description]]" << std::endl; + + BOOST_FOREACH(parameter const& p, f.template_parameters) + { + if ( p.brief_description.empty() ) + continue; + + out << "[[`"; + if ( p.fulltype.find("typename ") == 0 ) + out << p.fulltype.substr(9); + else if ( p.fulltype.find("class ") == 0 ) + out << p.fulltype.substr(6); + else + out << p.fulltype; + out << "`][" << p.brief_description << "]]" << std::endl; + } + out << "]" << std::endl + << std::endl; + } + // Parameters - if ( !f.parameters.empty() ) + if ( !f.parameters.empty() && has_brief_description(f.parameters) ) { out << "[heading Parameter(s)]" << std::endl; out << "[table " << std::endl; @@ -1152,30 +1201,6 @@ void quickbook_output_alt(documentation const& doc, configuration const& config, } } -template -bool has_brief_description(Range const& rng) -{ - typedef typename Range::value_type V; - BOOST_FOREACH(V const& bc, rng) - { - if ( !bc.brief_description.empty() ) - return true; - } - return false; -} - -template -bool has_brief_description(Range const& rng, function_type t) -{ - typedef typename Range::value_type V; - BOOST_FOREACH(V const& bc, rng) - { - if ( bc.type == t && !bc.brief_description.empty() ) - return true; - } - return false; -} - void quickbook_output_alt(class_or_struct const& cos, configuration const& config, std::ostream& out) { // Skip namespace @@ -1300,6 +1325,7 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi if (display_ctors && counts[function_constructor_destructor] > 0) quickbook_output_functions_details(cos.functions, function_constructor_destructor, config, out); + if (display_members && counts[function_member] > 0) quickbook_output_functions_details(cos.functions, function_member, config, out); diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 17f6153e1..f82f0e56d 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -51,7 +51,7 @@ // TODO change the name to bounding_tree /*! -\defgroup rtree_functions Functions related to the rtree (boost::geometry::index::) +\defgroup rtree_functions Functions related to the rtree */ namespace boost { namespace geometry { namespace index { @@ -1548,4 +1548,45 @@ box(rtree const& tree) }}} // namespace boost::geometry::index +#include + +namespace boost { namespace geometry { + +/*! +\brief Get the box containing all stored values or an invalid box if the index has no values. + +It calls \c rtree::box(). + +\ingroup rtree_functions + +\param tree The spatial index. +\param box The object to which box containing all stored values or an invalid box will be assigned. +*/ +template +void envelope(index::rtree const& tree, Box & box) +{ + envelope(tree.box(), box); +} + +/*! +\brief Get the box containing all stored values or an invalid box if the index has no values. + +It calls \c rtree::box(). + +\ingroup rtree_functions + +\tparam Box The type of returned Box. + +\param tree The spatial index. + +\return The box containing all stored values or an invalid box. +*/ +template +Box return_envelope(index::rtree const& tree) +{ + return return_envelope(tree.box()); +} + +}} //namespace boost::geometry + #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP From 3083a3721c16184be0588d0172deaa68a725a633 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 16 Jan 2013 14:45:30 +0000 Subject: [PATCH 287/366] docs copyrights modified [SVN r82511] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 2 +- .../geometry_index/r_tree/introduction.html | 2 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 20 +++++++++---------- .../r_tree/rtree_quickstart.html | 2 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 5 ++--- doc/index.qbk | 2 +- 10 files changed, 20 insertions(+), 21 deletions(-) diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd8b1efc4..dd5718dbb 100644 --- a/doc/html/geometry_index/introduction.html +++ b/doc/html/geometry_index/introduction.html @@ -39,7 +39,7 @@
    -
    - @@ -7398,7 +8756,7 @@ R*-tree creation algorithm parameters. @@ -7412,7 +8770,7 @@ R*-tree creation algorithm parameters. @@ -7486,7 +8844,7 @@ R*-tree creation algorithm parameters.

    Generate to_nearest() - Point-Indexable relationship. + relationship.

    @@ -7539,7 +8897,7 @@ R*-tree creation algorithm parameters.
    @@ -7585,7 +8943,7 @@ R*-tree creation algorithm parameters. @@ -7598,7 +8956,7 @@ R*-tree creation algorithm parameters.

    Generate to_centroid() - Point-Indexable relationship. + relationship.

    @@ -7649,7 +9007,7 @@ R*-tree creation algorithm parameters.
    @@ -7695,7 +9053,7 @@ R*-tree creation algorithm parameters. @@ -7708,7 +9066,7 @@ R*-tree creation algorithm parameters.

    Generate to_furthest() - Point-Indexable relationship. + relationship.

    @@ -7761,7 +9119,7 @@ R*-tree creation algorithm parameters.
    @@ -7807,7 +9165,7 @@ R*-tree creation algorithm parameters. @@ -8468,6 +9826,19 @@ R*-tree creation algorithm parameters. + + + +
    -
    - + + + + + + + + + + + + + + + + + + + + + + + + + +
    -

    - + The R-tree spatial index.

    @@ -5937,7 +5937,7 @@ The R-tree spatial index. boost::geometry::index::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -6012,7 +6012,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -6087,7 +6087,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

    - + R*-tree creation algorithm parameters.

    @@ -6191,7 +6191,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -6327,7 +6327,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -6463,7 +6463,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

    - + R*-tree creation algorithm parameters.

    @@ -8795,7 +8795,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -8865,7 +8865,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    @@ -9146,7 +9146,7 @@ The index translator. -+ + + + + + + + + + + + + + + + + + + + + + + +
    -
    - - - - - - - - - @@ -5626,7 +5597,7 @@ The R-tree spatial index.

    @@ -5638,7 +5609,7 @@ The R-tree spatial index. Description

    - It calls rtree::box(). + It calls rtree::box().

    @@ -5648,7 +5619,7 @@ The R-tree spatial index. typename Options, typename Translator, typename Allocator> -rtree<Value, Options, Translator, Allocator>::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree) +rtree<Value, Options, Translator, Allocator>::box_type const& boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)
    @@ -5708,224 +5679,6 @@ The R-tree spatial index. The box containing all stored values or an invalid box.

    -
    - -

    - Get the box containing all stored values or an invalid box if the index - has no values. -

    -
    - - Description -
    -

    - It calls rtree::box(). -

    -
    - - Synopsis -
    -
    template<typename Value,
    -         typename Options,
    -         typename Translator,
    -         typename Allocator,
    -         typename Box>
    -void boost::geometry::envelope(index::rtree< Value, Options, Translator, Allocator > const & tree, Box & box)
    -
    -
    - - Parameter(s) -
    -

    - + The R-tree spatial index.

    @@ -707,7 +707,7 @@ The R-tree spatial index.

    - box() + box()

    @@ -744,7 +744,7 @@ The R-tree spatial index.

    - translator() + translator()

    @@ -3533,7 +3533,7 @@ The R-tree spatial index.

    Returns the box containing all values stored in the container. @@ -3550,7 +3550,7 @@ The R-tree spatial index. Synopsis -

    box_type box()
    +
    box_type const & box()
     
    @@ -3683,7 +3683,7 @@ The R-tree spatial index.

    Returns the translator object. @@ -3692,7 +3692,7 @@ The R-tree spatial index. Synopsis -

    const translator_type & translator()
    +
    translator_type const & translator()
     
    @@ -3968,36 +3968,7 @@ The R-tree spatial index.

    - box(rtree<...> - const &) -

    -
    -

    - Get the box containing all stored values or an invalid box if - the index has no values. -

    -
    -

    - envelope(index::rtree<...> - const &, - Box &) -

    -
    -

    - Get the box containing all stored values or an invalid box if - the index has no values. -

    -
    -

    - return_envelope(index::rtree<...> + box(rtree<...> const &)

    ----- - - - - - - - - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - index::rtree< - Value, - Options, - Translator, - Allocator > - const & -

    -
    -

    - tree -

    -
    -

    - The spatial index. -

    -
    -

    - Box & -

    -
    -

    - box -

    -
    -

    - The object to which box containing all stored values or an - invalid box will be assigned. -

    -
    - -
    - -

    - Get the box containing all stored values or an invalid box if the index - has no values. -

    -
    - - Description -
    -

    - It calls rtree::box(). -

    -
    - - Synopsis -
    -
    template<typename Box,
    -         typename Value,
    -         typename Options,
    -         typename Translator,
    -         typename Allocator>
    -Box boost::geometry::return_envelope(index::rtree< Value, Options, Translator, Allocator > const & tree)
    -
    -
    - - Template - parameter(s) -
    -
    ---- - - - - - - - - -
    -

    - Parameter -

    -
    -

    - Description -

    -
    -

    - Box -

    -
    -

    - The type of returned Box. -

    -
    -
    - - Parameter(s) -
    -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - index::rtree< - Value, - Options, - Translator, - Allocator > - const & -

    -
    -

    - tree -

    -
    -

    - The spatial index. -

    -
    -
    - - Returns -
    -

    - The box containing all stored values or an invalid box. -

    -

    @@ -5937,7 +5690,7 @@ The R-tree spatial index. boost::geometry::index::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -6012,7 +5765,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -6087,7 +5840,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

    - + R*-tree creation algorithm parameters.

    @@ -6191,7 +5944,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -6327,7 +6080,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -6463,7 +6216,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

    - + R*-tree creation algorithm parameters.

    @@ -8795,7 +8548,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -8865,7 +8618,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    diff --git a/doc/html/index.html b/doc/html/index.html index 4c5b08ce4..adc9c950a 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@ - +

    Last revised: January 16, 2013 at 14:44:32 GMT

    Last revised: January 17, 2013 at 03:55:35 GMT


    From 4836bbabce34fb0c0b67ff07aedbed47127ca53e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 17 Jan 2013 14:37:40 +0000 Subject: [PATCH 290/366] root box calculation after remove moved from rtree::raw_remove() to visitor::remove. [SVN r82522] --- .../geometry/extensions/index/rtree/rtree.hpp | 20 ++------- .../index/rtree/visitors/remove.hpp | 20 +++++++++ tests/additional_speed.cpp | 45 ++++++++++--------- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree/rtree.hpp index 2d582811e..830e16ebc 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree/rtree.hpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -1057,6 +1056,8 @@ private: BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); + geometry::expand(m_box, m_translator(value)); + detail::rtree::visitors::insert< value_type, value_type, options_type, translator_type, box_type, allocators_type, @@ -1072,8 +1073,6 @@ private: // TODO // If exception is thrown, m_values_count may be invalid ++m_values_count; - - geometry::expand(m_box, m_translator(value)); } /*! @@ -1091,7 +1090,7 @@ private: detail::rtree::visitors::remove< value_type, options_type, translator_type, box_type, allocators_type - > remove_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + > remove_v(m_root, m_leafs_level, m_box, value, m_parameters, m_translator, m_allocators); detail::rtree::apply_visitor(remove_v, *m_root); @@ -1103,19 +1102,6 @@ private: --m_values_count; - // Calculate new box - if ( m_values_count == 0 ) - { - geometry::assign_inverse(m_box); - } - else - { - detail::rtree::visitors::children_box - children_box_v(m_box, m_translator); - - detail::rtree::apply_visitor(children_box_v, *m_root); - } - return 1; } diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp index a11837c19..25ca6eeff 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp @@ -38,6 +38,7 @@ class remove public: inline remove(node* & root, size_t & leafs_level, + Box & root_box, Value const& value, parameters_type const& parameters, Translator const& translator, @@ -47,6 +48,7 @@ public: , m_translator(translator) , m_allocators(allocators) , m_root_node(root) + , m_root_box(root_box) , m_leafs_level(leafs_level) , m_is_value_removed(false) , m_parent(0) @@ -110,6 +112,9 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); + // assign new root's box + assign_root_box(elements); + // reinsert elements from removed nodes (underflows) reinsert_removed_nodes_elements(); // MAY THROW (V, E: alloc, copy, N: alloc) @@ -155,6 +160,10 @@ public: rtree::elements(*m_parent)[m_current_child_index].first = rtree::elements_box(elements.begin(), elements.end(), m_translator); } + else + { + assign_root_box(elements); + } } } @@ -285,13 +294,24 @@ private: } } + template + void assign_root_box(Elements const& elements) + { + if ( elements.empty() ) + geometry::assign_inverse(m_root_box); + else + m_root_box = rtree::elements_box(elements.begin(), elements.end(), m_translator); + } + Value const& m_value; parameters_type const& m_parameters; Translator const& m_translator; Allocators & m_allocators; node* & m_root_node; + Box & m_root_box; size_t & m_leafs_level; + bool m_is_value_removed; UnderflowNodes m_underflowed_nodes; diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 5ed9f558d..e362fd3af 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -71,8 +71,6 @@ int main() // inserting test { - std::cout << "rtree inserting time test... (" - << values_count << ")\n"; tim.restart(); for (size_t i = 0 ; i < values_count ; ++i ) { @@ -82,14 +80,8 @@ int main() t.insert(b); } - std::cout << "time: " << tim.elapsed() << "s\n"; - } - - { - float x = coords[0].first; - float y = coords[0].second; - B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - t.remove(b); + double time = tim.elapsed(); + std::cout << time << "s - insert " << values_count << '\n'; } std::vector result; @@ -98,8 +90,6 @@ int main() // query test { - std::cout << "query(B) searching time test... (" - << queries_count << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count ; ++i ) @@ -110,16 +100,14 @@ int main() t.spatial_query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); temp += result.size(); } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; + double time = tim.elapsed(); + std::cout << time << "s - spatial_query(B) " << queries_count << " found " << temp << '\n'; } result.clear(); // searching test { - std::cout << "nearest 10 searching time test... (" - << queries_count / 10 << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count / 10 ; ++i ) @@ -129,13 +117,11 @@ int main() result.clear(); temp += t.nearest_query(P(x, y), 5, std::back_inserter(result)); } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; + double time = tim.elapsed(); + std::cout << time << "s - nearest_query(P, 5) " << (queries_count / 10) << " found " << temp << '\n'; } { - std::cout << "nearest 1 searching time test... (" - << queries_count / 10 << ")\n"; tim.restart(); size_t temp = 0; for (size_t i = 0 ; i < queries_count / 10 ; ++i ) @@ -144,8 +130,23 @@ int main() float y = coords[i].second + 100; temp += t.nearest_query(P(x, y), result_one); } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; + double time = tim.elapsed(); + std::cout << time << "s - nearest_query(P) " << (queries_count / 10) << " found " << temp << '\n'; + } + + // inserting test + { + tim.restart(); + for (size_t i = 0 ; i < values_count / 10 ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); + + t.remove(b); + } + double time = tim.elapsed(); + std::cout << time << "s - remove " << values_count / 10 << '\n'; } } From 392ac1a864b2ce56fc65bcd64ee1e268452f41d6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 17 Jan 2013 15:19:40 +0000 Subject: [PATCH 291/366] Options, functions: check_predicates(), are_boxes_ok(), are_levels_ok() moved to the index::detail namespace. query_expr.hpp deleted. [SVN r82523] --- doc/generated/adaptors.qbk | 1 - doc/generated/distance_predicates.qbk | 47 - doc/generated/inserters.qbk | 1 - doc/generated/predicates.qbk | 37 - doc/generated/rtree_functions.qbk | 1 - doc/generated/rtree_rstar.qbk | 2 +- doc/generated/rtree_runtime_rstar.qbk | 6 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 26 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 1156 +++++------------ .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../geometry/extensions/index/predicates.hpp | 12 +- .../geometry/extensions/index/query_expr.hpp | 376 ------ .../extensions/index/rtree/options.hpp | 98 +- .../index/rtree/visitors/are_boxes_ok.hpp | 12 +- .../index/rtree/visitors/are_levels_ok.hpp | 14 +- .../index/rtree/visitors/nearest_query.hpp | 4 +- .../index/rtree/visitors/spatial_query.hpp | 4 +- test/rtree/test_rtree.hpp | 4 +- test/rtree/test_rtree_exceptions.hpp | 8 +- 25 files changed, 418 insertions(+), 1417 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/query_expr.hpp diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index 4bfedeaa6..298b89454 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -1,7 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__adaptors.xml] [section:group__adaptors Adaptors (boost::geometry::index::adaptors::)] -[heading Functions] [table [[Function][Description]] [[[link group__adaptors_1ga8e094e1f312fc00336a3536f51a69468 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index 66cd264f7..2bd521571 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -1,7 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__distance__predicates.xml] [section:group__distance__predicates Distance predicates (boost::geometry::index::)] -[heading Functions] [table [[Function][Description]] [[[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] Point-Indexable relationship. ]] @@ -24,12 +23,6 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_nearest boost::geometry::index::to_nearest``(``T const &` `v``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -48,12 +41,6 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_centroid boost::geometry::index::to_centroid``(``T const &` `v``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -72,12 +59,6 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_furthest boost::geometry::index::to_furthest``(``T const &` `v``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -96,12 +77,6 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::unbounded boost::geometry::index::unbounded``(``PointRelation const &` `pr``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -120,13 +95,6 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::min_bounded boost::geometry::index::min_bounded``(``PointRelation const &` `pr``,` `MinRelation const &` `minr``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type. ]] -[[`MinRelation`][MinRelation type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -146,13 +114,6 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::max_bounded boost::geometry::index::max_bounded``(``PointRelation const &` `pr``,` `MaxRelation const &` `maxr``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type. ]] -[[`MaxRelation`][MaxRelation type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -176,14 +137,6 @@ Generate a distance predicate. This defines distances bounds which are used by k `MaxRelation const &` `maxr``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type. ]] -[[`MinRelation`][MinRelation type. ]] -[[`MaxRelation`][MaxRelation type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] diff --git a/doc/generated/inserters.qbk b/doc/generated/inserters.qbk index 6f619857d..83ee2e194 100644 --- a/doc/generated/inserters.qbk +++ b/doc/generated/inserters.qbk @@ -1,7 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__inserters.xml] [section:group__inserters Inserters (boost::geometry::index::)] -[heading Functions] [table [[Function][Description]] [[[link group__inserters_1gab22c33d31b9805250e54ee6d6d240a47 `inserter(Container &)`]][Insert iterator generator. ]] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 3d01a4ace..acb289d5c 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -1,7 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__predicates.xml] [section:group__predicates Spatial predicates (boost::geometry::index::)] -[heading Functions] [table [[Function][Description]] [[[link group__predicates_1ga150fd87dc53e5472f8905bb5827428e2 `empty()`]][Generate empty predicate. ]] @@ -36,12 +35,6 @@ A wrapper around user-defined functor describing if Value should be returned by `detail::value boost::geometry::index::value``(``ValuePredicate const &` `vpred``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`ValuePredicate`][Functor type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -60,12 +53,6 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::covered_by boost::geometry::index::covered_by``(``Geometry const &` `g``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`Geometry`][The Geometry type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -84,12 +71,6 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::disjoint boost::geometry::index::disjoint``(``Geometry const &` `g``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`Geometry`][The Geometry type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -108,12 +89,6 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::intersects boost::geometry::index::intersects``(``Geometry const &` `g``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`Geometry`][The Geometry type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -132,12 +107,6 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::overlaps boost::geometry::index::overlaps``(``Geometry const &` `g``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`Geometry`][The Geometry type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] @@ -156,12 +125,6 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::within boost::geometry::index::within``(``Geometry const &` `g``)` ] -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`Geometry`][The Geometry type.]] -] - [heading Parameter(s)] [table [[Type][Name][Description]] diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 1db8f87c8..71720f531 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -1,7 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__rtree__functions.xml] [section:group__rtree__functions Functions related to the rtree] -[heading Functions] [table [[Function][Description]] [[[link group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] diff --git a/doc/generated/rtree_rstar.qbk b/doc/generated/rtree_rstar.qbk index 78244048c..c546da7a5 100644 --- a/doc/generated/rtree_rstar.qbk +++ b/doc/generated/rtree_rstar.qbk @@ -14,7 +14,7 @@ R*-tree creation algorithm parameters. `template<``size_t MaxElements``,` `size_t MinElements``,` `size_t OverlapCostThreshold` = `0``,` - `size_t ReinsertedElements` = [^[link structboost_1_1geometry_1_1index_1_1options_1_1detail_1_1default__rstar__reinserted__elements options::detail::default_rstar_reinserted_elements]]`::value``>` + `size_t ReinsertedElements` = [^[link structboost_1_1geometry_1_1index_1_1detail_1_1default__rstar__reinserted__elements__s detail::default_rstar_reinserted_elements_s]]`::value``>` `struct rstar` `{` ` // ...` diff --git a/doc/generated/rtree_runtime_rstar.qbk b/doc/generated/rtree_runtime_rstar.qbk index de5330903..1eb0d33a4 100644 --- a/doc/generated/rtree_runtime_rstar.qbk +++ b/doc/generated/rtree_runtime_rstar.qbk @@ -21,10 +21,10 @@ R*-tree creation algorithm parameters. [heading Constructor(s) and destructor] [table [[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1add502ea66da6579bb3556d20b46b428e `rstar(size_t, size_t)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1a44d70eb723daa4fca13a1cfa20bf346f `rstar(size_t, size_t)`]][The constructor. ]] ] -[#classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1add502ea66da6579bb3556d20b46b428e] +[#classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1a44d70eb723daa4fca13a1cfa20bf346f] [section rstar(size_t, size_t)] The constructor. @@ -34,7 +34,7 @@ The constructor. `rstar``(``size_t` `max_elements``,` `size_t` `min_elements``,` `size_t` `overlap_cost_threshold` = `0``,` - `size_t` `reinserted_elements` = `detail::default_rstar_reinserted_elements()``)` + `size_t` `reinserted_elements` = `detail::default_rstar_reinserted_elements_d()``)` ] [heading Parameter(s)] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd5718dbb..c00e43835 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 9c5468fb8..4d5f596cd 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 5d10c6375..263f4d250 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 035a9287c..28ae3b6fd 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

    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 + 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 [2]. + close to some point in space [2].

    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -179,13 +179,13 @@

    - Implementation + Implementation details

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

    -
      +
      • capable to store arbitrary Value type,
      • @@ -207,7 +207,7 @@
      - Contributors + Contributors

      The spatial index was originally started by Federico J. Fernandez during @@ -215,7 +215,7 @@

      - Spatial + Spatial thanks

      @@ -224,20 +224,20 @@ list for their help.

      -

      -

      [1] +


      +

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

      -

      [2] +

      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

      -

      [3] +

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

      -

      [4] +

      [4] 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 16a6eba21..18130e9d5 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index 284192372..8fea0afe2 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -47,12 +47,12 @@ boost::geometry::index::rtree

      - + The R-tree spatial index.

      - Description + Description

      This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

      - Parameters + Parameters

      The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

      Predefined algorithms with compile-time parameters are:

      -
        +
        • boost::geometry::index::linear,
        • @@ -84,7 +84,7 @@ The R-tree spatial index.

          Predefined algorithms with run-time parameters are:

          -
            +
            - Translator + Translator

            The Translator translates from Value to Indexable each time r-tree requires @@ -114,14 +114,14 @@ The R-tree spatial index.

            - Header + Header

            #include <boost/geometry/extensions/index/rtree/rtree.hpp>

            - Synopsis + Synopsis
            template<typename Value,
                      typename Parameters,
            @@ -134,7 +134,7 @@ The R-tree spatial index.
             
            - Template + Template parameter(s)
            @@ -208,7 +208,7 @@ The R-tree spatial index.
            - Typedef(s) + Typedef(s)
            @@ -316,7 +316,7 @@ The R-tree spatial index.
            - Constructor(s) + Constructor(s) and destructor
            @@ -458,7 +458,7 @@ The R-tree spatial index.
            - Member(s) + Member(s)
            @@ -776,13 +776,13 @@ The R-tree spatial index.

            - Synopsis + Synopsis
            rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
             
            - Parameter(s) + Parameter(s)
            @@ -847,7 +847,7 @@ The R-tree spatial index.
            - Throws + Throws

            If allocator default constructor throws. @@ -863,7 +863,7 @@ The R-tree spatial index.

            - Synopsis + Synopsis
            rtree(parameters_type parameters,
                   translator_type const & translator,
            @@ -871,7 +871,7 @@ The R-tree spatial index.
             
            - Parameter(s) + Parameter(s)
            @@ -953,7 +953,7 @@ The R-tree spatial index.
            - Throws + Throws

            If allocator copy constructor throws. @@ -969,7 +969,7 @@ The R-tree spatial index.

            - Synopsis + Synopsis
            template<typename Iterator>
             rtree(Iterator first,
            @@ -980,7 +980,7 @@ The R-tree spatial index.
             
            - Parameter(s) + Parameter(s)
            @@ -1096,9 +1096,9 @@ The R-tree spatial index.
            - Throws + Throws
            -
              +
              • If allocator copy constructor throws.
              • @@ -1123,7 +1123,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis
                template<typename Range>
                 rtree(Range const & rng,
                @@ -1133,7 +1133,7 @@ The R-tree spatial index.
                 
                - Parameter(s) + Parameter(s)
                @@ -1233,9 +1233,9 @@ The R-tree spatial index.
                - Throws + Throws
                -
                  +
                  • If allocator copy constructor throws.
                  • @@ -1259,13 +1259,13 @@ The R-tree spatial index.

                    - Synopsis + Synopsis
                    ~rtree()
                     
                    - Throws + Throws

                    Nothing. @@ -1281,20 +1281,20 @@ The R-tree spatial index.

                    - Description + Description

                    It uses parameters, translator and allocator from the source tree.

                    - Synopsis + Synopsis
                    rtree(rtree const & src)
                     
                    - Parameter(s) + Parameter(s)
                    @@ -1340,9 +1340,9 @@ The R-tree spatial index.
                    - Throws + Throws
                    -
                      +
                      • If allocator copy constructor throws.
                      • @@ -1367,20 +1367,20 @@ The R-tree spatial index.

                        - Description + Description

                        It uses Parameters and translator from the source tree.

                        - Synopsis + Synopsis
                        rtree(rtree const & src, allocator_type const & allocator)
                         
                        - Parameter(s) + Parameter(s)
                        @@ -1446,9 +1446,9 @@ The R-tree spatial index.
                        - Throws + Throws
                        -
                          +
                          • If allocator copy constructor throws.
                          • @@ -1473,20 +1473,20 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters, translator and allocator from the source tree.

                            - Synopsis + Synopsis
                            rtree(rtree && src)
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1532,7 +1532,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            Nothing. @@ -1548,20 +1548,20 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters and translator from the source tree.

                            - Synopsis + Synopsis
                            rtree(rtree && src, allocator_type const & allocator)
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1627,9 +1627,9 @@ The R-tree spatial index.
                            - Throws + Throws
                            -
                              +
                              • If allocator copy constructor throws.
                              • @@ -1655,20 +1655,20 @@ The R-tree spatial index.

                                - Description + Description

                                It uses parameters and translator from the source tree.

                                - Synopsis + Synopsis
                                rtree & operator=(const rtree & src)
                                 
                                - Parameter(s) + Parameter(s)
                                @@ -1714,9 +1714,9 @@ The R-tree spatial index.
                                - Throws + Throws
                                -
                                  +
                                  • If Value copy constructor throws.
                                  • @@ -1738,20 +1738,20 @@ The R-tree spatial index.

                                    - Description + Description

                                    It uses parameters and translator from the source tree.

                                    - Synopsis + Synopsis
                                    rtree & operator=(rtree && src)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1797,12 +1797,12 @@ The R-tree spatial index.
                                    - Throws + Throws

                                    Only if allocators aren't equal.

                                    -
                                      +
                                      • If Value copy constructor throws.
                                      • @@ -1824,20 +1824,20 @@ The R-tree spatial index.

                                        - Description + Description

                                        Parameters, translator and allocators are swapped as well.

                                        - Synopsis + Synopsis
                                        void swap(rtree & other)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -1883,7 +1883,7 @@ The R-tree spatial index.
                                        - Throws + Throws

                                        If allocators swap throws. @@ -1899,13 +1899,13 @@ The R-tree spatial index.

                                        - Synopsis + Synopsis
                                        void insert(value_type const & value)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -1951,9 +1951,9 @@ The R-tree spatial index.
                                        - Throws + Throws
                                        -
                                          +
                                          • If Value copy constructor or copy assignment throws.
                                          • @@ -1986,14 +1986,14 @@ The R-tree spatial index.

                                            - Synopsis + Synopsis
                                            template<typename Iterator>
                                             void insert(Iterator first, Iterator last)
                                             
                                            - Parameter(s) + Parameter(s)
                                            @@ -2057,9 +2057,9 @@ The R-tree spatial index.
                                            - Throws + Throws
                                            -
                                              +
                                              • If Value copy constructor or copy assignment throws.
                                              • @@ -2092,14 +2092,14 @@ The R-tree spatial index.

                                                - Synopsis + Synopsis
                                                template<typename Range>
                                                 void insert(Range const & rng)
                                                 
                                                - Parameter(s) + Parameter(s)
                                                @@ -2145,9 +2145,9 @@ The R-tree spatial index.
                                                - Throws + Throws
                                                -
                                                  +
                                                  • If Value copy constructor or copy assignment throws.
                                                  • @@ -2180,7 +2180,7 @@ The R-tree spatial index.

                                                    - Description + Description

                                                    In contrast to the std::set @@ -2189,13 +2189,13 @@ The R-tree spatial index.

                                                    - Synopsis + Synopsis
                                                    size_type remove(value_type const & value)
                                                     
                                                    - Parameter(s) + Parameter(s)
                                                    @@ -2241,16 +2241,16 @@ The R-tree spatial index.
                                                    - Returns + Returns

                                                    1 if the value was removed, 0 otherwise.

                                                    - Throws + Throws
                                                    -
                                                      +
                                                      • If Value copy constructor or copy assignment throws.
                                                      • @@ -2283,7 +2283,7 @@ The R-tree spatial index.

                                                        - Description + Description

                                                        In contrast to the std::set @@ -2294,14 +2294,14 @@ The R-tree spatial index.

                                                        - Synopsis + Synopsis
                                                        template<typename Iterator>
                                                         size_type remove(Iterator first, Iterator last)
                                                         
                                                        - Parameter(s) + Parameter(s)
                                                        @@ -2365,16 +2365,16 @@ The R-tree spatial index.
                                                        - Returns + Returns

                                                        The number of removed values.

                                                        - Throws + Throws
                                                        -
                                                          +
                                                          • If Value copy constructor or copy assignment throws.
                                                          • @@ -2407,7 +2407,7 @@ The R-tree spatial index.

                                                            - Description + Description

                                                            In contrast to the std::set @@ -2417,14 +2417,14 @@ The R-tree spatial index.

                                                            - Synopsis + Synopsis
                                                            template<typename Range>
                                                             size_type remove(Range const & rng)
                                                             
                                                            - Parameter(s) + Parameter(s)
                                                            @@ -2470,16 +2470,16 @@ The R-tree spatial index.
                                                            - Returns + Returns

                                                            The number of removed values.

                                                            - Throws + Throws
                                                            -
                                                              +
                                                              • If Value copy constructor or copy assignment throws.
                                                              • @@ -2512,7 +2512,7 @@ The R-tree spatial index.

                                                                - Description + Description

                                                                Spatial predicates may be a Geometry. In this case Values @@ -2522,7 +2522,7 @@ The R-tree spatial index.

                                                                It may be generated by one of the functions listed below:

                                                                -
                                                                  +
                                                                  • boost::geometry::index::covered_by(),
                                                                  • @@ -2564,14 +2564,14 @@ The R-tree spatial index.

                                                                    - Synopsis + Synopsis
                                                                    template<typename Predicates, typename OutIter>
                                                                     size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                                     
                                                                    - Parameter(s) + Parameter(s)
                                                                    @@ -2636,16 +2636,16 @@ The R-tree spatial index.
                                                                    - Returns + Returns

                                                                    The number of values found.

                                                                    - Throws + Throws
                                                                    -
                                                                      +
                                                                      • If Value copy constructor or copy assignment throws.
                                                                      • @@ -2664,7 +2664,7 @@ The R-tree spatial index.

                                                                        - Description + Description

                                                                        Distances predicates may be a Point. In this the case the @@ -2675,7 +2675,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                        -
                                                                          +
                                                                          • boost::geometry::index::to_nearest() - default, @@ -2692,7 +2692,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                            -
                                                                              +
                                                                              • boost::geometry::index::unbounded() - default, @@ -2711,7 +2711,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                -
                                                                                  +
                                                                                  - Synopsis + Synopsis
                                                                                  template<typename DistancesPredicates>
                                                                                   size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
                                                                                   
                                                                                  - Parameter(s) + Parameter(s)
                                                                                  @@ -2797,14 +2797,14 @@ The R-tree spatial index.
                                                                                  - Returns + Returns

                                                                                  The number of values found.

                                                                                  - Throws + Throws

                                                                                  If Value copy constructor or copy assignment throws. @@ -2821,7 +2821,7 @@ The R-tree spatial index.

                                                                                  - Description + Description

                                                                                  Distances predicates may be a Point. In this the case the @@ -2832,7 +2832,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                  -
                                                                                    +
                                                                                    • boost::geometry::index::to_nearest() - default, @@ -2849,7 +2849,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                      -
                                                                                        +
                                                                                        • boost::geometry::index::unbounded() - default, @@ -2868,7 +2868,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                          -
                                                                                            +
                                                                                            • boost::geometry::index::to_nearest(),
                                                                                            • @@ -2887,7 +2887,7 @@ The R-tree spatial index.

                                                                                              It may be generated by one of the functions listed below:

                                                                                              -
                                                                                                +
                                                                                                • boost::geometry::index::covered_by(),
                                                                                                • @@ -2929,7 +2929,7 @@ The R-tree spatial index.

                                                                                                  - Synopsis + Synopsis
                                                                                                  template<typename DistancesPredicates, typename Predicates>
                                                                                                   size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                  @@ -2938,7 +2938,7 @@ The R-tree spatial index.
                                                                                                   
                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                  @@ -3021,14 +3021,14 @@ The R-tree spatial index.
                                                                                                  - Returns + Returns

                                                                                                  The number of values found.

                                                                                                  - Throws + Throws

                                                                                                  If Value copy constructor or copy assignment throws. @@ -3045,7 +3045,7 @@ The R-tree spatial index.

                                                                                                  - Description + Description

                                                                                                  Distances predicates may be a Point. In this the case the @@ -3056,7 +3056,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                  -
                                                                                                    +
                                                                                                    • boost::geometry::index::to_nearest() - default, @@ -3073,7 +3073,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                      -
                                                                                                        +
                                                                                                        • boost::geometry::index::unbounded() - default, @@ -3092,7 +3092,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                          -
                                                                                                            +
                                                                                                            - Synopsis + Synopsis
                                                                                                            template<typename DistancesPredicates, typename OutIter>
                                                                                                             size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                            @@ -3114,7 +3114,7 @@ The R-tree spatial index.
                                                                                                             
                                                                                                            - Parameter(s) + Parameter(s)
                                                                                                            @@ -3196,14 +3196,14 @@ The R-tree spatial index.
                                                                                                            - Returns + Returns

                                                                                                            The number of values found.

                                                                                                            - Throws + Throws

                                                                                                            If Value copy constructor or copy assignment throws. If OutIter dereference @@ -3221,7 +3221,7 @@ The R-tree spatial index.

                                                                                                            - Description + Description

                                                                                                            Distances predicates may be a Point. In this the case the @@ -3232,7 +3232,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                            -
                                                                                                              +
                                                                                                              - +

                                                                                                              Last revised: January 17, 2013 at 03:55:35 GMT

                                                                                                              Last revised: January 17, 2013 at 15:17:48 GMT


                                                                                                              diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index cae80e9fd..902a705d3 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -455,7 +455,7 @@ struct predicates_check_tuple }; template -struct predicates_check +struct predicates_check_impl { template static inline bool apply(Predicate const& p, Value const& v, Indexable const& i) @@ -465,7 +465,7 @@ struct predicates_check }; template -struct predicates_check, Tag> +struct predicates_check_impl, Tag> { template static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) @@ -480,7 +480,7 @@ template < typename T5, typename T6, typename T7, typename T8, typename T9, typename Tag > -struct predicates_check< +struct predicates_check_impl< boost::tuple, Tag > @@ -498,15 +498,15 @@ struct predicates_check< } }; -} // namespace detail - template inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i) { - return detail::predicates_check + return detail::predicates_check_impl ::apply(p, v, i); } +} // namespace detail + }}} // namespace boost::geometry::index // operator! generators diff --git a/include/boost/geometry/extensions/index/query_expr.hpp b/include/boost/geometry/extensions/index/query_expr.hpp deleted file mode 100644 index 7fb6dbd38..000000000 --- a/include/boost/geometry/extensions/index/query_expr.hpp +++ /dev/null @@ -1,376 +0,0 @@ -// Boost.Geometry Index -// -// Query expression -// -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// TODO - CHANGE FILENAME TO query_expr.hpp -// create separate namespace etc. - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_QUERY_EXPR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_QUERY_EXPR_HPP - -namespace boost { namespace geometry { namespace index { - -namespace query_expr { - -// predicates tags - -struct empty_tag {}; -struct value_tag {}; - -struct covered_by_tag {}; -struct disjoint_tag {}; -struct intersects_tag {}; -struct overlaps_tag {}; -//struct touches_tag {}; -struct within_tag {}; - -struct not_covered_by_tag {}; -struct not_disjoint_tag {}; -struct not_intersects_tag {}; -struct not_overlaps_tag {}; -//struct not_touches_tag {}; -struct not_within_tag {}; - -struct nearest_tag {}; - -// closer_than_tag ? -// further_than_tag ? - -// predicates data - -template -struct predicate -{ - explicit predicate(Geometry const& geometry_) : geometry(geometry_) {} - Geometry geometry; -}; - -template -struct predicate -{ - explicit predicate(ValuePredicate const& value_predicate_) : value_predicate(value_predicate_) {} - ValuePredicate value_predicate; -}; - -template -struct predicate -{}; - -template -struct predicate -{ - predicate(size_t k_, DistancesPredicates const& distances_predicates_) - : k(k_), distances_predicates(distances_predicates_) - {} - - size_t k; - DistancesPredicates distances_predicates; -}; - -// expression && - -template -struct and_expr -{ - typedef Left left_type; - typedef Right right_type; - - and_expr(Left const& left_, Right const& right_) - : left(left_), right(right_) - {} - - Left const& left; - Right const& right; -}; - -// predicate_tag -template -struct predicate_tag -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_VALID_PREDICATE, - (Predicate)); -}; -template -struct predicate_tag< predicate > -{ - typedef Tag type; -}; - -// predicates_length - -template -struct predicates_length -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_VALID_QUERY_EXPRESSION, - (Expr)); -}; -template -struct predicates_length< and_expr > -{ - static const size_t value = predicates_length::value + predicates_length::value; -}; -template -struct predicates_length< predicate > -{ - static const size_t value = 1; -}; - -// if_v - -template -struct if_v -{ - static const size_t value = V1; -}; -template -struct if_v -{ - static const size_t value = V2; -}; - -// if_t - -template -struct if_t -{ - typedef T1 type; -}; -template -struct if_t -{ - typedef T2 type; -}; - -// if_ret_t -template -struct if_ret_t -{ - typedef T const& type; -}; -template -struct if_ret_t -{ - typedef void type; -}; - -// if_ret -template -struct if_ret -{ - template - static inline T const& apply(T const& v) { return v; } -}; -template <> -struct if_ret -{ - template - void apply(T const&) {} -}; - -// if_ret2 -template -struct if_ret2 -{ - template - static inline typename L::return_type - apply(Expr const& e) { return L::apply(e.left); } -}; -template -struct if_ret2 -{ - template - static inline typename R::return_type - apply(Expr const& e) { return R::apply(e.right); } -}; - -// types_equal -template -struct types_equal -{ - static const bool value = false; -}; -template -struct types_equal -{ - static const bool value = true; -}; - -// predicate_access_impl - used by predicate_type and get_predicate() - -template -struct predicate_access -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_VALID_QUERY_EXPRESSION, - (Expr)); -}; - -template -struct predicate_access, I, Curr> -{ - typedef predicate_access L; - typedef predicate_access::curr + 1> R; - - static const size_t curr = if_v< - I == L::curr, - L::curr, - R::curr - >::value; - - typedef typename if_t< - I == L::curr, - typename L::type, - typename R::type - >::type type; - - typedef typename if_t< - I == L::curr, - typename L::return_type, - typename R::return_type - >::type return_type; - - static inline return_type - apply(and_expr const& e) - { - return if_ret2::apply(e); - } -}; - -template -struct predicate_access, I, Curr> -{ - static const size_t curr = Curr; - - typedef typename if_t, void>::type type; - - typedef typename if_ret_t::type return_type; - - static inline return_type apply(predicate const& p) - { - return if_ret::apply(p); - } -}; - -// predicate_type - -template -struct predicate_type -{ - typedef typename predicate_access::type type; -}; - -// get_predicate - -template -typename predicate_access::return_type -get_predicate(Expr const& expr) -{ - return predicate_access::apply(expr); -}; - -// predicate_index -template -struct predicate_index_impl -{ - static const size_t value = if_v< - types_equal< - Tag, - typename predicate_tag< - typename predicate_type::type - >::type - >::value, - I, - predicate_index_impl::value - >::value; -}; -template -struct predicate_index_impl -{ - static const size_t value = N; -}; - -template -struct predicate_index -{ - static const size_t value = - predicate_index_impl< - Expr, Tag, I, predicates_length::value - >::value; -}; - -// count_predicate -template -struct count_predicate_impl -{ - static const size_t value = - count_predicate_impl::value + - if_v< - types_equal< - Tag, - typename predicate_tag< - typename predicate_type::type - >::type - >::value, - 1, - 0 - >::value; -}; -template -struct count_predicate_impl -{ - static const size_t value = 0; -}; - -template -struct count_predicate -{ - static const size_t value = - count_predicate_impl< - Expr, Tag, I, predicates_length::value - >::value; -}; - -// count_predicate - -} // namespace query_expr - -}}} // namespace boost::geometry::index - -template -boost::geometry::index::query_expr::and_expr< - boost::geometry::index::query_expr::predicate, - boost::geometry::index::query_expr::predicate -> -operator&&(boost::geometry::index::query_expr::predicate const& left, - boost::geometry::index::query_expr::predicate const& right) -{ - using namespace boost::geometry::index::query_expr; - - return and_expr< predicate, predicate >(left, right); -} - -template -boost::geometry::index::query_expr::and_expr< - boost::geometry::index::query_expr::and_expr, - boost::geometry::index::query_expr::predicate -> -operator&&(boost::geometry::index::query_expr::and_expr const& left, - boost::geometry::index::query_expr::predicate const& right) -{ - using namespace boost::geometry::index::query_expr; - - return and_expr< and_expr, predicate >(left, right); -} - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_QUERY_EXPR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/rtree/options.hpp index cf1544bc8..76f34a2fb 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/rtree/options.hpp @@ -15,29 +15,6 @@ namespace boost { namespace geometry { namespace index { -// InsertTag -struct insert_default_tag {}; -struct insert_reinsert_tag {}; - -// ChooseNextNodeTag -struct choose_by_content_diff_tag {}; -struct choose_by_overlap_diff_tag {}; - -// SplitTag -struct split_default_tag {}; -//struct split_kmeans_tag {}; - -// RedistributeTag -struct linear_tag {}; -struct quadratic_tag {}; -struct rstar_tag {}; - -// NodeTag -struct node_d_mem_dynamic_tag {}; -struct node_d_mem_static_tag {}; -struct node_s_mem_dynamic_tag {}; -struct node_s_mem_static_tag {}; - // TODO: awulkiew - implement those: //if ( m_min_elems_per_node < 1 ) // m_min_elems_per_node = 1; @@ -76,15 +53,15 @@ struct quadratic static size_t get_min_elements() { return MinElements; } }; -namespace options { namespace detail { +namespace detail { template -struct default_rstar_reinserted_elements +struct default_rstar_reinserted_elements_s { static const size_t value = (MaxElements * 3) / 10; }; -}} // namespace options::detail +} // namespace detail /*! \brief R*-tree creation algorithm parameters. @@ -99,7 +76,7 @@ struct default_rstar_reinserted_elements template ::value + size_t ReinsertedElements = detail::default_rstar_reinserted_elements_s::value > struct rstar { @@ -114,6 +91,13 @@ struct rstar static size_t get_reinserted_elements() { return ReinsertedElements; } }; +//template +//struct kmeans +//{ +// static const size_t max_elements = MaxElements; +// static const size_t min_elements = MinElements; +//}; + namespace runtime { /*! @@ -168,12 +152,12 @@ private: namespace detail { -inline size_t default_rstar_reinserted_elements() +inline size_t default_rstar_reinserted_elements_d() { return (std::numeric_limits::max)(); }; -} // namespace options::detail +} // namespace detail /*! \brief R*-tree creation algorithm parameters. @@ -194,12 +178,12 @@ public: rstar(size_t max_elements, size_t min_elements, size_t overlap_cost_threshold = 0, - size_t reinserted_elements = detail::default_rstar_reinserted_elements()) + size_t reinserted_elements = detail::default_rstar_reinserted_elements_d()) : m_max_elements(max_elements) , m_min_elements(min_elements) , m_overlap_cost_threshold(overlap_cost_threshold) , m_reinserted_elements( - detail::default_rstar_reinserted_elements() == reinserted_elements ? + detail::default_rstar_reinserted_elements_d() == reinserted_elements ? (max_elements * 3) / 10 : reinserted_elements ) @@ -219,10 +203,33 @@ private: } -namespace options { +namespace detail { namespace rtree { + +// InsertTag +struct insert_default_tag {}; +struct insert_reinsert_tag {}; + +// ChooseNextNodeTag +struct choose_by_content_diff_tag {}; +struct choose_by_overlap_diff_tag {}; + +// SplitTag +struct split_default_tag {}; +//struct split_kmeans_tag {}; + +// RedistributeTag +struct linear_tag {}; +struct quadratic_tag {}; +struct rstar_tag {}; + +// NodeTag +struct node_d_mem_dynamic_tag {}; +struct node_d_mem_static_tag {}; +struct node_s_mem_dynamic_tag {}; +struct node_s_mem_static_tag {}; template -struct rtree +struct options { typedef Parameters parameters_type; typedef InsertTag insert_tag; @@ -232,17 +239,6 @@ struct rtree typedef NodeTag node_tag; }; -} // namespace options - -//template -//struct kmeans -//{ -// static const size_t max_elements = MaxElements; -// static const size_t min_elements = MinElements; -//}; - -namespace detail { namespace rtree { - template struct options_type { @@ -252,7 +248,7 @@ struct options_type template struct options_type< linear > { - typedef options::rtree< + typedef options< linear, insert_default_tag, choose_by_content_diff_tag, @@ -265,7 +261,7 @@ struct options_type< linear > template struct options_type< quadratic > { - typedef options::rtree< + typedef options< quadratic, insert_default_tag, choose_by_content_diff_tag, @@ -278,7 +274,7 @@ struct options_type< quadratic > template struct options_type< rstar > { - typedef options::rtree< + typedef options< rstar, insert_reinsert_tag, choose_by_overlap_diff_tag, @@ -291,7 +287,7 @@ struct options_type< rstar //struct options_type< kmeans > //{ -// typedef options::rtree< +// typedef options< // kmeans, // insert_default_tag, // choose_by_content_diff_tag, // change it? @@ -304,7 +300,7 @@ struct options_type< rstar struct options_type< runtime::linear > { - typedef options::rtree< + typedef options< runtime::linear, insert_default_tag, choose_by_content_diff_tag, @@ -317,7 +313,7 @@ struct options_type< runtime::linear > template <> struct options_type< runtime::quadratic > { - typedef options::rtree< + typedef options< runtime::quadratic, insert_default_tag, choose_by_content_diff_tag, @@ -330,7 +326,7 @@ struct options_type< runtime::quadratic > template <> struct options_type< runtime::rstar > { - typedef options::rtree< + typedef options< runtime::rstar, insert_reinsert_tag, choose_by_overlap_diff_tag, diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp index 9f8ac5dcc..542c2e16d 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp @@ -14,9 +14,9 @@ #include #include -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { -namespace detail { namespace rtree { namespace visitors { +namespace rtree { namespace visitors { template class are_boxes_ok @@ -115,13 +115,13 @@ private: bool m_exact_match; }; -}}} // namespace detail::rtree::visitors +}} // namespace rtree::visitors template -bool are_boxes_ok(rtree const& tree, +bool are_boxes_ok(index::rtree const& tree, bool exact_match = true) { - typedef rtree rt; + typedef index::rtree rt; detail::rtree::visitors::are_boxes_ok< typename rt::value_type, @@ -136,6 +136,6 @@ bool are_boxes_ok(rtree const& tree, return v.result; } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp index e7999adc5..854a19243 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp @@ -13,9 +13,9 @@ #include -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { namespace visitors { +namespace boost { namespace geometry { namespace index { namespace detail { + +namespace rtree { namespace visitors { template class are_levels_ok @@ -86,12 +86,12 @@ private: size_t m_current_level; }; -}}} // namespace detail::rtree::visitors +}} // namespace rtree::visitors template -bool are_levels_ok(rtree const& tree) +bool are_levels_ok(index::rtree const& tree) { - typedef rtree rt; + typedef index::rtree rt; detail::rtree::visitors::are_levels_ok< typename rt::value_type, @@ -106,6 +106,6 @@ bool are_levels_ok(rtree const& tree) return v.result; } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp index e269fa1ce..58f59cbd7 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp @@ -211,7 +211,7 @@ public: { // if current node meets predicates // 0 - dummy value - if ( index::predicates_check(m_pred, 0, it->first) ) + if ( index::detail::predicates_check(m_pred, 0, it->first) ) { // calculate node's distance(s) for distance predicate node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); @@ -266,7 +266,7 @@ public: it != elements.end(); ++it) { // if value meets predicates - if ( index::predicates_check(m_pred, *it, m_translator(*it)) ) + if ( index::detail::predicates_check(m_pred, *it, m_translator(*it)) ) { // calculate values distance for distance predicate value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_translator(*it)); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp b/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp index 10926f2f2..87f904546 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp @@ -43,7 +43,7 @@ struct spatial_query { // if node meets predicates // 0 - dummy value - if ( index::predicates_check(pred, 0, it->first) ) + if ( index::detail::predicates_check(pred, 0, it->first) ) rtree::apply_visitor(*this, *it->second); } } @@ -58,7 +58,7 @@ struct spatial_query it != elements.end(); ++it) { // if value meets predicates - if ( index::predicates_check(pred, *it, tr(*it)) ) + if ( index::detail::predicates_check(pred, *it, tr(*it)) ) { out_iter = *it; ++out_iter; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 04071b432..05896776b 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -549,9 +549,9 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran 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::detail::are_levels_ok(rtree) ); if ( !rtree.empty() ) - BOOST_CHECK( bgi::are_boxes_ok(rtree) ); + BOOST_CHECK( bgi::detail::are_boxes_ok(rtree) ); std::vector output; size_t n = rtree.spatial_query(pred, std::back_inserter(output)); diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 80a9cb146..735510e61 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -30,7 +30,7 @@ struct linear_throwing : public linear {}; template struct quadratic_throwing : public quadratic {}; -template ::value> +template ::value> struct rstar_throwing : public rstar {}; namespace detail { namespace rtree { @@ -38,7 +38,7 @@ namespace detail { namespace rtree { template struct options_type< linear_throwing > { - typedef options::rtree< + typedef options< linear_throwing, insert_default_tag, choose_by_content_diff_tag, split_default_tag, linear_tag, node_throwing_d_mem_static_tag @@ -48,7 +48,7 @@ struct options_type< linear_throwing > template struct options_type< quadratic_throwing > { - typedef options::rtree< + typedef options< quadratic_throwing, insert_default_tag, choose_by_content_diff_tag, split_default_tag, quadratic_tag, node_throwing_d_mem_static_tag @@ -58,7 +58,7 @@ struct options_type< quadratic_throwing > template struct options_type< rstar_throwing > { - typedef options::rtree< + typedef options< rstar_throwing, insert_reinsert_tag, choose_by_overlap_diff_tag, split_default_tag, rstar_tag, node_throwing_d_mem_static_tag From 0a29cced585d3f111a4a622f1181167a34607eb3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 17 Jan 2013 17:11:33 +0000 Subject: [PATCH 292/366] doxygen_xml2qbk: added modifiers output to functions/members output. rtree: new docs generated with modifiers. [SVN r82527] --- doc/generated/adaptors.qbk | 1 + doc/generated/distance_predicates.qbk | 47 + doc/generated/inserters.qbk | 1 + doc/generated/predicates.qbk | 37 + doc/generated/rtree.qbk | 88 +- doc/generated/rtree_functions.qbk | 1 + doc/generated/translator_index.qbk | 3 +- doc/html/geometry_index/r_tree/reference.html | 809 +++++++++++++++++- doc/html/index.html | 2 +- .../doxygen_xml2qbk/doxygen_elements.hpp | 2 + .../doxygen_xml2qbk/doxygen_xml_parser.hpp | 7 + .../doxygen_xml2qbk/quickbook_output.hpp | 56 +- 12 files changed, 973 insertions(+), 81 deletions(-) diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index 298b89454..4bfedeaa6 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__adaptors.xml] [section:group__adaptors Adaptors (boost::geometry::index::adaptors::)] +[heading Functions] [table [[Function][Description]] [[[link group__adaptors_1ga8e094e1f312fc00336a3536f51a69468 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index 2bd521571..66cd264f7 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__distance__predicates.xml] [section:group__distance__predicates Distance predicates (boost::geometry::index::)] +[heading Functions] [table [[Function][Description]] [[[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] Point-Indexable relationship. ]] @@ -23,6 +24,12 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_nearest boost::geometry::index::to_nearest``(``T const &` `v``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -41,6 +48,12 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_centroid boost::geometry::index::to_centroid``(``T const &` `v``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -59,6 +72,12 @@ Generate a nearest query Point and Value's Indexable relationship while calculat `detail::to_furthest boost::geometry::index::to_furthest``(``T const &` `v``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -77,6 +96,12 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::unbounded boost::geometry::index::unbounded``(``PointRelation const &` `pr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -95,6 +120,13 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::min_bounded boost::geometry::index::min_bounded``(``PointRelation const &` `pr``,` `MinRelation const &` `minr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type. ]] +[[`MinRelation`][MinRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -114,6 +146,13 @@ Generate a distance predicate. This defines distances bounds which are used by k `detail::max_bounded boost::geometry::index::max_bounded``(``PointRelation const &` `pr``,` `MaxRelation const &` `maxr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type. ]] +[[`MaxRelation`][MaxRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -137,6 +176,14 @@ Generate a distance predicate. This defines distances bounds which are used by k `MaxRelation const &` `maxr``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`PointRelation`][PointRelation type. ]] +[[`MinRelation`][MinRelation type. ]] +[[`MaxRelation`][MaxRelation type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] diff --git a/doc/generated/inserters.qbk b/doc/generated/inserters.qbk index 83ee2e194..6f619857d 100644 --- a/doc/generated/inserters.qbk +++ b/doc/generated/inserters.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__inserters.xml] [section:group__inserters Inserters (boost::geometry::index::)] +[heading Functions] [table [[Function][Description]] [[[link group__inserters_1gab22c33d31b9805250e54ee6d6d240a47 `inserter(Container &)`]][Insert iterator generator. ]] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index acb289d5c..3d01a4ace 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__predicates.xml] [section:group__predicates Spatial predicates (boost::geometry::index::)] +[heading Functions] [table [[Function][Description]] [[[link group__predicates_1ga150fd87dc53e5472f8905bb5827428e2 `empty()`]][Generate empty predicate. ]] @@ -35,6 +36,12 @@ A wrapper around user-defined functor describing if Value should be returned by `detail::value boost::geometry::index::value``(``ValuePredicate const &` `vpred``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`ValuePredicate`][Functor type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -53,6 +60,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::covered_by boost::geometry::index::covered_by``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -71,6 +84,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::disjoint boost::geometry::index::disjoint``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -89,6 +108,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::intersects boost::geometry::index::intersects``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -107,6 +132,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::overlaps boost::geometry::index::overlaps``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] @@ -125,6 +156,12 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret `detail::within boost::geometry::index::within``(``Geometry const &` `g``)` ] +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Geometry`][The Geometry type.]] +] + [heading Parameter(s)] [table [[Type][Name][Description]] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 1611d28a4..7ccbd04bc 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -89,29 +89,29 @@ The Translator translates from Value to Indexable each time r-tree requires it. [heading Member(s)] [table -[[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] +[[Modifier][Function][Description]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] ] [#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b] @@ -124,7 +124,8 @@ The constructor. `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] @@ -207,7 +208,8 @@ The constructor. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] @@ -631,7 +633,8 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] @@ -683,7 +686,8 @@ MinRelation and MaxRelation describes bounds and can be generated by following f [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]] @@ -749,7 +753,8 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -799,7 +804,8 @@ MinRelation and MaxRelation describes bounds and can be generated by following f `OutIter` `out_it``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -869,7 +875,8 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ `OutIter` `out_it``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]] @@ -894,7 +901,8 @@ Returns the number of stored values. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The number of stored values. [heading Throws] Nothing. @@ -911,7 +919,8 @@ Query if the container is empty. `bool` `empty``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] true if the container is empty. [heading Throws] Nothing. @@ -944,7 +953,8 @@ Returns the box containing all values stored in the container. If the container [^[link classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d box_type]]` const &` `box``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The box containing all values stored in the container or an invalid box if there are no values in the container. [heading Throws] Nothing. @@ -962,7 +972,8 @@ For indexable_type it returns the number of values which indexables equals the p [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]] @@ -984,7 +995,8 @@ Returns parameters. [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The parameters object. [heading Throws] Nothing. @@ -1001,7 +1013,8 @@ Returns the translator object. [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The translator object. [heading Throws] Nothing. @@ -1018,7 +1031,8 @@ Returns allocator used by the rtree. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The allocator. [heading Throws] If allocator copy constructor throws. diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 71720f531..1db8f87c8 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -1,6 +1,7 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__rtree__functions.xml] [section:group__rtree__functions Functions related to the rtree] +[heading Functions] [table [[Function][Description]] [[[link group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 1d2ce0ca6..6bc83f483 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -43,7 +43,8 @@ The constructor. `index``(``Container const &` `c``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Container const &`][ `c` ][The container which stores indexed values. ]] diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 8fea0afe2..e0f1cc15c 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                                                                                                        - + The R-tree spatial index.

                                                                                                        @@ -464,8 +464,14 @@ The R-tree spatial index.
    +

    + Modifier +

    +

    Function @@ -479,6 +485,8 @@ The R-tree spatial index.

    +

    operator=(const rtree @@ -492,6 +500,8 @@ The R-tree spatial index.

    +

    operator=(rtree &&) @@ -504,6 +514,8 @@ The R-tree spatial index.

    +

    swap(rtree &) @@ -516,6 +528,8 @@ The R-tree spatial index.

    +

    insert(value_type const @@ -529,6 +543,8 @@ The R-tree spatial index.

    +

    insert(Iterator, @@ -542,6 +558,8 @@ The R-tree spatial index.

    +

    insert(Range const @@ -555,6 +573,8 @@ The R-tree spatial index.

    +

    remove(value_type const @@ -568,6 +588,8 @@ The R-tree spatial index.

    +

    remove(Iterator, @@ -581,6 +603,8 @@ The R-tree spatial index.

    +

    remove(Range const @@ -594,6 +618,11 @@ The R-tree spatial index.

    +

    + const +

    +

    spatial_query(Predicates const @@ -608,6 +637,11 @@ The R-tree spatial index.

    +

    + const +

    +

    nearest_query(DistancesPredicates const @@ -623,6 +657,11 @@ The R-tree spatial index.

    +

    + const +

    +

    nearest_query(DistancesPredicates const @@ -639,6 +678,11 @@ The R-tree spatial index.

    +

    + const +

    +

    nearest_query(DistancesPredicates const @@ -653,6 +697,11 @@ The R-tree spatial index.

    +

    + const +

    +

    nearest_query(DistancesPredicates const @@ -669,6 +718,11 @@ The R-tree spatial index.

    +

    + const +

    +

    size() @@ -681,6 +735,11 @@ The R-tree spatial index.

    +

    + const +

    +

    empty() @@ -693,6 +752,8 @@ The R-tree spatial index.

    +

    clear() @@ -705,6 +766,11 @@ The R-tree spatial index.

    +

    + const +

    +

    box() @@ -717,6 +783,11 @@ The R-tree spatial index.

    +

    + const +

    +

    count(ValueOrIndexable const @@ -730,6 +801,11 @@ The R-tree spatial index.

    +

    + const +

    +

    parameters() @@ -742,6 +818,11 @@ The R-tree spatial index.

    +

    + const +

    +

    translator() @@ -754,6 +835,11 @@ The R-tree spatial index.

    +

    + const +

    +

    get_allocator() @@ -782,6 +868,15 @@ The R-tree spatial index.

    + Modifier(s) +
    +

    +

    +
    explicit
    +

    +

    +
    + Parameter(s)
    @@ -846,7 +941,7 @@ The R-tree spatial index.
    - + Throws

    @@ -1133,6 +1228,15 @@ The R-tree spatial index.

    + Modifier(s) +
    +

    +

    +
    explicit
    +

    +

    +
    + Parameter(s)
    @@ -1232,7 +1336,7 @@ The R-tree spatial index.
    - + Throws
      @@ -2571,6 +2675,15 @@ The R-tree spatial index.
      + Modifier(s) +
      +

      +

      +
      const
      +

      +

      +
      + Parameter(s)
      @@ -2635,14 +2748,14 @@ The R-tree spatial index.
      - + Returns

      The number of values found.

      - + Throws
        @@ -2731,6 +2844,15 @@ The R-tree spatial index.
        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Parameter(s)
        @@ -2796,14 +2918,14 @@ The R-tree spatial index.
        - + Returns

        The number of values found.

        - + Throws

        @@ -2938,6 +3060,15 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Parameter(s)
        @@ -3020,14 +3151,14 @@ The R-tree spatial index.
        - + Returns

        The number of values found.

        - + Throws

        @@ -3114,6 +3245,15 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Parameter(s)
        @@ -3195,14 +3335,14 @@ The R-tree spatial index.
        - + Returns

        The number of values found.

        - + Throws

        @@ -3341,6 +3481,15 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Parameter(s)
        @@ -3439,14 +3588,14 @@ The R-tree spatial index.
        - + Returns

        The number of values found.

        - + Throws

        @@ -3469,13 +3618,22 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Returns

        The number of stored values.

        - + Throws

        @@ -3497,13 +3655,22 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Returns

        true if the container is empty.

        - + Throws

        @@ -3554,6 +3721,15 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Returns

        @@ -3561,7 +3737,7 @@ The R-tree spatial index. if there are no values in the container.

        - + Throws

        @@ -3594,6 +3770,15 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Parameter(s)
        @@ -3639,14 +3824,14 @@ The R-tree spatial index.
        - + Returns

        The number of values found.

        - + Throws

        @@ -3668,13 +3853,22 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Returns

        The parameters object.

        - + Throws

        @@ -3696,13 +3890,22 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Returns

        The translator object.

        - + Throws

        @@ -3724,13 +3927,22 @@ The R-tree spatial index.

        + Modifier(s) +
        +

        +

        +
        const
        +

        +

        +
        + Returns

        The allocator.

        - + Throws

        @@ -3743,6 +3955,10 @@ The R-tree spatial index. Functions related to the rtree

    +
    + + Functions +
    @@ -5686,7 +5902,7 @@ The R-tree spatial index. boost::geometry::index::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -5761,7 +5977,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -5836,7 +6052,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

    - + R*-tree creation algorithm parameters.

    @@ -5940,7 +6156,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -6076,7 +6292,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -6212,7 +6428,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

    - + R*-tree creation algorithm parameters.

    @@ -6388,6 +6604,10 @@ R*-tree creation algorithm parameters. Spatial predicates (boost::geometry::index::)
    +
    + + Functions +
    @@ -6542,6 +6762,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + ValuePredicate +

    +
    +

    + Functor type. +

    +
    +
    + Parameter(s)
    @@ -6612,6 +6867,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6683,6 +6973,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6754,6 +7079,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6825,6 +7185,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6896,6 +7291,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Geometry +

    +
    +

    + The Geometry type. +

    +
    +
    + Parameter(s)
    @@ -6947,6 +7377,10 @@ R*-tree creation algorithm parameters. Distance predicates (boost::geometry::index::) +
    + + Functions +
    @@ -7101,6 +7535,42 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + T +

    +
    +

    + Type of wrapped object. This may be a Point for PointRelation + or some Value for MinRelation or MaxRelation +

    +
    +
    + Parameter(s)
    @@ -7175,6 +7645,42 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + T +

    +
    +

    + Type of wrapped object. This may be a Point for PointRelation + or some Value for MinRelation or MaxRelation +

    +
    +
    + Parameter(s)
    @@ -7251,6 +7757,42 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + T +

    +
    +

    + Type of wrapped object. This may be a Point for PointRelation + or some Value for MinRelation or MaxRelation +

    +
    +
    + Parameter(s)
    @@ -7325,6 +7867,41 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +
    + Parameter(s)
    @@ -7404,6 +7981,55 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +

    + MinRelation +

    +
    +

    + MinRelation type. +

    +
    +
    + Parameter(s)
    @@ -7505,6 +8131,55 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +

    + MaxRelation +

    +
    +

    + MaxRelation type. +

    +
    +
    + Parameter(s)
    @@ -7611,6 +8286,67 @@ R*-tree creation algorithm parameters.
    + Template + parameter(s) +
    +
    ++++ + + + + + + + + + + + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + PointRelation +

    +
    +

    + PointRelation type. +

    +
    +

    + MinRelation +

    +
    +

    + MinRelation type. +

    +
    +

    + MaxRelation +

    +
    +

    + MaxRelation type. +

    +
    +
    + Parameter(s)
    @@ -7707,6 +8443,10 @@ R*-tree creation algorithm parameters. Adaptors (boost::geometry::index::adaptors::) +
    + + Functions +
    @@ -8020,7 +8760,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -8090,7 +8830,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    @@ -8206,6 +8946,13 @@ The index translator.
    index(Container const & c)
     
    + Modifier(s) +

    +

    +
    explicit
    +

    +

    + Parameter(s)
    @@ -8256,6 +9003,10 @@ The index translator. Inserters (boost::geometry::index::) +
    + + Functions +
    diff --git a/doc/html/index.html b/doc/html/index.html index 8feb6fa57..f99e33e3f 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@
    - +

    Last revised: January 17, 2013 at 15:17:48 GMT

    Last revised: January 17, 2013 at 17:06:52 GMT


    diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp index 123041039..35d5c924e 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp @@ -130,12 +130,14 @@ struct function : public element std::string precondition; std::string return_type_without_links; + bool is_static, is_const, is_explicit, is_virtual; bool unique; function() : type(function_unknown) , unique(true) + , is_static(false), is_const(false), is_explicit(false), is_virtual(false) {} }; diff --git a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp index d4ab6a089..b16dc67e8 100644 --- a/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp +++ b/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp @@ -630,12 +630,19 @@ static void parse(rapidxml::xml_node<>* node, configuration const& config, docum { std::string kind = get_attribute(node, "kind"); std::string id = get_attribute(node, "id"); + if (kind == "function") { function f; f.id = id; + f.is_static = get_attribute(node, "static") == "yes" ? true : false; + f.is_const = get_attribute(node, "const") == "yes" ? true : false; + f.is_explicit = get_attribute(node, "explicit") == "yes" ? true : false; + f.is_virtual = get_attribute(node, "virt") == "virtual" ? true : false; + parse_element(node->first_node(), config, "", f); parse_function(node->first_node(), config, "", f); + if (member) { bool c_or_d = boost::equals(f.name, doc.cos.name) || diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 854ca4330..737ff8f44 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -701,14 +701,26 @@ void quickbook_synopsis_short(function const& f, std::ostream& out) } void quickbook_output_functions(std::vector const& functions, - function_type type, - configuration const& config, - std::ostream& out, - bool display_all = false, - std::string const& ColTitle = "Function") + function_type type, + configuration const& config, + std::ostream& out, + bool display_all = false, + std::string const& ColTitle = "Function") { - out << "[table" << std::endl - << "[[" << ColTitle << "][Description]]" << std::endl; + bool show_modifiers = false; + BOOST_FOREACH(function const& f, functions) + { + if ( (display_all || f.type == type) && (f.is_const || f.is_static) ) + show_modifiers = true; + } + + out << "[table\n" + << "["; + if ( show_modifiers ) + out << "[Modifier]"; + out << "[" << ColTitle << "]"; + out << "[Description]"; + out << "]" << std::endl; for ( size_t i = 0 ; i < functions.size() ; ++i ) { @@ -716,9 +728,19 @@ void quickbook_output_functions(std::vector const& functions, if (display_all || f.type == type) { - out << "[[[link " << f.id << " `"; + out << "["; + if ( show_modifiers ) + { + out << "["; + out << (f.is_static ? "`static`" : ""); + out << (f.is_const ? " `const`" : ""); + out << "]"; + } + out << "[[link " << f.id << " `"; quickbook_synopsis_short(f, out); - out << "`]][" << f.brief_description << "]]" << std::endl; + out << "`]]"; + out << "[" << f.brief_description << "]"; + out << "]" << std::endl; } } out << "]" << std::endl @@ -900,14 +922,11 @@ void quickbook_synopsis_alt(function const& f, std::ostream& out) first = false; } } + if (! first) - { out << "`)`\n"; - } else if (f.type != function_define) - { out << "`()`\n"; - } } out << "]" @@ -1037,6 +1056,17 @@ void quickbook_output_functions_details(std::vector const& functions, quickbook_synopsis_alt(f, out); quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out); + if ( f.is_static || f.is_virtual || f.is_explicit || f.is_const ) + { + out << "[heading Modifier(s)]" << std::endl; + out << "``" + << (f.is_static ? "static " : "") + << (f.is_virtual ? "virtual " : "") + << (f.is_explicit ? "explicit " : "") + << (f.is_const ? "const " : "") + << "``"; + } + // Template parameters if ( !f.template_parameters.empty() && has_brief_description(f.template_parameters) ) { From b830ec1cdb9aa7f5066d5b7ae5d4d2ae92925ca5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 18 Jan 2013 20:40:24 +0000 Subject: [PATCH 293/366] Files structure rearranged to better reflect namespace strcture. Some classes moved to different namespaces. [SVN r82536] --- doc/generated/rtree.qbk | 90 +- doc/generated/rtree_linear.qbk | 2 +- doc/generated/rtree_quadratic.qbk | 2 +- doc/generated/rtree_rstar.qbk | 2 +- doc/generated/rtree_runtime_linear.qbk | 2 +- doc/generated/rtree_runtime_quadratic.qbk | 2 +- doc/generated/rtree_runtime_rstar.qbk | 2 +- doc/generated/translator_index.qbk | 3 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 26 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 925 +++++++----------- .../r_tree/rtree_quickstart.html | 6 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- doc/src/examples/Jamfile.v2 | 19 + doc/src/examples/rtree/Jamfile.v2 | 14 + doc/src/examples/rtree/quick_start.cpp | 2 +- .../extensions/index/{ => detail}/assert.hpp | 0 .../index/detail/distance_predicates.hpp | 866 ++++++++++++++++ .../index/{ => detail}/nonassignable.hpp | 4 +- .../extensions/index/detail/predicates.hpp | 525 ++++++++++ .../index/{ => detail}/pushable_array.hpp | 6 +- .../index/{ => detail}/rtree/adaptors.hpp | 0 .../{ => detail}/rtree/kmeans/kmeans.hpp | 0 .../index/{ => detail}/rtree/kmeans/split.hpp | 0 .../{ => detail}/rtree/linear/linear.hpp | 2 +- .../rtree/linear/redistribute_elements.hpp | 6 +- .../index/{ => detail}/rtree/node/concept.hpp | 0 .../rtree/node/dynamic_visitor.hpp | 0 .../index/{ => detail}/rtree/node/node.hpp | 14 +- .../{ => detail}/rtree/node/node_auto_ptr.hpp | 2 +- .../rtree/node/node_d_mem_dynamic.hpp | 2 +- .../rtree/node/node_d_mem_static.hpp | 14 +- .../rtree/node/node_s_mem_dynamic.hpp | 2 +- .../rtree/node/node_s_mem_static.hpp | 8 +- .../rtree/node/static_visitor.hpp | 0 .../extensions/index/detail/rtree/options.hpp | 155 +++ .../rtree/quadratic/quadratic.hpp | 2 +- .../rtree/quadratic/redistribute_elements.hpp | 6 +- .../rtree/rstar/choose_next_node.hpp | 4 +- .../index/{ => detail}/rtree/rstar/insert.hpp | 2 +- .../rtree/rstar/redistribute_elements.hpp | 10 +- .../index/{ => detail}/rtree/rstar/rstar.hpp | 6 +- .../rtree/visitors/are_boxes_ok.hpp | 12 +- .../rtree/visitors/are_levels_ok.hpp | 14 +- .../rtree/visitors/children_box.hpp | 0 .../{ => detail}/rtree/visitors/copy.hpp | 2 +- .../{ => detail}/rtree/visitors/count.hpp | 8 +- .../{ => detail}/rtree/visitors/destroy.hpp | 2 +- .../{ => detail}/rtree/visitors/gl_draw.hpp | 0 .../{ => detail}/rtree/visitors/insert.hpp | 6 +- .../{ => detail}/rtree/visitors/is_leaf.hpp | 2 +- .../rtree/visitors/nearest_query.hpp | 18 +- .../{ => detail}/rtree/visitors/print.hpp | 0 .../{ => detail}/rtree/visitors/remove.hpp | 6 +- .../rtree/visitors/spatial_query.hpp | 10 +- .../index/{ => detail}/static_vector.hpp | 6 +- .../index/{rtree => detail}/tags.hpp | 12 +- .../extensions/index/{ => detail}/tuples.hpp | 4 +- .../extensions/index/distance_predicates.hpp | 644 +----------- .../{rtree/options.hpp => parameters.hpp} | 145 +-- .../geometry/extensions/index/predicates.hpp | 343 +------ .../extensions/index/{rtree => }/rtree.hpp | 33 +- .../index/rtree/distance_predicates.hpp | 218 ----- .../extensions/index/rtree/predicates.hpp | 182 ---- test/geometry_index_test_common.hpp | 2 +- test/rtree/rtree_exceptions.cpp | 40 +- test/rtree/test_rtree.hpp | 10 +- test/rtree/test_rtree_exceptions.hpp | 12 +- test/rtree/test_throwing.hpp | 190 +--- 73 files changed, 2162 insertions(+), 2514 deletions(-) create mode 100644 doc/src/examples/Jamfile.v2 create mode 100644 doc/src/examples/rtree/Jamfile.v2 rename include/boost/geometry/extensions/index/{ => detail}/assert.hpp (100%) create mode 100644 include/boost/geometry/extensions/index/detail/distance_predicates.hpp rename include/boost/geometry/extensions/index/{ => detail}/nonassignable.hpp (81%) create mode 100644 include/boost/geometry/extensions/index/detail/predicates.hpp rename include/boost/geometry/extensions/index/{ => detail}/pushable_array.hpp (95%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/adaptors.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/kmeans/kmeans.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/kmeans/split.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/linear/linear.hpp (85%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/linear/redistribute_elements.hpp (98%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/concept.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/dynamic_visitor.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/node.hpp (90%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/node_auto_ptr.hpp (95%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/node_d_mem_dynamic.hpp (99%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/node_d_mem_static.hpp (93%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/node_s_mem_dynamic.hpp (99%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/node_s_mem_static.hpp (95%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/node/static_visitor.hpp (100%) create mode 100644 include/boost/geometry/extensions/index/detail/rtree/options.hpp rename include/boost/geometry/extensions/index/{ => detail}/rtree/quadratic/quadratic.hpp (85%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/quadratic/redistribute_elements.hpp (98%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/rstar/choose_next_node.hpp (98%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/rstar/insert.hpp (99%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/rstar/redistribute_elements.hpp (98%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/rstar/rstar.hpp (67%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/are_boxes_ok.hpp (94%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/are_levels_ok.hpp (93%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/children_box.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/copy.hpp (98%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/count.hpp (96%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/destroy.hpp (97%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/gl_draw.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/insert.hpp (99%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/is_leaf.hpp (95%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/nearest_query.hpp (95%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/print.hpp (100%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/remove.hpp (98%) rename include/boost/geometry/extensions/index/{ => detail}/rtree/visitors/spatial_query.hpp (88%) rename include/boost/geometry/extensions/index/{ => detail}/static_vector.hpp (99%) rename include/boost/geometry/extensions/index/{rtree => detail}/tags.hpp (64%) rename include/boost/geometry/extensions/index/{ => detail}/tuples.hpp (96%) rename include/boost/geometry/extensions/index/{rtree/options.hpp => parameters.hpp} (63%) rename include/boost/geometry/extensions/index/{rtree => }/rtree.hpp (97%) delete mode 100644 include/boost/geometry/extensions/index/rtree/distance_predicates.hpp delete mode 100644 include/boost/geometry/extensions/index/rtree/predicates.hpp diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 7ccbd04bc..f613f5718 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -38,7 +38,7 @@ Predefined algorithms with run-time parameters are: The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (called Indexables). It also handles [^`std::pair`] and [^`boost::tuple`]. For example, if [^`std::pair`] is stored in the container, the default translator translates from [^`std::pair const&`] to [^`Box const&`]. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre @@ -89,29 +89,29 @@ The Translator translates from Value to Indexable each time r-tree requires it. [heading Member(s)] [table -[[Modifier][Function][Description]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] +[[Function][Description]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] ] [#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b] @@ -124,8 +124,7 @@ The constructor. `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` ] -[heading Modifier(s)] -``explicit ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] @@ -208,8 +207,7 @@ The constructor. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` ] -[heading Modifier(s)] -``explicit ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] @@ -633,8 +631,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] @@ -686,8 +683,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]] @@ -753,8 +749,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -804,8 +799,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f `OutIter` `out_it``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -875,8 +869,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ `OutIter` `out_it``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]] @@ -901,8 +894,7 @@ Returns the number of stored values. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The number of stored values. [heading Throws] Nothing. @@ -919,8 +911,7 @@ Query if the container is empty. `bool` `empty``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] true if the container is empty. [heading Throws] Nothing. @@ -953,8 +944,7 @@ Returns the box containing all values stored in the container. If the container [^[link classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d box_type]]` const &` `box``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The box containing all values stored in the container or an invalid box if there are no values in the container. [heading Throws] Nothing. @@ -972,8 +962,7 @@ For indexable_type it returns the number of values which indexables equals the p [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]] @@ -995,8 +984,7 @@ Returns parameters. [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The parameters object. [heading Throws] Nothing. @@ -1013,8 +1001,7 @@ Returns the translator object. [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The translator object. [heading Throws] Nothing. @@ -1031,8 +1018,7 @@ Returns allocator used by the rtree. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The allocator. [heading Throws] If allocator copy constructor throws. diff --git a/doc/generated/rtree_linear.qbk b/doc/generated/rtree_linear.qbk index 3f32de605..5e307645f 100644 --- a/doc/generated/rtree_linear.qbk +++ b/doc/generated/rtree_linear.qbk @@ -7,7 +7,7 @@ Linear r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_quadratic.qbk b/doc/generated/rtree_quadratic.qbk index b4a3233b2..82d6b2636 100644 --- a/doc/generated/rtree_quadratic.qbk +++ b/doc/generated/rtree_quadratic.qbk @@ -7,7 +7,7 @@ Quadratic r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_rstar.qbk b/doc/generated/rtree_rstar.qbk index c546da7a5..a02079630 100644 --- a/doc/generated/rtree_rstar.qbk +++ b/doc/generated/rtree_rstar.qbk @@ -7,7 +7,7 @@ R*-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_linear.qbk b/doc/generated/rtree_runtime_linear.qbk index d3dd181f0..a20dccd53 100644 --- a/doc/generated/rtree_runtime_linear.qbk +++ b/doc/generated/rtree_runtime_linear.qbk @@ -7,7 +7,7 @@ Linear r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_quadratic.qbk b/doc/generated/rtree_runtime_quadratic.qbk index 1d52f8f47..5c39105e2 100644 --- a/doc/generated/rtree_runtime_quadratic.qbk +++ b/doc/generated/rtree_runtime_quadratic.qbk @@ -7,7 +7,7 @@ Quadratic r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_rstar.qbk b/doc/generated/rtree_runtime_rstar.qbk index 1eb0d33a4..8448ac1dc 100644 --- a/doc/generated/rtree_runtime_rstar.qbk +++ b/doc/generated/rtree_runtime_rstar.qbk @@ -7,7 +7,7 @@ R*-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 6bc83f483..1d2ce0ca6 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -43,8 +43,7 @@ The constructor. `index``(``Container const &` `c``)` ] -[heading Modifier(s)] -``explicit ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Container const &`][ `c` ][The container which stores indexed values. ]] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index c00e43835..dd5718dbb 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 4d5f596cd..9c5468fb8 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 263f4d250..5d10c6375 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 28ae3b6fd..035a9287c 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

              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 + 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 [2]. + close to some point in space [2].

              The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

              The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -179,13 +179,13 @@

    - Implementation + Implementation details

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

    -
      +
      • capable to store arbitrary Value type,
      • @@ -207,7 +207,7 @@
      - Contributors + Contributors

      The spatial index was originally started by Federico J. Fernandez during @@ -215,7 +215,7 @@

      - Spatial + Spatial thanks

      @@ -224,20 +224,20 @@ list for their help.

      -

      -

      [1] +


      +

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

      -

      [2] +

      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

      -

      [3] +

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

      -

      [4] +

      [4] 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 18130e9d5..16a6eba21 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index e0f1cc15c..ad1df612c 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -47,12 +47,12 @@ boost::geometry::index::rtree

      - + The R-tree spatial index.

      - Description + Description

      This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

      - Parameters + Parameters

      The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

      Predefined algorithms with compile-time parameters are:

      -
        +
        • boost::geometry::index::linear,
        • @@ -84,7 +84,7 @@ The R-tree spatial index.

          Predefined algorithms with run-time parameters are:

          -
            +
            - Translator + Translator

            The Translator translates from Value to Indexable each time r-tree requires @@ -114,14 +114,14 @@ The R-tree spatial index.

            - Header + Header

            - #include <boost/geometry/extensions/index/rtree/rtree.hpp> + #include <boost/geometry/extensions/index/rtree.hpp>

            - Synopsis + Synopsis
            template<typename Value,
                      typename Parameters,
            @@ -134,7 +134,7 @@ The R-tree spatial index.
             
            - Template + Template parameter(s)
            @@ -208,7 +208,7 @@ The R-tree spatial index.
            - Typedef(s) + Typedef(s)
            @@ -316,7 +316,7 @@ The R-tree spatial index.
            - Constructor(s) + Constructor(s) and destructor
            @@ -458,20 +458,14 @@ The R-tree spatial index.
            - Member(s) + Member(s)
            - - - - - - - - - - - - - - - - - - - - - - - -
            -

            - Modifier -

            -

            Function @@ -485,8 +479,6 @@ The R-tree spatial index.

            -

            operator=(const rtree @@ -500,8 +492,6 @@ The R-tree spatial index.

            -

            operator=(rtree &&) @@ -514,8 +504,6 @@ The R-tree spatial index.

            -

            swap(rtree &) @@ -528,8 +516,6 @@ The R-tree spatial index.

            -

            insert(value_type const @@ -543,8 +529,6 @@ The R-tree spatial index.

            -

            insert(Iterator, @@ -558,8 +542,6 @@ The R-tree spatial index.

            -

            insert(Range const @@ -573,8 +555,6 @@ The R-tree spatial index.

            -

            remove(value_type const @@ -588,8 +568,6 @@ The R-tree spatial index.

            -

            remove(Iterator, @@ -603,8 +581,6 @@ The R-tree spatial index.

            -

            remove(Range const @@ -618,11 +594,6 @@ The R-tree spatial index.

            -

            - const -

            -

            spatial_query(Predicates const @@ -637,11 +608,6 @@ The R-tree spatial index.

            -

            - const -

            -

            nearest_query(DistancesPredicates const @@ -657,11 +623,6 @@ The R-tree spatial index.

            -

            - const -

            -

            nearest_query(DistancesPredicates const @@ -678,11 +639,6 @@ The R-tree spatial index.

            -

            - const -

            -

            nearest_query(DistancesPredicates const @@ -697,11 +653,6 @@ The R-tree spatial index.

            -

            - const -

            -

            nearest_query(DistancesPredicates const @@ -718,11 +669,6 @@ The R-tree spatial index.

            -

            - const -

            -

            size() @@ -735,11 +681,6 @@ The R-tree spatial index.

            -

            - const -

            -

            empty() @@ -752,8 +693,6 @@ The R-tree spatial index.

            -

            clear() @@ -766,11 +705,6 @@ The R-tree spatial index.

            -

            - const -

            -

            box() @@ -783,11 +717,6 @@ The R-tree spatial index.

            -

            - const -

            -

            count(ValueOrIndexable const @@ -801,11 +730,6 @@ The R-tree spatial index.

            -

            - const -

            -

            parameters() @@ -818,11 +742,6 @@ The R-tree spatial index.

            -

            - const -

            -

            translator() @@ -835,11 +754,6 @@ The R-tree spatial index.

            -

            - const -

            -

            get_allocator() @@ -862,22 +776,13 @@ The R-tree spatial index.

            - Synopsis + Synopsis
            rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
             
            - Modifier(s) -
            -

            -

            -
            explicit
            -

            -

            -
            - - Parameter(s) + Parameter(s)
            @@ -941,8 +846,8 @@ The R-tree spatial index.
            - - Throws + + Throws

            If allocator default constructor throws. @@ -958,7 +863,7 @@ The R-tree spatial index.

            - Synopsis + Synopsis
            rtree(parameters_type parameters,
                   translator_type const & translator,
            @@ -966,7 +871,7 @@ The R-tree spatial index.
             
            - Parameter(s) + Parameter(s)
            @@ -1048,7 +953,7 @@ The R-tree spatial index.
            - Throws + Throws

            If allocator copy constructor throws. @@ -1064,7 +969,7 @@ The R-tree spatial index.

            - Synopsis + Synopsis
            template<typename Iterator>
             rtree(Iterator first,
            @@ -1075,7 +980,7 @@ The R-tree spatial index.
             
            - Parameter(s) + Parameter(s)
            @@ -1191,9 +1096,9 @@ The R-tree spatial index.
            - Throws + Throws
            -
              +
              • If allocator copy constructor throws.
              • @@ -1218,7 +1123,7 @@ The R-tree spatial index.

                - Synopsis + Synopsis
                template<typename Range>
                 rtree(Range const & rng,
                @@ -1228,16 +1133,7 @@ The R-tree spatial index.
                 
                - Modifier(s) -
                -

                -

                -
                explicit
                -

                -

                -
                - - Parameter(s) + Parameter(s)
                @@ -1336,10 +1232,10 @@ The R-tree spatial index.
                - - Throws + + Throws
                -
                  +
                  • If allocator copy constructor throws.
                  • @@ -1363,13 +1259,13 @@ The R-tree spatial index.

                    - Synopsis + Synopsis
                    ~rtree()
                     
                    - Throws + Throws

                    Nothing. @@ -1385,20 +1281,20 @@ The R-tree spatial index.

                    - Description + Description

                    It uses parameters, translator and allocator from the source tree.

                    - Synopsis + Synopsis
                    rtree(rtree const & src)
                     
                    - Parameter(s) + Parameter(s)
                    @@ -1444,9 +1340,9 @@ The R-tree spatial index.
                    - Throws + Throws
                    -
                      +
                      • If allocator copy constructor throws.
                      • @@ -1471,20 +1367,20 @@ The R-tree spatial index.

                        - Description + Description

                        It uses Parameters and translator from the source tree.

                        - Synopsis + Synopsis
                        rtree(rtree const & src, allocator_type const & allocator)
                         
                        - Parameter(s) + Parameter(s)
                        @@ -1550,9 +1446,9 @@ The R-tree spatial index.
                        - Throws + Throws
                        -
                          +
                          • If allocator copy constructor throws.
                          • @@ -1577,20 +1473,20 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters, translator and allocator from the source tree.

                            - Synopsis + Synopsis
                            rtree(rtree && src)
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1636,7 +1532,7 @@ The R-tree spatial index.
                            - Throws + Throws

                            Nothing. @@ -1652,20 +1548,20 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters and translator from the source tree.

                            - Synopsis + Synopsis
                            rtree(rtree && src, allocator_type const & allocator)
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1731,9 +1627,9 @@ The R-tree spatial index.
                            - Throws + Throws
                            -
                              +
                              • If allocator copy constructor throws.
                              • @@ -1759,20 +1655,20 @@ The R-tree spatial index.

                                - Description + Description

                                It uses parameters and translator from the source tree.

                                - Synopsis + Synopsis
                                rtree & operator=(const rtree & src)
                                 
                                - Parameter(s) + Parameter(s)
                                @@ -1818,9 +1714,9 @@ The R-tree spatial index.
                                - Throws + Throws
                                -
                                  +
                                  • If Value copy constructor throws.
                                  • @@ -1842,20 +1738,20 @@ The R-tree spatial index.

                                    - Description + Description

                                    It uses parameters and translator from the source tree.

                                    - Synopsis + Synopsis
                                    rtree & operator=(rtree && src)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1901,12 +1797,12 @@ The R-tree spatial index.
                                    - Throws + Throws

                                    Only if allocators aren't equal.

                                    -
                                      +
                                      • If Value copy constructor throws.
                                      • @@ -1928,20 +1824,20 @@ The R-tree spatial index.

                                        - Description + Description

                                        Parameters, translator and allocators are swapped as well.

                                        - Synopsis + Synopsis
                                        void swap(rtree & other)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -1987,7 +1883,7 @@ The R-tree spatial index.
                                        - Throws + Throws

                                        If allocators swap throws. @@ -2003,13 +1899,13 @@ The R-tree spatial index.

                                        - Synopsis + Synopsis
                                        void insert(value_type const & value)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -2055,9 +1951,9 @@ The R-tree spatial index.
                                        - Throws + Throws
                                        -
                                          +
                                          • If Value copy constructor or copy assignment throws.
                                          • @@ -2090,14 +1986,14 @@ The R-tree spatial index.

                                            - Synopsis + Synopsis
                                            template<typename Iterator>
                                             void insert(Iterator first, Iterator last)
                                             
                                            - Parameter(s) + Parameter(s)
                                            @@ -2161,9 +2057,9 @@ The R-tree spatial index.
                                            - Throws + Throws
                                            -
                                              +
                                              • If Value copy constructor or copy assignment throws.
                                              • @@ -2196,14 +2092,14 @@ The R-tree spatial index.

                                                - Synopsis + Synopsis
                                                template<typename Range>
                                                 void insert(Range const & rng)
                                                 
                                                - Parameter(s) + Parameter(s)
                                                @@ -2249,9 +2145,9 @@ The R-tree spatial index.
                                                - Throws + Throws
                                                -
                                                  +
                                                  • If Value copy constructor or copy assignment throws.
                                                  • @@ -2284,7 +2180,7 @@ The R-tree spatial index.

                                                    - Description + Description

                                                    In contrast to the std::set @@ -2293,13 +2189,13 @@ The R-tree spatial index.

                                                    - Synopsis + Synopsis
                                                    size_type remove(value_type const & value)
                                                     
                                                    - Parameter(s) + Parameter(s)
                                                    @@ -2345,16 +2241,16 @@ The R-tree spatial index.
                                                    - Returns + Returns

                                                    1 if the value was removed, 0 otherwise.

                                                    - Throws + Throws
                                                    -
                                                      +
                                                      • If Value copy constructor or copy assignment throws.
                                                      • @@ -2387,7 +2283,7 @@ The R-tree spatial index.

                                                        - Description + Description

                                                        In contrast to the std::set @@ -2398,14 +2294,14 @@ The R-tree spatial index.

                                                        - Synopsis + Synopsis
                                                        template<typename Iterator>
                                                         size_type remove(Iterator first, Iterator last)
                                                         
                                                        - Parameter(s) + Parameter(s)
                                                        @@ -2469,16 +2365,16 @@ The R-tree spatial index.
                                                        - Returns + Returns

                                                        The number of removed values.

                                                        - Throws + Throws
                                                        -
                                                          +
                                                          • If Value copy constructor or copy assignment throws.
                                                          • @@ -2511,7 +2407,7 @@ The R-tree spatial index.

                                                            - Description + Description

                                                            In contrast to the std::set @@ -2521,14 +2417,14 @@ The R-tree spatial index.

                                                            - Synopsis + Synopsis
                                                            template<typename Range>
                                                             size_type remove(Range const & rng)
                                                             
                                                            - Parameter(s) + Parameter(s)
                                                            @@ -2574,16 +2470,16 @@ The R-tree spatial index.
                                                            - Returns + Returns

                                                            The number of removed values.

                                                            - Throws + Throws
                                                            -
                                                              +
                                                              • If Value copy constructor or copy assignment throws.
                                                              • @@ -2616,7 +2512,7 @@ The R-tree spatial index.

                                                                - Description + Description

                                                                Spatial predicates may be a Geometry. In this case Values @@ -2626,7 +2522,7 @@ The R-tree spatial index.

                                                                It may be generated by one of the functions listed below:

                                                                -
                                                                  +
                                                                  • boost::geometry::index::covered_by(),
                                                                  • @@ -2668,23 +2564,14 @@ The R-tree spatial index.

                                                                    - Synopsis + Synopsis
                                                                    template<typename Predicates, typename OutIter>
                                                                     size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                                     
                                                                    - Modifier(s) -
                                                                    -

                                                                    -

                                                                    -
                                                                    const
                                                                    -

                                                                    -

                                                                    -
                                                                    - - Parameter(s) + Parameter(s)
                                                                    @@ -2748,17 +2635,17 @@ The R-tree spatial index.
                                                                    - - Returns + + Returns

                                                                    The number of values found.

                                                                    - - Throws + + Throws
                                                                    -
                                                                      +
                                                                      • If Value copy constructor or copy assignment throws.
                                                                      • @@ -2777,7 +2664,7 @@ The R-tree spatial index.

                                                                        - Description + Description

                                                                        Distances predicates may be a Point. In this the case the @@ -2788,7 +2675,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                        -
                                                                          +
                                                                          • boost::geometry::index::to_nearest() - default, @@ -2805,7 +2692,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                            -
                                                                              +
                                                                              • boost::geometry::index::unbounded() - default, @@ -2824,7 +2711,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                -
                                                                                  +
                                                                                  - Synopsis + Synopsis
                                                                                  template<typename DistancesPredicates>
                                                                                   size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
                                                                                   
                                                                                  - Modifier(s) -
                                                                                  -

                                                                                  -

                                                                                  -
                                                                                  const
                                                                                  -

                                                                                  -

                                                                                  -
                                                                                  - - Parameter(s) + Parameter(s)
                                                                                  @@ -2918,15 +2796,15 @@ The R-tree spatial index.
                                                                                  - - Returns + + Returns

                                                                                  The number of values found.

                                                                                  - - Throws + + Throws

                                                                                  If Value copy constructor or copy assignment throws. @@ -2943,7 +2821,7 @@ The R-tree spatial index.

                                                                                  - Description + Description

                                                                                  Distances predicates may be a Point. In this the case the @@ -2954,7 +2832,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                  -
                                                                                    +
                                                                                    • boost::geometry::index::to_nearest() - default, @@ -2971,7 +2849,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                      -
                                                                                        +
                                                                                        • boost::geometry::index::unbounded() - default, @@ -2990,7 +2868,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                          -
                                                                                            +
                                                                                            • boost::geometry::index::to_nearest(),
                                                                                            • @@ -3009,7 +2887,7 @@ The R-tree spatial index.

                                                                                              It may be generated by one of the functions listed below:

                                                                                              -
                                                                                                +
                                                                                                • boost::geometry::index::covered_by(),
                                                                                                • @@ -3051,7 +2929,7 @@ The R-tree spatial index.

                                                                                                  - Synopsis + Synopsis
                                                                                                  template<typename DistancesPredicates, typename Predicates>
                                                                                                   size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                  @@ -3060,16 +2938,7 @@ The R-tree spatial index.
                                                                                                   
                                                                                                  - Modifier(s) -
                                                                                                  -

                                                                                                  -

                                                                                                  -
                                                                                                  const
                                                                                                  -

                                                                                                  -

                                                                                                  -
                                                                                                  - - Parameter(s) + Parameter(s)
                                                                                                  @@ -3151,15 +3020,15 @@ The R-tree spatial index.
                                                                                                  - - Returns + + Returns

                                                                                                  The number of values found.

                                                                                                  - - Throws + + Throws

                                                                                                  If Value copy constructor or copy assignment throws. @@ -3176,7 +3045,7 @@ The R-tree spatial index.

                                                                                                  - Description + Description

                                                                                                  Distances predicates may be a Point. In this the case the @@ -3187,7 +3056,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                  -
                                                                                                    +
                                                                                                    • boost::geometry::index::to_nearest() - default, @@ -3204,7 +3073,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                      -
                                                                                                        +
                                                                                                        • boost::geometry::index::unbounded() - default, @@ -3223,7 +3092,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                          -
                                                                                                            +
                                                                                                            - Synopsis + Synopsis
                                                                                                            template<typename DistancesPredicates, typename OutIter>
                                                                                                             size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                            @@ -3245,16 +3114,7 @@ The R-tree spatial index.
                                                                                                             
                                                                                                            - Modifier(s) -
                                                                                                            -

                                                                                                            -

                                                                                                            -
                                                                                                            const
                                                                                                            -

                                                                                                            -

                                                                                                            -
                                                                                                            - - Parameter(s) + Parameter(s)
                                                                                                            @@ -3335,15 +3195,15 @@ The R-tree spatial index.
                                                                                                            - - Returns + + Returns

                                                                                                            The number of values found.

                                                                                                            - - Throws + + Throws

                                                                                                            If Value copy constructor or copy assignment throws. If OutIter dereference @@ -3361,7 +3221,7 @@ The R-tree spatial index.

                                                                                                            - Description + Description

                                                                                                            Distances predicates may be a Point. In this the case the @@ -3372,7 +3232,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                            -
                                                                                                            - +

                                                                                                            Last revised: January 17, 2013 at 17:06:52 GMT

                                                                                                            Last revised: January 18, 2013 at 20:09:35 GMT


                                                                                                            diff --git a/doc/src/examples/Jamfile.v2 b/doc/src/examples/Jamfile.v2 new file mode 100644 index 000000000..e221ca86b --- /dev/null +++ b/doc/src/examples/Jamfile.v2 @@ -0,0 +1,19 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import testing ; + +project boost-geometry-index-doc-src-examples + : + requirements + ../../.. + #../../../boost/geometry/extensions/contrib/ttmath + msvc:on + ; + +build-project rtree ; diff --git a/doc/src/examples/rtree/Jamfile.v2 b/doc/src/examples/rtree/Jamfile.v2 new file mode 100644 index 000000000..9a70926c8 --- /dev/null +++ b/doc/src/examples/rtree/Jamfile.v2 @@ -0,0 +1,14 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +project boost-geometry-index-doc-src-examples-rtree + : # requirements + ; + +exe quick_start : quick_start.cpp ; + diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index 33eb2147f..65fe4ddf4 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include // to store queries results #include diff --git a/include/boost/geometry/extensions/index/assert.hpp b/include/boost/geometry/extensions/index/detail/assert.hpp similarity index 100% rename from include/boost/geometry/extensions/index/assert.hpp rename to include/boost/geometry/extensions/index/detail/assert.hpp diff --git a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp new file mode 100644 index 000000000..6b0aa5989 --- /dev/null +++ b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp @@ -0,0 +1,866 @@ +// Boost.Geometry Index +// +// Spatial index distance predicates, calculators and checkers +// used in nearest query - specialized for envelopes +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP + +#include +#include +#include + +#include + +#include + +// TODO - optimization +// For Boxes and Points all types of distances may be calculated +// - near, far and centroid. For points those are the same distance +// calculate them for Boxes only! +// for Points calculate only 1 distance + +namespace boost { namespace geometry { namespace index { namespace detail { + +// ------------------------------------------------------------------ // +// relations +// ------------------------------------------------------------------ // + +template +struct to_nearest +{ + to_nearest(T const& v) : value(v) {} + T value; +}; + +template +struct to_centroid +{ + to_centroid(T const& v) : value(v) {} + T value; +}; + +template +struct to_furthest +{ + to_furthest(T const& v) : value(v) {} + T value; +}; + +// tags + +struct to_nearest_tag {}; +struct to_centroid_tag {}; +struct to_furthest_tag {}; + +// ------------------------------------------------------------------ // +// relation traits and access +// ------------------------------------------------------------------ // + +template +struct relation +{ + typedef T value_type; + typedef to_nearest_tag tag; + static inline T const& value(T const& v) { return v; } + static inline T & value(T & v) { return v; } +}; + +template +struct relation< to_nearest > +{ + typedef T value_type; + typedef to_nearest_tag tag; + static inline T const& value(to_nearest const& r) { return r.value; } + static inline T & value(to_nearest & r) { return r.value; } +}; + +template +struct relation< to_centroid > +{ + typedef T value_type; + typedef to_centroid_tag tag; + static inline T const& value(to_centroid const& r) { return r.value; } + static inline T & value(to_centroid & r) { return r.value; } +}; + +template +struct relation< to_furthest > +{ + typedef T value_type; + typedef to_furthest_tag tag; + static inline T const& value(to_furthest const& r) { return r.value; } + static inline T & value(to_furthest & r) { return r.value; } +}; + +// ------------------------------------------------------------------ // +// distance predicates +// ------------------------------------------------------------------ // + +template +struct unbounded + : nonassignable +{ + inline explicit unbounded(PointRelation const& pr) + : point_relation(pr) + {} + + PointRelation point_relation; +}; + +template +struct min_bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline min_bounded(PointRelation const& pr, MinRelation const& min_rel) + : point_relation(pr) + , comparable_min( + relation::value(min_rel) * + relation::value(min_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_min; +}; + +template +struct max_bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel) + : point_relation(pr) + , comparable_max( + relation::value(max_rel) * + relation::value(max_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_max; +}; + +template +struct bounded + : nonassignable +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel) + : point_relation(pr) + , comparable_min( + relation::value(min_rel) * + relation::value(min_rel) ) + , comparable_max( + relation::value(max_rel) * + relation::value(max_rel) ) + {} + + PointRelation point_relation; + distance_type comparable_min; + distance_type comparable_max; +}; + +// ------------------------------------------------------------------ // +// point_relation trait +// ------------------------------------------------------------------ // + +template +struct point_relation +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::unbounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::min_bounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::max_bounded > +{ + typedef PointRelation type; +}; + +template +struct point_relation< detail::bounded > +{ + typedef PointRelation type; +}; + +// ------------------------------------------------------------------ // +// helpers +// ------------------------------------------------------------------ // + +// algorithms + +// cdist + +template +struct cdist +{ + T value; +}; + +// cdist_merge + +template +struct cdist_merge +{ + typedef typename detail::tuples::add_unique< + CDistTuple, + CDist + >::type type; +}; + +template +struct cdist_merge< + cdist, + cdist > +{ + typedef boost::tuple< + cdist, + cdist + > type; +}; + +template +struct cdist_merge< + cdist, + cdist > +{ + typedef cdist type; +}; + +// cdist_value_type + +template +struct cdist_value +{ + typedef typename cdist_value< + typename boost::tuples::element<0, CDistTuple>::type + >::type type; + + template + static inline type & get(CDistTuple & cdtup) + { + return boost::get< + tuples::find_index< + CDistTuple, + cdist + >::value + >(cdtup).value; + } + + template + static inline type const& get(CDistTuple const& cdtup) + { + return boost::get< + tuples::find_index< + CDistTuple, + cdist + >::value + >(cdtup).value; + } +}; + +template +struct cdist_value< + cdist +> +{ + typedef T type; + + template + static inline type & get(cdist & cd) + { + BOOST_MPL_ASSERT_MSG( + (tuples::equal< cdist, cdist >::value), + TAGS_DO_NOT_MATCH, + (cdist_value)); + + return cd.value; + } + + template + static inline type const& get(cdist const& cd) + { + BOOST_MPL_ASSERT_MSG( + (tuples::equal< cdist, cdist >::value), + TAGS_DO_NOT_MATCH, + (cdist_value)); + + return cd.value; + } +}; + +// distances_calc_impl_rel + +template +struct distances_calc_impl_rel +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_RELATION, + (distances_calc_impl_rel)); +}; + +template +struct distances_calc_impl_rel< + cdist +> +{ + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_near(p, i); + } +}; + +template +struct distances_calc_impl_rel< + cdist +> +{ + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_centroid(p, i); + } +}; + +template +struct distances_calc_impl_rel< + cdist +> +{ + template + typename geometry::default_distance_result::type + static inline apply(Point const& p, Indexable const& i) + { + return index::comparable_distance_far(p, i); + } +}; + +// distances_calc_impl_tuple + +template +struct distances_calc_impl_tuple +{ + // TODO MPL ASSERT 0 < N + static inline void apply(Distances & d, Point const& p, Indexable const&i) + { + boost::get(d).value = + distances_calc_impl_rel< + typename boost::tuples::element::type + >::apply(p, i); + + distances_calc_impl_tuple< + Distances, + Point, + Indexable, + N - 1 + >::apply(d, p, i); + } +}; + +template +struct distances_calc_impl_tuple +{ + static inline void apply(Distances & d, Point const& p, Indexable const&i) + { + boost::get<0>(d).value = + distances_calc_impl_rel< + typename boost::tuples::element<0, Distances>::type + >::apply(p, i); + } +}; + +// distances_calc_impl + +template +struct distances_calc_impl +{ + static inline void apply(Distances & d, Point const& p, Indexable const&i) + { + distances_calc_impl_tuple< + Distances, + Point, + Indexable, + boost::tuples::length::value + >::apply(d, p, i); + } +}; + +template +struct distances_calc_impl< + cdist, + Point, + Indexable +> +{ + static inline void apply(cdist & d, Point const& p, Indexable const&i) + { + d.value = distances_calc_impl_rel< + cdist + >::apply(p, i); + } +}; + +// ------------------------------------------------------------------ // +// distance_calc and distances_predicates_check +// ------------------------------------------------------------------ // + +template +struct distances_calc +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG, + (distances_calc)); +}; + +template +struct distances_predicates_check +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG, + (distances_predicates_check)); +}; + +// ------------------------------------------------------------------ // +// distance_calc for value_tag +// ------------------------------------------------------------------ // + +template +struct distances_calc +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(PointRelation const& p, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(p), i); + return res; + } +}; + +template +struct distances_calc< + detail::unbounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(detail::unbounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::min_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag min_relation_tag; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::min_bounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::max_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag max_relation_tag; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::max_bounded const& pp, Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename detail::relation::tag point_relation_tag; + typedef typename geometry::default_distance_result::type distance_type; + typedef typename detail::relation::tag min_relation_tag; + typedef typename detail::relation::tag max_relation_tag; + + typedef typename detail::cdist_merge< + typename detail::cdist_merge< + cdist, + cdist + >::type, + cdist + >::type result_type; + + static inline result_type apply( + detail::bounded const& pp, + Indexable const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +// ------------------------------------------------------------------ // +// distance_predicates_check for value_tag +// ------------------------------------------------------------------ // + +template +struct distances_predicates_check +{ + template + static inline bool apply(PointRelation const&, Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::unbounded, + Indexable, + value_tag +> +{ + template + static inline bool apply(detail::unbounded const&, Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::min_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::tag min_relation_tag; + + template + static inline bool apply( + detail::min_bounded const& pred, + Distances const& d) + { + return pred.comparable_min <= + detail::cdist_value::template get(d); + } +}; + +template +struct distances_predicates_check< + detail::max_bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::tag max_relation_tag; + + template + static inline bool apply( + detail::max_bounded const& pred, + Distances const& d) + { + return pred.comparable_max <= + detail::cdist_value::template get(d); + } +}; + +template +struct distances_predicates_check< + detail::bounded, + Indexable, + value_tag +> +{ + typedef typename detail::relation::tag min_relation_tag; + typedef typename detail::relation::tag max_relation_tag; + + template + static inline bool apply( + detail::bounded const& pred, + Distances const& d) + { + return pred.comparable_min + <= detail::cdist_value::template get(d) + && detail::cdist_value::template get(d) + <= pred.comparable_max; + } +}; + +// ------------------------------------------------------------------ // +// distance_calc for envelope_tag +// ------------------------------------------------------------------ // + +template +struct distances_calc< + PointRelation, + Box, + envelope_tag> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(PointRelation const& p, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(p), i); + return res; + } +}; + +template +struct distances_calc< + detail::unbounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef detail::cdist result_type; + + static inline result_type apply(detail::unbounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::min_bounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::min_bounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::max_bounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef cdist result_type; + + static inline result_type apply(detail::max_bounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +template +struct distances_calc< + detail::bounded, + Box, + envelope_tag +> +{ + typedef typename detail::relation::value_type point_type; + typedef typename geometry::default_distance_result::type distance_type; + + typedef typename detail::cdist_merge< + cdist, + cdist + >::type result_type; + + static inline result_type apply(detail::bounded const& pp, Box const& i) + { + result_type res; + distances_calc_impl + ::apply(res, relation::value(pp.point_relation), i); + return res; + } +}; + +// ------------------------------------------------------------------ // +// distance_predicates_check for envelope_tag +// ------------------------------------------------------------------ // + +template +struct distances_predicates_check< + PointRelation, + Box, + envelope_tag> +{ + template + static inline bool apply(PointRelation const&, Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::unbounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::unbounded const&, + Distances const&) + { + return true; + } +}; + +template +struct distances_predicates_check< + detail::min_bounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::min_bounded const& pred, + Distances const& d) + { + return pred.comparable_min + <= cdist_value::template get(d); + } +}; + +template +struct distances_predicates_check< + detail::max_bounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::max_bounded const& pred, + Distances const& d) + { + return cdist_value::template get(d) + <= pred.comparable_max; + } +}; + +template +struct distances_predicates_check< + detail::bounded, + Box, + envelope_tag> +{ + template + static inline bool apply( + detail::bounded const& pred, + Distances const& d) + { + return pred.comparable_min + <= cdist_value::template get(d) + && cdist_value::template get(d) + <= pred.comparable_max; + } +}; + +}}}} // namespace boost::geometry::index::detail + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/nonassignable.hpp b/include/boost/geometry/extensions/index/detail/nonassignable.hpp similarity index 81% rename from include/boost/geometry/extensions/index/nonassignable.hpp rename to include/boost/geometry/extensions/index/detail/nonassignable.hpp index 810cfd111..345007b0d 100644 --- a/include/boost/geometry/extensions/index/nonassignable.hpp +++ b/include/boost/geometry/extensions/index/detail/nonassignable.hpp @@ -11,13 +11,13 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { class nonassignable { nonassignable & operator=(nonassignable const&); }; -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP diff --git a/include/boost/geometry/extensions/index/detail/predicates.hpp b/include/boost/geometry/extensions/index/detail/predicates.hpp new file mode 100644 index 000000000..abe19c760 --- /dev/null +++ b/include/boost/geometry/extensions/index/detail/predicates.hpp @@ -0,0 +1,525 @@ +// Boost.Geometry Index +// +// Spatial query predicates definition and checks. +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { namespace detail { + +// ------------------------------------------------------------------ // +// predicates +// ------------------------------------------------------------------ // + +struct empty {}; + +template +struct value +{ + value(ValuePredicate const& vpred) : value_predicate(vpred) {} + ValuePredicate value_predicate; +}; + +template +struct covered_by +{ + covered_by(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct disjoint +{ + disjoint(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct intersects +{ + intersects(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct overlaps +{ + overlaps(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +//template +//struct touches +//{ +// touches(Geometry const& g) : geometry(g) {} +// Geometry geometry; +//}; + +template +struct within +{ + within(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_covered_by +{ + not_covered_by(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_disjoint +{ + not_disjoint(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_intersects +{ + not_intersects(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +template +struct not_overlaps +{ + not_overlaps(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +//template +//struct not_touches +//{ +// not_touches(Geometry const& g) : geometry(g) {} +// Geometry geometry; +//}; + +template +struct not_within +{ + not_within(Geometry const& g) : geometry(g) {} + Geometry geometry; +}; + +// ------------------------------------------------------------------ // +// predicate_check +// ------------------------------------------------------------------ // + +template +struct predicate_check +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_TAG, + (predicate_check)); +}; + +// ------------------------------------------------------------------ // +// predicate_check for value +// ------------------------------------------------------------------ // + +template +struct predicate_check +{ + template + static inline bool apply(Geometry const& g, Value const&, Indexable const& i) + { + return geometry::intersects(i, g); + } +}; + +template <> +struct predicate_check +{ + template + static inline bool apply(empty const&, Value const&, Indexable const&) + { + return true; + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(value const& p, Value const& v, Indexable const&) + { + return p.value_predicate(v); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(covered_by const& p, Value const&, Indexable const& i) + { + return geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(disjoint const& p, Value const&, Indexable const& i) + { + return geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(intersects const& p, Value const&, Indexable const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(overlaps const& p, Value const&, Indexable const& i) + { + return geometry::overlaps(i, p.geometry); + } +}; + +//template +//struct predicate_check, value_tag> +//{ +// template +// static inline bool apply(touches const& p, Value const&, Indexable const& i) +// { +// return geometry::touches(i, p.geometry); +// } +//}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(within const& p, Value const&, Indexable const& i) + { + return geometry::within(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_covered_by const& p, Value const&, Indexable const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_disjoint const& p, Value const&, Indexable const& i) + { + return !geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_intersects const& p, Value const&, Indexable const& i) + { + return !geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_overlaps const& p, Value const&, Indexable const& i) + { + return !geometry::overlaps(i, p.geometry); + } +}; + +//template +//struct predicate_check, value_tag> +//{ +// template +// static inline bool apply(not_touches const& p, Value const&, Indexable const& i) +// { +// return !geometry::touches(i, p.geometry); +// } +//}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(not_within const& p, Value const&, Indexable const& i) + { + return !geometry::within(i, p.geometry); + } +}; + +// ------------------------------------------------------------------ // +// predicates_chec for envelope +// ------------------------------------------------------------------ // + +template +struct predicate_check +{ + template + static inline bool apply(Geometry const& g, Value const&, Indexable const& i) + { + return geometry::intersects(i, g); + } +}; + +template <> +struct predicate_check +{ + template + static inline bool apply(Geometry const&, Value const&, Indexable const&) + { + return true; + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(value const&, Value const&, Box const&) + { + return true; + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(covered_by const& p, Value const&, Box const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(disjoint const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(intersects const& p, Value const&, Indexable const& i) + { + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(overlaps const& p, Value const&, Box const& i) + { + // TODO: awulkiew - possibly change to the version without border case + // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false + return geometry::intersects(i, p.geometry); + } +}; + +//template +//struct predicate_check, envelope_tag> +//{ +// template +// static bool apply(touches const& p, Value const&, Box const& i) +// { +// return geometry::intersects(i, p.geometry); +// } +//}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(within const& p, Value const&, Box const& i) + { + // TODO: awulkiew - possibly change to the version without border case + // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false + return geometry::intersects(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_covered_by const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_disjoint const& p, Value const&, Box const& i) + { + return !geometry::disjoint(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_intersects const& p, Value const&, Box const& i) + { + return !geometry::covered_by(i, p.geometry); + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_overlaps const& p, Value const&, Box const& i) + { + return true; + } +}; + +//template +//struct predicate_check, envelope_tag> +//{ +// template +// static bool apply(not_touches const& p, Value const&, Box const& i) +// { +// return !geometry::intersects(i, p.geometry); +// } +//}; + +template +struct predicate_check, envelope_tag> +{ + template + static bool apply(not_within const& p, Value const&, Box const& i) + { + return !geometry::within(i, p.geometry); + } +}; + +// ------------------------------------------------------------------ // +// predicates_check +// ------------------------------------------------------------------ // + +template +struct predicates_check_tuple +{ + template + static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) + { + return predicates_check_tuple::apply(p, v, i) + && predicate_check< + typename boost::tuples::element::type, + Tag + >::apply(boost::get(p), v, i); + } +}; + +template +struct predicates_check_tuple +{ + template + static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) + { + return predicate_check< + typename boost::tuples::element<0, TuplePredicates>::type, + Tag + >::apply(boost::get<0>(p), v, i); + } +}; + +template +struct predicates_check_impl +{ + template + static inline bool apply(Predicate const& p, Value const& v, Indexable const& i) + { + return predicate_check::apply(p, v, i); + } +}; + +template +struct predicates_check_impl, Tag> +{ + template + static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) + { + return predicate_check::apply(p.first, v, i) + && predicate_check::apply(p.second, v, i); + } +}; + +template < + typename T0, typename T1, typename T2, typename T3, typename T4, + typename T5, typename T6, typename T7, typename T8, typename T9, + typename Tag +> +struct predicates_check_impl< + boost::tuple, + Tag +> +{ + typedef boost::tuple predicates_type; + + template + static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) + { + return predicates_check_tuple< + predicates_type, + Tag, + boost::tuples::length::value + >::apply(p, v, i); + } +}; + +template +inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i) +{ + return detail::predicates_check_impl + ::apply(p, v, i); +} + +}}}} // namespace boost::geometry::index::detail + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/pushable_array.hpp b/include/boost/geometry/extensions/index/detail/pushable_array.hpp similarity index 95% rename from include/boost/geometry/extensions/index/pushable_array.hpp rename to include/boost/geometry/extensions/index/detail/pushable_array.hpp index 5e9aad018..6140ac96e 100644 --- a/include/boost/geometry/extensions/index/pushable_array.hpp +++ b/include/boost/geometry/extensions/index/detail/pushable_array.hpp @@ -11,9 +11,9 @@ #include -#include +#include -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { template class pushable_array @@ -166,6 +166,6 @@ private: size_type m_size; }; -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP diff --git a/include/boost/geometry/extensions/index/rtree/adaptors.hpp b/include/boost/geometry/extensions/index/detail/rtree/adaptors.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/adaptors.hpp rename to include/boost/geometry/extensions/index/detail/rtree/adaptors.hpp diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp b/include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/kmeans/kmeans.hpp rename to include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp diff --git a/include/boost/geometry/extensions/index/rtree/kmeans/split.hpp b/include/boost/geometry/extensions/index/detail/rtree/kmeans/split.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/kmeans/split.hpp rename to include/boost/geometry/extensions/index/detail/rtree/kmeans/split.hpp diff --git a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp similarity index 85% rename from include/boost/geometry/extensions/index/rtree/linear/linear.hpp rename to include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp index 1f249bd04..4c6aaf44e 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/linear.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp @@ -11,6 +11,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP -#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp rename to include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp index fb52e3b5e..7581b557b 100644 --- a/include/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp @@ -17,9 +17,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/concept.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/concept.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/concept.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/concept.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/dynamic_visitor.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/dynamic_visitor.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/dynamic_visitor.hpp diff --git a/include/boost/geometry/extensions/index/rtree/node/node.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node.hpp similarity index 90% rename from include/boost/geometry/extensions/index/rtree/node/node.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node.hpp index 64b0bfc30..21d9ffad2 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node.hpp @@ -11,19 +11,19 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP -#include +#include -#include -#include +#include +#include -#include -#include +#include +#include -#include +#include #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp index fcb3e1492..7b7663660 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_auto_ptr.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp index 5d06919a3..1a0a5f5cf 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp similarity index 93% rename from include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp index 71d4b4488..7c6c6cfc0 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp @@ -11,8 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -22,7 +22,7 @@ template : public dynamic_node { - typedef index::static_vector< + typedef detail::static_vector< std::pair< Box, dynamic_node * @@ -43,7 +43,7 @@ template : public dynamic_node { - typedef index::static_vector elements_type; + typedef detail::static_vector elements_type; template inline dynamic_leaf(Dummy) {} @@ -82,16 +82,16 @@ struct visitor -struct container_from_elements_type, NewValue> +struct container_from_elements_type, NewValue> { - typedef index::static_vector type; + typedef detail::static_vector type; }; // allocators template class allocators - : nonassignable + : detail::nonassignable { BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp index e620ded8d..577e60c08 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp index 4040124bc..5f906fca3 100644 --- a/include/boost/geometry/extensions/index/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#include +#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -24,7 +24,7 @@ namespace detail { namespace rtree { template struct static_internal_node { - typedef index::static_vector< + typedef detail::static_vector< std::pair< Box, typename node::type * @@ -41,7 +41,7 @@ struct static_internal_node struct static_leaf { - typedef index::static_vector elements_type; + typedef detail::static_vector elements_type; template inline static_leaf(Dummy) {} diff --git a/include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp b/include/boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/node/static_visitor.hpp rename to include/boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp diff --git a/include/boost/geometry/extensions/index/detail/rtree/options.hpp b/include/boost/geometry/extensions/index/detail/rtree/options.hpp new file mode 100644 index 000000000..c9431ad90 --- /dev/null +++ b/include/boost/geometry/extensions/index/detail/rtree/options.hpp @@ -0,0 +1,155 @@ +// Boost.Geometry Index +// +// R-tree options, algorithms, parameters +// +// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +// InsertTag +struct insert_default_tag {}; +struct insert_reinsert_tag {}; + +// ChooseNextNodeTag +struct choose_by_content_diff_tag {}; +struct choose_by_overlap_diff_tag {}; + +// SplitTag +struct split_default_tag {}; +//struct split_kmeans_tag {}; + +// RedistributeTag +struct linear_tag {}; +struct quadratic_tag {}; +struct rstar_tag {}; + +// NodeTag +struct node_d_mem_dynamic_tag {}; +struct node_d_mem_static_tag {}; +struct node_s_mem_dynamic_tag {}; +struct node_s_mem_static_tag {}; + +template +struct options +{ + typedef Parameters parameters_type; + typedef InsertTag insert_tag; + typedef ChooseNextNodeTag choose_next_node_tag; + typedef SplitTag split_tag; + typedef RedistributeTag redistribute_tag; + typedef NodeTag node_tag; +}; + +template +struct options_type +{ + // TODO: awulkiew - use static assert +}; + +template +struct options_type< linear > +{ + typedef options< + linear, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + linear_tag, + node_d_mem_static_tag + > type; +}; + +template +struct options_type< quadratic > +{ + typedef options< + quadratic, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + quadratic_tag, + node_d_mem_static_tag + > type; +}; + +template +struct options_type< rstar > +{ + typedef options< + rstar, + insert_reinsert_tag, + choose_by_overlap_diff_tag, + split_default_tag, + rstar_tag, + node_d_mem_static_tag + > type; +}; + +//template +//struct options_type< kmeans > +//{ +// typedef options< +// kmeans, +// insert_default_tag, +// choose_by_content_diff_tag, // change it? +// split_kmeans_tag, +// int, // dummy tag - not used for now +// node_d_mem_static_tag +// > type; +//}; + +template <> +struct options_type< runtime::linear > +{ + typedef options< + runtime::linear, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + linear_tag, + node_d_mem_dynamic_tag + > type; +}; + +template <> +struct options_type< runtime::quadratic > +{ + typedef options< + runtime::quadratic, + insert_default_tag, + choose_by_content_diff_tag, + split_default_tag, + quadratic_tag, + node_d_mem_dynamic_tag + > type; +}; + +template <> +struct options_type< runtime::rstar > +{ + typedef options< + runtime::rstar, + insert_reinsert_tag, + choose_by_overlap_diff_tag, + split_default_tag, + rstar_tag, + node_d_mem_dynamic_tag + > type; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp b/include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp similarity index 85% rename from include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp rename to include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp index 071311d39..d7eaa03af 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/quadratic.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp @@ -11,6 +11,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP -#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP diff --git a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp rename to include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp index e4bf7d42b..de7d8ef1e 100644 --- a/include/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp @@ -16,9 +16,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/choose_next_node.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/choose_next_node.hpp index bf840cb5f..4624bfd06 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/choose_next_node.hpp @@ -19,8 +19,8 @@ #include #include -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/rstar/insert.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp index 1d4e17f2e..20be0c224 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp @@ -426,7 +426,7 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> template class insert : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp index f90e7656b..06c898b6f 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp @@ -11,15 +11,15 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP -#include +#include #include #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -31,7 +31,7 @@ namespace rstar { template class element_axis_corner_less - : index::nonassignable + : index::detail::nonassignable { public: element_axis_corner_less(Translator const& tr) diff --git a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp similarity index 67% rename from include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp rename to include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp index a8db3364e..905c4e540 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/rstar.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp @@ -11,8 +11,8 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP -#include -#include -#include +#include +#include +#include #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp similarity index 94% rename from include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp index 542c2e16d..3a1dd50be 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp @@ -12,16 +12,16 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP #include -#include +#include -namespace boost { namespace geometry { namespace index { namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { -namespace rtree { namespace visitors { +namespace visitors { template class are_boxes_ok : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -115,7 +115,7 @@ private: bool m_exact_match; }; -}} // namespace rtree::visitors +} // namespace visitors template bool are_boxes_ok(index::rtree const& tree, @@ -136,6 +136,6 @@ bool are_boxes_ok(index::rtree const& return v.result; } -}}}} // namespace boost::geometry::index::detail +}}}}} // namespace boost::geometry::index::detail::rtree #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp similarity index 93% rename from include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp index 854a19243..01576d2dd 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp @@ -11,16 +11,16 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP -#include +#include -namespace boost { namespace geometry { namespace index { namespace detail { - -namespace rtree { namespace visitors { +namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { + +namespace visitors { template class are_levels_ok : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; @@ -86,7 +86,7 @@ private: size_t m_current_level; }; -}} // namespace rtree::visitors +} // namespace visitors template bool are_levels_ok(index::rtree const& tree) @@ -106,6 +106,6 @@ bool are_levels_ok(index::rtree const& return v.result; } -}}}} // namespace boost::geometry::index::detail +}}}}} // namespace boost::geometry::index::detail::rtree #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP diff --git a/include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/children_box.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/visitors/children_box.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/children_box.hpp diff --git a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/visitors/copy.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp index ab92bc299..dddbe3c60 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/copy.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/count.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp similarity index 96% rename from include/boost/geometry/extensions/index/rtree/visitors/count.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp index 2b8a324c6..72e355919 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/count.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp @@ -11,9 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP -#include - -#include +#include namespace boost { namespace geometry { namespace index { @@ -22,7 +20,7 @@ namespace detail { namespace rtree { namespace visitors { template struct count : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -71,7 +69,7 @@ struct count template struct count : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp similarity index 97% rename from include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp index 0d60fae83..462d58bff 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/gl_draw.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/gl_draw.hpp diff --git a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp similarity index 99% rename from include/boost/geometry/extensions/index/rtree/visitors/insert.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp index 5635ce013..3f3189d68 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/insert.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp @@ -13,7 +13,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -122,7 +122,7 @@ protected: typedef rtree::node_auto_ptr node_auto_ptr; public: - typedef index::static_vector, 1> nodes_container_type; + typedef index::detail::static_vector, 1> nodes_container_type; template static inline void apply(nodes_container_type & additional_nodes, @@ -220,7 +220,7 @@ struct insert_traverse_data template class insert : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { protected: typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp index 9fd479b4f..7c22e3747 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/nearest_query.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/nearest_query.hpp index 58f59cbd7..c3cc698b5 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/nearest_query.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP -#include +#include -#include +#include #include namespace boost { namespace geometry { namespace index { @@ -159,7 +159,7 @@ template < > class nearest_query : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { public: typedef typename Options::parameters_type parameters_type; @@ -168,20 +168,20 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - typedef index::detail::distances_calc node_distances_calc; + typedef index::detail::distances_calc node_distances_calc; typedef typename node_distances_calc::result_type node_distances_type; - typedef index::detail::distances_predicates_check node_distances_predicates_check; + typedef index::detail::distances_predicates_check node_distances_predicates_check; typedef index::detail::distances_calc< DistancesPredicates, typename translator::indexable_type::type, - rtree::value_tag + index::detail::value_tag > value_distances_calc; typedef typename value_distances_calc::result_type value_distances_type; typedef index::detail::distances_predicates_check< DistancesPredicates, typename translator::indexable_type::type, - rtree::value_tag + index::detail::value_tag > value_distances_predicates_check; inline nearest_query(parameters_type const& parameters, Translator const& translator, DistancesPredicates const& dist_pred, Predicates const& pred, Result & r) @@ -211,7 +211,7 @@ public: { // if current node meets predicates // 0 - dummy value - if ( index::detail::predicates_check(m_pred, 0, it->first) ) + if ( index::detail::predicates_check(m_pred, 0, it->first) ) { // calculate node's distance(s) for distance predicate node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); @@ -266,7 +266,7 @@ public: it != elements.end(); ++it) { // if value meets predicates - if ( index::detail::predicates_check(m_pred, *it, m_translator(*it)) ) + if ( index::detail::predicates_check(m_pred, *it, m_translator(*it)) ) { // calculate values distance for distance predicate value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_translator(*it)); diff --git a/include/boost/geometry/extensions/index/rtree/visitors/print.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/print.hpp similarity index 100% rename from include/boost/geometry/extensions/index/rtree/visitors/print.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/print.hpp diff --git a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/remove.hpp similarity index 98% rename from include/boost/geometry/extensions/index/rtree/visitors/remove.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/remove.hpp index 25ca6eeff..2a6ae4ae4 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/remove.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/remove.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP -#include +#include -#include +#include #include @@ -25,7 +25,7 @@ namespace detail { namespace rtree { namespace visitors { template class remove : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp b/include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp similarity index 88% rename from include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp rename to include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp index 87f904546..15e40e966 100644 --- a/include/boost/geometry/extensions/index/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP -#include +#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -22,7 +22,7 @@ namespace detail { namespace rtree { namespace visitors { template struct spatial_query : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -43,7 +43,7 @@ struct spatial_query { // if node meets predicates // 0 - dummy value - if ( index::detail::predicates_check(pred, 0, it->first) ) + if ( index::detail::predicates_check(pred, 0, it->first) ) rtree::apply_visitor(*this, *it->second); } } @@ -58,7 +58,7 @@ struct spatial_query it != elements.end(); ++it) { // if value meets predicates - if ( index::detail::predicates_check(pred, *it, tr(*it)) ) + if ( index::detail::predicates_check(pred, *it, tr(*it)) ) { out_iter = *it; ++out_iter; diff --git a/include/boost/geometry/extensions/index/static_vector.hpp b/include/boost/geometry/extensions/index/detail/static_vector.hpp similarity index 99% rename from include/boost/geometry/extensions/index/static_vector.hpp rename to include/boost/geometry/extensions/index/detail/static_vector.hpp index bba47ae1b..675012b01 100644 --- a/include/boost/geometry/extensions/index/static_vector.hpp +++ b/include/boost/geometry/extensions/index/detail/static_vector.hpp @@ -28,9 +28,9 @@ #include #include -#include +#include -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { template class static_vector @@ -801,6 +801,6 @@ private: size_type m_size; }; -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP diff --git a/include/boost/geometry/extensions/index/rtree/tags.hpp b/include/boost/geometry/extensions/index/detail/tags.hpp similarity index 64% rename from include/boost/geometry/extensions/index/rtree/tags.hpp rename to include/boost/geometry/extensions/index/detail/tags.hpp index 5589be5b6..a49532008 100644 --- a/include/boost/geometry/extensions/index/rtree/tags.hpp +++ b/include/boost/geometry/extensions/index/detail/tags.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// Tags used by the R-tree predicates implementation. +// Tags used by the predicates checks implementation. // // Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. // @@ -8,17 +8,17 @@ // 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_TAGS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_TAGS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_TAGS_HPP namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { +namespace detail { struct value_tag {}; -struct node_tag {}; +struct envelope_tag {}; -}} // namespace detail::rtree +} // namespace detail }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/tuples.hpp b/include/boost/geometry/extensions/index/detail/tuples.hpp similarity index 96% rename from include/boost/geometry/extensions/index/tuples.hpp rename to include/boost/geometry/extensions/index/detail/tuples.hpp index 3e63c49bc..2784a495d 100644 --- a/include/boost/geometry/extensions/index/tuples.hpp +++ b/include/boost/geometry/extensions/index/detail/tuples.hpp @@ -13,7 +13,7 @@ // TODO move this to index/tuples and separate algorithms -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { namespace tuples { @@ -179,6 +179,6 @@ struct add_unique } // namespace tuples -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/extensions/index/distance_predicates.hpp index 57fd3e60d..7faad08ce 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/distance_predicates.hpp @@ -11,11 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP -#include -#include -#include - -#include +#include /*! \defgroup distance_predicates Distance predicates (boost::geometry::index::) @@ -23,86 +19,6 @@ namespace boost { namespace geometry { namespace index { -//TODO: awulkiew - consider storing values instead of const references -// it may be faster and it eliminates problems with storing of references to temporaries -// moreover user may use boost::cref - -// TODO: awulkiew - what with coordinate systems other than cartesian? -// do comparable_distance returns distance in coordinate system of objects used? -// what if objects are in different systems? -// should index algorithms work exactly like comparable_distance or not? - -namespace detail { - -// relations - -template -struct to_nearest -{ - to_nearest(T const& v) : value(v) {} - T value; -}; - -template -struct to_centroid -{ - to_centroid(T const& v) : value(v) {} - T value; -}; - -template -struct to_furthest -{ - to_furthest(T const& v) : value(v) {} - T value; -}; - -// tags - -struct to_nearest_tag {}; -struct to_centroid_tag {}; -struct to_furthest_tag {}; - -// relation - -template -struct relation -{ - typedef T value_type; - typedef to_nearest_tag tag; - static inline T const& value(T const& v) { return v; } - static inline T & value(T & v) { return v; } -}; - -template -struct relation< to_nearest > -{ - typedef T value_type; - typedef to_nearest_tag tag; - static inline T const& value(to_nearest const& r) { return r.value; } - static inline T & value(to_nearest & r) { return r.value; } -}; - -template -struct relation< to_centroid > -{ - typedef T value_type; - typedef to_centroid_tag tag; - static inline T const& value(to_centroid const& r) { return r.value; } - static inline T & value(to_centroid & r) { return r.value; } -}; - -template -struct relation< to_furthest > -{ - typedef T value_type; - typedef to_furthest_tag tag; - static inline T const& value(to_furthest const& r) { return r.value; } - static inline T & value(to_furthest & r) { return r.value; } -}; - -} // namespace detail - // relations generators /*! @@ -173,83 +89,6 @@ detail::to_furthest to_furthest(T const& v) return detail::to_furthest(v); } -// distance predicates - -namespace detail { - -// TODO: awulkiew - consider storing points instead of PointRelations in predicates below - -template -struct unbounded - : nonassignable -{ - inline explicit unbounded(PointRelation const& pr) - : point_relation(pr) - {} - - PointRelation point_relation; -}; - -template -struct min_bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline min_bounded(PointRelation const& pr, MinRelation const& min_rel) - : point_relation(pr) - , comparable_min( - relation::value(min_rel) * - relation::value(min_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_min; -}; - -template -struct max_bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel) - : point_relation(pr) - , comparable_max( - relation::value(max_rel) * - relation::value(max_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_max; -}; - -template -struct bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel) - : point_relation(pr) - , comparable_min( - relation::value(min_rel) * - relation::value(min_rel) ) - , comparable_max( - relation::value(max_rel) * - relation::value(max_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_min; - distance_type comparable_max; -}; - -} // namespace detail - // distance predicates generators /*! @@ -356,487 +195,6 @@ bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& max return detail::bounded(pr, minr, maxr); } -// algorithms - -namespace detail{ - -// point_relation - -template -struct point_relation -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::unbounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::min_bounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::max_bounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::bounded > -{ - typedef PointRelation type; -}; - - -} // namespace detail - -namespace detail -{ - -// cdist - -template -struct cdist -{ - T value; -}; - -// cdist_merge - -template -struct cdist_merge -{ - typedef typename index::tuples::add_unique< - CDistTuple, - CDist - >::type type; -}; - -template -struct cdist_merge< - cdist, - cdist > -{ - typedef boost::tuple< - cdist, - cdist - > type; -}; - -template -struct cdist_merge< - cdist, - cdist > -{ - typedef cdist type; -}; - -// cdist_value_type - -template -struct cdist_value -{ - typedef typename cdist_value< - typename boost::tuples::element<0, CDistTuple>::type - >::type type; - - template - static inline type & get(CDistTuple & cdtup) - { - return boost::get< - index::tuples::find_index< - CDistTuple, - cdist - >::value - >(cdtup).value; - } - - template - static inline type const& get(CDistTuple const& cdtup) - { - return boost::get< - index::tuples::find_index< - CDistTuple, - cdist - >::value - >(cdtup).value; - } -}; - -template -struct cdist_value< - cdist -> -{ - typedef T type; - - template - static inline type & get(cdist & cd) - { - BOOST_MPL_ASSERT_MSG( - (tuples::equal< cdist, cdist >::value), - TAGS_DO_NOT_MATCH, - (cdist_value)); - - return cd.value; - } - - template - static inline type const& get(cdist const& cd) - { - BOOST_MPL_ASSERT_MSG( - (tuples::equal< cdist, cdist >::value), - TAGS_DO_NOT_MATCH, - (cdist_value)); - - return cd.value; - } -}; - -} // namespace detail - -namespace detail { - -// distances_calc_impl_rel - -template -struct distances_calc_impl_rel -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_RELATION, - (distances_calc_impl_rel)); -}; - -template -struct distances_calc_impl_rel< - cdist -> -{ - template - typename geometry::default_distance_result::type - static inline apply(Point const& p, Indexable const& i) - { - return index::comparable_distance_near(p, i); - } -}; - -template -struct distances_calc_impl_rel< - cdist -> -{ - template - typename geometry::default_distance_result::type - static inline apply(Point const& p, Indexable const& i) - { - return index::comparable_distance_centroid(p, i); - } -}; - -template -struct distances_calc_impl_rel< - cdist -> -{ - template - typename geometry::default_distance_result::type - static inline apply(Point const& p, Indexable const& i) - { - return index::comparable_distance_far(p, i); - } -}; - -// distances_calc_impl_tuple - -template -struct distances_calc_impl_tuple -{ - // TODO MPL ASSERT 0 < N - static inline void apply(Distances & d, Point const& p, Indexable const&i) - { - boost::get(d).value = - distances_calc_impl_rel< - typename boost::tuples::element::type - >::apply(p, i); - - distances_calc_impl_tuple< - Distances, - Point, - Indexable, - N - 1 - >::apply(d, p, i); - } -}; - -template -struct distances_calc_impl_tuple -{ - static inline void apply(Distances & d, Point const& p, Indexable const&i) - { - boost::get<0>(d).value = - distances_calc_impl_rel< - typename boost::tuples::element<0, Distances>::type - >::apply(p, i); - } -}; - -// distances_calc_impl - -template -struct distances_calc_impl -{ - static inline void apply(Distances & d, Point const& p, Indexable const&i) - { - distances_calc_impl_tuple< - Distances, - Point, - Indexable, - boost::tuples::length::value - >::apply(d, p, i); - } -}; - -template -struct distances_calc_impl< - cdist, - Point, - Indexable -> -{ - static inline void apply(cdist & d, Point const& p, Indexable const&i) - { - d.value = distances_calc_impl_rel< - cdist - >::apply(p, i); - } -}; - -// distances_calc - -template -struct distances_calc -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(PointRelation const& p, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(p), i); - return res; - } -}; - -template -struct distances_calc< - detail::unbounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(detail::unbounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::min_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag min_relation_tag; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::min_bounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::max_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag max_relation_tag; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::max_bounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag min_relation_tag; - typedef typename detail::relation::tag max_relation_tag; - - typedef typename detail::cdist_merge< - typename detail::cdist_merge< - cdist, - cdist - >::type, - cdist - >::type result_type; - - static inline result_type apply( - detail::bounded const& pp, - Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -// distances_predicates_check - -// TODO explicitly define Distances type ? -// TODO move distance_calc and distance_comp into geometry::index ? - -template -struct distances_predicates_check -{ - template - static inline bool apply(PointRelation const&, Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::unbounded, - Indexable, - Tag -> -{ - template - static inline bool apply(detail::unbounded const&, Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::min_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::tag min_relation_tag; - - template - static inline bool apply( - detail::min_bounded const& pred, - Distances const& d) - { - return pred.comparable_min <= - detail::cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::max_bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::tag max_relation_tag; - - template - static inline bool apply( - detail::max_bounded const& pred, - Distances const& d) - { - return pred.comparable_max <= - detail::cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::bounded, - Indexable, - Tag -> -{ - typedef typename detail::relation::tag min_relation_tag; - typedef typename detail::relation::tag max_relation_tag; - - template - static inline bool apply( - detail::bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= detail::cdist_value::template get(d) - && detail::cdist_value::template get(d) - <= pred.comparable_max; - } -}; - -// TODO calculate all of this for Boxes only! -// for Points calculate only 1 distance allways - -} // namespace detail - }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/options.hpp b/include/boost/geometry/extensions/index/parameters.hpp similarity index 63% rename from include/boost/geometry/extensions/index/rtree/options.hpp rename to include/boost/geometry/extensions/index/parameters.hpp index 76f34a2fb..7b8a9a594 100644 --- a/include/boost/geometry/extensions/index/rtree/options.hpp +++ b/include/boost/geometry/extensions/index/parameters.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// R-tree options, algorithms, parameters +// R-tree algorithms parameters // // 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_OPTIONS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP #include @@ -201,143 +201,8 @@ private: size_t m_reinserted_elements; }; -} - -namespace detail { namespace rtree { - -// InsertTag -struct insert_default_tag {}; -struct insert_reinsert_tag {}; - -// ChooseNextNodeTag -struct choose_by_content_diff_tag {}; -struct choose_by_overlap_diff_tag {}; - -// SplitTag -struct split_default_tag {}; -//struct split_kmeans_tag {}; - -// RedistributeTag -struct linear_tag {}; -struct quadratic_tag {}; -struct rstar_tag {}; - -// NodeTag -struct node_d_mem_dynamic_tag {}; -struct node_d_mem_static_tag {}; -struct node_s_mem_dynamic_tag {}; -struct node_s_mem_static_tag {}; - -template -struct options -{ - typedef Parameters parameters_type; - typedef InsertTag insert_tag; - typedef ChooseNextNodeTag choose_next_node_tag; - typedef SplitTag split_tag; - typedef RedistributeTag redistribute_tag; - typedef NodeTag node_tag; -}; - -template -struct options_type -{ - // TODO: awulkiew - use static assert -}; - -template -struct options_type< linear > -{ - typedef options< - linear, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - linear_tag, - node_d_mem_static_tag - > type; -}; - -template -struct options_type< quadratic > -{ - typedef options< - quadratic, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - quadratic_tag, - node_d_mem_static_tag - > type; -}; - -template -struct options_type< rstar > -{ - typedef options< - rstar, - insert_reinsert_tag, - choose_by_overlap_diff_tag, - split_default_tag, - rstar_tag, - node_d_mem_static_tag - > type; -}; - -//template -//struct options_type< kmeans > -//{ -// typedef options< -// kmeans, -// insert_default_tag, -// choose_by_content_diff_tag, // change it? -// split_kmeans_tag, -// int, // dummy tag - not used for now -// node_d_mem_static_tag -// > type; -//}; - -template <> -struct options_type< runtime::linear > -{ - typedef options< - runtime::linear, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - linear_tag, - node_d_mem_dynamic_tag - > type; -}; - -template <> -struct options_type< runtime::quadratic > -{ - typedef options< - runtime::quadratic, - insert_default_tag, - choose_by_content_diff_tag, - split_default_tag, - quadratic_tag, - node_d_mem_dynamic_tag - > type; -}; - -template <> -struct options_type< runtime::rstar > -{ - typedef options< - runtime::rstar, - insert_reinsert_tag, - choose_by_overlap_diff_tag, - split_default_tag, - rstar_tag, - node_d_mem_dynamic_tag - > type; -}; - -}} // namespace detail::rtree +} // namespace runtime }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/extensions/index/predicates.hpp index 902a705d3..ee8554ba6 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/extensions/index/predicates.hpp @@ -18,113 +18,14 @@ // TODO: awulkiew - temporary #include +#include + /*! \defgroup predicates Spatial predicates (boost::geometry::index::) */ namespace boost { namespace geometry { namespace index { -namespace detail { - -// predicates - -struct empty {}; - -template -struct value -{ - value(ValuePredicate const& vpred) : value_predicate(vpred) {} - ValuePredicate value_predicate; -}; - -template -struct covered_by -{ - covered_by(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct disjoint -{ - disjoint(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct intersects -{ - intersects(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct overlaps -{ - overlaps(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -//template -//struct touches -//{ -// touches(Geometry const& g) : geometry(g) {} -// Geometry geometry; -//}; - -template -struct within -{ - within(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_covered_by -{ - not_covered_by(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_disjoint -{ - not_disjoint(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_intersects -{ - not_intersects(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -template -struct not_overlaps -{ - not_overlaps(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -//template -//struct not_touches -//{ -// not_touches(Geometry const& g) : geometry(g) {} -// Geometry geometry; -//}; - -template -struct not_within -{ - not_within(Geometry const& g) : geometry(g) {} - Geometry geometry; -}; - -} // namespace detail - -// generators - /*! \brief Generate empty predicate. @@ -267,246 +168,6 @@ inline detail::within within(Geometry const& g) return detail::within(g); } -namespace detail -{ - -// predicate check - -// TODO: awulkiew - consider passing Value/Node and Translator instead of -// Value and Indexable - -template -struct predicate_check -{ - template - static inline bool apply(Geometry const& g, Value const&, Indexable const& i) - { - return geometry::intersects(i, g); - } -}; - -template -struct predicate_check -{ - template - static inline bool apply(Geometry const&, Value const&, Indexable const&) - { - return true; - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(value const& p, Value const& v, Indexable const&) - { - return p.value_predicate(v); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(covered_by const& p, Value const&, Indexable const& i) - { - return geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(disjoint const& p, Value const&, Indexable const& i) - { - return geometry::disjoint(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(intersects const& p, Value const&, Indexable const& i) - { - return geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(overlaps const& p, Value const&, Indexable const& i) - { - return geometry::overlaps(i, p.geometry); - } -}; - -//template -//struct predicate_check, Tag> -//{ -// template -// static inline bool apply(touches const& p, Value const&, Indexable const& i) -// { -// return geometry::touches(i, p.geometry); -// } -//}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(within const& p, Value const&, Indexable const& i) - { - return geometry::within(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_covered_by const& p, Value const&, Indexable const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_disjoint const& p, Value const&, Indexable const& i) - { - return !geometry::disjoint(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_intersects const& p, Value const&, Indexable const& i) - { - return !geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_overlaps const& p, Value const&, Indexable const& i) - { - return !geometry::overlaps(i, p.geometry); - } -}; - -//template -//struct predicate_check, Tag> -//{ -// template -// static inline bool apply(not_touches const& p, Value const&, Indexable const& i) -// { -// return !geometry::touches(i, p.geometry); -// } -//}; - -template -struct predicate_check, Tag> -{ - template - static inline bool apply(not_within const& p, Value const&, Indexable const& i) - { - return !geometry::within(i, p.geometry); - } -}; - -// predicates check - -template -struct predicates_check_tuple -{ - template - static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) - { - return predicates_check_tuple::apply(p, v, i) - && predicate_check< - typename boost::tuples::element::type, - Tag - >::apply(boost::get(p), v, i); - } -}; - -template -struct predicates_check_tuple -{ - template - static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) - { - return predicate_check< - typename boost::tuples::element<0, TuplePredicates>::type, - Tag - >::apply(boost::get<0>(p), v, i); - } -}; - -template -struct predicates_check_impl -{ - template - static inline bool apply(Predicate const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p, v, i); - } -}; - -template -struct predicates_check_impl, Tag> -{ - template - static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.first, v, i) - && predicate_check::apply(p.second, v, i); - } -}; - -template < - typename T0, typename T1, typename T2, typename T3, typename T4, - typename T5, typename T6, typename T7, typename T8, typename T9, - typename Tag -> -struct predicates_check_impl< - boost::tuple, - Tag -> -{ - typedef boost::tuple predicates_type; - - template - static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) - { - return predicates_check_tuple< - predicates_type, - Tag, - boost::tuples::length::value - >::apply(p, v, i); - } -}; - -template -inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i) -{ - return detail::predicates_check_impl - ::apply(p, v, i); -} - -} // namespace detail - }}} // namespace boost::geometry::index // operator! generators diff --git a/include/boost/geometry/extensions/index/rtree/rtree.hpp b/include/boost/geometry/extensions/index/rtree.hpp similarity index 97% rename from include/boost/geometry/extensions/index/rtree/rtree.hpp rename to include/boost/geometry/extensions/index/rtree.hpp index 830e16ebc..e5b364e9f 100644 --- a/include/boost/geometry/extensions/index/rtree/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree.hpp @@ -19,31 +19,32 @@ #include -#include -#include +#include +#include #include -#include +#include #include -#include +#include +#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -//#include +#include +#include +#include +//#include #include diff --git a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp b/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp deleted file mode 100644 index 73e10e188..000000000 --- a/include/boost/geometry/extensions/index/rtree/distance_predicates.hpp +++ /dev/null @@ -1,218 +0,0 @@ -// Boost.Geometry Index -// -// Spatial index distance predicates, calculators and checkers -// used in nearest query - specialized for nodes -// -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP - -#include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { - -// distance_calc - -template -struct distances_calc< - PointRelation, - Box, - rtree::node_tag> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(PointRelation const& p, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(p), i); - return res; - } -}; - -template -struct distances_calc< - detail::unbounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(detail::unbounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::min_bounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::min_bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::max_bounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef cdist result_type; - - static inline result_type apply(detail::max_bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::bounded, - Box, - rtree::node_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -// distance_predicate_check - -template -struct distances_predicates_check< - PointRelation, - Box, - rtree::node_tag> -{ - template - static inline bool apply(PointRelation const&, Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::unbounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::unbounded const&, - Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::min_bounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::min_bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::max_bounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::max_bounded const& pred, - Distances const& d) - { - return cdist_value::template get(d) - <= pred.comparable_max; - } -}; - -template -struct distances_predicates_check< - detail::bounded, - Box, - rtree::node_tag> -{ - template - static inline bool apply( - detail::bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= cdist_value::template get(d) - && cdist_value::template get(d) - <= pred.comparable_max; - } -}; - -} // namespace detail - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree/predicates.hpp b/include/boost/geometry/extensions/index/rtree/predicates.hpp deleted file mode 100644 index 106d938b7..000000000 --- a/include/boost/geometry/extensions/index/rtree/predicates.hpp +++ /dev/null @@ -1,182 +0,0 @@ -// Boost.Geometry Index -// -// Spatial query predicates checks specialized for nodes -// -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP - -#include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { - -// TODO: awulkiew - consider removing Value from parameters -// then predicates_check must be implemented for nodes as well - -template -struct predicate_check -{ - template - static inline bool apply(Geometry const& g, Value const&, Indexable const& i) - { - return geometry::intersects(i, g); - } -}; - -template <> -struct predicate_check -{ - template - static inline bool apply(Geometry const&, Value const&, Indexable const&) - { - return true; - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(value const&, Value const&, Box const&) - { - return true; - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(covered_by const& p, Value const&, Box const& i) - { - return geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(disjoint const& p, Value const&, Box const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static inline bool apply(intersects const& p, Value const&, Indexable const& i) - { - return geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static inline bool apply(overlaps const& p, Value const&, Box const& i) - { - // TODO: awulkiew - possibly change to the version without border case - // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false - return geometry::intersects(i, p.geometry); - } -}; - -//template -//struct predicate_check, rtree::node_tag> -//{ -// template -// static bool apply(touches const& p, Value const&, Box const& i) -// { -// return geometry::intersects(i, p.geometry); -// } -//}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(within const& p, Value const&, Box const& i) - { - // TODO: awulkiew - possibly change to the version without border case - // e.g. intersects_without_border(0,0x1,1, 1,1x2,2) should give false - return geometry::intersects(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_covered_by const& p, Value const&, Box const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_disjoint const& p, Value const&, Box const& i) - { - return !geometry::disjoint(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_intersects const& p, Value const&, Box const& i) - { - return !geometry::covered_by(i, p.geometry); - } -}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_overlaps const& p, Value const&, Box const& i) - { - return true; - } -}; - -//template -//struct predicate_check, rtree::node_tag> -//{ -// template -// static bool apply(not_touches const& p, Value const&, Box const& i) -// { -// return !geometry::intersects(i, p.geometry); -// } -//}; - -template -struct predicate_check, rtree::node_tag> -{ - template - static bool apply(not_within const& p, Value const&, Box const& i) - { - return !geometry::within(i, p.geometry); - } -}; - -} // namespace detail - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_PREDICATES_HPP diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp index 35e623d86..770657d48 100644 --- a/test/geometry_index_test_common.hpp +++ b/test/geometry_index_test_common.hpp @@ -12,7 +12,7 @@ #include #define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE -#include +#include #include diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 2e279a121..365dae009 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -104,61 +104,61 @@ void test_rtree_elements_exceptions(Parameters const& parameters = Parameters()) for ( size_t i = 0 ; i < 100 ; i += 2 ) { - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(10000); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(10000); Tree tree(parameters); - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(i); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(i); - BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_pushable_array_exception ); + BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_static_vector_exception ); } for ( size_t i = 0 ; i < 50 ; i += 2 ) { - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(10000); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(10000); Tree tree(parameters); tree.insert(input.begin(), input.end()); - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(i); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(i); - BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_pushable_array_exception ); + BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_static_vector_exception ); } for ( size_t i = 0 ; i < 50 ; i += 2 ) { - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(10000); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(10000); Tree tree(parameters); tree.insert(input.begin(), input.end()); - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(i); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(i); - BOOST_CHECK_THROW( Tree tree2(tree), throwing_pushable_array_exception ); + BOOST_CHECK_THROW( Tree tree2(tree), throwing_static_vector_exception ); } for ( size_t i = 0 ; i < 50 ; i += 2 ) { - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(10000); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(10000); Tree tree(parameters); Tree tree2(parameters); tree.insert(input.begin(), input.end()); - throwing_pushable_array_settings::reset_calls_counter(); - throwing_pushable_array_settings::set_max_calls(i); + throwing_static_vector_settings::reset_calls_counter(); + throwing_static_vector_settings::set_max_calls(i); - BOOST_CHECK_THROW(tree2 = tree, throwing_pushable_array_exception ); + BOOST_CHECK_THROW(tree2 = tree, throwing_static_vector_exception ); } } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 05896776b..bc341c315 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -16,10 +16,8 @@ #include #include -#include - -#include -#include +#include +#include //#include //#include @@ -549,9 +547,9 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran template void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector const& expected_output) { - BOOST_CHECK( bgi::detail::are_levels_ok(rtree) ); + BOOST_CHECK( bgi::detail::rtree::are_levels_ok(rtree) ); if ( !rtree.empty() ) - BOOST_CHECK( bgi::detail::are_boxes_ok(rtree) ); + BOOST_CHECK( bgi::detail::rtree::are_boxes_ok(rtree) ); std::vector output; size_t n = rtree.spatial_query(pred, std::back_inserter(output)); diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 735510e61..138a27de8 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -14,16 +14,12 @@ #include -#include +#include #include namespace boost { namespace geometry { namespace index { -// options implementation (from options.hpp) - -struct node_throwing_d_mem_static_tag {}; - template struct linear_throwing : public linear {}; @@ -35,6 +31,10 @@ struct rstar_throwing : public rstar struct options_type< linear_throwing > { @@ -109,7 +109,7 @@ struct dynamic_leaf -struct container_from_elements_type, NewValue> +struct container_from_elements_type, NewValue> { typedef throwing_static_vector type; }; diff --git a/test/rtree/test_throwing.hpp b/test/rtree/test_throwing.hpp index 40d823b37..acc9d4a7a 100644 --- a/test/rtree/test_throwing.hpp +++ b/test/rtree/test_throwing.hpp @@ -141,185 +141,7 @@ struct generate_value< std::pair, throwing_value> > // //}}} // namespace boost::geometry::index -#include - -struct throwing_pushable_array_exception : public std::exception -{ - const char * what() const throw() { return "pushable array exception."; } -}; - -struct throwing_pushable_array_settings -{ - static void throw_if_required() - { - // throw if counter meets max count - if ( get_max_calls_ref() <= get_calls_counter_ref() ) - throw throwing_pushable_array_exception(); - else - ++get_calls_counter_ref(); - } - - static void reset_calls_counter() { get_calls_counter_ref() = 0; } - static void set_max_calls(size_t mc) { get_max_calls_ref() = mc; } - - static size_t & get_calls_counter_ref() { static size_t cc = 0; return cc; } - static size_t & get_max_calls_ref() { static size_t mc = (std::numeric_limits::max)(); return mc; } -}; - -template -class throwing_pushable_array -{ - typedef typename boost::array array_type; - -public: - typedef typename array_type::value_type value_type; - typedef typename array_type::size_type size_type; - typedef typename array_type::iterator iterator; - typedef typename array_type::const_iterator const_iterator; - typedef typename array_type::reverse_iterator reverse_iterator; - typedef typename array_type::const_reverse_iterator const_reverse_iterator; - typedef typename array_type::reference reference; - typedef typename array_type::const_reference const_reference; - - inline throwing_pushable_array() - : m_size(0) - {} - - //inline explicit throwing_pushable_array(size_type s) - // : m_size(s) - //{ - // BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); - //} - - inline void resize(size_type s) - { - BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); - throwing_pushable_array_settings::throw_if_required(); - m_size = s; - } - - inline void reserve(size_type /*s*/) - { - //BOOST_GEOMETRY_INDEX_ASSERT(s <= Capacity, "size too big"); - // do nothing - } - - inline Element & operator[](size_type i) - { - BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); - return m_array[i]; - } - - inline Element const& operator[](size_type i) const - { - BOOST_GEOMETRY_INDEX_ASSERT(i < m_size, "index of the element outside the container"); - return m_array[i]; - } - - inline Element const& front() const - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return m_array.front(); - } - - inline Element & front() - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return m_array.front(); - } - - inline Element const& back() const - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return *(begin() + (m_size - 1)); - } - - inline Element & back() - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - return *(begin() + (m_size - 1)); - } - - inline iterator begin() - { - return m_array.begin(); - } - - inline iterator end() - { - return m_array.begin() + m_size; - } - - inline const_iterator begin() const - { - return m_array.begin(); - } - - inline const_iterator end() const - { - return m_array.begin() + m_size; - } - - inline reverse_iterator rbegin() - { - return reverse_iterator(end()); - } - - inline reverse_iterator rend() - { - return reverse_iterator(begin()); - } - - inline const_reverse_iterator rbegin() const - { - return const_reverse_iterator(end()); - } - - inline const_reverse_iterator rend() const - { - return const_reverse_iterator(begin()); - } - - inline void clear() - { - m_size = 0; - } - - void push_back(Element const& v) - { - BOOST_GEOMETRY_INDEX_ASSERT(m_size < Capacity, "can't further increase the size of the container"); - throwing_pushable_array_settings::throw_if_required(); - m_array[m_size] = v; - ++m_size; - } - - inline void pop_back() - { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_size, "there are no elements in the container"); - --m_size; - } - - inline bool empty() const - { - return m_size == 0; - } - - inline size_t size() const - { - return m_size; - } - - inline size_t capacity() const - { - return Capacity; - } - -private: - boost::array m_array; - size_type m_size; -}; - -#include +#include struct throwing_static_vector_exception : public std::exception { @@ -332,7 +154,7 @@ struct throwing_static_vector_settings { // throw if counter meets max count if ( get_max_calls_ref() <= get_calls_counter_ref() ) - throw throwing_pushable_array_exception(); + throw throwing_static_vector_exception(); else ++get_calls_counter_ref(); } @@ -346,9 +168,9 @@ struct throwing_static_vector_settings template class throwing_static_vector - : public boost::geometry::index::static_vector + : public boost::geometry::index::detail::static_vector { - typedef boost::geometry::index::static_vector container; + typedef boost::geometry::index::detail::static_vector container; public: typedef typename container::value_type value_type; @@ -362,13 +184,13 @@ public: inline void resize(size_type s) { - throwing_pushable_array_settings::throw_if_required(); + throwing_static_vector_settings::throw_if_required(); container::resize(s); } void push_back(Element const& v) { - throwing_pushable_array_settings::throw_if_required(); + throwing_static_vector_settings::throw_if_required(); container::push_back(v); } }; From ca17094850782e6f84f35bbca2ccc680e69efec1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 18 Jan 2013 21:18:32 +0000 Subject: [PATCH 294/366] indexable traits and accessors moved to index::detail namespace [SVN r82538] --- .../comparable_distance_centroid.hpp | 8 +++---- .../algorithms/comparable_distance_far.hpp | 8 +++---- .../algorithms/comparable_distance_near.hpp | 8 +++---- .../extensions/index/algorithms/content.hpp | 10 ++++---- .../extensions/index/algorithms/is_valid.hpp | 10 ++++---- .../extensions/index/algorithms/margin.hpp | 8 +++---- .../index/{ => detail}/indexable.hpp | 10 ++++---- .../rtree/linear/redistribute_elements.hpp | 24 +++++++++---------- .../rtree/quadratic/redistribute_elements.hpp | 4 ++-- .../rtree/rstar/redistribute_elements.hpp | 14 +++++------ .../boost/geometry/extensions/index/rtree.hpp | 2 +- .../extensions/index/translator/def.hpp | 6 ++--- .../extensions/index/translator/helpers.hpp | 6 ++--- test/rtree/test_rtree.hpp | 8 +++---- 14 files changed, 63 insertions(+), 63 deletions(-) rename include/boost/geometry/extensions/index/{ => detail}/indexable.hpp (92%) diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp index 36620535b..983452848 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp @@ -44,8 +44,8 @@ struct sum_for_indexable_dimension::type point_coord_t; - typedef typename index::traits::coordinate_type::type indexable_coord_t; + typedef typename index::detail::traits::coordinate_type::type point_coord_t; + typedef typename index::detail::traits::coordinate_type::type indexable_coord_t; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); @@ -69,9 +69,9 @@ comparable_distance_centroid(Point const& pt, Indexable const& i) return detail::sum_for_indexable< Point, Indexable, - typename index::traits::tag::type, + typename index::detail::traits::tag::type, detail::comparable_distance_centroid_tag, - index::traits::dimension::value + index::detail::traits::dimension::value >::apply(pt, i); } diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp index 30fb83e74..dbedd9cd0 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp @@ -32,8 +32,8 @@ struct sum_for_indexable_dimension::type point_coord_t; - typedef typename index::traits::coordinate_type::type indexable_coord_t; + typedef typename index::detail::traits::coordinate_type::type point_coord_t; + typedef typename index::detail::traits::coordinate_type::type indexable_coord_t; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); @@ -59,9 +59,9 @@ comparable_distance_far(Point const& pt, Indexable const& i) return detail::sum_for_indexable< Point, Indexable, - typename index::traits::tag::type, + typename index::detail::traits::tag::type, detail::comparable_distance_far_tag, - index::traits::dimension::value + index::detail::traits::dimension::value >::apply(pt, i); } diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp b/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp index 8b809d41d..6ed71bcb5 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp +++ b/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp @@ -43,8 +43,8 @@ struct sum_for_indexable_dimension::type point_coord_t; - typedef typename index::traits::coordinate_type::type indexable_coord_t; + typedef typename index::detail::traits::coordinate_type::type point_coord_t; + typedef typename index::detail::traits::coordinate_type::type indexable_coord_t; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); @@ -70,9 +70,9 @@ comparable_distance_near(Point const& pt, Indexable const& i) return detail::sum_for_indexable< Point, Indexable, - typename index::traits::tag::type, + typename index::detail::traits::tag::type, detail::comparable_distance_near_tag, - index::traits::dimension::value + index::detail::traits::dimension::value >::apply(pt, i); } diff --git a/include/boost/geometry/extensions/index/algorithms/content.hpp b/include/boost/geometry/extensions/index/algorithms/content.hpp index 12c9471f0..bec29b3f9 100644 --- a/include/boost/geometry/extensions/index/algorithms/content.hpp +++ b/include/boost/geometry/extensions/index/algorithms/content.hpp @@ -17,7 +17,7 @@ template struct default_content_result { typedef typename select_most_precise< - typename traits::coordinate_type::type, + typename detail::traits::coordinate_type::type, long double >::type type; }; @@ -33,7 +33,7 @@ struct content_for_each_dimension static inline typename default_content_result::type apply(Box const& b) { return content_for_each_dimension::apply(b) * - ( index::get(b) - index::get(b) ); + ( detail::get(b) - detail::get(b) ); } }; @@ -42,7 +42,7 @@ struct content_for_each_dimension { static inline typename default_area_result::type apply(Box const& b) { - return index::get(b) - index::get(b); + return detail::get(b) - detail::get(b); } }; @@ -70,7 +70,7 @@ struct content { static typename default_content_result::type apply(Indexable const& b) { - return detail::content_for_each_dimension::value>::apply(b); + return detail::content_for_each_dimension::value>::apply(b); } }; @@ -79,7 +79,7 @@ struct content template typename default_content_result::type content(Indexable const& b) { - return dispatch::content::type>::apply(b); + return dispatch::content::type>::apply(b); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/algorithms/is_valid.hpp b/include/boost/geometry/extensions/index/algorithms/is_valid.hpp index 4468b3684..42c55282c 100644 --- a/include/boost/geometry/extensions/index/algorithms/is_valid.hpp +++ b/include/boost/geometry/extensions/index/algorithms/is_valid.hpp @@ -19,14 +19,14 @@ template struct is_valid_box { BOOST_MPL_ASSERT_MSG( - (0 < Dimension && Dimension <= index::traits::dimension::value), + (0 < Dimension && Dimension <= detail::traits::dimension::value), INVALID_DIMENSION_PARAMETER, (is_valid_box)); static inline bool apply(Box const& b) { return is_valid_box::apply(b) && - ( index::get(b) <= index::get(b) ); + ( detail::get(b) <= detail::get(b) ); } }; @@ -35,7 +35,7 @@ struct is_valid_box { static inline bool apply(Box const& b) { - return index::get(b) <= index::get(b); + return detail::get(b) <= detail::get(b); } }; @@ -66,7 +66,7 @@ struct is_valid { static inline bool apply(Indexable const& b) { - return detail::is_valid_box::value>::apply(b); + return detail::is_valid_box::value>::apply(b); } }; @@ -75,7 +75,7 @@ struct is_valid template inline bool is_valid(Indexable const& b) { - return dispatch::is_valid::type>::apply(b); + return dispatch::is_valid::type>::apply(b); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/algorithms/margin.hpp b/include/boost/geometry/extensions/index/algorithms/margin.hpp index aee9c4dc7..45d33817f 100644 --- a/include/boost/geometry/extensions/index/algorithms/margin.hpp +++ b/include/boost/geometry/extensions/index/algorithms/margin.hpp @@ -72,12 +72,12 @@ template struct margin_for_each_dimension { BOOST_STATIC_ASSERT(0 < CurrentDimension); - BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); + BOOST_STATIC_ASSERT(CurrentDimension <= detail::traits::dimension::value); static inline typename default_margin_result::type apply(Box const& b) { return margin_for_each_dimension::apply(b) + - margin_for_each_edge::value>::apply(b); + margin_for_each_edge::value>::apply(b); } }; @@ -86,7 +86,7 @@ struct margin_for_each_dimension { static inline typename default_margin_result::type apply(Box const& b) { - return margin_for_each_edge::value>::apply(b); + return margin_for_each_edge::value>::apply(b); } }; @@ -95,7 +95,7 @@ struct margin_for_each_dimension template typename default_margin_result::type margin(Box const& b) { - return 2 * detail::margin_for_each_dimension::value>::apply(b); + return 2 * detail::margin_for_each_dimension::value>::apply(b); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/indexable.hpp b/include/boost/geometry/extensions/index/detail/indexable.hpp similarity index 92% rename from include/boost/geometry/extensions/index/indexable.hpp rename to include/boost/geometry/extensions/index/detail/indexable.hpp index 1729c3699..b3a10452f 100644 --- a/include/boost/geometry/extensions/index/indexable.hpp +++ b/include/boost/geometry/extensions/index/detail/indexable.hpp @@ -8,10 +8,10 @@ // 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_INDEXABLE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { namespace dispatch { @@ -172,6 +172,6 @@ struct default_box_type > type; }; -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INDEXABLE_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp index 7581b557b..1fd7f3255 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp @@ -45,7 +45,7 @@ struct find_greatest_normalized_separation { typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::detail::traits::coordinate_type::type coordinate_type; static inline void apply(Elements const& elements, Parameters const& parameters, @@ -59,15 +59,15 @@ struct find_greatest_normalized_separation BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); // find the lowest low, highest high - coordinate_type lowest_low = index::get(rtree::element_indexable(elements[0], translator)); - coordinate_type highest_high = index::get(rtree::element_indexable(elements[0], translator)); + coordinate_type lowest_low = index::detail::get(rtree::element_indexable(elements[0], translator)); + coordinate_type highest_high = index::detail::get(rtree::element_indexable(elements[0], translator)); // and the lowest high coordinate_type lowest_high = highest_high; size_t lowest_high_index = 0; for ( size_t i = 1 ; i < elements_count ; ++i ) { - coordinate_type min_coord = index::get(rtree::element_indexable(elements[i], translator)); - coordinate_type max_coord = index::get(rtree::element_indexable(elements[i], translator)); + coordinate_type min_coord = index::detail::get(rtree::element_indexable(elements[i], translator)); + coordinate_type max_coord = index::detail::get(rtree::element_indexable(elements[i], translator)); if ( max_coord < lowest_high ) { @@ -84,10 +84,10 @@ struct find_greatest_normalized_separation // find the highest low size_t highest_low_index = lowest_high_index == 0 ? 1 : 0; - coordinate_type highest_low = index::get(rtree::element_indexable(elements[highest_low_index], translator)); + coordinate_type highest_low = index::detail::get(rtree::element_indexable(elements[highest_low_index], translator)); for ( size_t i = highest_low_index ; i < elements_count ; ++i ) { - coordinate_type min_coord = index::get(rtree::element_indexable(elements[i], translator)); + coordinate_type min_coord = index::detail::get(rtree::element_indexable(elements[i], translator)); if ( highest_low < min_coord && i != lowest_high_index ) { @@ -124,7 +124,7 @@ struct pick_seeds_impl typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::detail::traits::coordinate_type::type coordinate_type; static inline void apply(Elements const& elements, Parameters const& parameters, @@ -154,7 +154,7 @@ struct pick_seeds_impl { typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::detail::traits::coordinate_type::type coordinate_type; static inline void apply(Elements const& elements, Parameters const& parameters, @@ -174,9 +174,9 @@ struct pick_seeds { typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::detail::traits::coordinate_type::type coordinate_type; - static const size_t dimension = index::traits::dimension::value; + static const size_t dimension = index::detail::traits::dimension::value; static inline void apply(Elements const& elements, Parameters const& parameters, @@ -214,7 +214,7 @@ struct redistribute_elements::type elements_type; typedef typename elements_type::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::detail::traits::coordinate_type::type coordinate_type; typedef typename index::default_content_result::type content_type; elements_type & elements1 = rtree::elements(n); diff --git a/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp index de7d8ef1e..1ea480313 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp @@ -33,7 +33,7 @@ struct pick_seeds { typedef typename Elements::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::detail::traits::coordinate_type::type coordinate_type; typedef Box box_type; typedef typename index::default_content_result::type content_type; @@ -100,7 +100,7 @@ struct redistribute_elements::type elements_type; typedef typename elements_type::value_type element_type; typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename index::traits::coordinate_type::type coordinate_type; + typedef typename index::detail::traits::coordinate_type::type coordinate_type; elements_type & elements1 = rtree::elements(n); elements_type & elements2 = rtree::elements(second_node); diff --git a/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp index 06c898b6f..0ad80cf6d 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp @@ -40,8 +40,8 @@ public: bool operator()(Element const& e1, Element const& e2) const { - return index::get(rtree::element_indexable(e1, m_tr)) - < index::get(rtree::element_indexable(e2, m_tr)); + return index::detail::get(rtree::element_indexable(e1, m_tr)) + < index::detail::get(rtree::element_indexable(e2, m_tr)); } private: @@ -229,7 +229,7 @@ struct choose_split_axis_and_index Parameters, Box, Dimension - 1, - typename index::traits::tag::type + typename index::detail::traits::tag::type >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); // MAY THROW, STRONG if ( sum_of_margins < smallest_sum_of_margins ) @@ -269,7 +269,7 @@ struct choose_split_axis_and_index Parameters, Box, 0, - typename index::traits::tag::type + typename index::detail::traits::tag::type >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, parameters, translator); // MAY THROW } }; @@ -325,7 +325,7 @@ struct redistribute_elements::value; + static const size_t dimension = index::detail::traits::dimension::value; typedef typename index::default_margin_result::type margin_type; typedef typename index::default_content_result::type content_type; @@ -355,7 +355,7 @@ struct redistribute_elements::value + index::detail::traits::dimension::value >::apply(elements1, split_axis, split_corner, split_index, smallest_sum_of_margins, smallest_overlap, smallest_content, @@ -363,7 +363,7 @@ struct redistribute_elements::value, "unexpected value"); + BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::detail::traits::dimension::value, "unexpected value"); BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast(min_corner) || split_corner == static_cast(max_corner), "unexpected value"); BOOST_GEOMETRY_INDEX_ASSERT(parameters.get_min_elements() <= split_index && split_index <= parameters.get_max_elements() - parameters.get_min_elements() + 1, "unexpected value"); diff --git a/include/boost/geometry/extensions/index/rtree.hpp b/include/boost/geometry/extensions/index/rtree.hpp index e5b364e9f..014dbf8ff 100644 --- a/include/boost/geometry/extensions/index/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree.hpp @@ -116,7 +116,7 @@ public: /*! \brief The Indexable type to which Value is translated. */ typedef typename translator::indexable_type::type indexable_type; /*! \brief The Box type used by the R-tree. */ - typedef typename index::default_box_type::type box_type; + typedef typename index::detail::default_box_type::type box_type; #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) private: diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index 375907e2d..f78f71774 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -28,7 +28,7 @@ struct def { BOOST_MPL_ASSERT_MSG( (!detail::indexable_not_found_error< - typename traits::indexable_type::type + typename index::detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Value) @@ -60,7 +60,7 @@ struct def< std::pair > { BOOST_MPL_ASSERT_MSG( (!detail::indexable_not_found_error< - typename traits::indexable_type::type + typename index::detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Indexable) @@ -128,7 +128,7 @@ struct def< boost::tuple > BOOST_MPL_ASSERT_MSG( (!detail::indexable_not_found_error< - typename traits::indexable_type::type + typename index::detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Indexable) diff --git a/include/boost/geometry/extensions/index/translator/helpers.hpp b/include/boost/geometry/extensions/index/translator/helpers.hpp index 6f0ce2cfb..c439d0405 100644 --- a/include/boost/geometry/extensions/index/translator/helpers.hpp +++ b/include/boost/geometry/extensions/index/translator/helpers.hpp @@ -21,7 +21,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { namespace translator { @@ -88,8 +88,8 @@ struct extract_indexable< std::pair > { typedef typename dispatch::choose_pair_element< std::pair, - typename traits::indexable_type::type, - typename traits::indexable_type::type + typename index::detail::traits::indexable_type::type, + typename index::detail::traits::indexable_type::type > cp; typedef typename cp::type type; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index bc341c315..bff86d529 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -477,7 +477,7 @@ generate_value_outside() typedef typename Rtree::value_type V; typedef typename Rtree::indexable_type I; - return generate_value_outside_impl::value>::apply(); + return generate_value_outside_impl::value>::apply(); } template @@ -489,7 +489,7 @@ void generate_rtree(bgi::rtree & tree, std::vector & input, typedef typename T::indexable_type I; generate_input< - bgi::traits::dimension::value + bgi::detail::traits::dimension::value >::apply(input, qbox); tree.insert(input.begin(), input.end()); @@ -670,7 +670,7 @@ template void test_overlaps(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { test_overlap_impl< - typename bgi::traits::tag< + typename bgi::detail::traits::tag< typename bgi::rtree::indexable_type >::type >::apply(tree, input, qbox); @@ -1171,7 +1171,7 @@ void test_rtree_by_value(Parameters const& parameters) //test_touches(tree, input, qbox); test_within(tree, input, qbox); - typedef typename bgi::traits::point_type::type P; + typedef typename bgi::detail::traits::point_type::type P; P pt; bg::centroid(qbox, pt); From be5a04924836b3f546560e5a8f7925ec14bbcaa8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 18 Jan 2013 21:23:25 +0000 Subject: [PATCH 295/366] added test for rtree envelope, area, perimeter, centroid [SVN r82539] --- test/rtree/test_rtree.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index bff86d529..85443ebea 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1295,10 +1295,10 @@ void test_rtree_box(Parameters const& parameters) BOOST_CHECK(bg::equals(t.box(), b)); - //BOOST_CHECK(bg::equals(bg::return_envelope(t), b)); - //BOOST_CHECK(bg::area(t) == bg::area(b)); - //BOOST_CHECK(bg::perimeter(t) == bg::perimeter(b)); - //BOOST_CHECK(bg::equals(bg::return_centroid

                                                                                                            (t), bg::return_centroid

                                                                                                            (b))); + BOOST_CHECK(bg::equals(bg::return_envelope(t), b)); + BOOST_CHECK(bg::area(t) == bg::area(b)); + BOOST_CHECK(bg::perimeter(t) == bg::perimeter(b)); + BOOST_CHECK(bg::equals(bg::return_centroid

                                                                                                            (t), bg::return_centroid

                                                                                                            (b))); size_t s = input.size(); while ( s/2 < input.size() && !input.empty() ) From 017e910bbeca77e1124cadf6c7aa5aca29c9f3cb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 18 Jan 2013 21:50:28 +0000 Subject: [PATCH 296/366] area and perimeter tested only for 2d [SVN r82540] --- test/rtree/test_rtree.hpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 85443ebea..91e18b77e 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1272,6 +1272,24 @@ void test_rtree_count(Parameters const& parameters) // test rtree box +template +struct test_geometry_algorithms +{ + template + static void apply(Rtree const& , Box const& ) {} +}; + +template <> +struct test_geometry_algorithms<2> +{ + template + static void apply(Rtree const& t, Box const& b) + { + BOOST_CHECK(bg::area(t) == bg::area(b)); + BOOST_CHECK(bg::perimeter(t) == bg::perimeter(b)); + } +}; + template void test_rtree_box(Parameters const& parameters) { @@ -1296,9 +1314,8 @@ void test_rtree_box(Parameters const& parameters) BOOST_CHECK(bg::equals(t.box(), b)); BOOST_CHECK(bg::equals(bg::return_envelope(t), b)); - BOOST_CHECK(bg::area(t) == bg::area(b)); - BOOST_CHECK(bg::perimeter(t) == bg::perimeter(b)); BOOST_CHECK(bg::equals(bg::return_centroid

                                                                                                            (t), bg::return_centroid

                                                                                                            (b))); + test_geometry_algorithms::value>::apply(t, b); size_t s = input.size(); while ( s/2 < input.size() && !input.empty() ) From 55774f5041210a4474cad5422a0818a1358a697f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 19 Jan 2013 00:23:48 +0000 Subject: [PATCH 297/366] MSVC compilation error fixed. is_valid moved to detail namespace. [SVN r82544] --- .../{ => detail}/algorithms/is_valid.hpp | 12 ++++-------- .../index/detail/distance_predicates.hpp | 4 ++-- .../extensions/index/detail/tuples.hpp | 19 +++---------------- .../boost/geometry/extensions/index/rtree.hpp | 4 ++-- .../extensions/index/translator/def.hpp | 6 +++--- 5 files changed, 14 insertions(+), 31 deletions(-) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/is_valid.hpp (88%) diff --git a/include/boost/geometry/extensions/index/algorithms/is_valid.hpp b/include/boost/geometry/extensions/index/detail/algorithms/is_valid.hpp similarity index 88% rename from include/boost/geometry/extensions/index/algorithms/is_valid.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/is_valid.hpp index 42c55282c..63efed886 100644 --- a/include/boost/geometry/extensions/index/algorithms/is_valid.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/is_valid.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { -namespace detail { +namespace dispatch { template struct is_valid_box @@ -39,10 +39,6 @@ struct is_valid_box } }; -} // namespace detail - -namespace dispatch { - template struct is_valid { @@ -66,7 +62,7 @@ struct is_valid { static inline bool apply(Indexable const& b) { - return detail::is_valid_box::value>::apply(b); + return dispatch::is_valid_box::value>::apply(b); } }; @@ -78,6 +74,6 @@ inline bool is_valid(Indexable const& b) return dispatch::is_valid::type>::apply(b); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP diff --git a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp index 6b0aa5989..9cd7255f6 100644 --- a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp @@ -293,7 +293,7 @@ struct cdist_value< static inline type & get(cdist & cd) { BOOST_MPL_ASSERT_MSG( - (tuples::equal< cdist, cdist >::value), + (boost::is_same< cdist, cdist >::value), TAGS_DO_NOT_MATCH, (cdist_value)); @@ -304,7 +304,7 @@ struct cdist_value< static inline type const& get(cdist const& cd) { BOOST_MPL_ASSERT_MSG( - (tuples::equal< cdist, cdist >::value), + (boost::is_same< cdist, cdist >::value), TAGS_DO_NOT_MATCH, (cdist_value)); diff --git a/include/boost/geometry/extensions/index/detail/tuples.hpp b/include/boost/geometry/extensions/index/detail/tuples.hpp index 2784a495d..31e6bfec4 100644 --- a/include/boost/geometry/extensions/index/detail/tuples.hpp +++ b/include/boost/geometry/extensions/index/detail/tuples.hpp @@ -10,6 +10,7 @@ #define BOOST_GEOMETRY_EXTENSIONS_INDEX_TUPLES_HPP #include +#include // TODO move this to index/tuples and separate algorithms @@ -76,20 +77,6 @@ struct find_index >::value; }; -// types_equal - -template -struct equal -{ - static const bool value = false; -}; - -template -struct equal -{ - static const bool value = true; -}; - // has namespace detail { @@ -98,7 +85,7 @@ template struct has { static const bool value - = equal< + = boost::is_same< typename boost::tuples::element::type, El >::value @@ -109,7 +96,7 @@ template struct has { static const bool value - = equal< + = boost::is_same< typename boost::tuples::element<0, Tuple>::type, El >::value; diff --git a/include/boost/geometry/extensions/index/rtree.hpp b/include/boost/geometry/extensions/index/rtree.hpp index 014dbf8ff..977a06d8d 100644 --- a/include/boost/geometry/extensions/index/rtree.hpp +++ b/include/boost/geometry/extensions/index/rtree.hpp @@ -31,7 +31,7 @@ #include -#include +#include #include #include @@ -1055,7 +1055,7 @@ private: inline void raw_insert(value_type const& value) { BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); - BOOST_GEOMETRY_INDEX_ASSERT(index::is_valid(m_translator(value)), "Indexable is invalid"); + BOOST_GEOMETRY_INDEX_ASSERT(detail::is_valid(m_translator(value)), "Indexable is invalid"); geometry::expand(m_box, m_translator(value)); diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/extensions/index/translator/def.hpp index f78f71774..87f238312 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/extensions/index/translator/def.hpp @@ -28,7 +28,7 @@ struct def { BOOST_MPL_ASSERT_MSG( (!detail::indexable_not_found_error< - typename index::detail::traits::indexable_type::type + typename geometry::index::detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Value) @@ -60,7 +60,7 @@ struct def< std::pair > { BOOST_MPL_ASSERT_MSG( (!detail::indexable_not_found_error< - typename index::detail::traits::indexable_type::type + typename geometry::index::detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Indexable) @@ -128,7 +128,7 @@ struct def< boost::tuple > BOOST_MPL_ASSERT_MSG( (!detail::indexable_not_found_error< - typename index::detail::traits::indexable_type::type + typename geometry::index::detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Indexable) From 4233d851c469694d9994e100d2abecd28db03b62 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 19 Jan 2013 01:15:55 +0000 Subject: [PATCH 298/366] index/algorithms/* moved to index/detail/algorithms/* [SVN r82545] --- .../comparable_distance_centroid.hpp | 18 +++----- .../algorithms/comparable_distance_far.hpp | 18 +++----- .../algorithms/comparable_distance_near.hpp | 16 +++---- .../index/{ => detail}/algorithms/content.hpp | 28 ++++++------ .../detail => detail/algorithms}/diff_abs.hpp | 8 +--- .../algorithms/intersection_content.hpp | 14 +++--- .../index/{ => detail}/algorithms/margin.hpp | 14 +++--- .../{ => detail}/algorithms/minmaxdist.hpp | 20 ++++----- .../algorithms}/smallest_for_indexable.hpp | 8 +--- .../algorithms}/sum_for_indexable.hpp | 8 +--- .../{ => detail}/algorithms/union_content.hpp | 14 +++--- .../index/detail/distance_predicates.hpp | 12 ++--- .../rtree/linear/redistribute_elements.hpp | 25 +++++------ .../extensions/index/detail/rtree/options.hpp | 24 +++++----- .../rtree/quadratic/redistribute_elements.hpp | 30 ++++++------- .../detail/rtree/rstar/choose_next_node.hpp | 36 +++++++-------- .../index/detail/rtree/rstar/insert.hpp | 12 ++--- .../rtree/rstar/redistribute_elements.hpp | 44 +++++++++---------- .../index/detail/rtree/visitors/insert.hpp | 18 ++++---- test/rtree/test_rtree.hpp | 10 ++--- 20 files changed, 161 insertions(+), 216 deletions(-) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/comparable_distance_centroid.hpp (81%) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/comparable_distance_far.hpp (79%) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/comparable_distance_near.hpp (83%) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/content.hpp (65%) rename include/boost/geometry/extensions/index/{algorithms/detail => detail/algorithms}/diff_abs.hpp (81%) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/intersection_content.hpp (59%) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/margin.hpp (89%) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/minmaxdist.hpp (87%) rename include/boost/geometry/extensions/index/{algorithms/detail => detail/algorithms}/smallest_for_indexable.hpp (94%) rename include/boost/geometry/extensions/index/{algorithms/detail => detail/algorithms}/sum_for_indexable.hpp (93%) rename include/boost/geometry/extensions/index/{ => detail}/algorithms/union_content.hpp (59%) diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp b/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_centroid.hpp similarity index 81% rename from include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_centroid.hpp index 983452848..06283ea36 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_centroid.hpp @@ -8,15 +8,13 @@ // 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_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP -#include -#include +#include +#include -namespace boost { namespace geometry { namespace index { - -namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { struct comparable_distance_centroid_tag {}; @@ -60,8 +58,6 @@ struct sum_for_indexable_dimension typename geometry::default_distance_result::type comparable_distance_centroid(Point const& pt, Indexable const& i) @@ -75,7 +71,7 @@ comparable_distance_centroid(Point const& pt, Indexable const& i) >::apply(pt, i); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#endif // #define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp b/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_far.hpp similarity index 79% rename from include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_far.hpp index dbedd9cd0..a945ac014 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_far.hpp @@ -8,15 +8,13 @@ // 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_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP -#include -#include +#include +#include -namespace boost { namespace geometry { namespace index { - -namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { // minmaxdist component @@ -50,8 +48,6 @@ struct sum_for_indexable_dimension typename geometry::default_distance_result::type comparable_distance_far(Point const& pt, Indexable const& i) @@ -65,6 +61,6 @@ comparable_distance_far(Point const& pt, Indexable const& i) >::apply(pt, i); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp b/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_near.hpp similarity index 83% rename from include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_near.hpp index 6ed71bcb5..71ccc1678 100644 --- a/include/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_near.hpp @@ -8,14 +8,12 @@ // 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_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP -#include +#include -namespace boost { namespace geometry { namespace index { - -namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { struct comparable_distance_near_tag {}; @@ -61,8 +59,6 @@ struct sum_for_indexable_dimension typename geometry::default_distance_result::type comparable_distance_near(Point const& pt, Indexable const& i) @@ -76,6 +72,6 @@ comparable_distance_near(Point const& pt, Indexable const& i) >::apply(pt, i); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/content.hpp b/include/boost/geometry/extensions/index/detail/algorithms/content.hpp similarity index 65% rename from include/boost/geometry/extensions/index/algorithms/content.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/content.hpp index bec29b3f9..766b1d6a2 100644 --- a/include/boost/geometry/extensions/index/algorithms/content.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/content.hpp @@ -8,10 +8,10 @@ // 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_ALGORITHMS_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { template struct default_content_result @@ -22,7 +22,7 @@ struct default_content_result >::type type; }; -namespace detail { +namespace dispatch { template struct content_for_each_dimension @@ -30,7 +30,7 @@ struct content_for_each_dimension BOOST_STATIC_ASSERT(0 < CurrentDimension); BOOST_STATIC_ASSERT(CurrentDimension <= traits::dimension::value); - static inline typename default_content_result::type apply(Box const& b) + static inline typename detail::default_content_result::type apply(Box const& b) { return content_for_each_dimension::apply(b) * ( detail::get(b) - detail::get(b) ); @@ -40,16 +40,12 @@ struct content_for_each_dimension template struct content_for_each_dimension { - static inline typename default_area_result::type apply(Box const& b) + static inline typename detail::default_content_result::type apply(Box const& b) { return detail::get(b) - detail::get(b); } }; -} // namespace detail - -namespace dispatch { - template struct content { @@ -59,7 +55,7 @@ struct content template struct content { - static typename default_content_result::type apply(Indexable const&) + static typename detail::default_content_result::type apply(Indexable const&) { return 0; } @@ -70,7 +66,7 @@ struct content { static typename default_content_result::type apply(Indexable const& b) { - return detail::content_for_each_dimension::value>::apply(b); + return dispatch::content_for_each_dimension::value>::apply(b); } }; @@ -79,9 +75,11 @@ struct content template typename default_content_result::type content(Indexable const& b) { - return dispatch::content::type>::apply(b); + return dispatch::content::type + >::apply(b); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_CONTENT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp b/include/boost/geometry/extensions/index/detail/algorithms/diff_abs.hpp similarity index 81% rename from include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/diff_abs.hpp index 0490976a7..8beed4d0f 100644 --- a/include/boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/diff_abs.hpp @@ -11,9 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP -namespace boost { namespace geometry { namespace index { - -namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { template inline T diff_abs(T const& v1, T const& v2) @@ -21,8 +19,6 @@ inline T diff_abs(T const& v1, T const& v2) return v1 < v2 ? v2 - v1 : v1 - v2; } -} // namespace detail - -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp b/include/boost/geometry/extensions/index/detail/algorithms/intersection_content.hpp similarity index 59% rename from include/boost/geometry/extensions/index/algorithms/intersection_content.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/intersection_content.hpp index 60762473e..876e1ce25 100644 --- a/include/boost/geometry/extensions/index/algorithms/intersection_content.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/intersection_content.hpp @@ -8,13 +8,13 @@ // 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_ALGORITHMS_INTERSECTION_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP #include -#include +#include -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { /** * \brief Compute the area of the intersection of b1 and b2 @@ -26,11 +26,11 @@ inline typename default_content_result::type intersection_content(Box const { Box box_intersection; geometry::intersection(box1, box2, box_intersection); - return index::content(box_intersection); + return detail::content(box_intersection); } return 0; } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_INTERSECTION_CONTENT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/margin.hpp b/include/boost/geometry/extensions/index/detail/algorithms/margin.hpp similarity index 89% rename from include/boost/geometry/extensions/index/algorithms/margin.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/margin.hpp index 45d33817f..6a91c1ed6 100644 --- a/include/boost/geometry/extensions/index/algorithms/margin.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/margin.hpp @@ -8,10 +8,10 @@ // 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_ALGORITHMS_MARGIN_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { template struct default_margin_result @@ -22,8 +22,6 @@ struct default_margin_result >::type type; }; -namespace detail { - template struct margin_for_each_edge { @@ -90,14 +88,12 @@ struct margin_for_each_dimension } }; -} // namespace detail - template typename default_margin_result::type margin(Box const& b) { return 2 * detail::margin_for_each_dimension::value>::apply(b); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MARGIN_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp b/include/boost/geometry/extensions/index/detail/algorithms/minmaxdist.hpp similarity index 87% rename from include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/minmaxdist.hpp index fd2b43c13..28e7e9715 100644 --- a/include/boost/geometry/extensions/index/algorithms/minmaxdist.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/minmaxdist.hpp @@ -8,19 +8,17 @@ // 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_ALGORITHMS_MINMAXDIST_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP #include #include -#include -#include -#include +#include +#include +#include -namespace boost { namespace geometry { namespace index { - -namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { struct minmaxdist_tag {}; @@ -102,8 +100,6 @@ struct minmaxdist_impl } }; -} // namespace detail - /** * This is comparable distace. */ @@ -118,6 +114,6 @@ minmaxdist(Point const& pt, Indexable const& i) >::apply(pt, i); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINMAXDIST_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp b/include/boost/geometry/extensions/index/detail/algorithms/smallest_for_indexable.hpp similarity index 94% rename from include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/smallest_for_indexable.hpp index 1181f6193..0e864934d 100644 --- a/include/boost/geometry/extensions/index/algorithms/detail/smallest_for_indexable.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/smallest_for_indexable.hpp @@ -11,9 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP -namespace boost { namespace geometry { namespace index { - -namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { template < typename Geometry, @@ -77,8 +75,6 @@ struct smallest_for_indexable } }; -} // namespace detail - -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp b/include/boost/geometry/extensions/index/detail/algorithms/sum_for_indexable.hpp similarity index 93% rename from include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/sum_for_indexable.hpp index 44c64fd64..014b871ca 100644 --- a/include/boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/sum_for_indexable.hpp @@ -11,9 +11,7 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP -namespace boost { namespace geometry { namespace index { - -namespace detail { +namespace boost { namespace geometry { namespace index { namespace detail { template < typename Geometry, @@ -73,8 +71,6 @@ struct sum_for_indexable } }; -} // namespace detail - -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/algorithms/union_content.hpp b/include/boost/geometry/extensions/index/detail/algorithms/union_content.hpp similarity index 59% rename from include/boost/geometry/extensions/index/algorithms/union_content.hpp rename to include/boost/geometry/extensions/index/detail/algorithms/union_content.hpp index 30070d4b0..93b770704 100644 --- a/include/boost/geometry/extensions/index/algorithms/union_content.hpp +++ b/include/boost/geometry/extensions/index/detail/algorithms/union_content.hpp @@ -9,13 +9,13 @@ // 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_ALGORITHMS_UNION_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP +#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP +#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP #include -#include +#include -namespace boost { namespace geometry { namespace index { +namespace boost { namespace geometry { namespace index { namespace detail { /** * \brief Compute the area of the union of b1 and b2 @@ -25,9 +25,9 @@ inline typename default_content_result::type union_content(Box const& b, Ge { Box expanded_box(b); geometry::expand(expanded_box, g); - return index::content(expanded_box); + return detail::content(expanded_box); } -}}} // namespace boost::geometry::index +}}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_UNION_CONTENT_HPP +#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp index 9cd7255f6..d293183df 100644 --- a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/extensions/index/detail/distance_predicates.hpp @@ -12,9 +12,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP -#include -#include -#include +#include +#include +#include #include @@ -332,7 +332,7 @@ struct distances_calc_impl_rel< typename geometry::default_distance_result::type static inline apply(Point const& p, Indexable const& i) { - return index::comparable_distance_near(p, i); + return index::detail::comparable_distance_near(p, i); } }; @@ -345,7 +345,7 @@ struct distances_calc_impl_rel< typename geometry::default_distance_result::type static inline apply(Point const& p, Indexable const& i) { - return index::comparable_distance_centroid(p, i); + return index::detail::comparable_distance_centroid(p, i); } }; @@ -358,7 +358,7 @@ struct distances_calc_impl_rel< typename geometry::default_distance_result::type static inline apply(Point const& p, Indexable const& i) { - return index::comparable_distance_far(p, i); + return index::detail::comparable_distance_far(p, i); } }; diff --git a/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp index 1fd7f3255..a3f5fb8ba 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp @@ -14,8 +14,7 @@ #include -#include -#include +#include #include #include @@ -23,9 +22,7 @@ namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace visitors { - -namespace detail { +namespace detail { namespace rtree { namespace linear { @@ -215,7 +212,7 @@ struct redistribute_elements::type indexable_type; typedef typename index::detail::traits::coordinate_type::type coordinate_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_content_result::type content_type; elements_type & elements1 = rtree::elements(n); elements_type & elements2 = rtree::elements(second_node); @@ -250,8 +247,8 @@ struct redistribute_elements -struct options_type< linear > +struct options_type< index::linear > { typedef options< - linear, + index::linear, insert_default_tag, choose_by_content_diff_tag, split_default_tag, @@ -71,10 +71,10 @@ struct options_type< linear > }; template -struct options_type< quadratic > +struct options_type< index::quadratic > { typedef options< - quadratic, + index::quadratic, insert_default_tag, choose_by_content_diff_tag, split_default_tag, @@ -84,10 +84,10 @@ struct options_type< quadratic > }; template -struct options_type< rstar > +struct options_type< index::rstar > { typedef options< - rstar, + index::rstar, insert_reinsert_tag, choose_by_overlap_diff_tag, split_default_tag, @@ -110,10 +110,10 @@ struct options_type< rstar -struct options_type< runtime::linear > +struct options_type< index::runtime::linear > { typedef options< - runtime::linear, + index::runtime::linear, insert_default_tag, choose_by_content_diff_tag, split_default_tag, @@ -123,10 +123,10 @@ struct options_type< runtime::linear > }; template <> -struct options_type< runtime::quadratic > +struct options_type< index::runtime::quadratic > { typedef options< - runtime::quadratic, + index::runtime::quadratic, insert_default_tag, choose_by_content_diff_tag, split_default_tag, @@ -136,10 +136,10 @@ struct options_type< runtime::quadratic > }; template <> -struct options_type< runtime::rstar > +struct options_type< index::runtime::rstar > { typedef options< - runtime::rstar, + index::runtime::rstar, insert_reinsert_tag, choose_by_overlap_diff_tag, split_default_tag, diff --git a/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp index 1ea480313..7d13f278e 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp @@ -13,8 +13,8 @@ #include -#include -#include +#include +#include #include #include @@ -22,9 +22,7 @@ namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace visitors { - -namespace detail { +namespace detail { namespace rtree { namespace quadratic { @@ -35,7 +33,7 @@ struct pick_seeds typedef typename rtree::element_indexable_type::type indexable_type; typedef typename index::detail::traits::coordinate_type::type coordinate_type; typedef Box box_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_content_result::type content_type; static inline void apply(Elements const& elements, Parameters const& parameters, @@ -62,7 +60,7 @@ struct pick_seeds geometry::convert(ind1, enlarged_box); geometry::expand(enlarged_box, ind2); - content_type free_content = (index::content(enlarged_box) - index::content(ind1)) - index::content(ind2); + content_type free_content = (index::detail::content(enlarged_box) - index::detail::content(ind1)) - index::detail::content(ind2); if ( greatest_free_content < free_content ) { @@ -86,7 +84,7 @@ struct redistribute_elements::type internal_node; typedef typename rtree::leaf::type leaf; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_content_result::type content_type; template static inline void apply(Node & n, @@ -153,8 +151,8 @@ struct redistribute_elements -#include -#include -#include +#include +#include +#include #include #include namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace visitors { - -namespace detail { +namespace detail { namespace rtree { template class choose_next_node @@ -40,7 +38,7 @@ class choose_next_node::type content_type; + typedef typename index::detail::default_content_result::type content_type; public: template @@ -88,8 +86,8 @@ private: geometry::expand(box_exp, indexable); // calculate content and content diff - content_type content = index::content(ch_i.first); - content_type content_diff = index::content(box_exp) - content; + content_type content = index::detail::content(ch_i.first); + content_type content_diff = index::detail::content(box_exp) - content; content_type overlap = 0; content_type overlap_exp = 0; @@ -101,8 +99,8 @@ private: { child_type const& ch_j = children[j]; - overlap += index::intersection_content(ch_i.first, ch_j.first); - overlap_exp += index::intersection_content(box_exp, ch_j.first); + overlap += index::detail::intersection_content(ch_i.first, ch_j.first); + overlap_exp += index::detail::intersection_content(box_exp, ch_j.first); } } @@ -141,8 +139,8 @@ private: geometry::expand(box_exp, indexable); // areas difference - content_type content = index::content(box_exp); - content_type content_diff = content - index::content(ch_i.first); + content_type content = index::detail::content(box_exp); + content_type content_diff = content - index::detail::content(ch_i.first); sorted_children[i] = boost::make_tuple(i, content_diff, content); } @@ -178,8 +176,8 @@ private: { child_type const& ch_j = children[j]; - overlap += index::intersection_content(ch_i.first, ch_j.first); - overlap_exp += index::intersection_content(box_exp, ch_j.first); + overlap += index::detail::intersection_content(ch_i.first, ch_j.first); + overlap_exp += index::detail::intersection_content(box_exp, ch_j.first); } } @@ -222,8 +220,8 @@ private: geometry::expand(box_exp, indexable); // areas difference - content_type content = index::content(box_exp); - content_type content_diff = content - index::content(ch_i.first); + content_type content = index::detail::content(box_exp); + content_type content_diff = content - index::detail::content(ch_i.first); // update the result if ( content_diff < smallest_content_diff || @@ -239,9 +237,7 @@ private: } }; -} // namespace detail - -}}} // namespace detail::rtree::visitors +}} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp index 20be0c224..5de0738f3 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp @@ -11,14 +11,12 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { -namespace detail { - namespace rstar { template @@ -417,8 +415,6 @@ struct level_insert<0, Value, Value, Options, Translator, Box, Allocators> } // namespace rstar -} // namespace detail - // R*-tree insert visitor // After passing the Element to insert visitor the Element is managed by the tree // I.e. one should not delete the node passed to the insert visitor after exception is thrown @@ -451,7 +447,7 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( + rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc) @@ -466,7 +462,7 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); - detail::rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( + rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); rtree::apply_visitor(lins_v, *m_root); // MAY THROW (V, E: alloc, copy, N: alloc) @@ -485,7 +481,7 @@ private: typename Elements::reverse_iterator it = elements.rbegin(); for ( ; it != elements.rend() ; ++it) { - detail::rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( + rstar::level_insert<1, element_type, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, *it, m_parameters, m_translator, m_allocators, relative_level); try diff --git a/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp index 0ad80cf6d..6958cd604 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp @@ -13,9 +13,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include @@ -23,9 +23,7 @@ namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace visitors { - -namespace detail { +namespace detail { namespace rtree { namespace rstar { @@ -51,8 +49,8 @@ private: template struct choose_split_axis_and_index_for_corner { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_margin_result::type margin_type; + typedef typename index::detail::default_content_result::type content_type; template static inline void apply(Elements const& elements, @@ -90,10 +88,10 @@ struct choose_split_axis_and_index_for_corner Box box1 = rtree::elements_box(elements_copy.begin(), elements_copy.begin() + i, translator); Box box2 = rtree::elements_box(elements_copy.begin() + i, elements_copy.end(), translator); - sum_of_margins += index::margin(box1) + index::margin(box2); + sum_of_margins += index::detail::margin(box1) + index::detail::margin(box2); - content_type ovl = index::intersection_content(box1, box2); - content_type con = index::content(box1) + index::content(box2); + content_type ovl = index::detail::intersection_content(box1, box2); + content_type con = index::detail::content(box1) + index::detail::content(box2); if ( ovl < smallest_overlap || (ovl == smallest_overlap && con <= smallest_content) ) { @@ -114,8 +112,8 @@ struct choose_split_axis_and_index_for_axis template struct choose_split_axis_and_index_for_axis { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_margin_result::type margin_type; + typedef typename index::detail::default_content_result::type content_type; template static inline void apply(Elements const& elements, @@ -169,8 +167,8 @@ struct choose_split_axis_and_index_for_axis template struct choose_split_axis_and_index_for_axis { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_margin_result::type margin_type; + typedef typename index::detail::default_content_result::type content_type; template static inline void apply(Elements const& elements, @@ -196,8 +194,8 @@ struct choose_split_axis_and_index { BOOST_STATIC_ASSERT(0 < Dimension); - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_margin_result::type margin_type; + typedef typename index::detail::default_content_result::type content_type; template static inline void apply(Elements const& elements, @@ -247,8 +245,8 @@ struct choose_split_axis_and_index template struct choose_split_axis_and_index { - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_margin_result::type margin_type; + typedef typename index::detail::default_content_result::type content_type; template static inline void apply(Elements const& elements, @@ -327,8 +325,8 @@ struct redistribute_elements::value; - typedef typename index::default_margin_result::type margin_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_margin_result::type margin_type; + typedef typename index::detail::default_content_result::type content_type; template static inline void apply( @@ -403,9 +401,7 @@ struct redistribute_elements +#include #include namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace visitors { - -namespace detail { +namespace detail { namespace rtree { // Default choose_next_node template @@ -37,7 +35,7 @@ public: typedef typename rtree::elements_type::type children_type; - typedef typename index::default_content_result::type content_type; + typedef typename index::detail::default_content_result::type content_type; template static inline size_t apply(internal_node & n, @@ -67,8 +65,8 @@ public: geometry::expand(box_exp, indexable); // areas difference - content_type content = index::content(box_exp); - content_type content_diff = content - index::content(ch_i.first); + content_type content = index::detail::content(box_exp); + content_type content_diff = content - index::detail::content(ch_i.first); // update the result if ( content_diff < smallest_content_diff || @@ -177,6 +175,8 @@ public: // ----------------------------------------------------------------------- // +namespace visitors { namespace detail { + template struct insert_traverse_data { @@ -260,7 +260,7 @@ protected: inline void traverse(Visitor & visitor, internal_node & n) { // choose next node - size_t choosen_node_index = detail::choose_next_node:: + size_t choosen_node_index = rtree::choose_next_node:: apply(n, rtree::element_indexable(m_element, m_translator), m_parameters, m_leafs_level - m_traverse_data.current_level); // expand the node to contain value @@ -309,7 +309,7 @@ protected: template inline void split(Node & n) const { - typedef detail::split split_algo; + typedef rtree::split split_algo; typename split_algo::nodes_container_type additional_nodes; Box n_box; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 91e18b77e..668ab3e03 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -746,7 +746,7 @@ void test_nearest_query(Rtree const& rtree, std::vector const& input, Poi Value expected_output(generate_value_default::apply()); BOOST_FOREACH(Value const& v, input) { - D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::detail::comparable_distance_near(pt, rtree.translator()(v)); if ( d < smallest_d ) { smallest_d = d; @@ -766,8 +766,8 @@ void test_nearest_query(Rtree const& rtree, std::vector const& input, Poi if ( !rtree.translator().equals(output, expected_output) ) { - D d1 = bgi::comparable_distance_near(pt, rtree.translator()(output)); - D d2 = bgi::comparable_distance_near(pt, rtree.translator()(expected_output)); + D d1 = bgi::detail::comparable_distance_near(pt, rtree.translator()(output)); + D d2 = bgi::detail::comparable_distance_near(pt, rtree.translator()(expected_output)); BOOST_CHECK(d1 == d2); } } @@ -810,7 +810,7 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P // calculate test output - k closest values pairs BOOST_FOREACH(Value const& v, input) { - D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::detail::comparable_distance_near(pt, rtree.translator()(v)); if ( test_output.size() < k ) test_output.push_back(std::make_pair(d, v)); @@ -848,7 +848,7 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P if ( test_find(rtree, expected_output.begin(), expected_output.end(), v) == expected_output.end() ) { - D d = bgi::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::detail::comparable_distance_near(pt, rtree.translator()(v)); BOOST_CHECK(d == biggest_d); } } From 26e9526564291279b390fc1d3106657dc047e48d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 19 Jan 2013 02:26:34 +0000 Subject: [PATCH 299/366] boost/geometry/extensions/index/* moved to boost/geometry/index/* rtree::box() renamed to rtree::envelope() index::box() renamed to index::envelope() some unneeded tests removed docs updated [SVN r82546] --- doc/Doxyfile | 7 +- doc/generated/rtree.qbk | 104 +- doc/generated/rtree_functions.qbk | 10 +- doc/generated/rtree_linear.qbk | 2 +- doc/generated/rtree_quadratic.qbk | 2 +- doc/generated/rtree_rstar.qbk | 2 +- doc/generated/rtree_runtime_linear.qbk | 2 +- doc/generated/rtree_runtime_quadratic.qbk | 2 +- doc/generated/rtree_runtime_rstar.qbk | 2 +- doc/generated/translator_def.qbk | 2 +- doc/generated/translator_index.qbk | 5 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 26 +- .../r_tree/nearest_neighbours_queries.html | 2 +- doc/html/geometry_index/r_tree/reference.html | 971 +++++++++++------- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 2 +- doc/html/index.html | 4 +- .../index/detail/rtree/kmeans/kmeans.hpp | 16 - .../index/detail/rtree/linear/linear.hpp | 16 - .../detail/rtree/quadratic/quadratic.hpp | 16 - .../index/detail/rtree/rstar/rstar.hpp | 18 - .../index/adaptors/nearest_query.hpp | 8 +- .../index/adaptors/spatial_query.hpp | 8 +- .../comparable_distance_centroid.hpp | 12 +- .../algorithms/comparable_distance_far.hpp | 12 +- .../algorithms/comparable_distance_near.hpp | 10 +- .../index/detail/algorithms/content.hpp | 8 +- .../index/detail/algorithms/diff_abs.hpp | 8 +- .../algorithms/intersection_content.hpp | 10 +- .../index/detail/algorithms/is_valid.hpp | 8 +- .../index/detail/algorithms/margin.hpp | 8 +- .../index/detail/algorithms/minmaxdist.hpp | 14 +- .../algorithms/smallest_for_indexable.hpp | 8 +- .../detail/algorithms/sum_for_indexable.hpp | 8 +- .../index/detail/algorithms/union_content.hpp | 10 +- .../{extensions => }/index/detail/assert.hpp | 8 +- .../index/detail/distance_predicates.hpp | 18 +- .../index/detail/indexable.hpp | 8 +- .../index/detail/nonassignable.hpp | 8 +- .../index/detail/predicates.hpp | 12 +- .../index/detail/pushable_array.hpp | 10 +- .../index/detail/rtree/adaptors.hpp | 12 +- .../index/detail/rtree/kmeans/kmeans.hpp | 16 + .../index/detail/rtree/kmeans/split.hpp | 20 +- .../index/detail/rtree/linear/linear.hpp | 16 + .../rtree/linear/redistribute_elements.hpp | 16 +- .../index/detail/rtree/node/concept.hpp | 8 +- .../detail/rtree/node/dynamic_visitor.hpp | 8 +- .../index/detail/rtree/node/node.hpp | 22 +- .../index/detail/rtree/node/node_auto_ptr.hpp | 10 +- .../detail/rtree/node/node_d_mem_dynamic.hpp | 10 +- .../detail/rtree/node/node_d_mem_static.hpp | 12 +- .../detail/rtree/node/node_s_mem_dynamic.hpp | 10 +- .../detail/rtree/node/node_s_mem_static.hpp | 12 +- .../detail/rtree/node/static_visitor.hpp | 8 +- .../index/detail/rtree/options.hpp | 10 +- .../detail/rtree/quadratic/quadratic.hpp | 16 + .../rtree/quadratic/redistribute_elements.hpp | 18 +- .../detail/rtree/rstar/choose_next_node.hpp | 18 +- .../index/detail/rtree/rstar/insert.hpp | 10 +- .../rtree/rstar/redistribute_elements.hpp | 22 +- .../index/detail/rtree/rstar/rstar.hpp | 18 + .../detail/rtree/visitors/are_boxes_ok.hpp | 14 +- .../detail/rtree/visitors/are_levels_ok.hpp | 14 +- .../detail/rtree/visitors/children_box.hpp | 10 +- .../index/detail/rtree/visitors/copy.hpp | 10 +- .../index/detail/rtree/visitors/count.hpp | 10 +- .../index/detail/rtree/visitors/destroy.hpp | 10 +- .../index/detail/rtree/visitors/gl_draw.hpp | 32 +- .../index/detail/rtree/visitors/insert.hpp | 12 +- .../index/detail/rtree/visitors/is_leaf.hpp | 10 +- .../detail/rtree/visitors/nearest_query.hpp | 14 +- .../index/detail/rtree/visitors/print.hpp | 12 +- .../index/detail/rtree/visitors/remove.hpp | 12 +- .../detail/rtree/visitors/spatial_query.hpp | 12 +- .../index/detail/static_vector.hpp | 10 +- .../{extensions => }/index/detail/tags.hpp | 8 +- .../{extensions => }/index/detail/tuples.hpp | 8 +- .../index/distance_predicates.hpp | 10 +- .../{extensions => }/index/inserter.hpp | 8 +- .../{extensions => }/index/parameters.hpp | 8 +- .../{extensions => }/index/predicates.hpp | 10 +- .../geometry/{extensions => }/index/rtree.hpp | 73 +- .../{extensions => }/index/translator/def.hpp | 10 +- .../index/translator/helpers.hpp | 10 +- .../index/translator/index.hpp | 10 +- .../index/translator/translator.hpp | 12 +- test/Jamfile.v2 | 2 +- test/algorithms/Jamfile.v2 | 2 +- test/algorithms/content.cpp | 6 +- test/algorithms/intersection_content.cpp | 6 +- test/algorithms/is_valid.cpp | 10 +- test/algorithms/margin.cpp | 6 +- test/algorithms/minmaxdist.cpp | 8 +- test/algorithms/test_content.hpp | 16 +- test/algorithms/test_intersection_content.hpp | 16 +- test/algorithms/test_margin.hpp | 16 +- test/algorithms/test_union_content.hpp | 16 +- test/algorithms/union_content.cpp | 6 +- test/geometry_index_test_common.hpp | 4 +- test/rtree/Jamfile.v2 | 2 +- test/rtree/rtree_exceptions.cpp | 2 +- test/rtree/test_rtree.hpp | 36 +- test/rtree/test_rtree_exceptions.hpp | 10 +- test/rtree/test_throwing.hpp | 10 +- test/static_vector.cpp | 6 +- tests/additional_glut_vis.cpp | 24 +- tests/additional_sizes_and_times.cpp | 45 +- tests/additional_speed.cpp | 9 +- tests/main.cpp | 35 - tests/rtree_filters.hpp | 70 -- tests/rtree_function.hpp | 550 ---------- tests/rtree_test_generator.cpp | 6 +- tests/static_vector.cpp | 44 - tests/t1.cpp | 54 - tests/t2.cpp | 74 -- tests/translators.hpp | 109 -- 120 files changed, 1286 insertions(+), 1980 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp delete mode 100644 include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp delete mode 100644 include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp delete mode 100644 include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp rename include/boost/geometry/{extensions => }/index/adaptors/nearest_query.hpp (91%) rename include/boost/geometry/{extensions => }/index/adaptors/spatial_query.hpp (87%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/comparable_distance_centroid.hpp (82%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/comparable_distance_far.hpp (81%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/comparable_distance_near.hpp (85%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/content.hpp (89%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/diff_abs.hpp (63%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/intersection_content.hpp (69%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/is_valid.hpp (87%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/margin.hpp (91%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/minmaxdist.hpp (87%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/smallest_for_indexable.hpp (87%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/sum_for_indexable.hpp (86%) rename include/boost/geometry/{extensions => }/index/detail/algorithms/union_content.hpp (68%) rename include/boost/geometry/{extensions => }/index/detail/assert.hpp (71%) rename include/boost/geometry/{extensions => }/index/detail/distance_predicates.hpp (97%) rename include/boost/geometry/{extensions => }/index/detail/indexable.hpp (94%) rename include/boost/geometry/{extensions => }/index/detail/nonassignable.hpp (66%) rename include/boost/geometry/{extensions => }/index/detail/predicates.hpp (97%) rename include/boost/geometry/{extensions => }/index/detail/pushable_array.hpp (93%) rename include/boost/geometry/{extensions => }/index/detail/rtree/adaptors.hpp (86%) create mode 100644 include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp rename include/boost/geometry/{extensions => }/index/detail/rtree/kmeans/split.hpp (86%) create mode 100644 include/boost/geometry/index/detail/rtree/linear/linear.hpp rename include/boost/geometry/{extensions => }/index/detail/rtree/linear/redistribute_elements.hpp (96%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/concept.hpp (88%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/dynamic_visitor.hpp (91%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/node.hpp (86%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/node_auto_ptr.hpp (81%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/node_d_mem_dynamic.hpp (96%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/node_d_mem_static.hpp (93%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/node_s_mem_dynamic.hpp (96%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/node_s_mem_static.hpp (92%) rename include/boost/geometry/{extensions => }/index/detail/rtree/node/static_visitor.hpp (89%) rename include/boost/geometry/{extensions => }/index/detail/rtree/options.hpp (92%) create mode 100644 include/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp rename include/boost/geometry/{extensions => }/index/detail/rtree/quadratic/redistribute_elements.hpp (94%) rename include/boost/geometry/{extensions => }/index/detail/rtree/rstar/choose_next_node.hpp (93%) rename include/boost/geometry/{extensions => }/index/detail/rtree/rstar/insert.hpp (98%) rename include/boost/geometry/{extensions => }/index/detail/rtree/rstar/redistribute_elements.hpp (95%) create mode 100644 include/boost/geometry/index/detail/rtree/rstar/rstar.hpp rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/are_boxes_ok.hpp (89%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/are_levels_ok.hpp (86%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/children_box.hpp (84%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/copy.hpp (91%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/count.hpp (93%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/destroy.hpp (87%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/gl_draw.hpp (84%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/insert.hpp (98%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/is_leaf.hpp (77%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/nearest_query.hpp (96%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/print.hpp (92%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/remove.hpp (96%) rename include/boost/geometry/{extensions => }/index/detail/rtree/visitors/spatial_query.hpp (86%) rename include/boost/geometry/{extensions => }/index/detail/static_vector.hpp (98%) rename include/boost/geometry/{extensions => }/index/detail/tags.hpp (67%) rename include/boost/geometry/{extensions => }/index/detail/tuples.hpp (93%) rename include/boost/geometry/{extensions => }/index/distance_predicates.hpp (96%) rename include/boost/geometry/{extensions => }/index/inserter.hpp (87%) rename include/boost/geometry/{extensions => }/index/parameters.hpp (96%) rename include/boost/geometry/{extensions => }/index/predicates.hpp (95%) rename include/boost/geometry/{extensions => }/index/rtree.hpp (95%) rename include/boost/geometry/{extensions => }/index/translator/def.hpp (92%) rename include/boost/geometry/{extensions => }/index/translator/helpers.hpp (93%) rename include/boost/geometry/{extensions => }/index/translator/index.hpp (83%) rename include/boost/geometry/{extensions => }/index/translator/translator.hpp (60%) delete mode 100644 tests/main.cpp delete mode 100644 tests/rtree_filters.hpp delete mode 100644 tests/rtree_function.hpp delete mode 100644 tests/static_vector.cpp delete mode 100644 tests/t1.cpp delete mode 100644 tests/t2.cpp delete mode 100644 tests/translators.hpp diff --git a/doc/Doxyfile b/doc/Doxyfile index 9cfc96a6d..eb34e0697 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -666,10 +666,9 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = ../boost/geometry/extensions/index/ \ - ../boost/geometry/extensions/index/rtree \ - ../boost/geometry/extensions/index/adaptors \ - ../boost/geometry/extensions/index/translator +INPUT = ../boost/geometry/index/ \ + ../boost/geometry/index/adaptors \ + ../boost/geometry/index/translator # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index f613f5718..77217a4c9 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -38,7 +38,7 @@ Predefined algorithms with run-time parameters are: The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (called Indexables). It also handles [^`std::pair`] and [^`boost::tuple`]. For example, if [^`std::pair`] is stored in the container, the default translator translates from [^`std::pair const&`] to [^`Box const&`]. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre @@ -70,7 +70,7 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[[#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d] `allocator_type`][The type of allocator used by the container. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6] `size_type`][Unsigned integral type used by the container. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1ac011da09678f034a7fab487a9b973bfc] `indexable_type`][The Indexable type to which Value is translated. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d] `box_type`][The Box type used by the R-tree. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093] `envelope_type`][The Box type used by the R-tree. ]] ] [heading Constructor(s) and destructor] @@ -89,29 +89,29 @@ The Translator translates from Value to Indexable each time r-tree requires it. [heading Member(s)] [table -[[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 `box()`]][Returns the box containing all values stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] +[[Modifier][Function][Description]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e `envelope()`]][Returns the box able to contain all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] ] [#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b] @@ -124,7 +124,8 @@ The constructor. `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] @@ -207,7 +208,8 @@ The constructor. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] @@ -631,7 +633,8 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] @@ -683,7 +686,8 @@ MinRelation and MaxRelation describes bounds and can be generated by following f [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]] @@ -749,7 +753,8 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -799,7 +804,8 @@ MinRelation and MaxRelation describes bounds and can be generated by following f `OutIter` `out_it``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -869,7 +875,8 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ `OutIter` `out_it``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]] @@ -894,7 +901,8 @@ Returns the number of stored values. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The number of stored values. [heading Throws] Nothing. @@ -911,7 +919,8 @@ Query if the container is empty. `bool` `empty``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] true if the container is empty. [heading Throws] Nothing. @@ -933,19 +942,20 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6] -[section box()] -Returns the box containing all values stored in the container. +[#classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e] +[section envelope()] +Returns the box able to contain all values stored in the container. [heading Description] -Returns the box containing all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis] +Returns the box able to contain all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a42d0c9efffbc6f3935b5b9c3dd31e50d box_type]]` const &` `box``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093 envelope_type]]` const &` `envelope``()` ] -[heading Returns] -The box containing all values stored in the container or an invalid box if there are no values in the container. +[heading Modifier(s)] +``const ``[heading Returns] +The box able to contain all values stored in the container or an invalid box if there are no values in the container. [heading Throws] Nothing. @@ -962,7 +972,8 @@ For indexable_type it returns the number of values which indexables equals the p [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]] @@ -984,7 +995,8 @@ Returns parameters. [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The parameters object. [heading Throws] Nothing. @@ -1001,7 +1013,8 @@ Returns the translator object. [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The translator object. [heading Throws] Nothing. @@ -1018,7 +1031,8 @@ Returns allocator used by the rtree. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The allocator. [heading Throws] If allocator copy constructor throws. diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 1db8f87c8..875e4b41c 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -18,7 +18,7 @@ [[[link group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c `clear(rtree<...> &)`]][Remove all values from the index. ]] [[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] [[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] -[[[link group__rtree__functions_1gad039bb35d79bded11a1454601f6eed3a `box(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4 `envelope(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] ] [#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc] @@ -395,18 +395,18 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb9 true if there are no values in the index. [endsect] -[#group__rtree__functions_1gad039bb35d79bded11a1454601f6eed3a] -[section box(rtree<...> const &)] +[#group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4] +[section envelope(rtree<...> const &)] Get the box containing all stored values or an invalid box if the index has no values. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad534a6ed759677548f50b86dfeba07c6 rtree::box()]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e rtree::envelope()]].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` `typename Translator``,` `typename Allocator``>` -`rtree::box_type const& boost::geometry::index::box``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +`rtree::box_type const& boost::geometry::index::envelope``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` ] [heading Parameter(s)] diff --git a/doc/generated/rtree_linear.qbk b/doc/generated/rtree_linear.qbk index 5e307645f..6e90a4a2d 100644 --- a/doc/generated/rtree_linear.qbk +++ b/doc/generated/rtree_linear.qbk @@ -7,7 +7,7 @@ Linear r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_quadratic.qbk b/doc/generated/rtree_quadratic.qbk index 82d6b2636..54880ba50 100644 --- a/doc/generated/rtree_quadratic.qbk +++ b/doc/generated/rtree_quadratic.qbk @@ -7,7 +7,7 @@ Quadratic r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_rstar.qbk b/doc/generated/rtree_rstar.qbk index a02079630..1d434696e 100644 --- a/doc/generated/rtree_rstar.qbk +++ b/doc/generated/rtree_rstar.qbk @@ -7,7 +7,7 @@ R*-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_linear.qbk b/doc/generated/rtree_runtime_linear.qbk index a20dccd53..b6dc0a110 100644 --- a/doc/generated/rtree_runtime_linear.qbk +++ b/doc/generated/rtree_runtime_linear.qbk @@ -7,7 +7,7 @@ Linear r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_quadratic.qbk b/doc/generated/rtree_runtime_quadratic.qbk index 5c39105e2..2a5102750 100644 --- a/doc/generated/rtree_runtime_quadratic.qbk +++ b/doc/generated/rtree_runtime_quadratic.qbk @@ -7,7 +7,7 @@ Quadratic r-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree_runtime_rstar.qbk b/doc/generated/rtree_runtime_rstar.qbk index 8448ac1dc..491ce09cc 100644 --- a/doc/generated/rtree_runtime_rstar.qbk +++ b/doc/generated/rtree_runtime_rstar.qbk @@ -7,7 +7,7 @@ R*-tree creation algorithm parameters. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/translator_def.qbk b/doc/generated/translator_def.qbk index d16613078..a1d8ff7e2 100644 --- a/doc/generated/translator_def.qbk +++ b/doc/generated/translator_def.qbk @@ -10,7 +10,7 @@ The default translator. It translates Value object to Indexable object. The default version handles Values which are Indexables. This translator is also specialized for std::pair and boost::tuple. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 1d2ce0ca6..12c4725ca 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -10,7 +10,7 @@ The index translator. This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size\u005ftype) defined. Index translator uses [link structboost_1_1geometry_1_1index_1_1translator_1_1def translator::def]<...> to translate from Container::value\u005ftype to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre @@ -43,7 +43,8 @@ The constructor. `index``(``Container const &` `c``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Container const &`][ `c` ][The container which stores indexed values. ]] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd5718dbb..c00e43835 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 9c5468fb8..4d5f596cd 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 5d10c6375..263f4d250 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 - + @@ -55,7 +55,7 @@

                                                                                                            rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
                                                                                                             
                                                                                                            -
                                                                                                              +
                                                                                                              • Value - type of object which will be stored in the container,
                                                                                                              • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

                                                                                                                -
                                                                                                                  +
                                                                                                                  • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

                                                                                                                    -
                                                                                                                      +
                                                                                                                      • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                                                                                                                        If comparison of two Values is required, the default translator:

                                                                                                                        -
                                                                                                                          +
                                                                                                                          • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 035a9287c..28ae3b6fd 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                                                                                                                      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 + 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 [2]. + close to some point in space [2].

                                                                                                                      The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                                                                                                                      The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -179,13 +179,13 @@

            - Implementation + Implementation details

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

            -
              +
              • capable to store arbitrary Value type,
              • @@ -207,7 +207,7 @@
              - Contributors + Contributors

              The spatial index was originally started by Federico J. Fernandez during @@ -215,7 +215,7 @@

              - Spatial + Spatial thanks

              @@ -224,20 +224,20 @@ list for their help.

              -

              -

              [1] +


              +

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

              -

              [2] +

              [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

              -

              [3] +

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

              -

              [4] +

              [4] 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 16a6eba21..18130e9d5 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/reference.html b/doc/html/geometry_index/r_tree/reference.html index ad1df612c..c81b25631 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -47,12 +47,12 @@ boost::geometry::index::rtree

              - + The R-tree spatial index.

              - Description + Description

              This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

              - Parameters + Parameters

              The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

              Predefined algorithms with compile-time parameters are:

              -
                +
                • boost::geometry::index::linear,
                • @@ -84,7 +84,7 @@ The R-tree spatial index.

                  Predefined algorithms with run-time parameters are:

                  -
                    +
                    - Translator + Translator

                    The Translator translates from Value to Indexable each time r-tree requires @@ -114,14 +114,14 @@ The R-tree spatial index.

                    - Header + Header

                    - #include <boost/geometry/extensions/index/rtree.hpp> + #include <boost/geometry/index/rtree.hpp>

                    - Synopsis + Synopsis
                    template<typename Value,
                              typename Parameters,
                    @@ -134,7 +134,7 @@ The R-tree spatial index.
                     
                    - Template + Template parameter(s)
                    @@ -208,7 +208,7 @@ The R-tree spatial index.
                    - Typedef(s) + Typedef(s)
                    @@ -303,7 +303,7 @@ The R-tree spatial index.

                    - box_type + envelope_type

                    @@ -316,7 +316,7 @@ The R-tree spatial index.
                    - Constructor(s) + Constructor(s) and destructor
                    @@ -458,14 +458,20 @@ The R-tree spatial index.
                    - Member(s) + Member(s)
                    + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + +
                    +

                    + Modifier +

                    +

                    Function @@ -479,6 +485,8 @@ The R-tree spatial index.

                    +

                    operator=(const rtree @@ -492,6 +500,8 @@ The R-tree spatial index.

                    +

                    operator=(rtree &&) @@ -504,6 +514,8 @@ The R-tree spatial index.

                    +

                    swap(rtree &) @@ -516,6 +528,8 @@ The R-tree spatial index.

                    +

                    insert(value_type const @@ -529,6 +543,8 @@ The R-tree spatial index.

                    +

                    insert(Iterator, @@ -542,6 +558,8 @@ The R-tree spatial index.

                    +

                    insert(Range const @@ -555,6 +573,8 @@ The R-tree spatial index.

                    +

                    remove(value_type const @@ -568,6 +588,8 @@ The R-tree spatial index.

                    +

                    remove(Iterator, @@ -581,6 +603,8 @@ The R-tree spatial index.

                    +

                    remove(Range const @@ -594,6 +618,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    spatial_query(Predicates const @@ -608,6 +637,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    nearest_query(DistancesPredicates const @@ -623,6 +657,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    nearest_query(DistancesPredicates const @@ -639,6 +678,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    nearest_query(DistancesPredicates const @@ -653,6 +697,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    nearest_query(DistancesPredicates const @@ -669,6 +718,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    size() @@ -681,6 +735,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    empty() @@ -693,6 +752,8 @@ The R-tree spatial index.

                    +

                    clear() @@ -707,16 +768,26 @@ The R-tree spatial index.

                    - box() + const

                    - Returns the box containing all values stored in the container. + envelope() +

                    +
                    +

                    + Returns the box able to contain all values stored in the container.

                    +

                    + const +

                    +

                    count(ValueOrIndexable const @@ -730,6 +801,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    parameters() @@ -742,6 +818,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    translator() @@ -754,6 +835,11 @@ The R-tree spatial index.

                    +

                    + const +

                    +

                    get_allocator() @@ -776,13 +862,22 @@ The R-tree spatial index.

                    - Synopsis + Synopsis
                    rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                     
                    - Parameter(s) + Modifier(s) +
                    +

                    +

                    +
                    explicit
                    +

                    +

                    +
                    + + Parameter(s)
                    @@ -846,8 +941,8 @@ The R-tree spatial index.
                    - - Throws + + Throws

                    If allocator default constructor throws. @@ -863,7 +958,7 @@ The R-tree spatial index.

                    - Synopsis + Synopsis
                    rtree(parameters_type parameters,
                           translator_type const & translator,
                    @@ -871,7 +966,7 @@ The R-tree spatial index.
                     
                    - Parameter(s) + Parameter(s)
                    @@ -953,7 +1048,7 @@ The R-tree spatial index.
                    - Throws + Throws

                    If allocator copy constructor throws. @@ -969,7 +1064,7 @@ The R-tree spatial index.

                    - Synopsis + Synopsis
                    template<typename Iterator>
                     rtree(Iterator first,
                    @@ -980,7 +1075,7 @@ The R-tree spatial index.
                     
                    - Parameter(s) + Parameter(s)
                    @@ -1096,9 +1191,9 @@ The R-tree spatial index.
                    - Throws + Throws
                    -
                      +
                      • If allocator copy constructor throws.
                      • @@ -1123,7 +1218,7 @@ The R-tree spatial index.

                        - Synopsis + Synopsis
                        template<typename Range>
                         rtree(Range const & rng,
                        @@ -1133,7 +1228,16 @@ The R-tree spatial index.
                         
                        - Parameter(s) + Modifier(s) +
                        +

                        +

                        +
                        explicit
                        +

                        +

                        +
                        + + Parameter(s)
                        @@ -1232,10 +1336,10 @@ The R-tree spatial index.
                        - - Throws + + Throws
                        -
                          +
                          • If allocator copy constructor throws.
                          • @@ -1259,13 +1363,13 @@ The R-tree spatial index.

                            - Synopsis + Synopsis
                            ~rtree()
                             
                            - Throws + Throws

                            Nothing. @@ -1281,20 +1385,20 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters, translator and allocator from the source tree.

                            - Synopsis + Synopsis
                            rtree(rtree const & src)
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1340,9 +1444,9 @@ The R-tree spatial index.
                            - Throws + Throws
                            -
                              +
                              • If allocator copy constructor throws.
                              • @@ -1367,20 +1471,20 @@ The R-tree spatial index.

                                - Description + Description

                                It uses Parameters and translator from the source tree.

                                - Synopsis + Synopsis
                                rtree(rtree const & src, allocator_type const & allocator)
                                 
                                - Parameter(s) + Parameter(s)
                                @@ -1446,9 +1550,9 @@ The R-tree spatial index.
                                - Throws + Throws
                                -
                                  +
                                  • If allocator copy constructor throws.
                                  • @@ -1473,20 +1577,20 @@ The R-tree spatial index.

                                    - Description + Description

                                    It uses parameters, translator and allocator from the source tree.

                                    - Synopsis + Synopsis
                                    rtree(rtree && src)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1532,7 +1636,7 @@ The R-tree spatial index.
                                    - Throws + Throws

                                    Nothing. @@ -1548,20 +1652,20 @@ The R-tree spatial index.

                                    - Description + Description

                                    It uses parameters and translator from the source tree.

                                    - Synopsis + Synopsis
                                    rtree(rtree && src, allocator_type const & allocator)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1627,9 +1731,9 @@ The R-tree spatial index.
                                    - Throws + Throws
                                    -
                                      +
                                      • If allocator copy constructor throws.
                                      • @@ -1655,20 +1759,20 @@ The R-tree spatial index.

                                        - Description + Description

                                        It uses parameters and translator from the source tree.

                                        - Synopsis + Synopsis
                                        rtree & operator=(const rtree & src)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -1714,9 +1818,9 @@ The R-tree spatial index.
                                        - Throws + Throws
                                        -
                                          +
                                          • If Value copy constructor throws.
                                          • @@ -1738,20 +1842,20 @@ The R-tree spatial index.

                                            - Description + Description

                                            It uses parameters and translator from the source tree.

                                            - Synopsis + Synopsis
                                            rtree & operator=(rtree && src)
                                             
                                            - Parameter(s) + Parameter(s)
                                            @@ -1797,12 +1901,12 @@ The R-tree spatial index.
                                            - Throws + Throws

                                            Only if allocators aren't equal.

                                            -
                                              +
                                              • If Value copy constructor throws.
                                              • @@ -1824,20 +1928,20 @@ The R-tree spatial index.

                                                - Description + Description

                                                Parameters, translator and allocators are swapped as well.

                                                - Synopsis + Synopsis
                                                void swap(rtree & other)
                                                 
                                                - Parameter(s) + Parameter(s)
                                                @@ -1883,7 +1987,7 @@ The R-tree spatial index.
                                                - Throws + Throws

                                                If allocators swap throws. @@ -1899,13 +2003,13 @@ The R-tree spatial index.

                                                - Synopsis + Synopsis
                                                void insert(value_type const & value)
                                                 
                                                - Parameter(s) + Parameter(s)
                                                @@ -1951,9 +2055,9 @@ The R-tree spatial index.
                                                - Throws + Throws
                                                -
                                                  +
                                                  • If Value copy constructor or copy assignment throws.
                                                  • @@ -1986,14 +2090,14 @@ The R-tree spatial index.

                                                    - Synopsis + Synopsis
                                                    template<typename Iterator>
                                                     void insert(Iterator first, Iterator last)
                                                     
                                                    - Parameter(s) + Parameter(s)
                                                    @@ -2057,9 +2161,9 @@ The R-tree spatial index.
                                                    - Throws + Throws
                                                    -
                                                      +
                                                      • If Value copy constructor or copy assignment throws.
                                                      • @@ -2092,14 +2196,14 @@ The R-tree spatial index.

                                                        - Synopsis + Synopsis
                                                        template<typename Range>
                                                         void insert(Range const & rng)
                                                         
                                                        - Parameter(s) + Parameter(s)
                                                        @@ -2145,9 +2249,9 @@ The R-tree spatial index.
                                                        - Throws + Throws
                                                        -
                                                          +
                                                          • If Value copy constructor or copy assignment throws.
                                                          • @@ -2180,7 +2284,7 @@ The R-tree spatial index.

                                                            - Description + Description

                                                            In contrast to the std::set @@ -2189,13 +2293,13 @@ The R-tree spatial index.

                                                            - Synopsis + Synopsis
                                                            size_type remove(value_type const & value)
                                                             
                                                            - Parameter(s) + Parameter(s)
                                                            @@ -2241,16 +2345,16 @@ The R-tree spatial index.
                                                            - Returns + Returns

                                                            1 if the value was removed, 0 otherwise.

                                                            - Throws + Throws
                                                            -
                                                              +
                                                              • If Value copy constructor or copy assignment throws.
                                                              • @@ -2283,7 +2387,7 @@ The R-tree spatial index.

                                                                - Description + Description

                                                                In contrast to the std::set @@ -2294,14 +2398,14 @@ The R-tree spatial index.

                                                                - Synopsis + Synopsis
                                                                template<typename Iterator>
                                                                 size_type remove(Iterator first, Iterator last)
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -2365,16 +2469,16 @@ The R-tree spatial index.
                                                                - Returns + Returns

                                                                The number of removed values.

                                                                - Throws + Throws
                                                                -
                                                                  +
                                                                  • If Value copy constructor or copy assignment throws.
                                                                  • @@ -2407,7 +2511,7 @@ The R-tree spatial index.

                                                                    - Description + Description

                                                                    In contrast to the std::set @@ -2417,14 +2521,14 @@ The R-tree spatial index.

                                                                    - Synopsis + Synopsis
                                                                    template<typename Range>
                                                                     size_type remove(Range const & rng)
                                                                     
                                                                    - Parameter(s) + Parameter(s)
                                                                    @@ -2470,16 +2574,16 @@ The R-tree spatial index.
                                                                    - Returns + Returns

                                                                    The number of removed values.

                                                                    - Throws + Throws
                                                                    -
                                                                      +
                                                                      • If Value copy constructor or copy assignment throws.
                                                                      • @@ -2512,7 +2616,7 @@ The R-tree spatial index.

                                                                        - Description + Description

                                                                        Spatial predicates may be a Geometry. In this case Values @@ -2522,7 +2626,7 @@ The R-tree spatial index.

                                                                        It may be generated by one of the functions listed below:

                                                                        -
                                                                          +
                                                                          • boost::geometry::index::covered_by(),
                                                                          • @@ -2564,14 +2668,23 @@ The R-tree spatial index.

                                                                            - Synopsis + Synopsis
                                                                            template<typename Predicates, typename OutIter>
                                                                             size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                                             
                                                                            - Parameter(s) + Modifier(s) +
                                                                            +

                                                                            +

                                                                            +
                                                                            const
                                                                            +

                                                                            +

                                                                            +
                                                                            + + Parameter(s)
                                                                            @@ -2635,17 +2748,17 @@ The R-tree spatial index.
                                                                            - - Returns + + Returns

                                                                            The number of values found.

                                                                            - - Throws + + Throws
                                                                            -
                                                                              +
                                                                              • If Value copy constructor or copy assignment throws.
                                                                              • @@ -2664,7 +2777,7 @@ The R-tree spatial index.

                                                                                - Description + Description

                                                                                Distances predicates may be a Point. In this the case the @@ -2675,7 +2788,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                -
                                                                                  +
                                                                                  • boost::geometry::index::to_nearest() - default, @@ -2692,7 +2805,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                    -
                                                                                      +
                                                                                      • boost::geometry::index::unbounded() - default, @@ -2711,7 +2824,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                        -
                                                                                          +
                                                                                          - Synopsis + Synopsis
                                                                                          template<typename DistancesPredicates>
                                                                                           size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
                                                                                           
                                                                                          - Parameter(s) + Modifier(s) +
                                                                                          +

                                                                                          +

                                                                                          +
                                                                                          const
                                                                                          +

                                                                                          +

                                                                                          +
                                                                                          + + Parameter(s)
                                                                                          @@ -2796,15 +2918,15 @@ The R-tree spatial index.
                                                                                          - - Returns + + Returns

                                                                                          The number of values found.

                                                                                          - - Throws + + Throws

                                                                                          If Value copy constructor or copy assignment throws. @@ -2821,7 +2943,7 @@ The R-tree spatial index.

                                                                                          - Description + Description

                                                                                          Distances predicates may be a Point. In this the case the @@ -2832,7 +2954,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                          -
                                                                                            +
                                                                                            • boost::geometry::index::to_nearest() - default, @@ -2849,7 +2971,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                              -
                                                                                                +
                                                                                                • boost::geometry::index::unbounded() - default, @@ -2868,7 +2990,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                  -
                                                                                                    +
                                                                                                    • boost::geometry::index::to_nearest(),
                                                                                                    • @@ -2887,7 +3009,7 @@ The R-tree spatial index.

                                                                                                      It may be generated by one of the functions listed below:

                                                                                                      -
                                                                                                        +
                                                                                                        • boost::geometry::index::covered_by(),
                                                                                                        • @@ -2929,7 +3051,7 @@ The R-tree spatial index.

                                                                                                          - Synopsis + Synopsis
                                                                                                          template<typename DistancesPredicates, typename Predicates>
                                                                                                           size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                          @@ -2938,7 +3060,16 @@ The R-tree spatial index.
                                                                                                           
                                                                                                          - Parameter(s) + Modifier(s) +
                                                                                                          +

                                                                                                          +

                                                                                                          +
                                                                                                          const
                                                                                                          +

                                                                                                          +

                                                                                                          +
                                                                                                          + + Parameter(s)
                                                                                                          @@ -3020,15 +3151,15 @@ The R-tree spatial index.
                                                                                                          - - Returns + + Returns

                                                                                                          The number of values found.

                                                                                                          - - Throws + + Throws

                                                                                                          If Value copy constructor or copy assignment throws. @@ -3045,7 +3176,7 @@ The R-tree spatial index.

                                                                                                          - Description + Description

                                                                                                          Distances predicates may be a Point. In this the case the @@ -3056,7 +3187,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                          -
                                                                                                            +
                                                                                                            • boost::geometry::index::to_nearest() - default, @@ -3073,7 +3204,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                              -
                                                                                                                +
                                                                                                                • boost::geometry::index::unbounded() - default, @@ -3092,7 +3223,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                                  -
                                                                                                                    +
                                                                                                                    - Synopsis + Synopsis
                                                                                                                    template<typename DistancesPredicates, typename OutIter>
                                                                                                                     size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                                    @@ -3114,7 +3245,16 @@ The R-tree spatial index.
                                                                                                                     
                                                                                                                    - Parameter(s) + Modifier(s) +
                                                                                                                    +

                                                                                                                    +

                                                                                                                    +
                                                                                                                    const
                                                                                                                    +

                                                                                                                    +

                                                                                                                    +
                                                                                                                    + + Parameter(s)
                                                                                                                    @@ -3195,15 +3335,15 @@ The R-tree spatial index.
                                                                                                                    - - Returns + + Returns

                                                                                                                    The number of values found.

                                                                                                                    - - Throws + + Throws

                                                                                                                    If Value copy constructor or copy assignment throws. If OutIter dereference @@ -3221,7 +3361,7 @@ The R-tree spatial index.

                                                                                                                    - Description + Description

                                                                                                                    Distances predicates may be a Point. In this the case the @@ -3232,7 +3372,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                                    -
                                                                                                                    - +

                                                                                                                    Last revised: January 18, 2013 at 20:09:35 GMT

                                                                                                                    Last revised: January 19, 2013 at 02:20:46 GMT


                                                                                                                    diff --git a/include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp b/include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp deleted file mode 100644 index 7e2ff2285..000000000 --- a/include/boost/geometry/extensions/index/detail/rtree/kmeans/kmeans.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Boost.Geometry Index -// -// R-tree kmeans algorithm implementation -// -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_KMEANS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_KMEANS_HPP - -#include - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_KMEANS_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp b/include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp deleted file mode 100644 index 4c6aaf44e..000000000 --- a/include/boost/geometry/extensions/index/detail/rtree/linear/linear.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Boost.Geometry Index -// -// R-tree linear algorithm implementation -// -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP - -#include - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp b/include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp deleted file mode 100644 index d7eaa03af..000000000 --- a/include/boost/geometry/extensions/index/detail/rtree/quadratic/quadratic.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Boost.Geometry Index -// -// R-tree quadratic algorithm implementation -// -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP - -#include - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_QUADRATIC_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp b/include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp deleted file mode 100644 index 905c4e540..000000000 --- a/include/boost/geometry/extensions/index/detail/rtree/rstar/rstar.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Boost.Geometry Index -// -// R-tree R*-tree algorithm implementation -// -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP - -#include -#include -#include - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp b/include/boost/geometry/index/adaptors/nearest_query.hpp similarity index 91% rename from include/boost/geometry/extensions/index/adaptors/nearest_query.hpp rename to include/boost/geometry/index/adaptors/nearest_query.hpp index dfa34b31f..fd86465eb 100644 --- a/include/boost/geometry/extensions/index/adaptors/nearest_query.hpp +++ b/include/boost/geometry/index/adaptors/nearest_query.hpp @@ -2,14 +2,14 @@ // // Nearest neighbour query range adaptor // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP +#ifndef BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP +#define BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP /*! \defgroup adaptors Adaptors (boost::geometry::index::adaptors::) @@ -119,4 +119,4 @@ operator|( }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_NEAREST_QUERY_HPP +#endif // BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp b/include/boost/geometry/index/adaptors/spatial_query.hpp similarity index 87% rename from include/boost/geometry/extensions/index/adaptors/spatial_query.hpp rename to include/boost/geometry/index/adaptors/spatial_query.hpp index b57ca3270..46331e02d 100644 --- a/include/boost/geometry/extensions/index/adaptors/spatial_query.hpp +++ b/include/boost/geometry/index/adaptors/spatial_query.hpp @@ -2,14 +2,14 @@ // // Spatial query range adaptor // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP +#ifndef BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP +#define BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP /*! \defgroup adaptors Adaptors (boost::geometry::index::adaptors::) @@ -85,4 +85,4 @@ operator|( }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ADAPTORS_SPATIAL_QUERY_HPP +#endif // BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_centroid.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp similarity index 82% rename from include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_centroid.hpp rename to include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp index 06283ea36..269a2c9c3 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_centroid.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp @@ -2,17 +2,17 @@ // // squared distance between point and centroid of the box or point // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -73,5 +73,5 @@ comparable_distance_centroid(Point const& pt, Indexable const& i) }}}} // namespace boost::geometry::index::detail -#endif // #define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP +#endif // #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_far.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp similarity index 81% rename from include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_far.hpp rename to include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp index a945ac014..1646a82d6 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_far.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp @@ -2,17 +2,17 @@ // // squared distance between point and furthest point of the box or point // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -63,4 +63,4 @@ comparable_distance_far(Point const& pt, Indexable const& i) }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_near.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp similarity index 85% rename from include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_near.hpp rename to include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp index 71ccc1678..221d3ee3f 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/comparable_distance_near.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp @@ -2,16 +2,16 @@ // // squared distance between point and nearest point of the box or point // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -74,4 +74,4 @@ comparable_distance_near(Point const& pt, Indexable const& i) }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/content.hpp b/include/boost/geometry/index/detail/algorithms/content.hpp similarity index 89% rename from include/boost/geometry/extensions/index/detail/algorithms/content.hpp rename to include/boost/geometry/index/detail/algorithms/content.hpp index 766b1d6a2..0677fe564 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/content.hpp +++ b/include/boost/geometry/index/detail/algorithms/content.hpp @@ -2,14 +2,14 @@ // // n-dimensional box's content (hypervolume) - 2d area, 3d volume, ... // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -82,4 +82,4 @@ typename default_content_result::type content(Indexable const& b) }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/diff_abs.hpp b/include/boost/geometry/index/detail/algorithms/diff_abs.hpp similarity index 63% rename from include/boost/geometry/extensions/index/detail/algorithms/diff_abs.hpp rename to include/boost/geometry/index/detail/algorithms/diff_abs.hpp index 8beed4d0f..a89784d7f 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/diff_abs.hpp +++ b/include/boost/geometry/index/detail/algorithms/diff_abs.hpp @@ -2,14 +2,14 @@ // // Abs of difference // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -21,4 +21,4 @@ inline T diff_abs(T const& v1, T const& v2) }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_DIFF_ABS_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_DIFF_ABS_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/intersection_content.hpp b/include/boost/geometry/index/detail/algorithms/intersection_content.hpp similarity index 69% rename from include/boost/geometry/extensions/index/detail/algorithms/intersection_content.hpp rename to include/boost/geometry/index/detail/algorithms/intersection_content.hpp index 876e1ce25..955d6eb65 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/intersection_content.hpp +++ b/include/boost/geometry/index/detail/algorithms/intersection_content.hpp @@ -2,17 +2,17 @@ // // boxes union/intersection area/volume // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -33,4 +33,4 @@ inline typename default_content_result::type intersection_content(Box const }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/is_valid.hpp b/include/boost/geometry/index/detail/algorithms/is_valid.hpp similarity index 87% rename from include/boost/geometry/extensions/index/detail/algorithms/is_valid.hpp rename to include/boost/geometry/index/detail/algorithms/is_valid.hpp index 63efed886..327e629af 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/is_valid.hpp +++ b/include/boost/geometry/index/detail/algorithms/is_valid.hpp @@ -2,14 +2,14 @@ // // n-dimensional box's / point validity check // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -76,4 +76,4 @@ inline bool is_valid(Indexable const& b) }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_IS_VALID_HPP +#endif // BOOST_GEOMETRY_DETAIL_INDEX_ALGORITHMS_IS_VALID_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/margin.hpp b/include/boost/geometry/index/detail/algorithms/margin.hpp similarity index 91% rename from include/boost/geometry/extensions/index/detail/algorithms/margin.hpp rename to include/boost/geometry/index/detail/algorithms/margin.hpp index 6a91c1ed6..cebc2cfb7 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/margin.hpp +++ b/include/boost/geometry/index/detail/algorithms/margin.hpp @@ -2,14 +2,14 @@ // // n-dimensional box's margin value (hypersurface), 2d perimeter, 3d surface, etc... // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -96,4 +96,4 @@ typename default_margin_result::type margin(Box const& b) }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/minmaxdist.hpp b/include/boost/geometry/index/detail/algorithms/minmaxdist.hpp similarity index 87% rename from include/boost/geometry/extensions/index/detail/algorithms/minmaxdist.hpp rename to include/boost/geometry/index/detail/algorithms/minmaxdist.hpp index 28e7e9715..d2429cbb2 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/minmaxdist.hpp +++ b/include/boost/geometry/index/detail/algorithms/minmaxdist.hpp @@ -2,21 +2,21 @@ // // minmaxdist used in R-tree k nearest neighbors query // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -116,4 +116,4 @@ minmaxdist(Point const& pt, Indexable const& i) }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MINMAXDIST_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/smallest_for_indexable.hpp b/include/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp similarity index 87% rename from include/boost/geometry/extensions/index/detail/algorithms/smallest_for_indexable.hpp rename to include/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp index 0e864934d..3ca335d5a 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/smallest_for_indexable.hpp +++ b/include/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp @@ -2,14 +2,14 @@ // // Get smallest value calculated for indexable's dimensions, used in R-tree k nearest neighbors query // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -77,4 +77,4 @@ struct smallest_for_indexable }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SMALLEST_FOR_INDEXABLE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SMALLEST_FOR_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/sum_for_indexable.hpp b/include/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp similarity index 86% rename from include/boost/geometry/extensions/index/detail/algorithms/sum_for_indexable.hpp rename to include/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp index 014b871ca..4aef36352 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/sum_for_indexable.hpp +++ b/include/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp @@ -2,14 +2,14 @@ // // Sum values calculated for indexable's dimensions, used e.g. in R-tree k nearest neighbors query // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -73,4 +73,4 @@ struct sum_for_indexable }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_DETAIL_SUM_FOR_INDEXABLE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SUM_FOR_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/detail/algorithms/union_content.hpp b/include/boost/geometry/index/detail/algorithms/union_content.hpp similarity index 68% rename from include/boost/geometry/extensions/index/detail/algorithms/union_content.hpp rename to include/boost/geometry/index/detail/algorithms/union_content.hpp index 93b770704..3acdc3d19 100644 --- a/include/boost/geometry/extensions/index/detail/algorithms/union_content.hpp +++ b/include/boost/geometry/index/detail/algorithms/union_content.hpp @@ -3,17 +3,17 @@ // boxes union/sum area/volume // // Copyright (c) 2008 Federico J. Fernandez. -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -30,4 +30,4 @@ inline typename default_content_result::type union_content(Box const& b, Ge }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP diff --git a/include/boost/geometry/extensions/index/detail/assert.hpp b/include/boost/geometry/index/detail/assert.hpp similarity index 71% rename from include/boost/geometry/extensions/index/detail/assert.hpp rename to include/boost/geometry/index/detail/assert.hpp index bf3b3038a..1ac4f5490 100644 --- a/include/boost/geometry/extensions/index/detail/assert.hpp +++ b/include/boost/geometry/index/detail/assert.hpp @@ -1,6 +1,6 @@ // Boost.Geometry Index // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -8,8 +8,8 @@ #include -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ASSERT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_ASSERT_HPP #define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) \ BOOST_ASSERT_MSG(CONDITION, TEXT_MSG) @@ -24,4 +24,4 @@ #endif -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ASSERT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_ASSERT_HPP diff --git a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp b/include/boost/geometry/index/detail/distance_predicates.hpp similarity index 97% rename from include/boost/geometry/extensions/index/detail/distance_predicates.hpp rename to include/boost/geometry/index/detail/distance_predicates.hpp index d293183df..9d86a03f2 100644 --- a/include/boost/geometry/extensions/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/index/detail/distance_predicates.hpp @@ -3,22 +3,22 @@ // Spatial index distance predicates, calculators and checkers // used in nearest query - specialized for envelopes // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_DISTANCE_PREDICATES_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_DISTANCE_PREDICATES_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_DISTANCE_PREDICATES_HPP -#include -#include -#include +#include +#include +#include -#include +#include -#include +#include // TODO - optimization // For Boxes and Points all types of distances may be calculated @@ -863,4 +863,4 @@ struct distances_predicates_check< }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_DISTANCE_PREDICATES_HPP +#endif // BOOST_GEOMETRY_INDEX_RTREE_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/detail/indexable.hpp b/include/boost/geometry/index/detail/indexable.hpp similarity index 94% rename from include/boost/geometry/extensions/index/detail/indexable.hpp rename to include/boost/geometry/index/detail/indexable.hpp index b3a10452f..6d04b90ad 100644 --- a/include/boost/geometry/extensions/index/detail/indexable.hpp +++ b/include/boost/geometry/index/detail/indexable.hpp @@ -2,14 +2,14 @@ // // Indexable's traits and related functions // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_INDEXABLE_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_INDEXABLE_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -174,4 +174,4 @@ struct default_box_type }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_INDEXABLE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_INDEXABLE_HPP diff --git a/include/boost/geometry/extensions/index/detail/nonassignable.hpp b/include/boost/geometry/index/detail/nonassignable.hpp similarity index 66% rename from include/boost/geometry/extensions/index/detail/nonassignable.hpp rename to include/boost/geometry/index/detail/nonassignable.hpp index 345007b0d..944fc1547 100644 --- a/include/boost/geometry/extensions/index/detail/nonassignable.hpp +++ b/include/boost/geometry/index/detail/nonassignable.hpp @@ -2,14 +2,14 @@ // // Nonassignable base class. // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP namespace boost { namespace geometry { namespace index { namespace detail { @@ -20,4 +20,4 @@ class nonassignable }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_NONASSIGNABLE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP diff --git a/include/boost/geometry/extensions/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp similarity index 97% rename from include/boost/geometry/extensions/index/detail/predicates.hpp rename to include/boost/geometry/index/detail/predicates.hpp index abe19c760..9ea3172ab 100644 --- a/include/boost/geometry/extensions/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -2,17 +2,17 @@ // // Spatial query predicates definition and checks. // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -522,4 +522,4 @@ inline bool predicates_check(Predicates const& p, Value const& v, Indexable cons }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_PREDICATES_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/detail/pushable_array.hpp b/include/boost/geometry/index/detail/pushable_array.hpp similarity index 93% rename from include/boost/geometry/extensions/index/detail/pushable_array.hpp rename to include/boost/geometry/index/detail/pushable_array.hpp index 6140ac96e..180d46580 100644 --- a/include/boost/geometry/extensions/index/detail/pushable_array.hpp +++ b/include/boost/geometry/index/detail/pushable_array.hpp @@ -1,17 +1,17 @@ // Boost.Geometry Index // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_PUSHABLE_ARRAY_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_PUSHABLE_ARRAY_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -168,4 +168,4 @@ private: }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PUSHABLE_ARRAY_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_PUSHABLE_ARRAY_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/adaptors.hpp b/include/boost/geometry/index/detail/rtree/adaptors.hpp similarity index 86% rename from include/boost/geometry/extensions/index/detail/rtree/adaptors.hpp rename to include/boost/geometry/index/detail/rtree/adaptors.hpp index 85b14d670..0066766df 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/adaptors.hpp +++ b/include/boost/geometry/index/detail/rtree/adaptors.hpp @@ -2,20 +2,20 @@ // // R-tree queries range adaptors // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ADAPTORS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ADAPTORS_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP #include #include -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -82,4 +82,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_ADAPTORS_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP diff --git a/include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp b/include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp new file mode 100644 index 000000000..3f61482b2 --- /dev/null +++ b/include/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp @@ -0,0 +1,16 @@ +// Boost.Geometry Index +// +// R-tree kmeans algorithm implementation +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP + +#include + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/kmeans/split.hpp b/include/boost/geometry/index/detail/rtree/kmeans/split.hpp similarity index 86% rename from include/boost/geometry/extensions/index/detail/rtree/kmeans/split.hpp rename to include/boost/geometry/index/detail/rtree/kmeans/split.hpp index 55512ec5e..f19654972 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/kmeans/split.hpp +++ b/include/boost/geometry/index/detail/rtree/kmeans/split.hpp @@ -2,23 +2,21 @@ // // R-tree kmeans split algorithm implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_SPLIT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_SPLIT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { -namespace detail { namespace rtree { namespace visitors { - -namespace detail { +namespace detail { namespace rtree { namespace kmeans { @@ -82,10 +80,8 @@ public: } }; -} // namespace detail - -}}} // namespace detail::rtree::visitors +}} // namespace detail::rtree }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_KMEANS_SPLIT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP diff --git a/include/boost/geometry/index/detail/rtree/linear/linear.hpp b/include/boost/geometry/index/detail/rtree/linear/linear.hpp new file mode 100644 index 000000000..1461692a1 --- /dev/null +++ b/include/boost/geometry/index/detail/rtree/linear/linear.hpp @@ -0,0 +1,16 @@ +// Boost.Geometry Index +// +// R-tree linear algorithm implementation +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_LINEAR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_LINEAR_HPP + +#include + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_LINEAR_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp similarity index 96% rename from include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp rename to include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp index a3f5fb8ba..17bc20a94 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp @@ -3,22 +3,22 @@ // R-tree linear split algorithm implementation // // Copyright (c) 2008 Federico J. Fernandez. -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_LINEAR_REDISTRIBUTE_ELEMENTS_HPP #include -#include +#include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -328,4 +328,4 @@ struct redistribute_elements +#include -#include -#include +#include +#include -#include -#include +#include +#include -#include +#include #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -159,4 +159,4 @@ void copy_from_back(Container & container, Iterator it) }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp b/include/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp similarity index 81% rename from include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp rename to include/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp index 7b7663660..4ae6707ef 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/node/node_auto_ptr.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp @@ -2,18 +2,18 @@ // // R-tree node auto ptr // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_AUTO_PTR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_AUTO_PTR_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_AUTO_PTR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_AUTO_PTR_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -75,4 +75,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_AUTO_PTR_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_AUTO_PTR_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp similarity index 96% rename from include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp rename to include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 1a0a5f5cf..0f100de46 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -2,18 +2,18 @@ // // R-tree nodes based on run-time polymorphism, storing std::vectors // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -336,4 +336,4 @@ struct destroy_node< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp similarity index 93% rename from include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp rename to include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index 7c6c6cfc0..9634341a3 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -2,17 +2,17 @@ // // R-tree nodes based on runtime-polymorphism, storing static-size containers // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -181,4 +181,4 @@ struct create_node< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp similarity index 96% rename from include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp rename to include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index 577e60c08..d8dac9287 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -2,18 +2,18 @@ // // R-tree nodes based on Boost.Variant, storing std::vectors // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -294,4 +294,4 @@ struct destroy_node< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp similarity index 92% rename from include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp rename to include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp index 5f906fca3..64ba6b0c5 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp @@ -2,18 +2,18 @@ // // R-tree nodes based on Boost.Variant, storing static-size containers // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#include +#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -172,4 +172,4 @@ struct create_node< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp b/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp similarity index 89% rename from include/boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp rename to include/boost/geometry/index/detail/rtree/node/static_visitor.hpp index cf089b3d2..c96ca3265 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/node/static_visitor.hpp +++ b/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp @@ -2,14 +2,14 @@ // // R-tree nodes static visitor related code // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP #include @@ -73,4 +73,4 @@ inline void apply_visitor(Visitor & v, }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_STATIC_VISITOR_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_STATIC_VISITOR_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/options.hpp b/include/boost/geometry/index/detail/rtree/options.hpp similarity index 92% rename from include/boost/geometry/extensions/index/detail/rtree/options.hpp rename to include/boost/geometry/index/detail/rtree/options.hpp index 4cad22fc5..061bbfb8a 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/options.hpp +++ b/include/boost/geometry/index/detail/rtree/options.hpp @@ -2,16 +2,16 @@ // // R-tree options, algorithms, parameters // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -152,4 +152,4 @@ struct options_type< index::runtime::rstar > }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_OPTIONS_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_OPTIONS_HPP diff --git a/include/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp b/include/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp new file mode 100644 index 000000000..837ddbeec --- /dev/null +++ b/include/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp @@ -0,0 +1,16 @@ +// Boost.Geometry Index +// +// R-tree quadratic algorithm implementation +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_QUADRATIC_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_QUADRATIC_HPP + +#include + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_QUADRATIC_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp similarity index 94% rename from include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp rename to include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp index 7d13f278e..eeda1adec 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp @@ -2,23 +2,23 @@ // // R-tree quadratic split algorithm implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_QUADRATIC_REDISTRIBUTE_ELEMENTS_HPP #include -#include -#include +#include +#include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -289,4 +289,4 @@ struct redistribute_elements #include -#include -#include -#include +#include +#include +#include -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -241,4 +241,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_CHOOSE_NEXT_NODE_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp similarity index 98% rename from include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp rename to include/boost/geometry/index/detail/rtree/rstar/insert.hpp index 5de0738f3..a20646922 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/rstar/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp @@ -2,16 +2,16 @@ // // R-tree R*-tree insert algorithm implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_INSERT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_INSERT_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -522,4 +522,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_INSERT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp similarity index 95% rename from include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp rename to include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp index 6958cd604..75c78f0b5 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp @@ -2,24 +2,24 @@ // // R-tree R*-tree split algorithm implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP -#include +#include -#include -#include -#include +#include +#include +#include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -405,4 +405,4 @@ struct redistribute_elements +#include +#include + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_RSTAR_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp similarity index 89% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp rename to include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp index 3a1dd50be..81596b84b 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp @@ -2,17 +2,17 @@ // // R-tree boxes validating visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_BOXES_OK_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_BOXES_OK_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -117,6 +117,10 @@ private: } // namespace visitors +#ifndef BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE +#error "To use are_boxes_ok BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" +#endif + template bool are_boxes_ok(index::rtree const& tree, bool exact_match = true) @@ -138,4 +142,4 @@ bool are_boxes_ok(index::rtree const& }}}}} // namespace boost::geometry::index::detail::rtree -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_BOXES_OK_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp similarity index 86% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp rename to include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp index 01576d2dd..b2a0d4134 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp @@ -2,16 +2,16 @@ // // R-tree levels validating visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_LEVELS_OK_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_LEVELS_OK_HPP -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -88,6 +88,10 @@ private: } // namespace visitors +#ifndef BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE +#error "To use are_levels_ok() BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" +#endif + template bool are_levels_ok(index::rtree const& tree) { @@ -108,4 +112,4 @@ bool are_levels_ok(index::rtree const& }}}}} // namespace boost::geometry::index::detail::rtree -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ARE_LEVELS_OK_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/children_box.hpp b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp similarity index 84% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/children_box.hpp rename to include/boost/geometry/index/detail/rtree/visitors/children_box.hpp index 5f83cf909..0536d0043 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp @@ -2,16 +2,16 @@ // // R-tree node children box calculating visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_CHILDREN_BOX_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_CHILDREN_BOX_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -55,4 +55,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_CHILDREN_BOX_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp similarity index 91% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp rename to include/boost/geometry/index/detail/rtree/visitors/copy.hpp index dddbe3c60..1819f4a95 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/copy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp @@ -2,16 +2,16 @@ // // R-tree deep copying visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -91,4 +91,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COPY_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp b/include/boost/geometry/index/detail/rtree/visitors/count.hpp similarity index 93% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp rename to include/boost/geometry/index/detail/rtree/visitors/count.hpp index 72e355919..2c1d8717f 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/count.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/count.hpp @@ -2,16 +2,16 @@ // // R-tree count visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -119,4 +119,4 @@ struct count }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_COUNT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp similarity index 87% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp rename to include/boost/geometry/index/detail/rtree/visitors/destroy.hpp index 462d58bff..2cc1e96b4 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp @@ -2,16 +2,16 @@ // // R-tree destroying visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -68,4 +68,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/gl_draw.hpp b/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp similarity index 84% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/gl_draw.hpp rename to include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp index cf8ec843a..a5fabdc01 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp @@ -2,16 +2,16 @@ // // R-tree OpenGL drawing visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_GL_DRAW_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_GL_DRAW_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -26,7 +26,7 @@ struct gl_draw_point template struct gl_draw_point { - static inline void apply(Point const& p, typename index::traits::coordinate_type::type z) + static inline void apply(Point const& p, typename index::detail::traits::coordinate_type::type z) { glBegin(GL_POINT); glVertex3f(geometry::get<0>(p), geometry::get<1>(p), z); @@ -41,7 +41,7 @@ struct gl_draw_box template struct gl_draw_box { - static inline void apply(Box const& b, typename index::traits::coordinate_type::type z) + static inline void apply(Box const& b, typename index::detail::traits::coordinate_type::type z) { glBegin(GL_LINE_LOOP); glVertex3f(geometry::get(b), geometry::get(b), z); @@ -60,9 +60,9 @@ struct gl_draw_indexable template struct gl_draw_indexable { - static const size_t dimension = index::traits::dimension::value; + static const size_t dimension = index::detail::traits::dimension::value; - static inline void apply(Indexable const& i, typename index::traits::coordinate_type::type z) + static inline void apply(Indexable const& i, typename index::detail::traits::coordinate_type::type z) { gl_draw_box::apply(i, z); } @@ -71,9 +71,9 @@ struct gl_draw_indexable template struct gl_draw_indexable { - static const size_t dimension = index::traits::dimension::value; + static const size_t dimension = index::detail::traits::dimension::value; - static inline void apply(Indexable const& i, typename index::traits::coordinate_type::type z) + static inline void apply(Indexable const& i, typename index::detail::traits::coordinate_type::type z) { gl_draw_point::apply(i, z); } @@ -84,11 +84,11 @@ struct gl_draw_indexable namespace detail { template -inline void gl_draw_indexable(Indexable const& i, typename index::traits::coordinate_type::type z) +inline void gl_draw_indexable(Indexable const& i, typename index::detail::traits::coordinate_type::type z) { dispatch::gl_draw_indexable< Indexable, - typename index::traits::tag::type + typename index::detail::traits::tag::type >::apply(i, z); } @@ -103,7 +103,7 @@ struct gl_draw : public rtree::visitor::max)(), - typename index::traits::coordinate_type::type z_coord_level_multiplier = 1 + typename index::detail::traits::coordinate_type::type z_coord_level_multiplier = 1 ) : tr(t) , level_f(level_first) @@ -180,7 +180,7 @@ struct gl_draw : public rtree::visitor::type z_mul; + typename index::detail::traits::coordinate_type::type z_mul; size_t level; }; @@ -191,7 +191,7 @@ template const& tree, size_t level_first = 0, size_t level_last = (std::numeric_limits::max)(), - typename index::traits::coordinate_type< + typename index::detail::traits::coordinate_type< typename rtree::box_type >::type z_coord_level_multiplier = 1 ) @@ -218,4 +218,4 @@ void gl_draw(rtree const& tree, }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_GL_DRAW_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_GL_DRAW_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp similarity index 98% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp rename to include/boost/geometry/index/detail/rtree/visitors/insert.hpp index 1766fef3a..84b25398a 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -2,18 +2,18 @@ // // R-tree inserting visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_INSERT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_INSERT_HPP -#include +#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -504,4 +504,4 @@ public: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_INSERT_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_INSERT_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp b/include/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp similarity index 77% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp rename to include/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp index 7c22e3747..ce8608f22 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp @@ -2,16 +2,16 @@ // // R-tree leaf node checking visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_IS_LEAF_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_IS_LEAF_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -40,4 +40,4 @@ struct is_leaf : public rtree::visitor +#include -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { @@ -338,4 +338,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_QUERY_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_NEAREST_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/print.hpp b/include/boost/geometry/index/detail/rtree/visitors/print.hpp similarity index 92% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/print.hpp rename to include/boost/geometry/index/detail/rtree/visitors/print.hpp index 8c48ecb08..c28c0a0fc 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/print.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/print.hpp @@ -2,14 +2,14 @@ // // R-tree ostreaming visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_PRINT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_PRINT_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_PRINT_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_PRINT_HPP #include @@ -71,7 +71,7 @@ struct print_indexable template struct print_indexable { - static const size_t dimension = index::traits::dimension::value; + static const size_t dimension = index::detail::traits::dimension::value; static inline void apply(std::ostream &os, Indexable const& i) { @@ -86,7 +86,7 @@ struct print_indexable template struct print_indexable { - static const size_t dimension = index::traits::dimension::value; + static const size_t dimension = index::detail::traits::dimension::value; static inline void apply(std::ostream &os, Indexable const& i) { @@ -194,4 +194,4 @@ std::ostream & operator<<(std::ostream & os, rtree +#include -#include +#include #include @@ -328,4 +328,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP diff --git a/include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp similarity index 86% rename from include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp rename to include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index 15e40e966..3ceec4d45 100644 --- a/include/boost/geometry/extensions/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -2,18 +2,18 @@ // // R-tree spatial query visitor implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP -#include +#include -#include +#include namespace boost { namespace geometry { namespace index { @@ -78,4 +78,4 @@ struct spatial_query }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_SPATIAL_QUERY_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP diff --git a/include/boost/geometry/extensions/index/detail/static_vector.hpp b/include/boost/geometry/index/detail/static_vector.hpp similarity index 98% rename from include/boost/geometry/extensions/index/detail/static_vector.hpp rename to include/boost/geometry/index/detail/static_vector.hpp index 675012b01..7f336d70c 100644 --- a/include/boost/geometry/extensions/index/detail/static_vector.hpp +++ b/include/boost/geometry/index/detail/static_vector.hpp @@ -1,13 +1,13 @@ // Boost.Geometry Index // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_STATIC_VECTOR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_STATIC_VECTOR_HPP #include #include @@ -28,7 +28,7 @@ #include #include -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { @@ -803,4 +803,4 @@ private: }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_STATIC_VECTOR_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_STATIC_VECTOR_HPP diff --git a/include/boost/geometry/extensions/index/detail/tags.hpp b/include/boost/geometry/index/detail/tags.hpp similarity index 67% rename from include/boost/geometry/extensions/index/detail/tags.hpp rename to include/boost/geometry/index/detail/tags.hpp index a49532008..4d462df7e 100644 --- a/include/boost/geometry/extensions/index/detail/tags.hpp +++ b/include/boost/geometry/index/detail/tags.hpp @@ -2,14 +2,14 @@ // // Tags used by the predicates checks implementation. // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_TAGS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DETAIL_TAGS_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_TAGS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_TAGS_HPP namespace boost { namespace geometry { namespace index { @@ -22,4 +22,4 @@ struct envelope_tag {}; }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP +#endif // BOOST_GEOMETRY_INDEX_RTREE_TAGS_HPP diff --git a/include/boost/geometry/extensions/index/detail/tuples.hpp b/include/boost/geometry/index/detail/tuples.hpp similarity index 93% rename from include/boost/geometry/extensions/index/detail/tuples.hpp rename to include/boost/geometry/index/detail/tuples.hpp index 31e6bfec4..d2100e775 100644 --- a/include/boost/geometry/extensions/index/detail/tuples.hpp +++ b/include/boost/geometry/index/detail/tuples.hpp @@ -1,13 +1,13 @@ // Boost.Geometry Index // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TUPLES_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TUPLES_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_TUPLES_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_TUPLES_HPP #include #include @@ -168,4 +168,4 @@ struct add_unique }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_TAGS_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_TAGS_HPP diff --git a/include/boost/geometry/extensions/index/distance_predicates.hpp b/include/boost/geometry/index/distance_predicates.hpp similarity index 96% rename from include/boost/geometry/extensions/index/distance_predicates.hpp rename to include/boost/geometry/index/distance_predicates.hpp index 7faad08ce..45f58b7c5 100644 --- a/include/boost/geometry/extensions/index/distance_predicates.hpp +++ b/include/boost/geometry/index/distance_predicates.hpp @@ -2,16 +2,16 @@ // // Spatial index distance predicates, calculators and checkers used in nearest neighbor query // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP +#ifndef BOOST_GEOMETRY_INDEX_DISTANCE_PREDICATES_HPP +#define BOOST_GEOMETRY_INDEX_DISTANCE_PREDICATES_HPP -#include +#include /*! \defgroup distance_predicates Distance predicates (boost::geometry::index::) @@ -197,4 +197,4 @@ bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& max }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_DISTANCE_PREDICATES_HPP +#endif // BOOST_GEOMETRY_INDEX_DISTANCE_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/inserter.hpp b/include/boost/geometry/index/inserter.hpp similarity index 87% rename from include/boost/geometry/extensions/index/inserter.hpp rename to include/boost/geometry/index/inserter.hpp index 35497afb5..7c489bc3f 100644 --- a/include/boost/geometry/extensions/index/inserter.hpp +++ b/include/boost/geometry/index/inserter.hpp @@ -2,14 +2,14 @@ // // Insert iterator // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_INSERTER_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_INSERTER_HPP +#ifndef BOOST_GEOMETRY_INDEX_INSERTER_HPP +#define BOOST_GEOMETRY_INDEX_INSERTER_HPP #include @@ -75,4 +75,4 @@ insert_iterator inserter(Container & c) }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_INSERTER_HPP +#endif // BOOST_GEOMETRY_INDEX_INSERTER_HPP diff --git a/include/boost/geometry/extensions/index/parameters.hpp b/include/boost/geometry/index/parameters.hpp similarity index 96% rename from include/boost/geometry/extensions/index/parameters.hpp rename to include/boost/geometry/index/parameters.hpp index 7b8a9a594..60d7d33cc 100644 --- a/include/boost/geometry/extensions/index/parameters.hpp +++ b/include/boost/geometry/index/parameters.hpp @@ -2,14 +2,14 @@ // // R-tree algorithms parameters // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP +#ifndef BOOST_GEOMETRY_INDEX_PARAMETERS_HPP +#define BOOST_GEOMETRY_INDEX_PARAMETERS_HPP #include @@ -205,4 +205,4 @@ private: }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PARAMETERS_HPP +#endif // BOOST_GEOMETRY_INDEX_PARAMETERS_HPP diff --git a/include/boost/geometry/extensions/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp similarity index 95% rename from include/boost/geometry/extensions/index/predicates.hpp rename to include/boost/geometry/index/predicates.hpp index ee8554ba6..c992e5a9b 100644 --- a/include/boost/geometry/extensions/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -2,14 +2,14 @@ // // Spatial query predicates // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP +#ifndef BOOST_GEOMETRY_INDEX_PREDICATES_HPP +#define BOOST_GEOMETRY_INDEX_PREDICATES_HPP #include #include @@ -18,7 +18,7 @@ // TODO: awulkiew - temporary #include -#include +#include /*! \defgroup predicates Spatial predicates (boost::geometry::index::) @@ -256,4 +256,4 @@ operator!(boost::geometry::index::detail::not_within const& p) return boost::geometry::index::detail::within(p.geometry); } -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_PREDICATES_HPP +#endif // BOOST_GEOMETRY_INDEX_PREDICATES_HPP diff --git a/include/boost/geometry/extensions/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp similarity index 95% rename from include/boost/geometry/extensions/index/rtree.hpp rename to include/boost/geometry/index/rtree.hpp index 977a06d8d..5e3e6601f 100644 --- a/include/boost/geometry/extensions/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -3,14 +3,14 @@ // R-tree implementation // // Copyright (c) 2008 Federico J. Fernandez. -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP +#ifndef BOOST_GEOMETRY_INDEX_RTREE_HPP +#define BOOST_GEOMETRY_INDEX_RTREE_HPP #include @@ -19,34 +19,34 @@ #include -#include -#include +#include +#include -#include -#include +#include +#include -#include -#include -#include +#include +#include +#include -#include +#include -#include +#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include +#include +#include +#include //#include -#include +#include // TODO change the name to bounding_tree @@ -116,11 +116,12 @@ public: /*! \brief The Indexable type to which Value is translated. */ typedef typename translator::indexable_type::type indexable_type; /*! \brief The Box type used by the R-tree. */ - typedef typename index::detail::default_box_type::type box_type; + typedef typename index::detail::default_box_type::type envelope_type; #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) private: #endif + typedef envelope_type box_type; typedef typename detail::rtree::options_type::type options_type; typedef typename options_type::node_tag node_tag; typedef detail::rtree::allocators allocators_type; @@ -908,18 +909,18 @@ public: } /*! - \brief Returns the box containing all values stored in the container. + \brief Returns the box able to contain all values stored in the container. - Returns the box containing all values stored in the container. + Returns the box able to contain all values stored in the container. If the container is empty the result of \c geometry::assign_inverse() is returned. - \return The box containing all values stored in the container or an invalid box if + \return The box able to contain all values stored in the container or an invalid box if there are no values in the container. \par Throws Nothing. */ - inline box_type const& box() const + inline envelope_type const& envelope() const { return m_box; } @@ -1542,7 +1543,7 @@ inline bool empty(rtree const& tree) /*! \brief Get the box containing all stored values or an invalid box if the index has no values. -It calls \c rtree::box(). +It calls \c rtree::envelope(). \ingroup rtree_functions @@ -1552,9 +1553,9 @@ It calls \c rtree::box(). */ template inline typename rtree::box_type const& -box(rtree const& tree) +envelope(rtree const& tree) { - return tree.box(); + return tree.envelope(); } }}} // namespace boost::geometry::index @@ -1593,13 +1594,13 @@ struct indexed_access, mi static inline coordinate_type get(index::rtree const& tree) { - return geometry::get(tree.box()); + return geometry::get(tree.envelope()); } static inline void set(index::rtree & tree, coordinate_type const& value) { - return geometry::set(tree.box(), value); + return geometry::set(tree.envelope(), value); } }; @@ -1614,13 +1615,13 @@ struct indexed_access, ma static inline coordinate_type get(index::rtree const& tree) { - return geometry::get(tree.box()); + return geometry::get(tree.envelope()); } static inline void set(index::rtree & tree, coordinate_type const& value) { - return geometry::set(tree.box(), value); + return geometry::set(tree.envelope(), value); } }; @@ -1629,4 +1630,4 @@ struct indexed_access, ma }} //namespace boost::geometry -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_RTREE_HPP +#endif // BOOST_GEOMETRY_INDEX_RTREE_HPP diff --git a/include/boost/geometry/extensions/index/translator/def.hpp b/include/boost/geometry/index/translator/def.hpp similarity index 92% rename from include/boost/geometry/extensions/index/translator/def.hpp rename to include/boost/geometry/index/translator/def.hpp index 87f238312..1ff01b4eb 100644 --- a/include/boost/geometry/extensions/index/translator/def.hpp +++ b/include/boost/geometry/index/translator/def.hpp @@ -2,16 +2,16 @@ // // Default translator // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_DEF_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_DEF_HPP +#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP +#define BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP -#include +#include namespace boost { namespace geometry { namespace index { namespace translator { @@ -150,4 +150,4 @@ struct def< boost::tuple > }}}} // namespace boost::geometry::index::translator -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_DEF_HPP +#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP diff --git a/include/boost/geometry/extensions/index/translator/helpers.hpp b/include/boost/geometry/index/translator/helpers.hpp similarity index 93% rename from include/boost/geometry/extensions/index/translator/helpers.hpp rename to include/boost/geometry/index/translator/helpers.hpp index c439d0405..494cfe02e 100644 --- a/include/boost/geometry/extensions/index/translator/helpers.hpp +++ b/include/boost/geometry/index/translator/helpers.hpp @@ -2,14 +2,14 @@ // // Translators helper functions // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_HELPERS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_HELPERS_HPP +#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP +#define BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP #include @@ -21,7 +21,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { namespace translator { @@ -191,4 +191,4 @@ struct equals< std::pair > }}}} // namespace boost::geometry::index::translator -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_HELPERS_HPP +#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP diff --git a/include/boost/geometry/extensions/index/translator/index.hpp b/include/boost/geometry/index/translator/index.hpp similarity index 83% rename from include/boost/geometry/extensions/index/translator/index.hpp rename to include/boost/geometry/index/translator/index.hpp index b49d774bb..e20d90ee6 100644 --- a/include/boost/geometry/extensions/index/translator/index.hpp +++ b/include/boost/geometry/index/translator/index.hpp @@ -2,16 +2,16 @@ // // Translator translating random-access container index value to Indexable object // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP +#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP +#define BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP -#include +#include namespace boost { namespace geometry { namespace index { namespace translator { @@ -60,4 +60,4 @@ private: }}}} // namespace boost::geometry::index::translator -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_INDEX_HPP +#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP diff --git a/include/boost/geometry/extensions/index/translator/translator.hpp b/include/boost/geometry/index/translator/translator.hpp similarity index 60% rename from include/boost/geometry/extensions/index/translator/translator.hpp rename to include/boost/geometry/index/translator/translator.hpp index 8caef4dab..07aa78241 100644 --- a/include/boost/geometry/extensions/index/translator/translator.hpp +++ b/include/boost/geometry/index/translator/translator.hpp @@ -1,16 +1,16 @@ // Boost.Geometry Index // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_TRANSLATOR_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_TRANSLATOR_HPP +#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP +#define BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP -#include -#include +#include +#include namespace boost { namespace geometry { namespace index { namespace translator { @@ -26,4 +26,4 @@ struct indexable_type }}}} // namespace boost::geometry::index::translator -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TRANSLATOR_TRANSLATOR_HPP +#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 390409723..f1bab92bd 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,6 +1,6 @@ # Boost.Geometry Index # -# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/algorithms/Jamfile.v2 b/test/algorithms/Jamfile.v2 index 43c9a4217..fb92b276e 100644 --- a/test/algorithms/Jamfile.v2 +++ b/test/algorithms/Jamfile.v2 @@ -1,6 +1,6 @@ # Boost.Geometry Index # -# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/algorithms/content.cpp b/test/algorithms/content.cpp index 1d52cc5c2..0d8cc0818 100644 --- a/test/algorithms/content.cpp +++ b/test/algorithms/content.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -27,8 +27,8 @@ void test_large_integers() bg::read_wkt(box_li, int_box); bg::read_wkt(box_li, double_box); - double int_value = bgi::content(int_box); - double double_value = bgi::content(double_box); + double int_value = bgi::detail::content(int_box); + double double_value = bgi::detail::content(double_box); BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); } diff --git a/test/algorithms/intersection_content.cpp b/test/algorithms/intersection_content.cpp index 4692f7a6b..b53873bcd 100644 --- a/test/algorithms/intersection_content.cpp +++ b/test/algorithms/intersection_content.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -30,8 +30,8 @@ void test_large_integers() bg::read_wkt(box_li2, int_box2); bg::read_wkt(box_li2, double_box2); - double int_value = bgi::intersection_content(int_box1, int_box2); - double double_value = bgi::intersection_content(double_box1, double_box2); + double int_value = bgi::detail::intersection_content(int_box1, int_box2); + double double_value = bgi::detail::intersection_content(double_box1, double_box2); BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); } diff --git a/test/algorithms/is_valid.cpp b/test/algorithms/is_valid.cpp index f2190cd7f..ff3dae0ba 100644 --- a/test/algorithms/is_valid.cpp +++ b/test/algorithms/is_valid.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -11,7 +11,7 @@ #include -#include +#include #include #include @@ -22,7 +22,7 @@ template void test(Geometry const& geometry, bool expected_value) { - bool value = bgi::is_valid(geometry); + bool value = bgi::detail::is_valid(geometry); #ifdef GEOMETRY_TEST_DEBUG std::ostringstream out; @@ -63,13 +63,13 @@ void test_large_integers() bg::read_wkt(box_li, int_box); bg::read_wkt(box_li, double_box); - BOOST_CHECK(bgi::is_valid(int_box) == bgi::is_valid(double_box)); + BOOST_CHECK(bgi::detail::is_valid(int_box) == bgi::detail::is_valid(double_box)); std::string const box_li2 = "POLYGON((1872000 528000, 1536119 192000))"; bg::read_wkt(box_li2, int_box); bg::read_wkt(box_li2, double_box); - BOOST_CHECK(bgi::is_valid(int_box) == bgi::is_valid(double_box)); + BOOST_CHECK(bgi::detail::is_valid(int_box) == bgi::detail::is_valid(double_box)); } int test_main(int, char* []) diff --git a/test/algorithms/margin.cpp b/test/algorithms/margin.cpp index fa4205897..225676f68 100644 --- a/test/algorithms/margin.cpp +++ b/test/algorithms/margin.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -27,8 +27,8 @@ void test_large_integers() bg::read_wkt(box_li, int_box); bg::read_wkt(box_li, double_box); - double int_value = bgi::margin(int_box); - double double_value = bgi::margin(double_box); + double int_value = bgi::detail::margin(int_box); + double double_value = bgi::detail::margin(double_box); BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); } diff --git a/test/algorithms/minmaxdist.cpp b/test/algorithms/minmaxdist.cpp index df770cb83..dd7e8e5e2 100644 --- a/test/algorithms/minmaxdist.cpp +++ b/test/algorithms/minmaxdist.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -11,7 +11,7 @@ #include -#include +#include #include #include @@ -23,7 +23,7 @@ template void test(Point const& pt, Indexable const& indexable, typename bg::default_distance_result::type expected_value) { - typename bg::default_distance_result::type value = bgi::minmaxdist(pt, indexable); + typename bg::default_distance_result::type value = bgi::detail::minmaxdist(pt, indexable); #ifdef GEOMETRY_TEST_DEBUG std::ostringstream out; @@ -65,7 +65,7 @@ void test_large_integers() bg::read_wkt(box_li, int_box); bg::read_wkt(box_li, double_box); - BOOST_CHECK(bgi::minmaxdist(int_pt, int_box) == bgi::minmaxdist(double_pt, double_box)); + BOOST_CHECK(bgi::detail::minmaxdist(int_pt, int_box) == bgi::detail::minmaxdist(double_pt, double_box)); } int test_main(int, char* []) diff --git a/test/algorithms/test_content.hpp b/test/algorithms/test_content.hpp index 9d880ae71..226bbcd36 100644 --- a/test/algorithms/test_content.hpp +++ b/test/algorithms/test_content.hpp @@ -1,33 +1,33 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_CONTENT_HPP +#ifndef BOOST_GEOMETRY_INDEX_TEST_CONTENT_HPP +#define BOOST_GEOMETRY_INDEX_TEST_CONTENT_HPP #include -#include +#include //#include template void test_content(Geometry const& geometry, - typename bgi::default_content_result::type expected_value) + typename bgi::detail::default_content_result::type expected_value) { - typename bgi::default_content_result::type value = bgi::content(geometry); + typename bgi::detail::default_content_result::type value = bgi::detail::content(geometry); #ifdef GEOMETRY_TEST_DEBUG std::ostringstream out; out << typeid(typename bg::coordinate_type::type).name() << " " - << typeid(typename bgi::default_content_result::type).name() + << typeid(typename bgi::detail::default_content_result::type).name() << " " << "content : " << value << std::endl; @@ -39,7 +39,7 @@ void test_content(Geometry const& geometry, template void test_geometry(std::string const& wkt, - typename bgi::default_content_result::type expected_value) + typename bgi::detail::default_content_result::type expected_value) { Geometry geometry; bg::read_wkt(wkt, geometry); diff --git a/test/algorithms/test_intersection_content.hpp b/test/algorithms/test_intersection_content.hpp index 9998e4543..5a074b7c1 100644 --- a/test/algorithms/test_intersection_content.hpp +++ b/test/algorithms/test_intersection_content.hpp @@ -1,30 +1,30 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_INTERSECTION_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_INTERSECTION_CONTENT_HPP +#ifndef BOOST_GEOMETRY_INDEX_TEST_INTERSECTION_CONTENT_HPP +#define BOOST_GEOMETRY_INDEX_TEST_INTERSECTION_CONTENT_HPP #include -#include +#include template void test_intersection_content(Geometry const& geometry1, Geometry const& geometry2, - typename bgi::default_content_result::type expected_value) + typename bgi::detail::default_content_result::type expected_value) { - typename bgi::default_content_result::type value = bgi::intersection_content(geometry1, geometry2); + typename bgi::detail::default_content_result::type value = bgi::detail::intersection_content(geometry1, geometry2); #ifdef GEOMETRY_TEST_DEBUG std::ostringstream out; out << typeid(typename bg::coordinate_type::type).name() << " " - << typeid(typename bgi::default_content_result::type).name() + << typeid(typename bgi::detail::default_content_result::type).name() << " " << "intersection_content : " << value << std::endl; @@ -36,7 +36,7 @@ void test_intersection_content(Geometry const& geometry1, Geometry const& geomet template void test_geometry(std::string const& wkt1, std::string const& wkt2, - typename bgi::default_content_result::type expected_value) + typename bgi::detail::default_content_result::type expected_value) { Geometry geometry1, geometry2; bg::read_wkt(wkt1, geometry1); diff --git a/test/algorithms/test_margin.hpp b/test/algorithms/test_margin.hpp index 2dfef3b34..7c0cb0d52 100644 --- a/test/algorithms/test_margin.hpp +++ b/test/algorithms/test_margin.hpp @@ -1,32 +1,32 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_MARGIN_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_MARGIN_HPP +#ifndef BOOST_GEOMETRY_INDEX_TEST_MARGIN_HPP +#define BOOST_GEOMETRY_INDEX_TEST_MARGIN_HPP #include -#include +#include //#include template void test_margin(Geometry const& geometry, - typename bgi::default_margin_result::type expected_value) + typename bgi::detail::default_margin_result::type expected_value) { - typename bgi::default_margin_result::type value = bgi::margin(geometry); + typename bgi::detail::default_margin_result::type value = bgi::detail::margin(geometry); #ifdef GEOMETRY_TEST_DEBUG std::ostringstream out; out << typeid(typename bg::coordinate_type::type).name() << " " - << typeid(typename bgi::default_margin_result::type).name() + << typeid(typename bgi::detail::default_margin_result::type).name() << " " << "content : " << value << std::endl; @@ -38,7 +38,7 @@ void test_margin(Geometry const& geometry, template void test_geometry(std::string const& wkt, - typename bgi::default_margin_result::type expected_value) + typename bgi::detail::default_margin_result::type expected_value) { Geometry geometry; bg::read_wkt(wkt, geometry); diff --git a/test/algorithms/test_union_content.hpp b/test/algorithms/test_union_content.hpp index 0310ae266..fe0268795 100644 --- a/test/algorithms/test_union_content.hpp +++ b/test/algorithms/test_union_content.hpp @@ -1,30 +1,30 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_UNION_CONTENT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_UNION_CONTENT_HPP +#ifndef BOOST_GEOMETRY_INDEX_TEST_UNION_CONTENT_HPP +#define BOOST_GEOMETRY_INDEX_TEST_UNION_CONTENT_HPP #include -#include +#include template void test_union_content(Geometry const& geometry1, Geometry const& geometry2, - typename bgi::default_content_result::type expected_value) + typename bgi::detail::default_content_result::type expected_value) { - typename bgi::default_content_result::type value = bgi::union_content(geometry1, geometry2); + typename bgi::detail::default_content_result::type value = bgi::detail::union_content(geometry1, geometry2); #ifdef GEOMETRY_TEST_DEBUG std::ostringstream out; out << typeid(typename bg::coordinate_type::type).name() << " " - << typeid(typename bgi::default_content_result::type).name() + << typeid(typename bgi::detail::default_content_result::type).name() << " " << "union_content : " << value << std::endl; @@ -36,7 +36,7 @@ void test_union_content(Geometry const& geometry1, Geometry const& geometry2, template void test_geometry(std::string const& wkt1, std::string const& wkt2, - typename bgi::default_content_result::type expected_value) + typename bgi::detail::default_content_result::type expected_value) { Geometry geometry1, geometry2; bg::read_wkt(wkt1, geometry1); diff --git a/test/algorithms/union_content.cpp b/test/algorithms/union_content.cpp index 6acac580f..4939e57ad 100644 --- a/test/algorithms/union_content.cpp +++ b/test/algorithms/union_content.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -30,8 +30,8 @@ void test_large_integers() bg::read_wkt(box_li2, int_box2); bg::read_wkt(box_li2, double_box2); - double int_value = bgi::union_content(int_box1, int_box2); - double double_value = bgi::union_content(double_box1, double_box2); + double int_value = bgi::detail::union_content(int_box1, int_box2); + double double_value = bgi::detail::union_content(double_box1, double_box2); BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); } diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp index 770657d48..492d48530 100644 --- a/test/geometry_index_test_common.hpp +++ b/test/geometry_index_test_common.hpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -12,7 +12,7 @@ #include #define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE -#include +#include #include diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index 543f40c70..a99fd208d 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -1,6 +1,6 @@ # Boost.Geometry Index # -# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 365dae009..85a8e130e 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 668ab3e03..404a913fe 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1,14 +1,14 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_HPP +#ifndef BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP +#define BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP #include @@ -16,8 +16,8 @@ #include #include -#include -#include +#include +#include //#include //#include @@ -1291,7 +1291,7 @@ struct test_geometry_algorithms<2> }; template -void test_rtree_box(Parameters const& parameters) +void test_rtree_envelope(Parameters const& parameters) { typedef bgi::rtree Tree; typedef typename Tree::box_type B; @@ -1304,15 +1304,21 @@ void test_rtree_box(Parameters const& parameters) std::vector input; B qbox; - BOOST_CHECK(bg::equals(t.box(), b)); + BOOST_CHECK(bg::equals(t.envelope(), b)); generate_rtree(t, input, qbox); BOOST_FOREACH(Value const& v, input) bg::expand(b, t.translator()(v)); - BOOST_CHECK(bg::equals(t.box(), b)); + BOOST_CHECK(bg::equals(t.envelope(), b)); + { + using namespace bg; + B temp_b; + envelope(t, temp_b); + BOOST_CHECK(equals(temp_b, b)); + } BOOST_CHECK(bg::equals(bg::return_envelope(t), b)); BOOST_CHECK(bg::equals(bg::return_centroid

                                                                                                                    (t), bg::return_centroid

                                                                                                                    (b))); test_geometry_algorithms::value>::apply(t, b); @@ -1328,21 +1334,21 @@ void test_rtree_box(Parameters const& parameters) BOOST_FOREACH(Value const& v, input) bg::expand(b, t.translator()(v)); - BOOST_CHECK(bg::equals(t.box(), b)); + BOOST_CHECK(bg::equals(t.envelope(), b)); Tree t2(t); - BOOST_CHECK(bg::equals(t2.box(), b)); + BOOST_CHECK(bg::equals(t2.envelope(), b)); t2.clear(); t2 = t; - BOOST_CHECK(bg::equals(t2.box(), b)); + BOOST_CHECK(bg::equals(t2.envelope(), b)); t2.clear(); t2 = boost::move(t); - BOOST_CHECK(bg::equals(t2.box(), b)); + BOOST_CHECK(bg::equals(t2.envelope(), b)); t.clear(); bg::assign_inverse(b); - BOOST_CHECK(bg::equals(t.box(), b)); + BOOST_CHECK(bg::equals(t.envelope(), b)); } // run all tests for one Algorithm for some number of rtrees @@ -1366,7 +1372,7 @@ void test_rtree_for_point(Parameters const& parameters = Parameters()) test_count_rtree_values(parameters); test_rtree_count(parameters); - test_rtree_box(parameters); + test_rtree_envelope(parameters); } template @@ -1386,7 +1392,7 @@ void test_rtree_for_box(Parameters const& parameters = Parameters()) test_count_rtree_values(parameters); test_rtree_count(parameters); - test_rtree_box(parameters); + test_rtree_envelope(parameters); } #endif diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 138a27de8..b90f217c8 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -3,18 +3,18 @@ // R-tree nodes based on runtime-polymorphism, storing static-size containers // test version throwing exceptions on creation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_EXCEPTIONS_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_EXCEPTIONS_HPP +#ifndef BOOST_GEOMETRY_INDEX_TEST_RTREE_EXCEPTIONS_HPP +#define BOOST_GEOMETRY_INDEX_TEST_RTREE_EXCEPTIONS_HPP #include -#include +#include #include @@ -262,4 +262,4 @@ struct create_node< }}} // namespace boost::geometry::index -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_RTREE_EXCEPTIONS_HPP +#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_EXCEPTIONS_HPP diff --git a/test/rtree/test_throwing.hpp b/test/rtree/test_throwing.hpp index acc9d4a7a..1dc56f1a9 100644 --- a/test/rtree/test_throwing.hpp +++ b/test/rtree/test_throwing.hpp @@ -2,14 +2,14 @@ // // Throwing objects implementation // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_THROWING_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_THROWING_HPP +#ifndef BOOST_GEOMETRY_INDEX_TEST_THROWING_HPP +#define BOOST_GEOMETRY_INDEX_TEST_THROWING_HPP // value @@ -141,7 +141,7 @@ struct generate_value< std::pair, throwing_value> > // //}}} // namespace boost::geometry::index -#include +#include struct throwing_static_vector_exception : public std::exception { @@ -195,4 +195,4 @@ public: } }; -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_TEST_THROWING_HPP +#endif // BOOST_GEOMETRY_INDEX_TEST_THROWING_HPP diff --git a/test/static_vector.cpp b/test/static_vector.cpp index ae54323df..03ea50e0e 100644 --- a/test/static_vector.cpp +++ b/test/static_vector.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -10,9 +10,9 @@ #include #include -#include +#include -using namespace boost::geometry::index; +using namespace boost::geometry::index::detail; class value_ndc { diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index ce4c1b672..9ab8b195d 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Additional tests -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -13,16 +13,16 @@ #include -#include +#include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace bg = boost::geometry; namespace bgi = bg::index; @@ -494,8 +494,8 @@ void mouse(int button, int state, int x, int y) 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 << ( bgi::detail::rtree::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( bgi::detail::rtree::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); std::cout << "\n"; search_valid = false; @@ -515,8 +515,8 @@ void mouse(int button, int state, int x, int y) 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 << ( bgi::detail::rtree::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( bgi::detail::rtree::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); std::cout << "\n"; search_valid = false; @@ -558,8 +558,8 @@ void keyboard(unsigned char key, int x, int y) 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 << ( bgi::detail::rtree::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" ); + std::cout << ( bgi::detail::rtree::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" ); std::cout << "\n"; search_valid = false; diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 05d24995f..41bbc22c2 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Additional tests -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -10,11 +10,12 @@ #include #include -#include -#include +#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE +#include +#include -#include -#include +#include +#include #include #include @@ -181,11 +182,11 @@ int main() } // check - if ( bgi::are_boxes_ok(t) ) + if ( bgi::detail::rtree::are_boxes_ok(t) ) std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; - if ( bgi::are_levels_ok(t) ) + if ( bgi::detail::rtree::are_levels_ok(t) ) std::cout << "LEVELS OK\n"; else std::cout << "WRONG LEVELS\n"; @@ -201,7 +202,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -228,7 +229,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t_copy.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t_copy.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -247,7 +248,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.query(!bgi::disjoint(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.spatial_query(!bgi::disjoint(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -265,7 +266,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.spatial_query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -283,7 +284,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.query( + t.spatial_query( std::make_pair( B(P(x - 10, y - 10), P(x + 10, y + 10)), bgi::value(test_pred< std::pair >()) @@ -305,7 +306,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.query( + t.spatial_query( boost::make_tuple( B(P(x - 10, y - 10), P(x + 10, y + 10)), bgi::value(test_pred< std::pair >()) @@ -355,7 +356,7 @@ int main() float x = coords[i].first + 100; float y = coords[i].second + 100; std::pair result; - temp += t.nearest(bgi::unbounded(P(x, y)), result); + temp += t.nearest_query(bgi::unbounded(P(x, y)), result); } std::cout << "time: " << tim.elapsed() << "s\n"; std::cout << "found: " << temp << "\n"; @@ -372,7 +373,7 @@ int main() float x = coords[i].first + 100; float y = coords[i].second + 100; std::vector< std::pair > result; - temp += t.nearest(P(x, y), 5, std::back_inserter(result)); + temp += t.nearest_query(P(x, y), 5, std::back_inserter(result)); } std::cout << "time: " << tim.elapsed() << "s\n"; std::cout << "found: " << temp << "\n"; @@ -397,7 +398,7 @@ int main() it != v.end(); ++it ) { - distance_type cd = bgi::comparable_distance_near(P(x, y), it->first); + distance_type cd = bgi::detail::comparable_distance_near(P(x, y), it->first); if ( cd < dist ) { @@ -428,11 +429,11 @@ int main() } // check - if ( bgi::are_boxes_ok(t) ) + if ( bgi::detail::rtree::are_boxes_ok(t) ) std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; - if ( bgi::are_levels_ok(t) ) + if ( bgi::detail::rtree::are_levels_ok(t) ) std::cout << "LEVELS OK\n"; else std::cout << "WRONG LEVELS\n"; @@ -448,7 +449,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -472,11 +473,11 @@ int main() } // check - if ( bgi::are_boxes_ok(t) ) + if ( bgi::detail::rtree::are_boxes_ok(t) ) std::cout << "BOXES OK\n"; else std::cout << "WRONG BOXES\n"; - if ( bgi::are_levels_ok(t) ) + if ( bgi::detail::rtree::are_levels_ok(t) ) std::cout << "LEVELS OK\n"; else std::cout << "WRONG LEVELS\n"; @@ -492,7 +493,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index e362fd3af..642342c13 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Additional tests -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -10,11 +10,8 @@ #include #include -#include -#include - -#include -#include +#include +#include #include #include diff --git a/tests/main.cpp b/tests/main.cpp deleted file mode 100644 index 0fc440ff3..000000000 --- a/tests/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#define BOOST_TEST_MODULE test_module_boost_geometry_index -#include - -#include - -BOOST_AUTO_TEST_CASE( first_test_case ) -{ - ::srand( (unsigned)::time(NULL) ); -} - -#define TEST_PRINT_INFO - -#include -#include -#include - -#include - -BOOST_AUTO_TEST_CASE( last_test_case ) -{ - -#ifdef _MSC_VER - std::cin.get(); -#endif - -} diff --git a/tests/rtree_filters.hpp b/tests/rtree_filters.hpp deleted file mode 100644 index 6dd0c82a8..000000000 --- a/tests/rtree_filters.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef TESTS_RTREE_FILTERS_HPP -#define TESTS_RTREE_FILTERS_HPP - -#include -#include - -#include -#include - -#include - -#include -#include - -//template -//void tests_rtree_filters_hpp_print_range(R const& r) -//{ -// BOOST_FOREACH(typename boost::iterator_value::type const& b, r) -// { -// float min_x = b.min_corner().template get<0>(); -// float min_y = b.min_corner().template get<1>(); -// float max_x = b.max_corner().template get<0>(); -// float max_y = b.max_corner().template get<1>(); -// std::cout << "(" << min_x << ", " << min_y << ")"; -// std::cout << 'x'; -// std::cout << "(" << max_x << ", " << max_y << ")"; -// std::cout << '\n'; -// } -// std::cout << std::endl; -//} - -BOOST_AUTO_TEST_CASE(tests_rtree_query_filter) -{ -#ifdef TEST_PRINT_INFO - std::cout << "tests/rtree_filters.hpp\n"; -#endif - - typedef boost::geometry::model::point P; - typedef boost::geometry::model::box

                                                                                                                    B; - - { - namespace bgi = boost::geometry::index; - - bgi::rtree > t; - bgi::insert(t, B(P(0, 0), P(1, 1))); - bgi::insert(t, B(P(2, 2), P(3, 3))); - bgi::insert(t, B(P(4, 4), P(5, 5))); - bgi::insert(t, B(P(6, 6), P(7, 7))); - bgi::insert(t, B(P(8, 8), P(9, 9))); - - size_t n = 0; - BOOST_FOREACH(B const& b, t | bgi::query_filtered(B(P(1.5f, 1.5f), P(4.5f, 4.5f)))) - { - ++n; - } - - BOOST_CHECK(n == 2); - } -} - -#endif // TESTS_RTREE_FILTERS_HPP diff --git a/tests/rtree_function.hpp b/tests/rtree_function.hpp deleted file mode 100644 index bae08189b..000000000 --- a/tests/rtree_function.hpp +++ /dev/null @@ -1,550 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef TESTS_RTREE_FUNCTION_HPP -#define TESTS_RTREE_FUNCTION_HPP - -#include - -#include -#include -#include - -#include - -#include -#include - -#include - -namespace helpers -{ - -template -struct value_randomizer_impl_set {}; - -template -struct value_randomizer_impl_set -{ - inline static void apply( - Box & b, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type w) - { - namespace bg = boost::geometry; - typedef typename bg::index::traits::coordinate_type::type coord_t; - - coord_t c1 = ::rand() / coord_t(RAND_MAX / m); - coord_t c2 = ::rand() / coord_t(RAND_MAX / w); - - bg::set(b, c1 - c2); - bg::set(b, c1 + c2); - } -}; - -template -struct value_randomizer_impl_set -{ - inline static void apply( - Point & p, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type) - { - namespace bg = boost::geometry; - typedef typename bg::index::traits::coordinate_type::type coord_t; - - coord_t c = ::rand() / coord_t(RAND_MAX / m); - - bg::set(p, c); - } -}; - -template -struct value_randomizer_impl -{ - inline static void apply( - Indexable & i, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type w) - { - value_randomizer_impl::apply(i, m, w); - value_randomizer_impl_set< - Indexable, - D - 1, - typename boost::geometry::index::traits::tag::type - >::apply(i, m, w); - } -}; - -template -struct value_randomizer_impl -{ - inline static void apply( - Indexable & i, - typename boost::geometry::index::traits::coordinate_type::type m, - typename boost::geometry::index::traits::coordinate_type::type w) - { - value_randomizer_impl_set< - Indexable, - 0, - typename boost::geometry::index::traits::tag::type - >::apply(i, m, w); - } -}; - -template -struct value_randomizer -{ - typedef Indexable value_type; - - typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; - - inline value_randomizer(coord_t mm, coord_t ww) - : m(mm), w(ww) - {} - - inline Indexable operator()() const - { - namespace bg = boost::geometry; - namespace bgi = bg::index; - - Indexable i; - value_randomizer_impl::value>::apply(i, m, w); - return i; - } - - coord_t m, w; -}; - -template -void random_insert(Rtree & t, Cont & c, size_t n, Randomizer r) -{ - namespace bg = boost::geometry; - namespace bgi = bg::index; - - bgi::insert_iterator ii = bgi::inserter(t); - - for ( size_t i = 0 ; i < n ; ++i ) - { - typename Randomizer::value_type v = r(); - //bgi::insert(t, v); - *ii++ = v; - c.push_back(v); - } -} - -template -bool results_compare(Cont const& c1, Cont const& c2, Translator const& tr) -{ - if ( c1.size() != c2.size() ) - return false; - - for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) - { - bool found = false; - for ( typename Cont::const_iterator it2 = c2.begin() ; it2 != c2.end() ; ++it2 ) - if ( tr.equals(*it, *it2) ) - { - found = true; - break; - } - - if ( !found ) - return false; - } - - return true; -} - -template -bool nearest_results_compare(Point const& p, Cont const& c1, Cont const& c2, Translator const& tr) -{ - namespace bg = boost::geometry; - namespace bgi = boost::geometry::index; - - typedef typename bgi::translator::indexable_type::type indexable_type; - typedef bg::default_distance_result::type distance_type; - - if ( c1.size() != c2.size() ) - return false; - - if ( c1.size() == 0 && c2.size() == 0 ) - return true; - - distance_type biggest_distance1 = 0; - - for ( typename Cont::const_iterator it = c1.begin() ; it != c1.end() ; ++it ) - { - distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); - - if ( biggest_distance1 < curr_distance ) - biggest_distance1 = curr_distance; - } - - distance_type biggest_distance2 = 0; - for ( typename Cont::const_iterator it = c2.begin() ; it != c2.end() ; ++it ) - { - distance_type curr_distance = bgi::comparable_distance_near(p, tr(*it)); - - if ( biggest_distance2 < curr_distance ) - biggest_distance2 = curr_distance; - } - - return biggest_distance1 == biggest_distance2; -} - -template -struct val_mindist_cmp -{ - val_mindist_cmp(Point const& p, Translator const& t) - : pt(p), tr(t) - {} - - template - bool operator()(Value const& v1, Value const& v2) - { - return boost::geometry::index::comparable_distance_near(pt, tr(v1)) - < boost::geometry::index::comparable_distance_near(pt, tr(v2)); - } - - Point const& pt; - Translator const& tr; -}; - -template -Box values_box(Iter first, Iter last, Translator const& tr) -{ - namespace bg = boost::geometry; - namespace bgi = bg::index; - - Box b; - bg::assign_inverse(b); - - for ( ; first != last ; ++first ) - { - bg::expand(b, tr(*first)); - } - - return b; -} - -} // namespace helpers - -template -void random_query_check(Rtree const& t, Cont const& c, size_t n, Randomizer r) -{ - namespace bg = boost::geometry; - namespace bgi = bg::index; - - for ( size_t i = 0 ; i < n ; ++i ) - { - Predicate pred = Predicate(r()); - - std::vector res1, res2; - - bgi::query(t, pred, std::back_inserter(res1)); - - for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) - { - if ( bgi::predicates_check(pred, *it, t.translator()(*it)) ) - res2.push_back(*it); - } - - std::stringstream ss; - ss << "\nPredicate: " << typeid(Predicate).name() << "\n" - << "res1: " << res1.size() - << ", res2: " << res2.size()<< '\n'; - - BOOST_CHECK_MESSAGE( helpers::results_compare(res1, res2, t.translator()), ss.str()); - } -} - -template -void random_nearest_check( - Rtree const& t, - Cont const& c, - size_t n, - PointRandomizer const& pr, - size_t k, - PredicateRandomizer const& r) -{ - namespace bg = boost::geometry; - namespace bgi = bg::index; - - for ( size_t i = 0 ; i < n ; ++i ) - { - typename PointRandomizer::value_type pt = pr(); - Predicate pred = Predicate(r()); - - std::vector res1, res2; - - bgi::nearest(t, pt, k, pred, std::back_inserter(res1)); - - for ( typename Cont::const_iterator it = c.begin() ; it != c.end() ; ++it ) - { - if ( bgi::predicates_check(pred, *it, t.translator()(*it)) ) - res2.push_back(*it); - } - std::sort( - res2.begin(), - res2.end(), - helpers::val_mindist_cmp< - typename PointRandomizer::value_type, - typename Rtree::translator_type - >(pt, t.translator()) - ); - if ( k < res2.size() ) - res2.resize(k); - - std::stringstream ss; - ss << "\nPredicate: " << typeid(Predicate).name() << "\n" - << "res1: " << res1.size() - << ", res2: " << res2.size() << '\n'; - - BOOST_CHECK_MESSAGE(helpers::nearest_results_compare(pt, res1, res2, t.translator()), ss.str()); - } -} - -template -struct tests_rtree_function_queries {}; - -template -struct tests_rtree_function_queries -{ - template - inline static void apply(Rtree const& t, Cont const& v) - { - namespace bgi = boost::geometry::index; - - random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - - random_nearest_check(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, bgi::empty); - random_nearest_check(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - } -}; - -template -struct tests_rtree_function_queries -{ - template - inline static void apply(Rtree const& t, Cont const& v) - { - namespace bgi = boost::geometry::index; - - random_query_check(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - random_query_check >(t, v, 5, helpers::value_randomizer(10, 5)); - - random_nearest_check(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, bgi::empty); - random_nearest_check(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - random_nearest_check >(t, v, 5, helpers::value_randomizer

                                                                                                                    (10, 0), 3, helpers::value_randomizer(10, 5)); - } -}; - -template -void tests_rtree_function(Translator const& tr = Translator()) -{ - namespace bg = boost::geometry; - namespace bgi = bg::index; - - bgi::rtree t(tr); - std::vector v; - - typedef typename bgi::rtree::indexable_type I; - typedef typename bgi::rtree::box_type B; - typedef typename bgi::traits::point_type::type P ; - - helpers::random_insert(t, v, 10, helpers::value_randomizer(10, 1)); - - bgi::rtree t_copy(t); - - BOOST_CHECK(bgi::size(t) == 10); - BOOST_CHECK(bgi::size(t) == bgi::size(t_copy)); - BOOST_CHECK(bg::equals(bgi::box(t), bgi::box(t_copy))); - - B bt = bgi::box(t); - B bv = helpers::values_box(v.begin(), v.end(), tr); - BOOST_CHECK(bg::equals(bt, bv)); - - tests_rtree_function_queries::type>::apply(t, v); - - bgi::clear(t); - BOOST_CHECK(bgi::empty(t)); - bt = bgi::box(t); - B be; - bg::assign_inverse(be); - BOOST_CHECK(bg::equals(be, bt)); - - for ( size_t i = 3 ; i < 10 ; ++i ) - bgi::remove(t_copy, v[i]); - v.erase(v.begin() + 3, v.end()); - - tests_rtree_function_queries::type>::apply(t_copy, v); -} - -BOOST_AUTO_TEST_CASE(tests_rtree_function_box3f) -{ -#ifdef TEST_PRINT_INFO - std::cout << "tests/rtree_function_box3f\n"; -#endif - - namespace bg = boost::geometry; - namespace bgi = bg::index; - - typedef bg::model::point P; - typedef bg::model::box

                                                                                                                    B; - typedef B V; - - tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); -} - -BOOST_AUTO_TEST_CASE(tests_rtree_function_box2f) -{ -#ifdef TEST_PRINT_INFO - std::cout << "tests/rtree_function_box2f\n"; -#endif - - namespace bg = boost::geometry; - namespace bgi = bg::index; - - typedef bg::model::point P; - typedef bg::model::box

                                                                                                                    B; - typedef B V; - - tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); -} - -BOOST_AUTO_TEST_CASE(tests_rtree_function_point2f) -{ -#ifdef TEST_PRINT_INFO - std::cout << "tests/rtree_function_point2f\n"; -#endif - - namespace bg = boost::geometry; - namespace bgi = bg::index; - - typedef bg::model::point P; - typedef P V; - - tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); -} - -namespace helpers { - -template -struct value_randomizer< std::pair > -{ - typedef std::pair value_type; - - typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; - - inline value_randomizer(coord_t mm, coord_t ww) - : r(mm, ww) - {} - - inline value_type operator()() const - { - return std::make_pair(r(), ::rand()); - } - - value_randomizer r; -}; - -} // namespace helpers - -BOOST_AUTO_TEST_CASE(tests_rtree_function_pair_box2f_int) -{ -#ifdef TEST_PRINT_INFO - std::cout << "tests/rtree_function_pair_box2f_int\n"; -#endif - - namespace bg = boost::geometry; - namespace bgi = bg::index; - - typedef bg::model::point P; - typedef bg::model::box

                                                                                                                    B; - typedef std::pair V; - - tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); -} - -namespace helpers { - -template -struct value_randomizer< boost::shared_ptr< std::pair > > -{ - typedef boost::shared_ptr< std::pair > value_type; - - typedef typename boost::geometry::index::traits::coordinate_type::type coord_t; - - inline value_randomizer(coord_t mm, coord_t ww) - : r(mm, ww) - {} - - inline value_type operator()() const - { - return value_type(new std::pair(r(), ::rand())); - } - - value_randomizer r; -}; - -} // namespace helpers - -BOOST_AUTO_TEST_CASE(tests_rtree_function_shared_ptr_pair_box2f_int) -{ -#ifdef TEST_PRINT_INFO - std::cout << "tests/rtree_function_shared_ptr_pair_box2f_int\n"; -#endif - - namespace bg = boost::geometry; - namespace bgi = bg::index; - - typedef bg::model::point P; - typedef bg::model::box

                                                                                                                    B; - typedef boost::shared_ptr< std::pair > V; - - tests_rtree_function< V, bgi::linear<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::quadratic<4, 2>, bgi::translator::def >(); - tests_rtree_function< V, bgi::rstar<4, 2>, bgi::translator::def >(); -} - -#endif // TESTS_RTREE_FUNCTION_HPP diff --git a/tests/rtree_test_generator.cpp b/tests/rtree_test_generator.cpp index 4c68a5816..f5e861277 100644 --- a/tests/rtree_test_generator.cpp +++ b/tests/rtree_test_generator.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Rtree tests generator -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -61,7 +61,7 @@ int main() "// Boost.Geometry Index\n" << "// Unit Test\n" << "\n" << - "// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.\n" << + "// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.\n" << "\n" << "// Use, modification and distribution is subject to the Boost Software License,\n" << "// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" << @@ -99,7 +99,7 @@ int main() f << "# Boost.Geometry Index\n" << "#\n" << - "# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland.\n" << + "# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.\n" << "#\n" << "# Use, modification and distribution is subject to the Boost Software License,\n" << "# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n" << diff --git a/tests/static_vector.cpp b/tests/static_vector.cpp deleted file mode 100644 index c3bce7ace..000000000 --- a/tests/static_vector.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include - -struct A -{ - A() : v(0) { std::cout << "A()" << std::endl; } - A(int i) : v(i) { std::cout << "A(" << i << ")" << std::endl; } - ~A() { std::cout << "~A" << v << "()" << std::endl; } - A(A const& a) { std::cout << "A(A(" << a.v << "))" << std::endl; v = a.v; } - A & operator=(A const& a) { std::cout << "A" << v << " = A" << a.v << std::endl; v = a.v; return *this; } - int v; -}; - -int main() -{ - namespace bgi = boost::geometry::index; - - bgi::static_vector sv; - std::cout << "resize(2)" << std::endl; - sv.resize(2); // 0 0 - std::cout << "push_back(A(22))" << std::endl; - sv.push_back(A(22)); // 0 0 22 - std::cout << "push_back(A(23))" << std::endl; - sv.push_back(A(23)); // 0 0 22 23 - std::cout << "pop_back()" << std::endl; - sv.pop_back(); // 0 0 22 - sv.front().v = 10; // 10 0 22 - sv.back().v = 100; // 10 0 100 - sv[1].v = 50; // 10 50 100 - std::cout << "resize(1)" << std::endl; - sv.resize(1); // 10 - std::cout << "~static_vector()" << std::endl; - return 0; -} diff --git a/tests/t1.cpp b/tests/t1.cpp deleted file mode 100644 index 2bb455e62..000000000 --- a/tests/t1.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include - -#include - -namespace bg = boost::geometry; -namespace bgi = bg::index; - -typedef bg::model::point P; -typedef bg::model::box

                                                                                                                    B; -typedef bgi::rtree< - B, - bgi::linear<4, 2> -> RTB; -typedef bgi::rtree< - P, - bgi::linear<4, 2> -> RTP; - -int main() -{ - RTB rtb; - rtb.insert(B(P(0,0),P(1,1))); - rtb.insert(B(P(1,0),P(2,1))); - rtb.insert(B(P(2,0),P(3,1))); - rtb.insert(B(P(2,2),P(3,3))); - rtb.insert(B(P(4,4),P(5,5))); - - std::vector res; - B bb = rtb.box(); - rtb.query(bb, std::back_inserter(res)); - - RTP rtp; - rtp.insert(P(0,0)); - rtp.insert(P(1,0)); - rtp.insert(P(2,0)); - rtp.insert(P(2,2)); - rtp.insert(P(4,4)); - - std::vector

                                                                                                                    resp; - B bp = rtp.box(); - rtp.query(bp, std::back_inserter(resp)); - - int a = 10; -} diff --git a/tests/t2.cpp b/tests/t2.cpp deleted file mode 100644 index ab888fbca..000000000 --- a/tests/t2.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include - -#include -#include - -#include - - -typedef boost::geometry::model::point - BGCartesianPoint; -typedef boost::geometry::model::box - BGCartesianBox; -typedef boost::geometry::model::segment - BGCartesianSegment; -namespace bgi = boost::geometry::index; - - -struct myTranslator -{ - typedef BGCartesianBox result_type; - - result_type operator()(BGCartesianPoint const& seg) const - { - result_type envelope; - boost::geometry::envelope(seg, envelope); - return envelope; - } - - bool equals(BGCartesianPoint const& go1, BGCartesianPoint const& go2) const - { - return (go1.get<0>() == go2.get<0>()) && - (go1.get<1>() == go2.get<1>()); - } -}; - -typedef bgi::rtree - , - myTranslator> - BGRTree; - -int main() -{ - BGRTree rTree; - for (int i = 0; i < 50; ++i) - { - BGCartesianPoint p(i, i); - rTree.insert(p); - - BGCartesianBox envelope(BGCartesianPoint(i-0.5, i-0.5), - BGCartesianPoint(i+0.5, i+0.5)); - - std::deque dq; - - if (rTree.query(envelope, std::back_inserter(dq))) - std::cout << "Retrieved inserted object nr. " << i << "\n"; - else - std::cout << "Could not retrieve inserted object nr. " << i << "\n"; - } - - std::cout << "Total objects: " << rTree.size(); - std::cin.get(); - return 0; -} diff --git a/tests/translators.hpp b/tests/translators.hpp deleted file mode 100644 index dda074baf..000000000 --- a/tests/translators.hpp +++ /dev/null @@ -1,109 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef TESTS_TRANSLATORS_HPP -#define TESTS_TRANSLATORS_HPP - -#include -#include - -#include - -#include -#include - -#include -#include - -template -struct tests_translators_val -{ - tests_translators_val(Indexable const& ii) - : i(ii) - {} - - Indexable const& get_box() const - { - return i; - } - - bool operator==(tests_translators_val const& v2) - { - return boost::geometry::equals(i, v2.i); - } - - Indexable i; -}; - -BOOST_AUTO_TEST_CASE(tests_translators) -{ -#ifdef TEST_PRINT_INFO - std::cout << "tests/translators\n"; -#endif - - namespace bg = boost::geometry; - namespace bgm = bg::model; - namespace bgi = bg::index; - namespace bgit = bgi::translator; - - typedef bgm::point P; - typedef bgm::box

                                                                                                                    B; - - bgit::def< P > p; - bgit::def< P* > pp; - bgit::def< std::pair* > ppip; - bgit::def< boost::shared_ptr

                                                                                                                    > sp; - bgit::def< std::vector

                                                                                                                    ::iterator > ip; - bgit::def< std::map::iterator > mip; - bgit::def< std::pair > pip; - bgit::def< boost::shared_ptr< std::pair > > spip; - bgit::def< boost::shared_ptr< std::pair > > sppi; - bgit::def< boost::scoped_ptr< std::pair > > scppi; - bgit::def< boost::scoped_ptr< std::pair > > scpip; - - P tmp_p(2, 3); - boost::shared_ptr

                                                                                                                    tmp_sp(new P(2, 3)); - std::vector

                                                                                                                    tmp_v(1, P(2, 3)); - std::map tmp_m; - tmp_m.insert(std::pair(0, P(2, 3))); - std::pair tmp_pip(0, P(2, 3)); - boost::shared_ptr< std::pair > tmp_spip(new std::pair(0, P(2, 3))); - boost::shared_ptr< std::pair > tmp_sppi(new std::pair(P(2, 3), 0)); - boost::scoped_ptr< std::pair > tmp_scpip(new std::pair(0, P(2, 3))); - boost::scoped_ptr< std::pair > tmp_scppi(new std::pair(P(2, 3), 0)); - - BOOST_CHECK( bg::equals(tmp_p, p(tmp_p)) ); - BOOST_CHECK( bg::equals(tmp_p, pp(&tmp_p)) ); - BOOST_CHECK( bg::equals(tmp_p, ppip(&tmp_pip)) ); - BOOST_CHECK( bg::equals(tmp_p, sp(tmp_sp)) ); - BOOST_CHECK( bg::equals(tmp_p, ip(tmp_v.begin())) ); - BOOST_CHECK( bg::equals(tmp_p, mip(tmp_m.begin())) ); - BOOST_CHECK( bg::equals(tmp_p, pip(tmp_pip)) ); - BOOST_CHECK( bg::equals(tmp_p, spip(tmp_spip)) ); - BOOST_CHECK( bg::equals(tmp_p, sppi(tmp_sppi)) ); - BOOST_CHECK( bg::equals(tmp_p, scpip(tmp_scpip)) ); - BOOST_CHECK( bg::equals(tmp_p, scppi(tmp_scppi)) ); - - //bgit::def d; // error - //bgit::def< bgm::segment

                                                                                                                    > d; // error - - B tmp_b(P(2, 3), P(4, 5)); - std::pair, B> tmp_ppb = - std::make_pair(bgm::polygon

                                                                                                                    (), tmp_b); - std::pair > tmp_pbp = - std::make_pair(tmp_b, bgm::polygon

                                                                                                                    ()); - - bgit::def< std::pair, B> > ppb; - bgit::def< std::pair > > pbp; - - BOOST_CHECK( bg::equals(tmp_b, ppb(tmp_ppb)) ); - BOOST_CHECK( bg::equals(tmp_b, pbp(tmp_pbp)) ); -} - -#endif // TESTS_TRANSLATORS_HPP From 72282dbed446c65da6cf20a8bf0f7a603c83021f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 19 Jan 2013 02:33:46 +0000 Subject: [PATCH 300/366] Quick start example fixed. Docs updated. [SVN r82547] --- doc/html/geometry_index/r_tree/reference.html | 18 +++++++++--------- .../r_tree/rtree_quickstart.html | 2 +- doc/html/index.html | 2 +- doc/src/examples/rtree/quick_start.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index c81b25631..d5275416f 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                                                                                                              - + The R-tree spatial index.

                                                                                                              @@ -5902,7 +5902,7 @@ The R-tree spatial index. boost::geometry::index::linear

                                                                                                        - + Linear r-tree creation algorithm parameters.

                                                                                                        @@ -5977,7 +5977,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                                                                                                  - + Quadratic r-tree creation algorithm parameters.

                                                                                                  @@ -6052,7 +6052,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                                                                                            - + R*-tree creation algorithm parameters.

                                                                                            @@ -6156,7 +6156,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

                                                                                      - + Linear r-tree creation algorithm parameters.

                                                                                      @@ -6292,7 +6292,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

                                                                                - + Quadratic r-tree creation algorithm parameters.

                                                                                @@ -6428,7 +6428,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

                                                                          - + R*-tree creation algorithm parameters.

                                                                          @@ -8760,7 +8760,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

                                                                    - + The default translator.

                                                                    @@ -8830,7 +8830,7 @@ The default translator. boost::geometry::index::translator::index

                                                              - + The index translator.

                                                              diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 69aa7fac0..ca0b0696c 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -39,7 +39,7 @@ #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/box.hpp> -#include <boost/geometry/extensions/index/rtree.hpp> +#include <boost/geometry/index/rtree.hpp> // to store queries results #include <vector> diff --git a/doc/html/index.html b/doc/html/index.html index 11dfe7bfc..d6c5fafcd 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@
                                                          - +

                                                          Last revised: January 19, 2013 at 02:20:46 GMT

                                                          Last revised: January 19, 2013 at 02:30:02 GMT


                                                          diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index 65fe4ddf4..806f2f08a 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include // to store queries results #include From 1fdee7912adbac7eeb8fdd54777466c50fa6f654 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 23 Jan 2013 02:10:38 +0000 Subject: [PATCH 301/366] added query_expr for test purposes [SVN r82590] --- include/boost/geometry/index/query_expr.hpp | 61 ++++++ tests/query_expr.cpp | 211 ++++++++++++++++++++ 2 files changed, 272 insertions(+) create mode 100644 include/boost/geometry/index/query_expr.hpp create mode 100644 tests/query_expr.cpp diff --git a/include/boost/geometry/index/query_expr.hpp b/include/boost/geometry/index/query_expr.hpp new file mode 100644 index 000000000..750fab90b --- /dev/null +++ b/include/boost/geometry/index/query_expr.hpp @@ -0,0 +1,61 @@ +// Boost.Geometry Index +// +// Query expr +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP +#define BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP + +#include +#include + +namespace boost { namespace geometry { namespace index { namespace qe { + +// tags + +struct intersects_tag {}; +struct within_tag {}; + +struct nearest_tag {}; + +// predicates + +template +struct predicate +{ + typedef Tag tag_type; + predicate(T const& d) : data(d) {} + T const& data; +}; + +template +struct predicate +{ + typedef nearest_tag tag_type; + predicate(T const& d, size_t k) : data(d), count(k) {} + T const& data; + size_t count; +}; + +// predicates generators + +template +predicate intersects(Geometry const& g) +{ + return predicate(g); +} + +template +predicate nearest(DistancePredicates const& p, size_t k) +{ + return predicate(p, k); +} + +}}}} // namespace boost::geometry::index::qe + +#endif // BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP diff --git a/tests/query_expr.cpp b/tests/query_expr.cpp new file mode 100644 index 000000000..8e33989f8 --- /dev/null +++ b/tests/query_expr.cpp @@ -0,0 +1,211 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +template +struct Test +{ + inline Test(T const& t) : v(t) {} + T v; +}; + +template +struct Raw +{ + inline explicit Raw(T1 const& t1, T2 const& t2, T3 const& t3) : v1(t1), v2(t2), v3(t3) {} + T1 v1; + T2 v2; + T3 v3; +}; + +template inline +boost::tuples::cons< + Test, + boost::tuples::cons, boost::tuples::null_type> +> +operator&&(Test const& t1, Test const& t2) +{ + return + boost::tuples::cons< + Test, + boost::tuples::cons, boost::tuples::null_type> + >(t2, + boost::tuples::cons, boost::tuples::null_type>(t1, boost::tuples::null_type()) + ); +} + +template inline +boost::tuples::cons< + Test, + boost::tuples::cons +> +operator&&(boost::tuples::cons const& t, Test const& t2) +{ + return + boost::tuples::cons< + Test, + boost::tuples::cons + >(t2, t); +} + +template +struct Test2 +{ + inline Test2(T const& t) : v(t) {} + T v; +}; + +template inline +boost::tuples::cons< + Test2, + boost::tuples::cons, boost::tuples::null_type> +> +operator&&(Test2 const& t1, Test2 const& t2) +{ + return + boost::tuples::cons< + Test2, + boost::tuples::cons, boost::tuples::null_type> + >(t1, + boost::tuples::cons, boost::tuples::null_type>(t2, boost::tuples::null_type()) + ); +} + +template +struct add +{ + typedef + boost::tuples::cons< + typename boost::tuples::element::type, + typename add::type + > type; + + static type apply(T const& t, Tuple const& tup) + { + return + type( + boost::get(tup), + add::apply(t, tup) + ); + } +}; + +template +struct add +{ + typedef boost::tuples::cons type; + + static type apply(T const& t, Tuple const&) + { + return type(t, boost::tuples::null_type()); + } +}; + +template inline +typename add< + Test2, + boost::tuples::cons, + 0, + boost::tuples::length >::value +>::type +operator&&(boost::tuples::cons const& t, Test2 const& t2) +{ + return + add< + Test2, + boost::tuples::cons, + 0, + boost::tuples::length >::value + >::apply(t2, t); +} + +template inline +double test(T const& t) +{ + return boost::get<0>(t).v + boost::get<1>(t).v + boost::get<2>(t).v; +} + +int main() +{ + using namespace boost::geometry::index::qe; + + boost::timer tim; + + size_t count = 200000000; + int dummy = 0; + std::ifstream f("blablabla"); + f >> dummy; + + std::cout << "&&1 &&2 b, r,\n"; + + double sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0; + for(size_t i = 0 ; i < 20; ++i) + { + double foo = 0; + + { + tim.restart(); + for ( size_t i = 0 ; i < count ; ++i ) + { + foo += test(Test(dummy) && Test(dummy) && Test(dummy)); + } + double t = tim.elapsed(); + sum1 += t; + std::cout << t << ' '; + } + + { + tim.restart(); + for ( size_t i = 0 ; i < count ; ++i ) + { + foo += test(Test2(dummy) && Test2(dummy) && Test2(dummy)); + } + double t = tim.elapsed(); + sum2 += t; + std::cout << t << ' '; + } + + { + tim.restart(); + for ( size_t i = 0 ; i < count ; ++i ) + { + boost::tuple, Test, Test > tup + = boost::make_tuple(Test(dummy), Test(dummy), Test(dummy)); + foo += boost::get<0>(tup).v + boost::get<1>(tup).v + boost::get<2>(tup).v; + } + double t = tim.elapsed(); + sum3 += t; + std::cout << t << ' '; + } + + { + tim.restart(); + for ( size_t i = 0 ; i < count ; ++i ) + { + Raw, Test, Test > tup(dummy, dummy, dummy); + foo += tup.v1.v + tup.v2.v + tup.v3.v; + } + double t = tim.elapsed(); + sum4 += t; + std::cout << t << ' '; + } + + std::cout << foo << '\n'; + } + + std::cout << "sums:\n"; + std::cout << sum1 << " " << sum2 << " " << sum3 << " " << sum4; + + return 0; +} From 344825c14439a762ee222aa066894c14d900194c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 24 Jan 2013 05:43:57 +0000 Subject: [PATCH 302/366] query_expr: implemented push_back_impl operator&& and find_nearest_impl [SVN r82593] --- include/boost/geometry/index/query_expr.hpp | 100 ++++++++++++++++++-- tests/query_expr.cpp | 12 +++ 2 files changed, 106 insertions(+), 6 deletions(-) diff --git a/include/boost/geometry/index/query_expr.hpp b/include/boost/geometry/index/query_expr.hpp index 750fab90b..d26c002ea 100644 --- a/include/boost/geometry/index/query_expr.hpp +++ b/include/boost/geometry/index/query_expr.hpp @@ -11,11 +11,14 @@ #ifndef BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP #define BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP +#include #include #include namespace boost { namespace geometry { namespace index { namespace qe { +namespace detail { + // tags struct intersects_tag {}; @@ -30,7 +33,7 @@ struct predicate { typedef Tag tag_type; predicate(T const& d) : data(d) {} - T const& data; + T data; }; template @@ -38,22 +41,107 @@ struct predicate { typedef nearest_tag tag_type; predicate(T const& d, size_t k) : data(d), count(k) {} - T const& data; + T data; size_t count; }; +template +struct push_back_impl +{ + typedef + boost::tuples::cons< + typename boost::tuples::element::type, + typename push_back_impl::type + > type; + + static type apply(T const& t, Tuple const& tup) + { + return + type( + boost::get(tup), + push_back_impl::apply(t, tup) + ); + } +}; + +template +struct push_back_impl +{ + typedef boost::tuples::cons type; + + static type apply(T const& t, Tuple const&) + { + return type(t, boost::tuples::null_type()); + } +}; + +template inline +boost::tuples::cons< + predicate, + boost::tuples::cons, boost::tuples::null_type> +> +operator&&(predicate const& p1, predicate const& p2) +{ + return + boost::tuples::cons< + predicate, + boost::tuples::cons, boost::tuples::null_type> + >( + p1, + boost::tuples::cons, boost::tuples::null_type>(p2, boost::tuples::null_type()) + ); +} + +template inline +typename push_back_impl< + predicate, + boost::tuples::cons, + 0, + boost::tuples::length >::value +>::type +operator&&(boost::tuples::cons const& t, predicate const& p) +{ + return + push_back_impl< + predicate, + boost::tuples::cons, + 0, + boost::tuples::length >::value + >::apply(p, t); +} + +template +struct find_nearest_impl +{ + static const size_t value = + boost::is_same< + typename boost::tuples::element::type::tag_type, + nearest_tag + >::value ? + I : + find_nearest_impl::value; +}; + +template +struct find_nearest_impl +{ + static const size_t value = N; +}; + +} // namespace detail + // predicates generators template -predicate intersects(Geometry const& g) +detail::predicate intersects(Geometry const& g) { - return predicate(g); + return detail::predicate(g); } template -predicate nearest(DistancePredicates const& p, size_t k) +detail::predicate nearest(DistancePredicates const& p, size_t k) { - return predicate(p, k); + return detail::predicate(p, k); } }}}} // namespace boost::geometry::index::qe diff --git a/tests/query_expr.cpp b/tests/query_expr.cpp index 8e33989f8..5e7fd9241 100644 --- a/tests/query_expr.cpp +++ b/tests/query_expr.cpp @@ -136,13 +136,25 @@ double test(T const& t) return boost::get<0>(t).v + boost::get<1>(t).v + boost::get<2>(t).v; } +template inline +void test2(T const& t) +{ + using namespace boost::geometry::index::qe; + std::cout << detail::find_nearest_impl::value << '\n'; +} + int main() { using namespace boost::geometry::index::qe; + //TEST + + test2(intersects(0) && nearest(0, 0) && intersects(0)); + boost::timer tim; size_t count = 200000000; + //size_t count = 2000000; int dummy = 0; std::ifstream f("blablabla"); f >> dummy; From 455b2d9f45af1138e138f3ebdc37a1bc1039e7ce Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 24 Jan 2013 13:51:01 +0000 Subject: [PATCH 303/366] Change in predicates. empty() removed. value() parameter renamed to Fun const& fun. operator! moved to index::detail namespace. Reference updated. [SVN r82595] --- doc/generated/predicates.qbk | 63 ++-- doc/generated/rtree.qbk | 6 +- doc/html/geometry_index/r_tree/reference.html | 285 ++++++++---------- doc/html/index.html | 2 +- .../geometry/index/detail/predicates.hpp | 20 +- include/boost/geometry/index/predicates.hpp | 124 ++++---- tests/additional_speed.cpp | 57 +++- 7 files changed, 280 insertions(+), 277 deletions(-) diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 3d01a4ace..842f6cd75 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -4,51 +4,14 @@ [heading Functions] [table [[Function][Description]] -[[[link group__predicates_1ga150fd87dc53e5472f8905bb5827428e2 `empty()`]][Generate empty predicate. ]] -[[[link group__predicates_1ga5c93efac97377136564623cbaf35d880 `value(ValuePredicate const &)`]][Generate value predicate. ]] [[[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 `covered_by(Geometry const &)`]][Generate [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 covered_by()]] predicate. ]] [[[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d `disjoint(Geometry const &)`]][Generate [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d disjoint()]] predicate. ]] [[[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 `intersects(Geometry const &)`]][Generate [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 intersects()]] predicate. ]] [[[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 `overlaps(Geometry const &)`]][Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. ]] [[[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d `within(Geometry const &)`]][Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. ]] +[[[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce `value(Fun const &)`]][Generate value predicate. ]] ] -[#group__predicates_1ga150fd87dc53e5472f8905bb5827428e2] -[section empty()] -Generate empty predicate. - -[heading Synopsis] -[pre - -`detail::empty boost::geometry::index::empty``()` -] - -[endsect] - -[#group__predicates_1ga5c93efac97377136564623cbaf35d880] -[section value(ValuePredicate const &)] -Generate value predicate. - -[heading Description] -A wrapper around user-defined functor describing if Value should be returned by spatial query.[heading Synopsis] -[pre -`template<``typename ValuePredicate``>` -`detail::value boost::geometry::index::value``(``ValuePredicate const &` `vpred``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`ValuePredicate`][Functor type.]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`ValuePredicate const &`][ `vpred` ][The functor. ]] -] -[endsect] - [#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61] [section covered_by(Geometry const &)] Generate [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 covered_by()]] predicate. @@ -169,5 +132,29 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret ] [endsect] +[#group__predicates_1ga8acb81106fce01da72f310184ab4d9ce] +[section value(Fun const &)] +Generate value predicate. + +[heading Description] +A wrapper around user-defined functor describing if Value should be returned by spatial query.[heading Synopsis] +[pre +`template<``typename Fun``>` +`detail::value boost::geometry::index::value``(``Fun const &` `fun``)` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Fun`][Functor type.]] +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`Fun const &`][ `fun` ][The functor. ]] +] +[endsect] + [endsect] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 77217a4c9..468603b25 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -624,7 +624,7 @@ It may be generated by one of the functions listed below: * [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], * [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -* [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. +* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] @@ -742,7 +742,7 @@ It may be generated by one of the functions listed below: * [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], * [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -* [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. +* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] @@ -861,7 +861,7 @@ It may be generated by one of the functions listed below: * [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], * [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -* [^[link group__predicates_1ga5c93efac97377136564623cbaf35d880 boost::geometry::index::value()]]. +* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index d5275416f..b121a57eb 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                                                    - + The R-tree spatial index.

                                                    @@ -2659,7 +2659,7 @@ The R-tree spatial index. ! boost::geometry::index::within()
                                                  • - boost::geometry::index::value(). + boost::geometry::index::value().

                                                  @@ -3042,7 +3042,7 @@ The R-tree spatial index. ! boost::geometry::index::within()

                                                • - boost::geometry::index::value(). + boost::geometry::index::value().

                                                @@ -3460,7 +3460,7 @@ The R-tree spatial index. ! boost::geometry::index::within()

                                              • - boost::geometry::index::value(). + boost::geometry::index::value().

                                              @@ -5902,7 +5902,7 @@ The R-tree spatial index. boost::geometry::index::linear

                                        - + Linear r-tree creation algorithm parameters.

                                        @@ -5977,7 +5977,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                                  - + Quadratic r-tree creation algorithm parameters.

                                  @@ -6052,7 +6052,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                            - + R*-tree creation algorithm parameters.

                            @@ -6156,7 +6156,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

                      - + Linear r-tree creation algorithm parameters.

                      @@ -6292,7 +6292,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

                    - + Quadratic r-tree creation algorithm parameters.

                    @@ -6428,7 +6428,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

                    - + R*-tree creation algorithm parameters.

                    @@ -6627,31 +6627,6 @@ R*-tree creation algorithm parameters.
                    -

                    - empty() -

                    -
                    -

                    - Generate empty predicate. -

                    -
                    -

                    - value(ValuePredicate const - &) -

                    -
                    -

                    - Generate value predicate. -

                    -

                    covered_by(Geometry const @@ -6721,128 +6696,23 @@ R*-tree creation algorithm parameters.

                    +

                    + value(Fun const + &) +

                    +
                    +

                    + Generate value predicate. +

                    +
                    -

                    - Generate empty predicate. -

                    -
                    - - Synopsis -
                    -
                    detail::empty boost::geometry::index::empty()
                    -
                    -
                    -
                    - -

                    - Generate value predicate. -

                    -
                    - - Description -
                    -

                    - A wrapper around user-defined functor describing if Value should be returned - by spatial query. -

                    -
                    - - Synopsis -
                    -
                    template<typename ValuePredicate>
                    -detail::value<ValuePredicate> boost::geometry::index::value(ValuePredicate const & vpred)
                    -
                    -
                    - - Template - parameter(s) -
                    -
                    ---- - - - - - - - - -
                    -

                    - Parameter -

                    -
                    -

                    - Description -

                    -
                    -

                    - ValuePredicate -

                    -
                    -

                    - Functor type. -

                    -
                    -
                    - - Parameter(s) -
                    -
                    ----- - - - - - - - - - - -
                    -

                    - Type -

                    -
                    -

                    - Name -

                    -
                    -

                    - Description -

                    -
                    -

                    - ValuePredicate const & -

                    -
                    -

                    - vpred -

                    -
                    -

                    - The functor. -

                    -
                    -
                    -
                    - @@ -7371,6 +7241,111 @@ R*-tree creation algorithm parameters.
    +
    + +

    + Generate value predicate. +

    +
    + + Description +
    +

    + A wrapper around user-defined functor describing if Value should be returned + by spatial query. +

    +
    + + Synopsis +
    +
    template<typename Fun>
    +detail::value<Fun> boost::geometry::index::value(Fun const & fun)
    +
    +
    + + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Fun +

    +
    +

    + Functor type. +

    +
    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Fun const + & +

    +
    +

    + fun +

    +
    +

    + The functor. +

    +
    +

    @@ -8760,7 +8735,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -8830,7 +8805,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    diff --git a/doc/html/index.html b/doc/html/index.html index d6c5fafcd..36e65ecb6 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@ - +

    Last revised: January 19, 2013 at 02:30:02 GMT

    Last revised: January 24, 2013 at 13:47:55 GMT


    diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index 9ea3172ab..e835fd9a6 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -22,11 +22,11 @@ namespace boost { namespace geometry { namespace index { namespace detail { struct empty {}; -template +template struct value { - value(ValuePredicate const& vpred) : value_predicate(vpred) {} - ValuePredicate value_predicate; + value(Fun const& f) : fun(f) {} + Fun fun; }; template @@ -150,13 +150,13 @@ struct predicate_check } }; -template -struct predicate_check, value_tag> +template +struct predicate_check, value_tag> { template - static inline bool apply(value const& p, Value const& v, Indexable const&) + static inline bool apply(value const& p, Value const& v, Indexable const&) { - return p.value_predicate(v); + return p.fun(v); } }; @@ -304,11 +304,11 @@ struct predicate_check } }; -template -struct predicate_check, envelope_tag> +template +struct predicate_check, envelope_tag> { template - static bool apply(value const&, Value const&, Box const&) + static bool apply(value const&, Value const&, Box const&) { return true; } diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index c992e5a9b..4644c2003 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -26,34 +26,6 @@ namespace boost { namespace geometry { namespace index { -/*! -\brief Generate empty predicate. - -\ingroup predicates -*/ -inline detail::empty empty() -{ - return detail::empty(); -} - -/*! -\brief Generate value predicate. - -A wrapper around user-defined functor -describing if Value should be returned by spatial query. - -\ingroup predicates - -\tparam ValuePredicate Functor type. - -\param vpred The functor. -*/ -template -inline detail::value value(ValuePredicate const& vpred) -{ - return detail::value(vpred); -} - /*! \brief Generate \c covered_by() predicate. @@ -168,92 +140,114 @@ inline detail::within within(Geometry const& g) return detail::within(g); } -}}} // namespace boost::geometry::index +/*! +\brief Generate value predicate. + +A wrapper around user-defined functor +describing if Value should be returned by spatial query. + +\ingroup predicates + +\tparam Fun Functor type. + +\param fun The functor. +*/ +template +inline detail::value value(Fun const& fun) +{ + return detail::value(fun); +} + +namespace detail { // operator! generators template -boost::geometry::index::detail::not_covered_by -operator!(boost::geometry::index::detail::covered_by const& p) +not_covered_by +operator!(covered_by const& p) { - return boost::geometry::index::detail::not_covered_by(p.geometry); + return not_covered_by(p.geometry); } template -boost::geometry::index::detail::covered_by -operator!(boost::geometry::index::detail::not_covered_by const& p) +covered_by +operator!(not_covered_by const& p) { - return boost::geometry::index::detail::covered_by(p.geometry); + return covered_by(p.geometry); } template -boost::geometry::index::detail::not_disjoint -operator!(boost::geometry::index::detail::disjoint const& p) +not_disjoint +operator!(disjoint const& p) { - return boost::geometry::index::detail::not_disjoint(p.geometry); + return not_disjoint(p.geometry); } template -boost::geometry::index::detail::disjoint -operator!(boost::geometry::index::detail::not_disjoint const& p) +disjoint +operator!(not_disjoint const& p) { - return boost::geometry::index::detail::disjoint(p.geometry); + return disjoint(p.geometry); } template -boost::geometry::index::detail::not_intersects -operator!(boost::geometry::index::detail::intersects const& p) +not_intersects +operator!(intersects const& p) { - return boost::geometry::index::detail::not_intersects(p.geometry); + return not_intersects(p.geometry); } template -boost::geometry::index::detail::intersects -operator!(boost::geometry::index::detail::not_intersects const& p) +intersects +operator!(not_intersects const& p) { - return boost::geometry::index::detail::intersects(p.geometry); + return intersects(p.geometry); } template -boost::geometry::index::detail::not_overlaps -operator!(boost::geometry::index::detail::overlaps const& p) +not_overlaps +operator!(overlaps const& p) { - return boost::geometry::index::detail::not_overlaps(p.geometry); + return not_overlaps(p.geometry); } template -boost::geometry::index::detail::overlaps -operator!(boost::geometry::index::detail::not_overlaps const& p) +overlaps +operator!(not_overlaps const& p) { - return boost::geometry::index::detail::overlaps(p.geometry); + return overlaps(p.geometry); } //template -//boost::geometry::index::detail::not_touches -//operator!(boost::geometry::index::detail::touches const& p) +//not_touches +//operator!(touches const& p) //{ -// return boost::geometry::index::detail::not_touches(p.geometry); +// return not_touches(p.geometry); //} // //template -//boost::geometry::index::detail::touches -//operator!(boost::geometry::index::detail::not_touches const& p) +//touches +//operator!(not_touches const& p) //{ -// return boost::geometry::index::detail::touches(p.geometry); +// return touches(p.geometry); //} template -boost::geometry::index::detail::not_within -operator!(boost::geometry::index::detail::within const& p) +not_within +operator!(within const& p) { - return boost::geometry::index::detail::not_within(p.geometry); + return not_within(p.geometry); } template -boost::geometry::index::detail::within -operator!(boost::geometry::index::detail::not_within const& p) +within +operator!(not_within const& p) { - return boost::geometry::index::detail::within(p.geometry); + return within(p.geometry); } + +} // namespace detail + +}}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_INDEX_PREDICATES_HPP diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 642342c13..cd6c20b7c 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -85,7 +85,6 @@ int main() result.reserve(100); B result_one; - // query test { tim.restart(); size_t temp = 0; @@ -101,9 +100,47 @@ int main() std::cout << time << "s - spatial_query(B) " << queries_count << " found " << temp << '\n'; } + { + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 2 ; ++i ) + { + float x1 = coords[i].first; + float y1 = coords[i].second; + float x2 = coords[i+1].first; + float y2 = coords[i+1].second; + float x3 = coords[i+2].first; + float y3 = coords[i+2].second; + result.clear(); + t.spatial_query( + boost::make_tuple( + bgi::intersects(B(P(x1 - 10, y1 - 10), P(x1 + 10, y1 + 10))), + !bgi::within(B(P(x2 - 10, y2 - 10), P(x2 + 10, y2 + 10))), + !bgi::overlaps(B(P(x3 - 10, y3 - 10), P(x3 + 10, y3 + 10))) + ), + std::back_inserter(result) + ); + temp += result.size(); + } + double time = tim.elapsed(); + std::cout << time << "s - spatial_query(i, !w, !o) " << queries_count << " found " << temp << '\n'; + } + result.clear(); - // searching test + { + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + temp += t.nearest_query(P(x, y), result_one); + } + double time = tim.elapsed(); + std::cout << time << "s - nearest_query(P) " << (queries_count / 10) << " found " << temp << '\n'; + } + { tim.restart(); size_t temp = 0; @@ -125,13 +162,21 @@ int main() { float x = coords[i].first + 100; float y = coords[i].second + 100; - temp += t.nearest_query(P(x, y), result_one); + result.clear(); + temp += t.nearest_query( + bgi::bounded( + bgi::to_nearest(P(x, y)), + bgi::to_centroid(0), + bgi::to_furthest(100000) + ), + 5, + std::back_inserter(result) + ); } double time = tim.elapsed(); - std::cout << time << "s - nearest_query(P) " << (queries_count / 10) << " found " << temp << '\n'; + std::cout << time << "s - nearest_query(bounded(n, c, f), 5) " << (queries_count / 10) << " found " << temp << '\n'; } - // inserting test { tim.restart(); for (size_t i = 0 ; i < values_count / 10 ; ++i ) @@ -145,6 +190,8 @@ int main() double time = tim.elapsed(); std::cout << time << "s - remove " << values_count / 10 << '\n'; } + + std::cout << "------------------------------------------------\n"; } return 0; From dfb33baede6e2ea0782ac60b07078fc1872cc6bc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 24 Jan 2013 22:24:58 +0000 Subject: [PATCH 304/366] Implemented all variants of rtree::query() method. spatial and nearest returning 1 and k values. [SVN r82600] --- .../index/detail/distance_predicates.hpp | 190 +++++++++++++++++- .../geometry/index/detail/predicates.hpp | 185 +++++++++++++++-- .../detail/rtree/visitors/nearest_query.hpp | 6 +- .../detail/rtree/visitors/spatial_query.hpp | 6 +- .../boost/geometry/index/detail/tuples.hpp | 30 +++ .../geometry/index/distance_predicates.hpp | 16 ++ include/boost/geometry/index/predicates.hpp | 38 ++++ include/boost/geometry/index/rtree.hpp | 73 ++++++- test/rtree/test_rtree.hpp | 23 ++- tests/additional_speed.cpp | 107 +++++++++- 10 files changed, 643 insertions(+), 31 deletions(-) diff --git a/include/boost/geometry/index/detail/distance_predicates.hpp b/include/boost/geometry/index/detail/distance_predicates.hpp index 9d86a03f2..805254704 100644 --- a/include/boost/geometry/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/index/detail/distance_predicates.hpp @@ -28,6 +28,194 @@ namespace boost { namespace geometry { namespace index { namespace detail { +// ------------------------------------------------------------------ // +// predicate +// ------------------------------------------------------------------ // + +template +struct nearest +{ + static const bool is_one = false; + + nearest(DistancePredicates const& dpred, unsigned k) + : distance_predicates(dpred) + , count(k) + {} + DistancePredicates const& distance_predicates; + unsigned count; +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(nearest const&, Value const&, Box const&) + { + return true; + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(nearest const&, Value const&, Box const&) + { + return true; + } +}; + +template +struct nearest_one +{ + static const bool is_one = true; + + nearest_one(DistancePredicates const& dpred) + : distance_predicates(dpred) + {} + DistancePredicates const& distance_predicates; +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(nearest_one const&, Value const&, Box const&) + { + return true; + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(nearest_one const&, Value const&, Box const&) + { + return true; + } +}; + +// predicates_is_nearest + +template +struct predicates_is_nearest +{ + static const unsigned value = 0; +}; + +template +struct predicates_is_nearest< nearest > +{ + static const unsigned value = 1; +}; + +template +struct predicates_is_nearest< nearest_one > +{ + static const unsigned value = 1; +}; + +// predicates_count_nearest + +template +struct predicates_count_nearest +{ + static const unsigned value = predicates_is_nearest::value; +}; + +template +struct predicates_count_nearest< std::pair > +{ + static const unsigned value = predicates_is_nearest::value + + predicates_is_nearest::value; +}; + +template +struct predicates_count_nearest_tuple +{ + static const unsigned value = + predicates_is_nearest::type>::value + + predicates_count_nearest_tuple::value; +}; + +template +struct predicates_count_nearest_tuple +{ + static const unsigned value = + predicates_is_nearest::type>::value; +}; + +template +struct predicates_count_nearest< boost::tuple > +{ + static const unsigned value = predicates_count_nearest_tuple< + boost::tuple, + boost::tuples::length< boost::tuple >::value + >::value; +}; + +template +struct predicates_count_nearest< boost::tuples::cons > +{ + static const unsigned value = predicates_count_nearest_tuple< + boost::tuples::cons, + boost::tuples::length< boost::tuples::cons >::value + >::value; +}; + +// predicates_find_nearest + +template +struct predicates_find_nearest +{ + static const unsigned value = predicates_is_nearest::value ? 0 : 1; +}; + +template +struct predicates_find_nearest< std::pair > +{ + static const unsigned value = predicates_is_nearest::value ? 0 : + (predicates_is_nearest::value ? 1 : 2); +}; + +template +struct predicates_find_nearest_tuple +{ + static const bool is_found = predicates_find_nearest_tuple::is_found + || predicates_is_nearest::type>::value; + + static const unsigned value = predicates_find_nearest_tuple::is_found ? + predicates_find_nearest_tuple::value : + (predicates_is_nearest::type>::value ? + N-1 : boost::tuples::length::value); +}; + +template +struct predicates_find_nearest_tuple +{ + static const bool is_found = predicates_is_nearest::type>::value; + static const unsigned value = is_found ? 0 : boost::tuples::length::value; +}; + +template +struct predicates_find_nearest< boost::tuple > +{ + static const unsigned value = predicates_find_nearest_tuple< + boost::tuple, + boost::tuples::length< boost::tuple >::value + >::value; +}; + +template +struct predicates_find_nearest< boost::tuples::cons > +{ + static const unsigned value = predicates_find_nearest_tuple< + boost::tuples::cons, + boost::tuples::length< boost::tuples::cons >::value + >::value; +}; + // ------------------------------------------------------------------ // // relations // ------------------------------------------------------------------ // @@ -364,7 +552,7 @@ struct distances_calc_impl_rel< // distances_calc_impl_tuple -template +template struct distances_calc_impl_tuple { // TODO MPL ASSERT 0 < N diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index e835fd9a6..a8261319a 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -438,40 +438,158 @@ struct predicate_check, envelope_tag> } }; +// ------------------------------------------------------------------ // +// predicates_length +// ------------------------------------------------------------------ // + +template +struct predicates_length +{ + static const unsigned value = 1; +}; + +template +struct predicates_length< std::pair > +{ + static const unsigned value = 2; +}; + +template +struct predicates_length< boost::tuple > +{ + static const unsigned value = boost::tuples::length< boost::tuple >::value; +}; + +template +struct predicates_length< boost::tuples::cons > +{ + static const unsigned value = boost::tuples::length< boost::tuples::cons >::value; +}; + +// ------------------------------------------------------------------ // +// predicates_element +// ------------------------------------------------------------------ // + +template +struct predicates_element +{ + BOOST_MPL_ASSERT_MSG((I < 1), INVALID_INDEX, (predicates_element)); + typedef T type; + static type const& get(T const& p) { return p; } +}; + +template +struct predicates_element< I, std::pair > +{ + BOOST_MPL_ASSERT_MSG((I < 2), INVALID_INDEX, (predicates_element)); + + typedef F type; + static type const& get(std::pair const& p) { return p.first; } +}; + +template +struct predicates_element< 1, std::pair > +{ + typedef S type; + static type const& get(std::pair const& p) { return p.second; } +}; + +template +struct predicates_element< I, boost::tuple > +{ + typedef boost::tuple predicate_type; + + typedef typename boost::tuples::element::type type; + static type const& get(predicate_type const& p) { return boost::get(p); } +}; + +template +struct predicates_element< I, boost::tuples::cons > +{ + typedef boost::tuples::cons predicate_type; + + typedef typename boost::tuples::element::type type; + static type const& get(predicate_type const& p) { return boost::get(p); } +}; + // ------------------------------------------------------------------ // // predicates_check // ------------------------------------------------------------------ // -template +template +struct predicates_check_pair {}; + +template +struct predicates_check_pair +{ + template + static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) + { + return true; + } +}; + +template +struct predicates_check_pair +{ + template + static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) + { + return predicate_check::apply(p.first, v, i); + } +}; + +template +struct predicates_check_pair +{ + template + static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) + { + return predicate_check::apply(p.second, v, i); + } +}; + +template +struct predicates_check_pair +{ + template + static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) + { + return predicate_check::apply(p.first, v, i) + && predicate_check::apply(p.second, v, i); + } +}; + +template struct predicates_check_tuple { template static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) { - return predicates_check_tuple::apply(p, v, i) - && predicate_check< - typename boost::tuples::element::type, - Tag - >::apply(boost::get(p), v, i); + return + predicate_check< + typename boost::tuples::element::type, + Tag + >::apply(boost::get(p), v, i) && + predicates_check_tuple::apply(p, v, i); } }; -template -struct predicates_check_tuple +template +struct predicates_check_tuple { template static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) { - return predicate_check< - typename boost::tuples::element<0, TuplePredicates>::type, - Tag - >::apply(boost::get<0>(p), v, i); + return true; } }; -template +template struct predicates_check_impl { + BOOST_MPL_ASSERT_MSG((First < 1 && Last <= 1 && First <= Last), INVALID_INDEXES, (predicates_check_impl)); + template static inline bool apply(Predicate const& p, Value const& v, Indexable const& i) { @@ -479,9 +597,11 @@ struct predicates_check_impl } }; -template -struct predicates_check_impl, Tag> +template +struct predicates_check_impl, Tag, First, Last> { + BOOST_MPL_ASSERT_MSG((First < 2 && Last <= 2 && First <= Last), INVALID_INDEXES, (predicates_check_impl)); + template static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) { @@ -493,30 +613,53 @@ struct predicates_check_impl, Tag> template < typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, - typename Tag + typename Tag, unsigned First, unsigned Last > struct predicates_check_impl< boost::tuple, - Tag + Tag, First, Last > { typedef boost::tuple predicates_type; + static const unsigned pred_len = boost::tuples::length::value; + BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl)); + template static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) { return predicates_check_tuple< predicates_type, - Tag, - boost::tuples::length::value + Tag, First, Last >::apply(p, v, i); } }; -template +template +struct predicates_check_impl< + boost::tuples::cons, + Tag, First, Last +> +{ + typedef boost::tuples::cons predicates_type; + + static const unsigned pred_len = boost::tuples::length::value; + BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl)); + + template + static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) + { + return predicates_check_tuple< + predicates_type, + Tag, First, Last + >::apply(p, v, i); + } +}; + +template inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i) { - return detail::predicates_check_impl + return detail::predicates_check_impl ::apply(p, v, i); } diff --git a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp index d6db7ca26..345246ed5 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp @@ -184,6 +184,8 @@ public: index::detail::value_tag > value_distances_predicates_check; + static const unsigned predicates_len = index::detail::predicates_length::value; + 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) @@ -211,7 +213,7 @@ public: { // if current node meets predicates // 0 - dummy value - if ( index::detail::predicates_check(m_pred, 0, it->first) ) + if ( index::detail::predicates_check(m_pred, 0, it->first) ) { // calculate node's distance(s) for distance predicate node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); @@ -266,7 +268,7 @@ public: it != elements.end(); ++it) { // if value meets predicates - if ( index::detail::predicates_check(m_pred, *it, m_translator(*it)) ) + if ( index::detail::predicates_check(m_pred, *it, m_translator(*it)) ) { // calculate values distance for distance predicate value_distances_type distances = value_distances_calc::apply(m_dist_pred, m_translator(*it)); diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index 3ceec4d45..87b0e4904 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -28,6 +28,8 @@ struct spatial_query typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; + static const unsigned predicates_len = index::detail::predicates_length::value; + inline spatial_query(Translator const& t, Predicates const& p, OutIter out_it) : tr(t), pred(p), out_iter(out_it), found_count(0) {} @@ -43,7 +45,7 @@ struct spatial_query { // if node meets predicates // 0 - dummy value - if ( index::detail::predicates_check(pred, 0, it->first) ) + if ( index::detail::predicates_check(pred, 0, it->first) ) rtree::apply_visitor(*this, *it->second); } } @@ -58,7 +60,7 @@ struct spatial_query it != elements.end(); ++it) { // if value meets predicates - if ( index::detail::predicates_check(pred, *it, tr(*it)) ) + if ( index::detail::predicates_check(pred, *it, tr(*it)) ) { out_iter = *it; ++out_iter; diff --git a/include/boost/geometry/index/detail/tuples.hpp b/include/boost/geometry/index/detail/tuples.hpp index d2100e775..28e347bed 100644 --- a/include/boost/geometry/index/detail/tuples.hpp +++ b/include/boost/geometry/index/detail/tuples.hpp @@ -164,6 +164,36 @@ struct add_unique >::type type; }; +template +struct push_back_impl +{ + typedef + boost::tuples::cons< + typename boost::tuples::element::type, + typename push_back_impl::type + > type; + + static type apply(Tuple const& tup, T const& t) + { + return + type( + boost::get(tup), + push_back_impl::apply(tup, t) + ); + } +}; + +template +struct push_back_impl +{ + typedef boost::tuples::cons type; + + static type apply(Tuple const&, T const& t) + { + return type(t, boost::tuples::null_type()); + } +}; + } // namespace tuples }}}} // namespace boost::geometry::index::detail diff --git a/include/boost/geometry/index/distance_predicates.hpp b/include/boost/geometry/index/distance_predicates.hpp index 45f58b7c5..67d111519 100644 --- a/include/boost/geometry/index/distance_predicates.hpp +++ b/include/boost/geometry/index/distance_predicates.hpp @@ -19,6 +19,22 @@ namespace boost { namespace geometry { namespace index { +// nearest predicate generators + +template inline +detail::nearest +nearest(DistancePredicates const& dpred, unsigned k) +{ + return detail::nearest(dpred, k); +} + +template inline +detail::nearest_one +nearest(DistancePredicates const& dpred) +{ + return detail::nearest_one(dpred); +} + // relations generators /*! diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index 4644c2003..b0cacfa77 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -19,6 +19,7 @@ #include #include +#include /*! \defgroup predicates Spatial predicates (boost::geometry::index::) @@ -245,6 +246,43 @@ operator!(not_within const& p) { return within(p.geometry); } + +// operator&& generators + +template inline +boost::tuples::cons< + Pred1, + boost::tuples::cons +> +operator&&(Pred1 const& p1, Pred2 const& p2) +{ + return + boost::tuples::cons< + Pred1, + boost::tuples::cons + >( + p1, + boost::tuples::cons(p2, boost::tuples::null_type()) + ); +} + +template inline +typename tuples::push_back_impl< + boost::tuples::cons, + Pred, + 0, + boost::tuples::length >::value +>::type +operator&&(boost::tuples::cons const& t, Pred const& p) +{ + return + tuples::push_back_impl< + boost::tuples::cons, + Pred, + 0, + boost::tuples::length >::value + >::apply(t, p); +} } // namespace detail diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 5e3e6601f..71ec6dc74 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -630,6 +630,75 @@ public: return result; } + template + size_type query(Predicates const& predicates, OutIter out_it) const + { + static const unsigned nearest_count = detail::predicates_count_nearest::value; + static const bool is_nearest = 0 < nearest_count; + BOOST_MPL_ASSERT_MSG((nearest_count <= 1), PASS_ONLY_ONE_NEAREST_PREDICATE, (Predicates)); + + return query_dispatch(predicates, out_it, boost::mpl::bool_()); + } + + template + size_type query(Predicates const& predicates, value_type & v) const + { + static const unsigned nearest_count = detail::predicates_count_nearest::value; + BOOST_MPL_ASSERT_MSG((nearest_count == 1), PASS_NEAREST_PREDICATE_TO_GET_VALUE_AS_RESULT, (Predicates)); + + return query_dispatch(predicates, v, boost::mpl::bool_()); + } + +private: + + template + size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const + { + return spatial_query(predicates, out_it); + } + + template + size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const + { + static const unsigned nearest_index = detail::predicates_find_nearest::value; + static const bool is_one = detail::predicates_element::type::is_one; + + return query_dispatch_nearest(predicates, out_it, boost::mpl::bool_()); + } + + template + size_type query_dispatch(Predicates const& predicates, value_type & v, boost::mpl::bool_ const& /*is_nearest*/) const + { + static const unsigned nearest_index = detail::predicates_find_nearest::value; + static const bool is_one = detail::predicates_element::type::is_one; + BOOST_MPL_ASSERT_MSG((is_one == 1), PASS_ONE_VALUE_NEAREST_PREDICATE_TO_GET_VALUE_AS_RESULT, (Predicates)); + + typedef detail::predicates_element element_access; + typename element_access::type const& nearest_pred = element_access::get(predicates); + + return this->raw_nearest_one(nearest_pred.distance_predicates, predicates, v); + } + + template + size_type query_dispatch_nearest(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_one*/) const + { + static const unsigned nearest_index = detail::predicates_find_nearest::value; + typedef detail::predicates_element element_access; + typename element_access::type const& nearest_pred = element_access::get(predicates); + return this->raw_nearest_k(nearest_pred.distance_predicates, nearest_pred.count, predicates, out_it); + } + + template + size_type query_dispatch_nearest(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_one*/) const + { + static const unsigned nearest_index = detail::predicates_find_nearest::value; + typedef detail::predicates_element element_access; + typename element_access::type const& nearest_pred = element_access::get(predicates); + return this->raw_nearest_k(nearest_pred.distance_predicates, 1, predicates, out_it); + } + +public: + /*! \brief Finds values meeting spatial predicates, e.g. intersecting some Box. @@ -661,8 +730,8 @@ public: \li If Value copy constructor or copy assignment throws. \li If OutIter dereference or increment throws. */ - template - inline size_type spatial_query(Predicates const& pred, OutIter out_it) const + template inline + size_type spatial_query(Predicates const& pred, OutIter out_it) const { if ( !m_root ) return 0; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 404a913fe..40398196d 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -559,10 +559,16 @@ void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector output2; size_t n2 = spatial_query(rtree, pred, std::back_inserter(output2)); - + BOOST_CHECK( n == n2 ); test_exactly_the_same_outputs(rtree, output, output2); + std::vector output3; + size_t n3 = rtree.query(pred, std::back_inserter(output3)); + + BOOST_CHECK( n == n3 ); + test_exactly_the_same_outputs(rtree, output, output3); + test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::spatial_queried(pred)); } @@ -771,6 +777,15 @@ void test_nearest_query(Rtree const& rtree, std::vector const& input, Poi BOOST_CHECK(d1 == d2); } } + + Value output2(generate_value_default::apply()); + size_t n_res2 = rtree.query(bgi::nearest(pt), output2); + + BOOST_CHECK(n == n_res2); + if ( 0 < n_res2 ) + { + BOOST_CHECK(rtree.translator().equals(output, output2)); + } } template @@ -861,6 +876,12 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P output2.resize(found_count, generate_value_default::apply()); test_exactly_the_same_outputs(rtree, output, output2); + + std::vector output3(k, generate_value_default::apply()); + found_count = rtree.query(bgi::nearest(pt, k), output3.begin()); + output3.resize(found_count, generate_value_default::apply()); + + test_exactly_the_same_outputs(rtree, output, output3); } // rtree nearest not found diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index cd6c20b7c..c4a26c12b 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -58,8 +58,8 @@ int main() // typedef bgi::rtree RT; //typedef bgi::rtree > RT; //typedef bgi::rtree RT; - - for ( ;; ) + + for (unsigned i = 0 ; i < 10 ; ++i) { RT t; //RT t(bgi::runtime::linear(32, 8)); @@ -126,6 +126,60 @@ int main() std::cout << time << "s - spatial_query(i, !w, !o) " << queries_count << " found " << temp << '\n'; } + { + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 2 ; ++i ) + { + float x1 = coords[i].first; + float y1 = coords[i].second; + float x2 = coords[i+1].first; + float y2 = coords[i+1].second; + float x3 = coords[i+2].first; + float y3 = coords[i+2].second; + result.clear(); + t.spatial_query( + bgi::intersects(B(P(x1 - 10, y1 - 10), P(x1 + 10, y1 + 10))) + && + !bgi::within(B(P(x2 - 10, y2 - 10), P(x2 + 10, y2 + 10))) + && + !bgi::overlaps(B(P(x3 - 10, y3 - 10), P(x3 + 10, y3 + 10))) + , + std::back_inserter(result) + ); + temp += result.size(); + } + double time = tim.elapsed(); + std::cout << time << "s - spatial_query(i && !w && !o) " << queries_count << " found " << temp << '\n'; + } + + { + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 2 ; ++i ) + { + float x1 = coords[i].first; + float y1 = coords[i].second; + float x2 = coords[i+1].first; + float y2 = coords[i+1].second; + float x3 = coords[i+2].first; + float y3 = coords[i+2].second; + result.clear(); + t.query( + bgi::intersects(B(P(x1 - 10, y1 - 10), P(x1 + 10, y1 + 10))) + && + !bgi::within(B(P(x2 - 10, y2 - 10), P(x2 + 10, y2 + 10))) + && + !bgi::overlaps(B(P(x3 - 10, y3 - 10), P(x3 + 10, y3 + 10))) + , + std::back_inserter(result) + ); + temp += result.size(); + } + double time = tim.elapsed(); + std::cout << time << "s - query(i && !w && !o) " << queries_count << " found " << temp << '\n'; + } + result.clear(); { @@ -177,6 +231,55 @@ int main() std::cout << time << "s - nearest_query(bounded(n, c, f), 5) " << (queries_count / 10) << " found " << temp << '\n'; } + { + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + temp += t.query(bgi::nearest(P(x, y)), result_one); + } + double time = tim.elapsed(); + std::cout << time << "s - query(nearest(P)) " << (queries_count / 10) << " found " << temp << '\n'; + } + + { + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + result.clear(); + temp += t.query(bgi::nearest(P(x, y), 5), std::back_inserter(result)); + } + double time = tim.elapsed(); + std::cout << time << "s - query(nearest(P, 5)) " << (queries_count / 10) << " found " << temp << '\n'; + } + + { + tim.restart(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = coords[i].first + 100; + float y = coords[i].second + 100; + result.clear(); + temp += t.query(bgi::nearest( + bgi::bounded( + bgi::to_nearest(P(x, y)), + bgi::to_centroid(0), + bgi::to_furthest(100000) + ), + 5), + std::back_inserter(result) + ); + } + double time = tim.elapsed(); + std::cout << time << "s - query(nearest(bounded(n, c, f), 5)) " << (queries_count / 10) << " found " << temp << '\n'; + } + { tim.restart(); for (size_t i = 0 ; i < values_count / 10 ; ++i ) From cfb4ee0d43c5d39697fd2af662e67016a8e7dbd0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 25 Jan 2013 13:23:10 +0000 Subject: [PATCH 305/366] MPL_ASSERT_MSG message modified. [SVN r82606] --- include/boost/geometry/index/rtree.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 71ec6dc74..b6c7734cb 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -644,7 +644,7 @@ public: size_type query(Predicates const& predicates, value_type & v) const { static const unsigned nearest_count = detail::predicates_count_nearest::value; - BOOST_MPL_ASSERT_MSG((nearest_count == 1), PASS_NEAREST_PREDICATE_TO_GET_VALUE_AS_RESULT, (Predicates)); + BOOST_MPL_ASSERT_MSG((nearest_count == 1), PASS_ONE_VALUE_NEAREST_PREDICATE_TO_GET_VALUE_AS_RESULT, (Predicates)); return query_dispatch(predicates, v, boost::mpl::bool_()); } From d3a27327674c2f837bef8d37c110101b9e5cbe57 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 25 Jan 2013 13:34:27 +0000 Subject: [PATCH 306/366] removed old queries from additional_speed test. [SVN r82607] --- tests/additional_speed.cpp | 124 ++++--------------------------------- 1 file changed, 11 insertions(+), 113 deletions(-) diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index c4a26c12b..79704fa54 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -59,7 +59,7 @@ int main() //typedef bgi::rtree > RT; //typedef bgi::rtree RT; - for (unsigned i = 0 ; i < 10 ; ++i) + for (;;) { RT t; //RT t(bgi::runtime::linear(32, 8)); @@ -93,64 +93,11 @@ int main() float x = coords[i].first; float y = coords[i].second; result.clear(); - t.spatial_query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); temp += result.size(); } double time = tim.elapsed(); - std::cout << time << "s - spatial_query(B) " << queries_count << " found " << temp << '\n'; - } - - { - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 2 ; ++i ) - { - float x1 = coords[i].first; - float y1 = coords[i].second; - float x2 = coords[i+1].first; - float y2 = coords[i+1].second; - float x3 = coords[i+2].first; - float y3 = coords[i+2].second; - result.clear(); - t.spatial_query( - boost::make_tuple( - bgi::intersects(B(P(x1 - 10, y1 - 10), P(x1 + 10, y1 + 10))), - !bgi::within(B(P(x2 - 10, y2 - 10), P(x2 + 10, y2 + 10))), - !bgi::overlaps(B(P(x3 - 10, y3 - 10), P(x3 + 10, y3 + 10))) - ), - std::back_inserter(result) - ); - temp += result.size(); - } - double time = tim.elapsed(); - std::cout << time << "s - spatial_query(i, !w, !o) " << queries_count << " found " << temp << '\n'; - } - - { - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 2 ; ++i ) - { - float x1 = coords[i].first; - float y1 = coords[i].second; - float x2 = coords[i+1].first; - float y2 = coords[i+1].second; - float x3 = coords[i+2].first; - float y3 = coords[i+2].second; - result.clear(); - t.spatial_query( - bgi::intersects(B(P(x1 - 10, y1 - 10), P(x1 + 10, y1 + 10))) - && - !bgi::within(B(P(x2 - 10, y2 - 10), P(x2 + 10, y2 + 10))) - && - !bgi::overlaps(B(P(x3 - 10, y3 - 10), P(x3 + 10, y3 + 10))) - , - std::back_inserter(result) - ); - temp += result.size(); - } - double time = tim.elapsed(); - std::cout << time << "s - spatial_query(i && !w && !o) " << queries_count << " found " << temp << '\n'; + std::cout << time << "s - query(B) " << queries_count << " found " << temp << '\n'; } { @@ -182,55 +129,6 @@ int main() result.clear(); - { - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 10 ; ++i ) - { - float x = coords[i].first + 100; - float y = coords[i].second + 100; - temp += t.nearest_query(P(x, y), result_one); - } - double time = tim.elapsed(); - std::cout << time << "s - nearest_query(P) " << (queries_count / 10) << " found " << temp << '\n'; - } - - { - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 10 ; ++i ) - { - float x = coords[i].first + 100; - float y = coords[i].second + 100; - result.clear(); - temp += t.nearest_query(P(x, y), 5, std::back_inserter(result)); - } - double time = tim.elapsed(); - std::cout << time << "s - nearest_query(P, 5) " << (queries_count / 10) << " found " << temp << '\n'; - } - - { - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 10 ; ++i ) - { - float x = coords[i].first + 100; - float y = coords[i].second + 100; - result.clear(); - temp += t.nearest_query( - bgi::bounded( - bgi::to_nearest(P(x, y)), - bgi::to_centroid(0), - bgi::to_furthest(100000) - ), - 5, - std::back_inserter(result) - ); - } - double time = tim.elapsed(); - std::cout << time << "s - nearest_query(bounded(n, c, f), 5) " << (queries_count / 10) << " found " << temp << '\n'; - } - { tim.restart(); size_t temp = 0; @@ -267,14 +165,14 @@ int main() float y = coords[i].second + 100; result.clear(); temp += t.query(bgi::nearest( - bgi::bounded( - bgi::to_nearest(P(x, y)), - bgi::to_centroid(0), - bgi::to_furthest(100000) - ), - 5), - std::back_inserter(result) - ); + bgi::bounded( + bgi::to_nearest(P(x, y)), + bgi::to_centroid(0), + bgi::to_furthest(100000) + ), + 5), + std::back_inserter(result) + ); } double time = tim.elapsed(); std::cout << time << "s - query(nearest(bounded(n, c, f), 5)) " << (queries_count / 10) << " found " << temp << '\n'; From fb25dff48eac2562c07de905834e399df6a232cc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 25 Jan 2013 18:43:48 +0000 Subject: [PATCH 307/366] Added rtree free function insert. Added adaptors::queried(). nearest_query_range and spatial_query_range moved to adaptors::detail. [SVN r82611] --- .../geometry/index/adaptors/nearest_query.hpp | 8 +- .../boost/geometry/index/adaptors/query.hpp | 88 +++++++++++++++++++ .../geometry/index/adaptors/spatial_query.hpp | 8 +- .../geometry/index/detail/rtree/adaptors.hpp | 29 +++++- include/boost/geometry/index/rtree.hpp | 18 ++++ 5 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 include/boost/geometry/index/adaptors/query.hpp diff --git a/include/boost/geometry/index/adaptors/nearest_query.hpp b/include/boost/geometry/index/adaptors/nearest_query.hpp index fd86465eb..9c042ac85 100644 --- a/include/boost/geometry/index/adaptors/nearest_query.hpp +++ b/include/boost/geometry/index/adaptors/nearest_query.hpp @@ -19,6 +19,8 @@ namespace boost { namespace geometry { namespace index { namespace adaptors { +namespace detail { + template class nearest_query_range { @@ -45,8 +47,6 @@ class nearest_query_range inline const_iterator end() const { return 0; } }; -namespace detail { - // TODO: awulkiew - consider removing references from predicates template @@ -108,12 +108,12 @@ nearest_queried( } // namespace adaptors template -index::adaptors::nearest_query_range +index::adaptors::detail::nearest_query_range operator|( Index const& si, index::adaptors::detail::nearest_query const& f) { - return index::adaptors::nearest_query_range( + return index::adaptors::detail::nearest_query_range( si, f.distances_predicates, f.count, f.predicates); } diff --git a/include/boost/geometry/index/adaptors/query.hpp b/include/boost/geometry/index/adaptors/query.hpp new file mode 100644 index 000000000..d1647bcb6 --- /dev/null +++ b/include/boost/geometry/index/adaptors/query.hpp @@ -0,0 +1,88 @@ +// Boost.Geometry Index +// +// Query range adaptor +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP +#define BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP + +/*! +\defgroup adaptors Adaptors (boost::geometry::index::adaptors::) +*/ + +namespace boost { namespace geometry { namespace index { + +namespace adaptors { + +namespace detail { + +template +class query_range +{ + BOOST_MPL_ASSERT_MSG( + (false), + NOT_IMPLEMENTED_FOR_THIS_INDEX, + (query_range)); + + typedef int* iterator; + typedef const int* const_iterator; + + template + inline query_range( + Index const&, + Predicates const&) + {} + + inline iterator begin() { return 0; } + inline iterator end() { return 0; } + inline const_iterator begin() const { return 0; } + inline const_iterator end() const { return 0; } +}; + +// TODO: awulkiew - consider removing reference from predicates + +template +struct query +{ + inline explicit query(Predicates const& pred) + : predicates(pred) + {} + + Predicates const& predicates; +}; + +} // namespace detail + +/*! +\brief The query index adaptor generator. + +\ingroup adaptors + +\param pred Predicates. +*/ +template +detail::query +queried(Predicates const& pred) +{ + return detail::query(pred); +} + +} // namespace adaptors + +template +index::adaptors::detail::query_range +operator|( + Index const& si, + index::adaptors::detail::query const& f) +{ + return index::adaptors::detail::query_range(si, f.predicates); +} + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP diff --git a/include/boost/geometry/index/adaptors/spatial_query.hpp b/include/boost/geometry/index/adaptors/spatial_query.hpp index 46331e02d..ef84fd325 100644 --- a/include/boost/geometry/index/adaptors/spatial_query.hpp +++ b/include/boost/geometry/index/adaptors/spatial_query.hpp @@ -19,6 +19,8 @@ namespace boost { namespace geometry { namespace index { namespace adaptors { +namespace detail { + template class spatial_query_range { @@ -42,8 +44,6 @@ class spatial_query_range inline const_iterator end() const { return 0; } }; -namespace detail { - // TODO: awulkiew - consider removing reference from predicates template @@ -75,12 +75,12 @@ spatial_queried(Predicates const& pred) } // namespace adaptors template -index::adaptors::spatial_query_range +index::adaptors::detail::spatial_query_range operator|( Index const& si, index::adaptors::detail::spatial_query const& f) { - return index::adaptors::spatial_query_range(si, f.predicates); + return index::adaptors::detail::spatial_query_range(si, f.predicates); } }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/index/detail/rtree/adaptors.hpp b/include/boost/geometry/index/detail/rtree/adaptors.hpp index 0066766df..c9c160394 100644 --- a/include/boost/geometry/index/detail/rtree/adaptors.hpp +++ b/include/boost/geometry/index/detail/rtree/adaptors.hpp @@ -16,13 +16,14 @@ #include #include +#include namespace boost { namespace geometry { namespace index { template class rtree; -namespace adaptors { +namespace adaptors { namespace detail { template class spatial_query_range< index::rtree > @@ -78,7 +79,31 @@ private: result_type m_result; }; -} // namespace adaptors +template +class query_range< index::rtree > +{ +public: + typedef std::vector result_type; + typedef typename result_type::iterator iterator; + typedef typename result_type::const_iterator const_iterator; + + template inline + query_range(index::rtree const& rtree, + Predicates const& pred) + { + rtree.query(pred, std::back_inserter(m_result)); + } + + inline iterator begin() { return m_result.begin(); } + inline iterator end() { return m_result.end(); } + inline const_iterator begin() const { return m_result.begin(); } + inline const_iterator end() const { return m_result.end(); } + +private: + result_type m_result; +}; + +}} // namespace adaptors::detail }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index b6c7734cb..4c283abba 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -1461,6 +1461,24 @@ remove(rtree & tree, Range const& rng) return tree.remove(rng); } +template inline +typename rtree::size_type +query(rtree const& tree, + Predicates const& pred, + OutIter out_it) +{ + return tree.query(pred, out_it); +} + +template inline +typename rtree::size_type +query(rtree const& tree, + Predicates const& pred, + typename rtree::value_type & v) +{ + return tree.query(pred, v); +} + /*! \brief Find values meeting spatial predicates. From 3f712b94f8e5165071dd53a24c6c3d24eaaefd6a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 26 Jan 2013 00:36:29 +0000 Subject: [PATCH 308/366] nearest() predicate and related classes moved from distance_predicates.hpp to predicates.hpp query() methods and functions documented. nearest() predicate documented. Changes in various methods/functions description. Deleted unneeded query_expr. [SVN r82617] --- doc/generated/adaptors.qbk | 18 + doc/generated/distance_predicates.qbk | 24 +- doc/generated/predicates.qbk | 115 +- doc/generated/rtree.qbk | 157 ++ doc/generated/rtree_functions.qbk | 170 ++ doc/html/geometry_index/r_tree.html | 4 +- doc/html/geometry_index/r_tree/reference.html | 1482 ++++++++++++++++- doc/html/index.html | 2 +- .../index/detail/distance_predicates.hpp | 188 --- .../geometry/index/detail/predicates.hpp | 188 +++ .../geometry/index/distance_predicates.hpp | 34 +- include/boost/geometry/index/predicates.hpp | 101 +- include/boost/geometry/index/query_expr.hpp | 149 -- include/boost/geometry/index/rtree.hpp | 268 ++- tests/query_expr.cpp | 223 --- 15 files changed, 2489 insertions(+), 634 deletions(-) delete mode 100644 include/boost/geometry/index/query_expr.hpp delete mode 100644 tests/query_expr.cpp diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index 4bfedeaa6..85255430d 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -6,6 +6,7 @@ [[Function][Description]] [[[link group__adaptors_1ga8e094e1f312fc00336a3536f51a69468 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] [[[link group__adaptors_1ga3478395ded5855dc0b6c2f36a89de9f6 `nearest_queried(DistancesPredicates const &, size_t)`]][The nearest query index adaptor generator. ]] +[[[link group__adaptors_1ga4716cd5423bfed3ff3e69e9ec274ac81 `queried(Predicates const &)`]][The query index adaptor generator. ]] [[[link group__adaptors_1ga3068771f0f9cca706269ec35a809db2a `spatial_queried(Predicates const &)`]][The spatial query index adaptor generator. ]] ] @@ -48,6 +49,23 @@ The nearest query index adaptor generator. ] [endsect] +[#group__adaptors_1ga4716cd5423bfed3ff3e69e9ec274ac81] +[section queried(Predicates const &)] +The query index adaptor generator. + +[heading Synopsis] +[pre +`template<``typename Predicates``>` +`detail::query boost::geometry::index::adaptors::queried``(``Predicates const &` `pred``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`Predicates const &`][ `pred` ][Predicates. ]] +] +[endsect] + [#group__adaptors_1ga3068771f0f9cca706269ec35a809db2a] [section spatial_queried(Predicates const &)] The spatial query index adaptor generator. diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk index 66cd264f7..53aca24e3 100644 --- a/doc/generated/distance_predicates.qbk +++ b/doc/generated/distance_predicates.qbk @@ -4,9 +4,9 @@ [heading Functions] [table [[Function][Description]] -[[[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] Point-Indexable relationship. ]] -[[[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 `to_centroid(T const &)`]][Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] Point-Indexable relationship. ]] -[[[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 `to_furthest(T const &)`]][Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] Point-Indexable relationship. ]] +[[[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] relationship. ]] +[[[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 `to_centroid(T const &)`]][Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] relationship. ]] +[[[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 `to_furthest(T const &)`]][Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] relationship. ]] [[[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db `unbounded(PointRelation const &)`]][Generate [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db unbounded()] distance predicate. ]] [[[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 `min_bounded(PointRelation const &, MinRelation const &)`]][Generate [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 min_bounded()] distance predicate. ]] [[[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 `max_bounded(PointRelation const &, MaxRelation const &)`]][Generate [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 max_bounded()] distance predicate. ]] @@ -15,7 +15,7 @@ [#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636] [section to_nearest(T const &)] -Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] Point-Indexable relationship. +Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] relationship. [heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it should be the distance to the nearest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation.[heading Synopsis] @@ -27,19 +27,19 @@ Generate a nearest query Point and Value's Indexable relationship while calculat [heading Template parameter(s)] [table [[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or CoordinateType for MinRelation or MaxRelation]] ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`T const &`][ `v` ][Point or bound value. ]] +[[`T const &`][ `v` ][Point or distance value. ]] ] [endsect] [#group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0] [section to_centroid(T const &)] -Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] Point-Indexable relationship. +Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] relationship. [heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v.[heading Synopsis] @@ -51,19 +51,19 @@ Generate a nearest query Point and Value's Indexable relationship while calculat [heading Template parameter(s)] [table [[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation]] ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`T const &`][ `v` ][Point or bound value. ]] +[[`T const &`][ `v` ][Point or distance value. ]] ] [endsect] [#group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02] [section to_furthest(T const &)] -Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] Point-Indexable relationship. +Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] relationship. [heading Description] Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it should be the distance to the furthest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v.[heading Synopsis] @@ -75,13 +75,13 @@ Generate a nearest query Point and Value's Indexable relationship while calculat [heading Template parameter(s)] [table [[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some Value for MinRelation or MaxRelation]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation]] ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`T const &`][ `v` ][Point or bound value. ]] +[[`T const &`][ `v` ][Point or distance value. ]] ] [endsect] diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 842f6cd75..3b67d1348 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -1,6 +1,6 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/group__predicates.xml] -[section:group__predicates Spatial predicates (boost::geometry::index::)] +[section:group__predicates Predicates (boost::geometry::index::)] [heading Functions] [table [[Function][Description]] @@ -10,6 +10,8 @@ [[[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 `overlaps(Geometry const &)`]][Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. ]] [[[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d `within(Geometry const &)`]][Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. ]] [[[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce `value(Fun const &)`]][Generate value predicate. ]] +[[[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b `nearest(DistancePredicates const &, unsigned)`]][Generate nearest predicate. ]] +[[[link group__predicates_1ga54f507955e8dba2c928d6592d5970638 `nearest(DistancePredicates const &)`]][Generate nearest predicate. ]] ] [#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61] @@ -156,5 +158,116 @@ A wrapper around user-defined functor describing if Value should be returned by ] [endsect] +[#group__predicates_1ga162233fd11b980853f8b8335cb70d57b] +[section nearest(DistancePredicates const &, unsigned)] +Generate nearest predicate. + +[heading Description] +When nearest predicate is passed to the query, k-nearest neighbour search will be performed. + +[*Distances predicates] may be a [^`Point`]. In this the case values closest to [^`Point`] are returned. + +It is possible to define how distance between values and query Point is calculated. This is done by passing PointRelation. It can be generated by following functions: + +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. + + +It is possible to define distances bounds, for example that a distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: + +* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, +* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], +* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], +* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. + + +MinRelation and MaxRelation describes bounds and can be generated by following functions: + +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. + +[heading Synopsis] +[pre +`template<``typename DistancePredicates``>` +`detail::nearest boost::geometry::index::nearest``(``DistancePredicates const &` `dpred``,` `unsigned` `k``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`DistancePredicates const &`][ `dpred` ][The distance predicates. ]] +[[`unsigned`][ `k` ][The maximum number of values to return. ]] +] +[heading Example] + +`` +tree.query(bgi::nearest(pt, 5), std::back_inserter(result)); +tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); +tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20)), 5), std::back_inserter(result)); +`` + + +[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate may be used in a query. This version may be used only in queries returning a set of values - using output iterator.] + +[endsect] + +[#group__predicates_1ga54f507955e8dba2c928d6592d5970638] +[section nearest(DistancePredicates const &)] +Generate nearest predicate. + +[heading Description] +When nearest predicate is passed to the query, k-nearest neighbour search will be performed. + +[*Distances predicates] may be a [^`Point`]. In this the case value closest to [^`Point`] is returned. + +It is possible to define how distance between value and query Point is calculated. This is done by passing PointRelation. It can be generated by following functions: + +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. + + +It is possible to define distances bounds, for example that a distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: + +* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, +* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], +* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], +* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. + + +MinRelation and MaxRelation describes bounds and can be generated by following functions: + +* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], +* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. + +[heading Synopsis] +[pre +`template<``typename DistancePredicates``>` +`detail::nearest_one boost::geometry::index::nearest``(``DistancePredicates const &` `dpred``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`DistancePredicates const &`][ `dpred` ][The distance predicates. ]] +] +[heading Example] + +`` +tree.query(bgi::nearest(pt), value); +tree.query(bgi::nearest(pt) && bgi::intersects(box), value); +tree.query(bgi::nearest(bgi::to_centroid(pt)) && bgi::within(box), value); +tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20))), value); +`` + + +[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate may be used in a query. This version may be used only in queries returning one value.] + +[endsect] + [endsect] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 468603b25..5dcc7d03d 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -99,6 +99,8 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] [[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] [[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949 `query(Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1abd965047110c9f8ef6ff097e97487312 `query(Predicates const &, value_type &)`]][Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] @@ -605,6 +607,161 @@ The number of removed values. [endsect] +[#classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949] +[section query(Predicates const &, OutIter)] +Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. + +[heading Description] +This query function performs spatial and k-nearest neighbor searches. It allows to pass a set of predicates. Values will be returned only if all predicates are met. + +[*Spatial predicates] + +The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: + +* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], + + +It is possible to negate spatial predicates: + +* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] + +[*Value predicate] + +This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: + +* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. + +[*Nearest predicate] + +If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. Passing the first one will result in returning k number of values, the second one will result in returning only one, closest value. In both cases values will be returned to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by: + +* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. + +[*Connecting predicates] + +A set of predicates may be generated by: + +* [^`std::make_pair()`] +* [^`boost::make_tuple()`] +* [^`operator&&()`] + +[heading Synopsis] +[pre +`template<``typename Predicates``,` `typename OutIter``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `query``(``Predicates const &` `predicates``,` `OutIter` `out_it``)` +] + +[heading Modifier(s)] +``const ``[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`Predicates const &`][ `predicates` ][Predicates. ]] +[[`OutIter`][ `out_it` ][The output iterator, e.g. generated by std::back_inserter().]] +] +[heading Returns] +The number of values found. +[heading Example] + +`` +tree.query(box1, std::back_inserter(result)); +tree.query(std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); +tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); +tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +`` + + +[heading Throws] +If Value copy constructor or copy assignment throws. + +[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] perdicate may be passed to the query.] + +[endsect] + +[#classboost_1_1geometry_1_1index_1_1rtree_1abd965047110c9f8ef6ff097e97487312] +[section query(Predicates const &, value_type &)] +Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. + +[heading Description] +This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. The value will be returned only if all predicates are met. This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. + +[*Spatial predicates] + +The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: + +* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], + + +It is possible to negate spatial predicates: + +* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] + +[*Value predicate] + +This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: + +* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. + +[*Nearest predicate] + +This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. It may be generated by [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] taking only one parameter - distance predicates. + +* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. + +[*Connecting predicates] + +A set of predicates may be generated by: + +* [^`std::make_pair()`] +* [^`boost::make_tuple()`] +* [^`operator&&()`] + +[heading Synopsis] +[pre +`template<``typename Predicates``>` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `query``(``Predicates const &` `predicates``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `value``)` +] + +[heading Modifier(s)] +``const ``[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`Predicates const &`][ `predicates` ][Predicates. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &`][ `value` ][The reference to value which will hold the result of the query.]] +] +[heading Returns] +The number of values found (1 if value was found, 0 otherwise). +[heading Example] + +`` +tree.query(std::make_pair(bgi::nearest(pt), bgi::within(box)), value); +tree.query(bgi::nearest(pt) && bgi::intersects(poly), value); +`` + + +[heading Throws] +If Value copy constructor or copy assignment throws. + +[warning This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate.] + +[endsect] + [#classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920] [section spatial_query(Predicates const &, OutIter)] Finds values meeting spatial predicates, e.g. intersecting some Box. diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 875e4b41c..166edb286 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -10,6 +10,8 @@ [[[link group__rtree__functions_1gad40492a5b99c3eebbd51901574762527 `remove(rtree<...> &, Value const &)`]][Remove a value from the container. ]] [[[link group__rtree__functions_1ga0219361de8b15c539af3f9bd027938ce `remove(rtree<...> &, Iterator, Iterator)`]][Remove a range of values from the container. ]] [[[link group__rtree__functions_1ga5885d6c90a91f238f72ab9b5ef24daf9 `remove(rtree<...> &, Range const &)`]][Remove a range of values from the container. ]] +[[[link group__rtree__functions_1ga86e0808522ef6682b72b310a3891b276 `query(rtree<...> const &, Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] +[[[link group__rtree__functions_1ga35b54dcaed4e4d5fb38e9ef4b78ee3c7 `query(rtree<...> const &, Predicates const &, typename rtree<...>::value_type &)`]][Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. ]] [[[link group__rtree__functions_1gadcec162d2391c2c9cc4215a5578d1721 `spatial_query(rtree<...> const &, Predicates const &, OutIter)`]][Find values meeting spatial predicates. ]] [[[link group__rtree__functions_1gacabbd521b88b67a700e1246e5889d343 `nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)`]][Find the value meeting distances predicates. ]] [[[link group__rtree__functions_1gaf963f417d4ab54a2782928020dd8c3ad `nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)`]][Find the value meeting distances and spatial predicates. ]] @@ -175,6 +177,174 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c65 The number of removed values. [endsect] +[#group__rtree__functions_1ga86e0808522ef6682b72b310a3891b276] +[section query(rtree<...> const &, Predicates const &, OutIter)] +Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. + +[heading Description] +This query function performs spatial and k-nearest neighbor searches. It allows to pass a set of predicates. Values will be returned only if all predicates are met. + +[*Spatial predicates] + +The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: + +* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], + + +It is possible to negate spatial predicates: + +* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] + +[*Value predicate] + +This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: + +* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. + +[*Nearest predicate] + +If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. Passing the first one will result in returning k number of values, the second one will result in returning only one, closest value. In both cases values will be returned to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by: + +* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. + +[*Connecting predicates] + +A set of predicates may be generated by: + +* [^`std::make_pair()`] +* [^`boost::make_tuple()`] +* [^`operator&&()`] + +[heading Synopsis] +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Predicates``,` + `typename OutIter``>` +`rtree::size_type boost::geometry::index::query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` + `Predicates const &` `predicates``,` + `OutIter` `out_it``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`Predicates const &`][ `predicates` ][Predicates. ]] +[[`OutIter`][ `out_it` ][The output iterator, e.g. generated by std::back_inserter().]] +] +[heading Returns] +The number of values found. +[heading Example] + +`` +bgi::query(tree, box1, std::back_inserter(result)); +bgi::query(tree, std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); +bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); +bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +`` + + +[heading Throws] +If Value copy constructor or copy assignment throws. + +[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] perdicate may be passed to the query.] + +[endsect] + +[#group__rtree__functions_1ga35b54dcaed4e4d5fb38e9ef4b78ee3c7] +[section query(rtree<...> const &, Predicates const &, typename rtree<...>::value_type &)] +Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. + +[heading Description] +This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. The value will be returned only if all predicates are met. This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. + +[*Spatial predicates] + +The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: + +* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], + + +It is possible to negate spatial predicates: + +* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], +* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], +* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], +* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], +* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] + +[*Value predicate] + +This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: + +* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. + +[*Nearest predicate] + +This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. It may be generated by [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] taking only one parameter - distance predicates. + +* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. + +[*Connecting predicates] + +A set of predicates may be generated by: + +* [^`std::make_pair()`] +* [^`boost::make_tuple()`] +* [^`operator&&()`] + +[heading Synopsis] +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``,` + `typename Predicates``>` +`rtree::size_type boost::geometry::index::query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` + `Predicates const &` `predicates``,` + `typename rtree< Value, Options, Translator, Allocator >::value_type &` `value``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`Predicates const &`][ `predicates` ][Predicates. ]] +[[`typename rtree< Value, Options, Translator, Allocator >::value_type &`][ `value` ][The reference to value which will hold the result of the query.]] +] +[heading Returns] +The number of values found (1 if value was found, 0 otherwise). +[heading Example] + +`` +bgi::query(tree, std::make_pair(bgi::nearest(pt), bgi::within(box)), value); +bgi::query(tree, bgi::nearest(pt) && bgi::intersects(poly), value); +`` + + +[heading Throws] +If Value copy constructor or copy assignment throws. + +[warning This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate.] + +[endsect] + [#group__rtree__functions_1gadcec162d2391c2c9cc4215a5578d1721] [section spatial_query(rtree<...> const &, Predicates const &, OutIter)] Find values meeting spatial predicates. diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 4d5f596cd..c8b440eaa 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -81,8 +81,8 @@ related to the rtree
    R-tree parameters
    -
    Spatial - predicates (boost::geometry::index::)
    +
    Predicates + (boost::geometry::index::)
    Distance predicates (boost::geometry::index::)
    Adaptors diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index b121a57eb..2f968054b 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -31,8 +31,8 @@ related to the rtree
    R-tree parameters
    -
    Spatial - predicates (boost::geometry::index::)
    +
    Predicates + (boost::geometry::index::)
    Distance predicates (boost::geometry::index::)
    Adaptors @@ -47,7 +47,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    @@ -618,6 +618,45 @@ The R-tree spatial index.
    +

    + const +

    +
    +

    + query(Predicates const + &, OutIter) +

    +
    +

    + Finds values meeting passed predicates e.g. nearest to some Point + and/or intersecting some Box. +

    +
    +

    + const +

    +
    +

    + query(Predicates const + &, value_type + &) +

    +
    +

    + Finds value meeting passed predicates e.g. nearest to some Point + and intersecting some Box. +

    +

    const @@ -2608,6 +2647,455 @@ The R-tree spatial index.

    +

    + Finds values meeting passed predicates e.g. nearest to some Point and/or + intersecting some Box. +

    +
    + + Description +
    +

    + This query function performs spatial and k-nearest neighbor searches. + It allows to pass a set of predicates. Values will be returned only if + all predicates are met. +

    +

    + Spatial predicates +

    +

    + The simplest form of spatial predicate is a Geometry. + In this case Values intersecting the Geometry + are returned. More spatial predicates may be generated by one of the + functions listed below: +

    + +

    + It is possible to negate spatial predicates: +

    + +

    + Value predicate +

    +

    + This is a special kind of predicate which allows to pass a user-defined + functor which checks if Value should be returned by the query. It's generated + by: +

    + +

    + Nearest predicate +

    +

    + If the nearest predicate is passed a k-nearest neighbor search will be + performed. It has two variants. Passing the first one will result in + returning k number of values, the second one will result in returning + only one, closest value. In both cases values will be returned to the + output iterator. Only one nearest predicate may be passed to the query. + It may be generated by: +

    + +

    + Connecting predicates +

    +

    + A set of predicates may be generated by: +

    +
      +
    • + std::make_pair() +
    • +
    • + boost::make_tuple() +
    • +
    • + operator&&() +
    • +
    +
    + + Synopsis +
    +
    template<typename Predicates, typename OutIter>
    +size_type query(Predicates const & predicates, OutIter out_it)
    +
    +
    + + Modifier(s) +
    +

    +

    +
    const
    +

    +

    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Predicates const & +

    +
    +

    + predicates +

    +
    +

    + Predicates. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator, e.g. generated by std::back_inserter(). +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Example +
    +

    +

    +
    tree.query(box1, std::back_inserter(result));
    +tree.query(std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result));
    +tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result));
    +tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result));
    +tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result));
    +
    +

    +

    +
    + + Throws +
    +

    + If Value copy constructor or copy assignment throws. +

    +
    + + + + + +
    [Warning]Warning

    + Only one nearest() + perdicate may be passed to the query. +

    +
    +
    + +

    + Finds value meeting passed predicates e.g. nearest to some Point and + intersecting some Box. +

    +
    + + Description +
    +

    + This query function performs k-nearest neighbor searches. It allows to + pass a set of predicates. The value will be returned only if all predicates + are met. This query requires that one of the predicates must be one-value + nearest() + predicate. +

    +

    + Spatial predicates +

    +

    + The simplest form of spatial predicate is a Geometry. + In this case Values intersecting the Geometry + are returned. More spatial predicates may be generated by one of the + functions listed below: +

    + +

    + It is possible to negate spatial predicates: +

    + +

    + Value predicate +

    +

    + This is a special kind of predicate which allows to pass a user-defined + functor which checks if Value should be returned by the query. It's generated + by: +

    + +

    + Nearest predicate +

    +

    + This query requires that one of the predicates must be one-value nearest() + predicate. It may be generated by nearest() + taking only one parameter - distance predicates. +

    + +

    + Connecting predicates +

    +

    + A set of predicates may be generated by: +

    +
      +
    • + std::make_pair() +
    • +
    • + boost::make_tuple() +
    • +
    • + operator&&() +
    • +
    +
    + + Synopsis +
    +
    template<typename Predicates>
    +size_type query(Predicates const & predicates, value_type & value)
    +
    +
    + + Modifier(s) +
    +

    +

    +
    const
    +

    +

    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Predicates const & +

    +
    +

    + predicates +

    +
    +

    + Predicates. +

    +
    +

    + value_type + & +

    +
    +

    + value +

    +
    +

    + The reference to value which will hold the result of the query. +

    +
    +
    + + Returns +
    +

    + The number of values found (1 if value was found, 0 otherwise). +

    +
    + + Example +
    +

    +

    +
    tree.query(std::make_pair(bgi::nearest(pt), bgi::within(box)), value);
    +tree.query(bgi::nearest(pt) && bgi::intersects(poly), value);
    +
    +

    +

    +
    + + Throws +
    +

    + If Value copy constructor or copy assignment throws. +

    +
    + + + + + +
    [Warning]Warning

    + This query requires that one of the predicates must be one-value nearest() + predicate. +

    +
    +
    + @@ -4060,6 +4548,39 @@ The R-tree spatial index.
    +

    + query(rtree<...> + const &, + Predicates const + &, OutIter) +

    +
    +

    + Finds values meeting passed predicates e.g. nearest to some Point + and/or intersecting some Box. +

    +
    +

    + query(rtree<...> + const &, + Predicates const + &, typename + rtree<...>::value_type &) +

    +
    +

    + Finds value meeting passed predicates e.g. nearest to some Point + and intersecting some Box. +

    +

    spatial_query(rtree<...> @@ -4853,6 +5374,496 @@ The R-tree spatial index.

    +

    + Finds values meeting passed predicates e.g. nearest to some Point and/or + intersecting some Box. +

    +
    + + Description +
    +

    + This query function performs spatial and k-nearest neighbor searches. + It allows to pass a set of predicates. Values will be returned only if + all predicates are met. +

    +

    + Spatial predicates +

    +

    + The simplest form of spatial predicate is a Geometry. + In this case Values intersecting the Geometry + are returned. More spatial predicates may be generated by one of the + functions listed below: +

    + +

    + It is possible to negate spatial predicates: +

    + +

    + Value predicate +

    +

    + This is a special kind of predicate which allows to pass a user-defined + functor which checks if Value should be returned by the query. It's generated + by: +

    + +

    + Nearest predicate +

    +

    + If the nearest predicate is passed a k-nearest neighbor search will be + performed. It has two variants. Passing the first one will result in + returning k number of values, the second one will result in returning + only one, closest value. In both cases values will be returned to the + output iterator. Only one nearest predicate may be passed to the query. + It may be generated by: +

    + +

    + Connecting predicates +

    +

    + A set of predicates may be generated by: +

    +
      +
    • + std::make_pair() +
    • +
    • + boost::make_tuple() +
    • +
    • + operator&&() +
    • +
    +
    + + Synopsis +
    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename Predicates,
    +         typename OutIter>
    +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::query(rtree< Value, Options, Translator, Allocator > const & tree,
    +                                                                                      Predicates const & predicates,
    +                                                                                      OutIter out_it)
    +
    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Predicates const & +

    +
    +

    + predicates +

    +
    +

    + Predicates. +

    +
    +

    + OutIter +

    +
    +

    + out_it +

    +
    +

    + The output iterator, e.g. generated by std::back_inserter(). +

    +
    +
    + + Returns +
    +

    + The number of values found. +

    +
    + + Example +
    +

    +

    +
    bgi::query(tree, box1, std::back_inserter(result));
    +bgi::query(tree, std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result));
    +bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result));
    +bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result));
    +bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result));
    +
    +

    +

    +
    + + Throws +
    +

    + If Value copy constructor or copy assignment throws. +

    +
    + + + + + +
    [Warning]Warning

    + Only one nearest() + perdicate may be passed to the query. +

    +
    +
    + +

    + Finds value meeting passed predicates e.g. nearest to some Point and + intersecting some Box. +

    +
    + + Description +
    +

    + This query function performs k-nearest neighbor searches. It allows to + pass a set of predicates. The value will be returned only if all predicates + are met. This query requires that one of the predicates must be one-value + nearest() + predicate. +

    +

    + Spatial predicates +

    +

    + The simplest form of spatial predicate is a Geometry. + In this case Values intersecting the Geometry + are returned. More spatial predicates may be generated by one of the + functions listed below: +

    + +

    + It is possible to negate spatial predicates: +

    + +

    + Value predicate +

    +

    + This is a special kind of predicate which allows to pass a user-defined + functor which checks if Value should be returned by the query. It's generated + by: +

    + +

    + Nearest predicate +

    +

    + This query requires that one of the predicates must be one-value nearest() + predicate. It may be generated by nearest() + taking only one parameter - distance predicates. +

    + +

    + Connecting predicates +

    +

    + A set of predicates may be generated by: +

    +
      +
    • + std::make_pair() +
    • +
    • + boost::make_tuple() +
    • +
    • + operator&&() +
    • +
    +
    + + Synopsis +
    +
    template<typename Value,
    +         typename Options,
    +         typename Translator,
    +         typename Allocator,
    +         typename Predicates>
    +rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::query(rtree< Value, Options, Translator, Allocator > const & tree,
    +                                                                                      Predicates const & predicates,
    +                                                                                      typename rtree< Value, Options, Translator, Allocator >::value_type & value)
    +
    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + rtree< + Value, + Options, + Translator, + Allocator > + const & +

    +
    +

    + tree +

    +
    +

    + The spatial index. +

    +
    +

    + Predicates const & +

    +
    +

    + predicates +

    +
    +

    + Predicates. +

    +
    +

    + typename rtree< Value, Options, Translator, Allocator + >::value_type + & +

    +
    +

    + value +

    +
    +

    + The reference to value which will hold the result of the query. +

    +
    +
    + + Returns +
    +

    + The number of values found (1 if value was found, 0 otherwise). +

    +
    + + Example +
    +

    +

    +
    bgi::query(tree, std::make_pair(bgi::nearest(pt), bgi::within(box)), value);
    +bgi::query(tree, bgi::nearest(pt) && bgi::intersects(poly), value);
    +
    +

    +

    +
    + + Throws +
    +

    + If Value copy constructor or copy assignment throws. +

    +
    + + + + + +
    [Warning]Warning

    + This query requires that one of the predicates must be one-value nearest() + predicate. +

    +
    +

    - + Linear r-tree creation algorithm parameters.

    @@ -5977,7 +6988,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -6052,7 +7063,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

    - + R*-tree creation algorithm parameters.

    @@ -6156,7 +7167,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -6292,7 +7303,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -6428,7 +7439,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

    - + R*-tree creation algorithm parameters.

    @@ -6601,8 +7612,8 @@ R*-tree creation algorithm parameters.
    @@ -6709,6 +7720,32 @@ R*-tree creation algorithm parameters.

    +

    + nearest(DistancePredicates const + &, unsigned) +

    +
    +

    + Generate nearest predicate. +

    +
    +

    + nearest(DistancePredicates const + &) +

    +
    +

    + Generate nearest predicate. +

    +
    @@ -7346,6 +8383,327 @@ R*-tree creation algorithm parameters.
    +
    + +

    + Generate nearest predicate. +

    +
    + + Description +
    +

    + When nearest predicate is passed to the query, k-nearest neighbour search + will be performed. +

    +

    + Distances predicates may be a Point. In this the case values + closest to Point + are returned. +

    +

    + It is possible to define how distance between values and query Point + is calculated. This is done by passing PointRelation. It can be generated + by following functions: +

    + +

    + It is possible to define distances bounds, for example that a distance + must be between min_distance and max_distance. This is done by passing + DistancesPredicates which can be generated by following functions: +

    + +

    + MinRelation and MaxRelation describes bounds and can be generated by + following functions: +

    + +
    + + Synopsis +
    +
    template<typename DistancePredicates>
    +detail::nearest<DistancePredicates> boost::geometry::index::nearest(DistancePredicates const & dpred, unsigned k)
    +
    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancePredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distance predicates. +

    +
    +

    + unsigned +

    +
    +

    + k +

    +
    +

    + The maximum number of values to return. +

    +
    +
    + + Example +
    +

    +

    +
    tree.query(bgi::nearest(pt, 5), std::back_inserter(result));
    +tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result));
    +tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result));
    +tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20)), 5), std::back_inserter(result));
    +
    +

    +

    +
    + + + + + +
    [Warning]Warning

    + Only one nearest() + predicate may be used in a query. This version may be used only in + queries returning a set of values - using output iterator. +

    +
    +
    + +

    + Generate nearest predicate. +

    +
    + + Description +
    +

    + When nearest predicate is passed to the query, k-nearest neighbour search + will be performed. +

    +

    + Distances predicates may be a Point. In this the case value + closest to Point + is returned. +

    +

    + It is possible to define how distance between value and query Point is + calculated. This is done by passing PointRelation. It can be generated + by following functions: +

    + +

    + It is possible to define distances bounds, for example that a distance + must be between min_distance and max_distance. This is done by passing + DistancesPredicates which can be generated by following functions: +

    + +

    + MinRelation and MaxRelation describes bounds and can be generated by + following functions: +

    + +
    + + Synopsis +
    +
    template<typename DistancePredicates>
    +detail::nearest_one<DistancePredicates> boost::geometry::index::nearest(DistancePredicates const & dpred)
    +
    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + DistancePredicates + const & +

    +
    +

    + dpred +

    +
    +

    + The distance predicates. +

    +
    +
    + + Example +
    +

    +

    +
    tree.query(bgi::nearest(pt), value);
    +tree.query(bgi::nearest(pt) && bgi::intersects(box), value);
    +tree.query(bgi::nearest(bgi::to_centroid(pt)) && bgi::within(box), value);
    +tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20))), value);
    +
    +

    +

    +
    + + + + + +
    [Warning]Warning

    + Only one nearest() + predicate may be used in a query. This version may be used only in + queries returning one value. +

    +

    @@ -7384,7 +8742,7 @@ R*-tree creation algorithm parameters.

    Generate to_nearest() - Point-Indexable relationship. + relationship.

    Generate to_centroid() - Point-Indexable relationship. + relationship.

    Generate to_furthest() - Point-Indexable relationship. + relationship.

    Type of wrapped object. This may be a Point for PointRelation - or some Value for MinRelation or MaxRelation + or CoordinateType for MinRelation or MaxRelation

    - Point or bound value. + Point or distance value.

    Type of wrapped object. This may be a Point for PointRelation - or some Value for MinRelation or MaxRelation + or some CoordinateType for MinRelation or MaxRelation

    - Point or bound value. + Point or distance value.

    Type of wrapped object. This may be a Point for PointRelation - or some Value for MinRelation or MaxRelation + or some CoordinateType for MinRelation or MaxRelation

    - Point or bound value. + Point or distance value.

    +

    + queried(Predicates const + &) +

    +
    +

    + The query index adaptor generator. +

    +

    spatial_queried(Predicates const @@ -8665,6 +10036,67 @@ R*-tree creation algorithm parameters.

    +

    + The query index adaptor generator. +

    +
    + + Synopsis +
    +
    template<typename Predicates>
    +detail::query<Predicates> boost::geometry::index::adaptors::queried(Predicates const & pred)
    +
    +
    + + Parameter(s) +
    +
    +++++ + + + + + + + + + + +
    +

    + Type +

    +
    +

    + Name +

    +
    +

    + Description +

    +
    +

    + Predicates const & +

    +
    +

    + pred +

    +
    +

    + Predicates. +

    +
    +
    +
    + @@ -8735,7 +10167,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -8805,7 +10237,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    diff --git a/doc/html/index.html b/doc/html/index.html index 36e65ecb6..3f2ec733d 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -52,7 +52,7 @@ - +

    Last revised: January 24, 2013 at 13:47:55 GMT

    Last revised: January 26, 2013 at 00:31:44 GMT


    diff --git a/include/boost/geometry/index/detail/distance_predicates.hpp b/include/boost/geometry/index/detail/distance_predicates.hpp index 805254704..e1bb2bf1f 100644 --- a/include/boost/geometry/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/index/detail/distance_predicates.hpp @@ -28,194 +28,6 @@ namespace boost { namespace geometry { namespace index { namespace detail { -// ------------------------------------------------------------------ // -// predicate -// ------------------------------------------------------------------ // - -template -struct nearest -{ - static const bool is_one = false; - - nearest(DistancePredicates const& dpred, unsigned k) - : distance_predicates(dpred) - , count(k) - {} - DistancePredicates const& distance_predicates; - unsigned count; -}; - -template -struct predicate_check, value_tag> -{ - template - static inline bool apply(nearest const&, Value const&, Box const&) - { - return true; - } -}; - -template -struct predicate_check, envelope_tag> -{ - template - static inline bool apply(nearest const&, Value const&, Box const&) - { - return true; - } -}; - -template -struct nearest_one -{ - static const bool is_one = true; - - nearest_one(DistancePredicates const& dpred) - : distance_predicates(dpred) - {} - DistancePredicates const& distance_predicates; -}; - -template -struct predicate_check, value_tag> -{ - template - static inline bool apply(nearest_one const&, Value const&, Box const&) - { - return true; - } -}; - -template -struct predicate_check, envelope_tag> -{ - template - static inline bool apply(nearest_one const&, Value const&, Box const&) - { - return true; - } -}; - -// predicates_is_nearest - -template -struct predicates_is_nearest -{ - static const unsigned value = 0; -}; - -template -struct predicates_is_nearest< nearest > -{ - static const unsigned value = 1; -}; - -template -struct predicates_is_nearest< nearest_one > -{ - static const unsigned value = 1; -}; - -// predicates_count_nearest - -template -struct predicates_count_nearest -{ - static const unsigned value = predicates_is_nearest::value; -}; - -template -struct predicates_count_nearest< std::pair > -{ - static const unsigned value = predicates_is_nearest::value - + predicates_is_nearest::value; -}; - -template -struct predicates_count_nearest_tuple -{ - static const unsigned value = - predicates_is_nearest::type>::value - + predicates_count_nearest_tuple::value; -}; - -template -struct predicates_count_nearest_tuple -{ - static const unsigned value = - predicates_is_nearest::type>::value; -}; - -template -struct predicates_count_nearest< boost::tuple > -{ - static const unsigned value = predicates_count_nearest_tuple< - boost::tuple, - boost::tuples::length< boost::tuple >::value - >::value; -}; - -template -struct predicates_count_nearest< boost::tuples::cons > -{ - static const unsigned value = predicates_count_nearest_tuple< - boost::tuples::cons, - boost::tuples::length< boost::tuples::cons >::value - >::value; -}; - -// predicates_find_nearest - -template -struct predicates_find_nearest -{ - static const unsigned value = predicates_is_nearest::value ? 0 : 1; -}; - -template -struct predicates_find_nearest< std::pair > -{ - static const unsigned value = predicates_is_nearest::value ? 0 : - (predicates_is_nearest::value ? 1 : 2); -}; - -template -struct predicates_find_nearest_tuple -{ - static const bool is_found = predicates_find_nearest_tuple::is_found - || predicates_is_nearest::type>::value; - - static const unsigned value = predicates_find_nearest_tuple::is_found ? - predicates_find_nearest_tuple::value : - (predicates_is_nearest::type>::value ? - N-1 : boost::tuples::length::value); -}; - -template -struct predicates_find_nearest_tuple -{ - static const bool is_found = predicates_is_nearest::type>::value; - static const unsigned value = is_found ? 0 : boost::tuples::length::value; -}; - -template -struct predicates_find_nearest< boost::tuple > -{ - static const unsigned value = predicates_find_nearest_tuple< - boost::tuple, - boost::tuples::length< boost::tuple >::value - >::value; -}; - -template -struct predicates_find_nearest< boost::tuples::cons > -{ - static const unsigned value = predicates_find_nearest_tuple< - boost::tuples::cons, - boost::tuples::length< boost::tuples::cons >::value - >::value; -}; - // ------------------------------------------------------------------ // // relations // ------------------------------------------------------------------ // diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index a8261319a..465f76799 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -113,6 +113,30 @@ struct not_within Geometry geometry; }; +template +struct nearest +{ + static const bool is_one = false; + + nearest(DistancePredicates const& dpred, unsigned k) + : distance_predicates(dpred) + , count(k) + {} + DistancePredicates const& distance_predicates; + unsigned count; +}; + +template +struct nearest_one +{ + static const bool is_one = true; + + nearest_one(DistancePredicates const& dpred) + : distance_predicates(dpred) + {} + DistancePredicates const& distance_predicates; +}; + // ------------------------------------------------------------------ // // predicate_check // ------------------------------------------------------------------ // @@ -280,6 +304,26 @@ struct predicate_check, value_tag> } }; +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(nearest const&, Value const&, Box const&) + { + return true; + } +}; + +template +struct predicate_check, value_tag> +{ + template + static inline bool apply(nearest_one const&, Value const&, Box const&) + { + return true; + } +}; + // ------------------------------------------------------------------ // // predicates_chec for envelope // ------------------------------------------------------------------ // @@ -438,6 +482,26 @@ struct predicate_check, envelope_tag> } }; +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(nearest const&, Value const&, Box const&) + { + return true; + } +}; + +template +struct predicate_check, envelope_tag> +{ + template + static inline bool apply(nearest_one const&, Value const&, Box const&) + { + return true; + } +}; + // ------------------------------------------------------------------ // // predicates_length // ------------------------------------------------------------------ // @@ -663,6 +727,130 @@ inline bool predicates_check(Predicates const& p, Value const& v, Indexable cons ::apply(p, v, i); } +// ------------------------------------------------------------------ // +// nearest predicate helpers +// ------------------------------------------------------------------ // + +// predicates_is_nearest + +template +struct predicates_is_nearest +{ + static const unsigned value = 0; +}; + +template +struct predicates_is_nearest< nearest > +{ + static const unsigned value = 1; +}; + +template +struct predicates_is_nearest< nearest_one > +{ + static const unsigned value = 1; +}; + +// predicates_count_nearest + +template +struct predicates_count_nearest +{ + static const unsigned value = predicates_is_nearest::value; +}; + +template +struct predicates_count_nearest< std::pair > +{ + static const unsigned value = predicates_is_nearest::value + + predicates_is_nearest::value; +}; + +template +struct predicates_count_nearest_tuple +{ + static const unsigned value = + predicates_is_nearest::type>::value + + predicates_count_nearest_tuple::value; +}; + +template +struct predicates_count_nearest_tuple +{ + static const unsigned value = + predicates_is_nearest::type>::value; +}; + +template +struct predicates_count_nearest< boost::tuple > +{ + static const unsigned value = predicates_count_nearest_tuple< + boost::tuple, + boost::tuples::length< boost::tuple >::value + >::value; +}; + +template +struct predicates_count_nearest< boost::tuples::cons > +{ + static const unsigned value = predicates_count_nearest_tuple< + boost::tuples::cons, + boost::tuples::length< boost::tuples::cons >::value + >::value; +}; + +// predicates_find_nearest + +template +struct predicates_find_nearest +{ + static const unsigned value = predicates_is_nearest::value ? 0 : 1; +}; + +template +struct predicates_find_nearest< std::pair > +{ + static const unsigned value = predicates_is_nearest::value ? 0 : + (predicates_is_nearest::value ? 1 : 2); +}; + +template +struct predicates_find_nearest_tuple +{ + static const bool is_found = predicates_find_nearest_tuple::is_found + || predicates_is_nearest::type>::value; + + static const unsigned value = predicates_find_nearest_tuple::is_found ? + predicates_find_nearest_tuple::value : + (predicates_is_nearest::type>::value ? + N-1 : boost::tuples::length::value); +}; + +template +struct predicates_find_nearest_tuple +{ + static const bool is_found = predicates_is_nearest::type>::value; + static const unsigned value = is_found ? 0 : boost::tuples::length::value; +}; + +template +struct predicates_find_nearest< boost::tuple > +{ + static const unsigned value = predicates_find_nearest_tuple< + boost::tuple, + boost::tuples::length< boost::tuple >::value + >::value; +}; + +template +struct predicates_find_nearest< boost::tuples::cons > +{ + static const unsigned value = predicates_find_nearest_tuple< + boost::tuples::cons, + boost::tuples::length< boost::tuples::cons >::value + >::value; +}; + }}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP diff --git a/include/boost/geometry/index/distance_predicates.hpp b/include/boost/geometry/index/distance_predicates.hpp index 67d111519..890c5a2c6 100644 --- a/include/boost/geometry/index/distance_predicates.hpp +++ b/include/boost/geometry/index/distance_predicates.hpp @@ -19,26 +19,10 @@ namespace boost { namespace geometry { namespace index { -// nearest predicate generators - -template inline -detail::nearest -nearest(DistancePredicates const& dpred, unsigned k) -{ - return detail::nearest(dpred, k); -} - -template inline -detail::nearest_one -nearest(DistancePredicates const& dpred) -{ - return detail::nearest_one(dpred); -} - // relations generators /*! -\brief Generate to_nearest() Point-Indexable relationship. +\brief Generate to_nearest() relationship. Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances @@ -49,10 +33,10 @@ closer or further than value v. This is default relation. \ingroup distance_predicates -\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for +\tparam T Type of wrapped object. This may be a Point for PointRelation or CoordinateType for MinRelation or MaxRelation -\param v Point or bound value. +\param v Point or distance value. */ template detail::to_nearest to_nearest(T const& v) @@ -61,7 +45,7 @@ detail::to_nearest to_nearest(T const& v) } /*! -\brief Generate to_centroid() Point-Indexable relationship. +\brief Generate to_centroid() relationship. Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances @@ -71,10 +55,10 @@ closer or further than value v. \ingroup distance_predicates -\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for +\tparam T Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation -\param v Point or bound value. +\param v Point or distance value. */ template detail::to_centroid to_centroid(T const& v) @@ -83,7 +67,7 @@ detail::to_centroid to_centroid(T const& v) } /*! -\brief Generate to_furthest() Point-Indexable relationship. +\brief Generate to_furthest() relationship. Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances @@ -94,10 +78,10 @@ closer or further than value v. \ingroup distance_predicates -\tparam T Type of wrapped object. This may be a Point for PointRelation or some Value for +\tparam T Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation -\param v Point or bound value. +\param v Point or distance value. */ template detail::to_furthest to_furthest(T const& v) diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index b0cacfa77..db9650398 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -22,7 +22,7 @@ #include /*! -\defgroup predicates Spatial predicates (boost::geometry::index::) +\defgroup predicates Predicates (boost::geometry::index::) */ namespace boost { namespace geometry { namespace index { @@ -159,6 +159,105 @@ inline detail::value value(Fun const& fun) return detail::value(fun); } +/*! +\brief Generate nearest predicate. + +When nearest predicate is passed to the query, k-nearest neighbour search will be performed. + +Distances predicates may be a \c Point. In this the case values closest to \c Point are returned. + +It is possible to define how distance between values and query Point is calculated. This is done by passing PointRelation. +It can be generated by following functions: +\li \c boost::geometry::index::to_nearest() - default, +\li \c boost::geometry::index::to_centroid(), +\li \c boost::geometry::index::to_furthest(). + +It is possible to define distances bounds, for example that a distance must be between +min_distance and max_distance. This is done by passing DistancesPredicates which can be generated +by following functions: +\li \c boost::geometry::index::unbounded() - default, +\li \c boost::geometry::index::min_bounded(), +\li \c boost::geometry::index::max_bounded(), +\li \c boost::geometry::index::bounded(). + +MinRelation and MaxRelation describes bounds and can be generated by following functions: +\li \c boost::geometry::index::to_nearest(), +\li \c boost::geometry::index::to_centroid(), +\li \c boost::geometry::index::to_furthest(). + +\par Example +\verbatim +tree.query(bgi::nearest(pt, 5), std::back_inserter(result)); +tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); +tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20)), 5), std::back_inserter(result)); +\endverbatim + +\warning +Only one \c nearest() predicate may be used in a query. +This version may be used only in queries returning a set of values - using output iterator. + +\ingroup predicates + +\param dpred The distance predicates. +\param k The maximum number of values to return. +*/ +template inline +detail::nearest +nearest(DistancePredicates const& dpred, unsigned k) +{ + return detail::nearest(dpred, k); +} + +/*! +\brief Generate nearest predicate. + +When nearest predicate is passed to the query, k-nearest neighbour search will be performed. + +Distances predicates may be a \c Point. In this the case value closest to \c Point is returned. + +It is possible to define how distance between value and query Point is calculated. This is done by passing PointRelation. +It can be generated by following functions: +\li \c boost::geometry::index::to_nearest() - default, +\li \c boost::geometry::index::to_centroid(), +\li \c boost::geometry::index::to_furthest(). + +It is possible to define distances bounds, for example that a distance must be between +min_distance and max_distance. This is done by passing DistancesPredicates which can be generated +by following functions: +\li \c boost::geometry::index::unbounded() - default, +\li \c boost::geometry::index::min_bounded(), +\li \c boost::geometry::index::max_bounded(), +\li \c boost::geometry::index::bounded(). + +MinRelation and MaxRelation describes bounds and can be generated by following functions: +\li \c boost::geometry::index::to_nearest(), +\li \c boost::geometry::index::to_centroid(), +\li \c boost::geometry::index::to_furthest(). + +\par Example +\verbatim +tree.query(bgi::nearest(pt), value); +tree.query(bgi::nearest(pt) && bgi::intersects(box), value); +tree.query(bgi::nearest(bgi::to_centroid(pt)) && bgi::within(box), value); +tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20))), value); +\endverbatim + +\warning +Only one \c nearest() predicate may be used in a query. +This version may be used only in queries returning one value. + +\ingroup predicates + +\param dpred The distance predicates. +*/ +template inline +detail::nearest_one +nearest(DistancePredicates const& dpred) +{ + return detail::nearest_one(dpred); +} + namespace detail { // operator! generators diff --git a/include/boost/geometry/index/query_expr.hpp b/include/boost/geometry/index/query_expr.hpp deleted file mode 100644 index d26c002ea..000000000 --- a/include/boost/geometry/index/query_expr.hpp +++ /dev/null @@ -1,149 +0,0 @@ -// Boost.Geometry Index -// -// Query expr -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP -#define BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP - -#include -#include -#include - -namespace boost { namespace geometry { namespace index { namespace qe { - -namespace detail { - -// tags - -struct intersects_tag {}; -struct within_tag {}; - -struct nearest_tag {}; - -// predicates - -template -struct predicate -{ - typedef Tag tag_type; - predicate(T const& d) : data(d) {} - T data; -}; - -template -struct predicate -{ - typedef nearest_tag tag_type; - predicate(T const& d, size_t k) : data(d), count(k) {} - T data; - size_t count; -}; - -template -struct push_back_impl -{ - typedef - boost::tuples::cons< - typename boost::tuples::element::type, - typename push_back_impl::type - > type; - - static type apply(T const& t, Tuple const& tup) - { - return - type( - boost::get(tup), - push_back_impl::apply(t, tup) - ); - } -}; - -template -struct push_back_impl -{ - typedef boost::tuples::cons type; - - static type apply(T const& t, Tuple const&) - { - return type(t, boost::tuples::null_type()); - } -}; - -template inline -boost::tuples::cons< - predicate, - boost::tuples::cons, boost::tuples::null_type> -> -operator&&(predicate const& p1, predicate const& p2) -{ - return - boost::tuples::cons< - predicate, - boost::tuples::cons, boost::tuples::null_type> - >( - p1, - boost::tuples::cons, boost::tuples::null_type>(p2, boost::tuples::null_type()) - ); -} - -template inline -typename push_back_impl< - predicate, - boost::tuples::cons, - 0, - boost::tuples::length >::value ->::type -operator&&(boost::tuples::cons const& t, predicate const& p) -{ - return - push_back_impl< - predicate, - boost::tuples::cons, - 0, - boost::tuples::length >::value - >::apply(p, t); -} - -template -struct find_nearest_impl -{ - static const size_t value = - boost::is_same< - typename boost::tuples::element::type::tag_type, - nearest_tag - >::value ? - I : - find_nearest_impl::value; -}; - -template -struct find_nearest_impl -{ - static const size_t value = N; -}; - -} // namespace detail - -// predicates generators - -template -detail::predicate intersects(Geometry const& g) -{ - return detail::predicate(g); -} - -template -detail::predicate nearest(DistancePredicates const& p, size_t k) -{ - return detail::predicate(p, k); -} - -}}}} // namespace boost::geometry::index::qe - -#endif // BOOST_GEOMETRY_INDEX_QUERY_EXPR_HPP diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 4c283abba..8f33f8832 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -630,6 +630,70 @@ public: return result; } + /*! + \brief Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. + + This query function performs spatial and k-nearest neighbor searches. It allows to pass a set of predicates. + Values will be returned only if all predicates are met. + + Spatial predicates + + The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. + More spatial predicates may be generated by one of the functions listed below: + \li \c boost::geometry::index::covered_by(), + \li \c boost::geometry::index::disjoint(), + \li \c boost::geometry::index::intersects() - default, + \li \c boost::geometry::index::overlaps(), + \li \c boost::geometry::index::within(), + + It is possible to negate spatial predicates: + \li ! boost::geometry::index::covered_by(), + \li ! boost::geometry::index::disjoint(), + \li ! boost::geometry::index::intersects(), + \li ! boost::geometry::index::overlaps(), + \li ! boost::geometry::index::within() + + Value predicate + + This is a special kind of predicate which allows to pass a user-defined functor which checks + if Value should be returned by the query. It's generated by: + \li \c boost::geometry::index::value(). + + Nearest predicate + + If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. + Passing the first one will result in returning k number of values, the second one will result in returning + only one, closest value. In both cases values will be returned to the output iterator. Only one nearest + predicate may be passed to the query. It may be generated by: + \li \c boost::geometry::index::nearest(). + + Connecting predicates + + A set of predicates may be generated by: + \li \c std::make_pair() + \li \c boost::make_tuple() + \li \c operator&&() + + \par Example + \verbatim + tree.query(box1, std::back_inserter(result)); + tree.query(std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); + tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); + tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); + tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); + \endverbatim + + \warning + Only one \c nearest() perdicate may be passed to the query. + + \param predicates Predicates. + \param out_it The output iterator, e.g. generated by std::back_inserter(). + + \return The number of values found. + + \par Throws + If Value copy constructor or copy assignment throws. + */ template size_type query(Predicates const& predicates, OutIter out_it) const { @@ -640,13 +704,73 @@ public: return query_dispatch(predicates, out_it, boost::mpl::bool_()); } + /*! + \brief Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. + + This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. + The value will be returned only if all predicates are met. This query requires that one of the + predicates must be one-value \c nearest() predicate. + + Spatial predicates + + The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. + More spatial predicates may be generated by one of the functions listed below: + \li \c boost::geometry::index::covered_by(), + \li \c boost::geometry::index::disjoint(), + \li \c boost::geometry::index::intersects() - default, + \li \c boost::geometry::index::overlaps(), + \li \c boost::geometry::index::within(), + + It is possible to negate spatial predicates: + \li ! boost::geometry::index::covered_by(), + \li ! boost::geometry::index::disjoint(), + \li ! boost::geometry::index::intersects(), + \li ! boost::geometry::index::overlaps(), + \li ! boost::geometry::index::within() + + Value predicate + + This is a special kind of predicate which allows to pass a user-defined functor which checks + if Value should be returned by the query. It's generated by: + \li \c boost::geometry::index::value(). + + Nearest predicate + + This query requires that one of the predicates must be one-value \c nearest() predicate. + It may be generated by \c nearest() taking only one parameter - distance predicates. + \li \c boost::geometry::index::nearest(). + + Connecting predicates + + A set of predicates may be generated by: + \li \c std::make_pair() + \li \c boost::make_tuple() + \li \c operator&&() + + \par Example + \verbatim + tree.query(std::make_pair(bgi::nearest(pt), bgi::within(box)), value); + tree.query(bgi::nearest(pt) && bgi::intersects(poly), value); + \endverbatim + + \warning + This query requires that one of the predicates must be one-value \c nearest() predicate. + + \param predicates Predicates. + \param value The reference to value which will hold the result of the query. + + \return The number of values found (1 if value was found, 0 otherwise). + + \par Throws + If Value copy constructor or copy assignment throws. + */ template - size_type query(Predicates const& predicates, value_type & v) const + size_type query(Predicates const& predicates, value_type & value) const { static const unsigned nearest_count = detail::predicates_count_nearest::value; BOOST_MPL_ASSERT_MSG((nearest_count == 1), PASS_ONE_VALUE_NEAREST_PREDICATE_TO_GET_VALUE_AS_RESULT, (Predicates)); - return query_dispatch(predicates, v, boost::mpl::bool_()); + return query_dispatch(predicates, value, boost::mpl::bool_()); } private: @@ -1461,22 +1585,152 @@ remove(rtree & tree, Range const& rng) return tree.remove(rng); } +/*! +\brief Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. + +This query function performs spatial and k-nearest neighbor searches. It allows to pass a set of predicates. +Values will be returned only if all predicates are met. + +Spatial predicates + +The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. +More spatial predicates may be generated by one of the functions listed below: +\li \c boost::geometry::index::covered_by(), +\li \c boost::geometry::index::disjoint(), +\li \c boost::geometry::index::intersects() - default, +\li \c boost::geometry::index::overlaps(), +\li \c boost::geometry::index::within(), + +It is possible to negate spatial predicates: +\li ! boost::geometry::index::covered_by(), +\li ! boost::geometry::index::disjoint(), +\li ! boost::geometry::index::intersects(), +\li ! boost::geometry::index::overlaps(), +\li ! boost::geometry::index::within() + +Value predicate + +This is a special kind of predicate which allows to pass a user-defined functor which checks +if Value should be returned by the query. It's generated by: +\li \c boost::geometry::index::value(). + +Nearest predicate + +If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. +Passing the first one will result in returning k number of values, the second one will result in returning +only one, closest value. In both cases values will be returned to the output iterator. Only one nearest +predicate may be passed to the query. It may be generated by: +\li \c boost::geometry::index::nearest(). + +Connecting predicates + +A set of predicates may be generated by: +\li \c std::make_pair() +\li \c boost::make_tuple() +\li \c operator&&() + +\par Example +\verbatim +bgi::query(tree, box1, std::back_inserter(result)); +bgi::query(tree, std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); +bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); +bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +\endverbatim + +\warning +Only one \c nearest() perdicate may be passed to the query. + +\ingroup rtree_functions + +\param tree The spatial index. +\param predicates Predicates. +\param out_it The output iterator, e.g. generated by std::back_inserter(). + +\return The number of values found. + +\par Throws +If Value copy constructor or copy assignment throws. +*/ template inline typename rtree::size_type query(rtree const& tree, - Predicates const& pred, + Predicates const& predicates, OutIter out_it) { - return tree.query(pred, out_it); + return tree.query(predicates, out_it); } +/*! +\brief Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. + +This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. +The value will be returned only if all predicates are met. This query requires that one of the +predicates must be one-value \c nearest() predicate. + +Spatial predicates + +The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. +More spatial predicates may be generated by one of the functions listed below: +\li \c boost::geometry::index::covered_by(), +\li \c boost::geometry::index::disjoint(), +\li \c boost::geometry::index::intersects() - default, +\li \c boost::geometry::index::overlaps(), +\li \c boost::geometry::index::within(), + +It is possible to negate spatial predicates: +\li ! boost::geometry::index::covered_by(), +\li ! boost::geometry::index::disjoint(), +\li ! boost::geometry::index::intersects(), +\li ! boost::geometry::index::overlaps(), +\li ! boost::geometry::index::within() + +Value predicate + +This is a special kind of predicate which allows to pass a user-defined functor which checks +if Value should be returned by the query. It's generated by: +\li \c boost::geometry::index::value(). + +Nearest predicate + +This query requires that one of the predicates must be one-value \c nearest() predicate. +It may be generated by \c nearest() taking only one parameter - distance predicates. +\li \c boost::geometry::index::nearest(). + +Connecting predicates + +A set of predicates may be generated by: +\li \c std::make_pair() +\li \c boost::make_tuple() +\li \c operator&&() + +\par Example +\verbatim +bgi::query(tree, std::make_pair(bgi::nearest(pt), bgi::within(box)), value); +bgi::query(tree, bgi::nearest(pt) && bgi::intersects(poly), value); +\endverbatim + +\warning +This query requires that one of the predicates must be one-value \c nearest() predicate. + +\ingroup rtree_functions + +\param tree The spatial index. +\param predicates Predicates. +\param value The reference to value which will hold the result of the query. + +\return The number of values found (1 if value was found, 0 otherwise). + +\par Throws +If Value copy constructor or copy assignment throws. +*/ template inline typename rtree::size_type query(rtree const& tree, - Predicates const& pred, - typename rtree::value_type & v) + Predicates const& predicates, + typename rtree::value_type & value) { - return tree.query(pred, v); + return tree.query(predicates, value); } /*! diff --git a/tests/query_expr.cpp b/tests/query_expr.cpp deleted file mode 100644 index 5e7fd9241..000000000 --- a/tests/query_expr.cpp +++ /dev/null @@ -1,223 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include - -#include -#include -#include - -template -struct Test -{ - inline Test(T const& t) : v(t) {} - T v; -}; - -template -struct Raw -{ - inline explicit Raw(T1 const& t1, T2 const& t2, T3 const& t3) : v1(t1), v2(t2), v3(t3) {} - T1 v1; - T2 v2; - T3 v3; -}; - -template inline -boost::tuples::cons< - Test, - boost::tuples::cons, boost::tuples::null_type> -> -operator&&(Test const& t1, Test const& t2) -{ - return - boost::tuples::cons< - Test, - boost::tuples::cons, boost::tuples::null_type> - >(t2, - boost::tuples::cons, boost::tuples::null_type>(t1, boost::tuples::null_type()) - ); -} - -template inline -boost::tuples::cons< - Test, - boost::tuples::cons -> -operator&&(boost::tuples::cons const& t, Test const& t2) -{ - return - boost::tuples::cons< - Test, - boost::tuples::cons - >(t2, t); -} - -template -struct Test2 -{ - inline Test2(T const& t) : v(t) {} - T v; -}; - -template inline -boost::tuples::cons< - Test2, - boost::tuples::cons, boost::tuples::null_type> -> -operator&&(Test2 const& t1, Test2 const& t2) -{ - return - boost::tuples::cons< - Test2, - boost::tuples::cons, boost::tuples::null_type> - >(t1, - boost::tuples::cons, boost::tuples::null_type>(t2, boost::tuples::null_type()) - ); -} - -template -struct add -{ - typedef - boost::tuples::cons< - typename boost::tuples::element::type, - typename add::type - > type; - - static type apply(T const& t, Tuple const& tup) - { - return - type( - boost::get(tup), - add::apply(t, tup) - ); - } -}; - -template -struct add -{ - typedef boost::tuples::cons type; - - static type apply(T const& t, Tuple const&) - { - return type(t, boost::tuples::null_type()); - } -}; - -template inline -typename add< - Test2, - boost::tuples::cons, - 0, - boost::tuples::length >::value ->::type -operator&&(boost::tuples::cons const& t, Test2 const& t2) -{ - return - add< - Test2, - boost::tuples::cons, - 0, - boost::tuples::length >::value - >::apply(t2, t); -} - -template inline -double test(T const& t) -{ - return boost::get<0>(t).v + boost::get<1>(t).v + boost::get<2>(t).v; -} - -template inline -void test2(T const& t) -{ - using namespace boost::geometry::index::qe; - std::cout << detail::find_nearest_impl::value << '\n'; -} - -int main() -{ - using namespace boost::geometry::index::qe; - - //TEST - - test2(intersects(0) && nearest(0, 0) && intersects(0)); - - boost::timer tim; - - size_t count = 200000000; - //size_t count = 2000000; - int dummy = 0; - std::ifstream f("blablabla"); - f >> dummy; - - std::cout << "&&1 &&2 b, r,\n"; - - double sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0; - for(size_t i = 0 ; i < 20; ++i) - { - double foo = 0; - - { - tim.restart(); - for ( size_t i = 0 ; i < count ; ++i ) - { - foo += test(Test(dummy) && Test(dummy) && Test(dummy)); - } - double t = tim.elapsed(); - sum1 += t; - std::cout << t << ' '; - } - - { - tim.restart(); - for ( size_t i = 0 ; i < count ; ++i ) - { - foo += test(Test2(dummy) && Test2(dummy) && Test2(dummy)); - } - double t = tim.elapsed(); - sum2 += t; - std::cout << t << ' '; - } - - { - tim.restart(); - for ( size_t i = 0 ; i < count ; ++i ) - { - boost::tuple, Test, Test > tup - = boost::make_tuple(Test(dummy), Test(dummy), Test(dummy)); - foo += boost::get<0>(tup).v + boost::get<1>(tup).v + boost::get<2>(tup).v; - } - double t = tim.elapsed(); - sum3 += t; - std::cout << t << ' '; - } - - { - tim.restart(); - for ( size_t i = 0 ; i < count ; ++i ) - { - Raw, Test, Test > tup(dummy, dummy, dummy); - foo += tup.v1.v + tup.v2.v + tup.v3.v; - } - double t = tim.elapsed(); - sum4 += t; - std::cout << t << ' '; - } - - std::cout << foo << '\n'; - } - - std::cout << "sums:\n"; - std::cout << sum1 << " " << sum2 << " " << sum3 << " " << sum4; - - return 0; -} From ce4d80715970fb479556d82d19fc20bbd468ab05 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 26 Jan 2013 01:27:59 +0000 Subject: [PATCH 309/366] Docs updated - new querying method used. Queries description rearranged/modified. [SVN r82618] --- doc/html/geometry_index/r_tree.html | 30 +- .../r_tree/creation_and_modification.html | 6 +- .../r_tree/nearest_neighbours_queries.html | 240 -------- doc/html/geometry_index/r_tree/queries.html | 538 ++++++++++++++++++ .../r_tree/r_tree_creation.html | 184 ------ doc/html/geometry_index/r_tree/reference.html | 24 +- .../r_tree/rtree_quickstart.html | 4 +- .../r_tree/spatial_queries.html | 308 ---------- doc/html/index.html | 6 +- doc/rtree.qbk | 4 +- doc/rtree/nearest_query.qbk | 137 ----- doc/rtree/query.qbk | 273 +++++++++ doc/rtree/spatial_query.qbk | 142 ----- doc/src/examples/rtree/quick_start.cpp | 4 +- 14 files changed, 843 insertions(+), 1057 deletions(-) delete mode 100644 doc/html/geometry_index/r_tree/nearest_neighbours_queries.html create mode 100644 doc/html/geometry_index/r_tree/queries.html delete mode 100644 doc/html/geometry_index/r_tree/r_tree_creation.html delete mode 100644 doc/html/geometry_index/r_tree/spatial_queries.html delete mode 100644 doc/rtree/nearest_query.qbk create mode 100644 doc/rtree/query.qbk delete mode 100644 doc/rtree/spatial_query.qbk diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index c8b440eaa..d8f3103ee 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -49,31 +49,21 @@
    Insert iterator
    -
    Spatial queries
    +
    Queries
    -
    Basic +
    Performing + a query
    +
    Spatial queries
    -
    Spatial - predicates
    -
    Connecting - predicates
    -
    Value +
    Nearest + neighbours queries
    +
    Value predicate
    -
    Inserting +
    Passing + a set of predicates
    +
    Inserting query results into the other R-tree
    -
    Nearest - neighbours queries
    -
    -
    k - nearest neighbours
    -
    One - nearest neighbour
    -
    Distances - predicates
    -
    Using - spatial predicates
    -
    Reference
    boost::geometry::index::rtree
    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 263f4d250..cce4835e6 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext

    @@ -357,7 +357,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html b/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html deleted file mode 100644 index 18130e9d5..000000000 --- a/doc/html/geometry_index/r_tree/nearest_neighbours_queries.html +++ /dev/null @@ -1,240 +0,0 @@ - - - -Nearest neighbours queries - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - - -

    - 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 query - distance to Indexable's furthest point greather than - ... -

    -
    -

    - knn query - distance to Indexable's closest point greather than - ... -

    -
    -

    - knn -

    -
    -

    - knn_inters -

    -
    -

    - knn_cover -

    -
    -
    - -

    - There are three ways of performing knn queries. Following queries returns - k Values closest to some point in space. For Boxes - Indexables the distance to the nearest point is calculated - by default. -

    -

    - Method call -

    -
    std::vector<Value> returned_values;
    -Point pt(...);
    -rt.nearest_query(pt, k, std::back_inserter(returned_values));
    -
    -

    - Function call -

    -
    std::vector<Value> returned_values;
    -Point pt(...);
    -index::nearest_query(rt, pt, k, std::back_inserter(returned_values));
    -
    -

    - Use of operator | -

    -
    Point pt(...);
    -BOOST_FOREACH(Value & v, rt | index::adaptors::nearest_queried(pt, k))
    -  ; // do something with v
    -
    -
    -
    - -

    - Another type of nearest neighbour query is searching for the one closest - Value. If it is found, 1 is returned by the method or function. - This kind of query has only two forms. -

    -

    - Method call -

    -
    Value returned_value;
    -Point pt(...);
    -size_t n = rt.nearest_query(pt, returned_value);
    -
    -

    - Function call -

    -
    Value Value returned_value;
    -Point pt(...);
    -size_t n = index::nearest_query(rt, pt, returned_value);
    -
    -
    -
    - -

    - It is possible to define if calculated distance between query point and - Value should be greater, lesser or between some other distances. - Those are called DistancesPredicates - and may be defined as follows. -

    -
    std::vector<__Value__> returned_values;
    -Point pt(...);
    -
    -/* default - without bounds */
    -index::nearest_query(rt, pt, k, std::back_inserter(returned_values));
    -
    -/* same as default */
    -index::nearest_query(rt, index::unbounded(pt), k, std::back_inserter(returned_values));
    -
    -/* distance must be greater than or equal to 10 */
    -index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    -
    -/* distance must be lesser than or equal to 500 */
    -index::nearest_query(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values));
    -
    -/* distance must be between 10 and 500 */
    -index::nearest_query(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values));
    -
    -

    - Furthermore, it's possible to define if the closest, furthest or centroidal - point of the non-point Indexable should be taken into account - in the routine calculating distance. -

    -
    std::vector<Value> returned_values;
    -Point pt(...);
    -
    -/* default - distance between Indexable's closest point and a query point
    -must be greater than 10 */
    -index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values));
    -
    -/* same as default - distance between Indexable's closest point and a query point
    -must be greater than 10 */
    -index::nearest_query(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values));
    -
    -/* distance between Indexable's furthest point and a query point
    -must be greater than 10 */
    -index::nearest_query(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values));
    -
    -/* distance between Indexable's centroid and a query point
    -must be greater than 10 */
    -index::nearest_query(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values));
    -
    -
    -
    - -

    - It is possible to use spatial predicates described before in nearest neighbours - queries. -

    -
    Value returned_value;
    -std::vector<Value> returned_values;
    -
    -Point pt(...);
    -Box b(...);
    -
    -size_t n1 = rt.nearest_query(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value);
    -
    -size_t n2 = index::nearest_query(rt, pt, k, index::within(b), std::back_inserter(returned_values));
    -
    -BOOST_FOREACH(Value & v, rt | index::adaptors::nearest_queried(pt, k, index::covered_by(b)))
    -  ; // do something with v
    -
    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/geometry_index/r_tree/queries.html b/doc/html/geometry_index/r_tree/queries.html new file mode 100644 index 000000000..7c642bc32 --- /dev/null +++ b/doc/html/geometry_index/r_tree/queries.html @@ -0,0 +1,538 @@ + + + +Queries + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + + +

    + Queries returns Values which + meets some predicates. Currently supported are three types of predicates: +

    +
      +
    • + spatial predicates - defining relationship between stored Values and + some Geometry, +
    • +
    • + nearest predicates - defining relationship between stored Values and + some Point, +
    • +
    • + value predicate - passing user-defined functor to the query. +
    • +
    +

    + For example queries may be used to retrieve Values: +

    +
      +
    • + intersecting some area but not within other area, +
    • +
    • + are nearest to some point, +
    • +
    • + overlapping a box and has user-defined property. +
    • +
    +
    + +

    + There are three ways to perform a query. In the following example Box + is used as the predicate, this is a default spatial predicate described + in the following section. Following queries returns Values + intersecting some region defined as a Box. + These three methods are: +

    +

    + Method call +

    +
    std::vector<Value> returned_values;
    +Box box_region(...);
    +rt.query(box_region, std::back_inserter(returned_values));
    +
    +

    + Function call +

    +
    std::vector<Value> returned_values;
    +Box box_region(...);
    +index::query(rt, box_region, std::back_inserter(returned_values));
    +
    +

    + Use of pipe operator generating a range +

    +
    Box box_region(...);
    +BOOST_FOREACH(Value & v, rt | index::adaptors::queried(box_region))
    +  ; // do something with v
    +
    +
    +
    + +

    + Spatial query returns Values which are related somehow to a geometry or + some number of geometries. Names of spatial predicates corresponds to names + of Boost.Geometry + algorithms. Examples of some basic queries may be found in tables below. + The query region and result Values + are orange. +

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

    + intersects(Box) - default +

    +
    +

    + covered_by(Box) +

    +
    +

    + disjoint(Box) +

    +
    +

    + overlaps(Box) +

    +
    +

    + within(Box) +

    +
    +

    + intersects +

    +
    +

    + within +

    +
    +

    + disjoint +

    +
    +

    + overlaps +

    +
    +

    + within +

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

    + intersects(Ring) +

    +
    +

    + intersects(Polygon) +

    +
    +

    + intersects(MultiPolygon) +

    +
    +

    + intersects_ring +

    +
    +

    + intersects_poly +

    +
    +

    + intersects_mpoly +

    +
    +

    + To use a spatial predicate one may pass a geometry (which is a default + case) or use one of the functions defined in boost::geometry::index + namespace to define it explicitly. +

    +
    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));
    +
    +

    + All predicates may be negated, e.g.: +

    +
    rt.query(!index::intersects(box), std::back_inserter(result));
    +// the same as
    +rt.query(index::disjoint(box), std::back_inserter(result));
    +
    +
    +
    + +

    + 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 query - distance to Indexable's furthest point greather than + ... +

    +
    +

    + knn query - distance to Indexable's closest point greather than + ... +

    +
    +

    + knn +

    +
    +

    + knn_inters +

    +
    +

    + knn_cover +

    +
    +
    + +

    + There are three ways of performing knn queries. Following queries returns + k Values closest to some point in space. For Boxes + Indexables the distance to the nearest point is calculated + by default. +

    +

    + Method call +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +rt.query(index::nearest(pt, k), std::back_inserter(returned_values));
    +
    +

    + Function call +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +index::query(rt, index::nearest(pt, k), std::back_inserter(returned_values));
    +
    +

    + Use of operator | +

    +
    Point pt(...);
    +BOOST_FOREACH(Value & v, rt | index::adaptors::queried(index::nearest(pt, k)))
    +  ; // do something with v
    +
    +
    +
    + +

    + Another type of nearest neighbour query is searching for the one closest + Value. If it is found, 1 is returned by the method or function. + This kind of query has only two forms. +

    +

    + Method call +

    +
    Value returned_value;
    +Point pt(...);
    +size_t n = rt.query(index::nearest(pt), returned_value);
    +
    +

    + Function call +

    +
    Value Value returned_value;
    +Point pt(...);
    +size_t n = index::query(rt, index::nearest(pt), returned_value);
    +
    +
    +
    + +

    + It is possible to define if calculated distance between query point and + Value should be greater, lesser or between some other distances. + Those are called DistancesPredicates + and may be defined as follows. +

    +
    std::vector<__Value__> returned_values;
    +Point pt(...);
    +
    +/* default - without bounds */
    +index::query(rt, index::nearest(pt, k), std::back_inserter(returned_values));
    +
    +/* same as default */
    +index::query(rt, index::nearest(index::unbounded(pt), k), std::back_inserter(returned_values));
    +
    +/* distance must be greater than or equal to 10 */
    +index::query(rt, index::nearest(index::min_bounded(pt, 10), k), std::back_inserter(returned_values));
    +
    +/* distance must be lesser than or equal to 500 */
    +index::query(rt, index::nearest(index::max_bounded(pt, 500), k), std::back_inserter(returned_values));
    +
    +/* distance must be between 10 and 500 */
    +index::query(rt, index::nearest(index::bounded(pt, 10, 500), k), std::back_inserter(returned_values));
    +
    +

    + Furthermore, it's possible to define if the closest, furthest or centroidal + point of the non-point Indexable should be taken into account + in the routine calculating distance. +

    +
    std::vector<Value> returned_values;
    +Point pt(...);
    +
    +/* default - distance between Indexable's closest point and a query point
    +must be greater than 10 */
    +index::query(rt, index::nearest(index::min_bounded(pt, 10), k), std::back_inserter(returned_values));
    +
    +/* same as default - distance between Indexable's closest point and a query point
    +must be greater than 10 */
    +index::query(rt, index::nearest(index::min_bounded(pt, index::to_nearest(10)), k), std::back_inserter(returned_values));
    +
    +/* distance between Indexable's furthest point and a query point
    +must be greater than 10 */
    +index::query(rt, index::nearest(index::min_bounded(pt, index::to_furthest(10)), k), std::back_inserter(returned_values));
    +
    +/* distance between Indexable's centroid and a query point
    +must be greater than 10 */
    +index::query(rt, index::nearest(index::min_bounded(pt, index::to_centroid(10)), k), std::back_inserter(returned_values));
    +
    +
    +
    +
    + +

    + There is a unique predicate index::value(...) taking user-defined function/functor + which checks if Value should be returned by the query. It + may be used to check some specific conditions for user-defined Values. +

    +
    bool fun(Value const& v)
    +{
    +  return v.is_red();
    +}
    +
    +// ...
    +
    +rt.query(index::intersects(box) && index::value(fun),
    +         std::back_inserter(result));
    +
    +
    +
    + +

    + It's possible to use some number of predicates in one query by passing: +

    +
      +
    • + std::pair<Pred1, + Pred2>, +
    • +
    • + boost::tuple<Pred1, + Pred2, + Pred3, + ...> +
    • +
    • + predicates connected by operator&& e.g. Pred1 + && Pred2 + && Pred3 + && .... +
    • +
    +

    + These predicates are connected by logical AND. Passing all predicates together + not only makes possible to construct advanced queries but is also faster + than separate calls because the tree is traversed only once. Traversing + is continued and Values + are returned only if all predicates are met. Predicates are checked left-to-right + so placing most restictive predicates first should accelerate the search. +

    +
    rt.query(index::intersects(box1) && !index::within(box2),
    +         std::back_inserter(result));
    +
    +rt.query(index::intersects(box1) && !index::within(box2) && index::overlaps(box3),
    +         std::back_inserter(result));
    +
    +

    + Of course it's possible to connect different types of predicates together. +

    +
    rt.query(index::nearest(index::bounded(pt, index::to_furthest(1), 10)) && index::intersects(b), returned_value);
    +
    +index::query(rt, index::nearest(pt, k) && index::within(b), std::back_inserter(returned_values));
    +
    +BOOST_FOREACH(Value & v, rt | index::adaptors::queried(index::nearest(pt, k) && index::covered_by(b)))
    +  ; // do something with v
    +
    +
    +
    + +

    + There are several ways of inserting Values returned by a query to the other + R-tree container. The most basic way is creating a temporary container + for Values and insert them later. +

    +
    namespace bgi = boost::geometry::index;
    +typedef std::pair<Box, int> Value;
    +typedef bgi::rtree< Value, bgi::linear<32, 8> > RTree;
    +
    +RTree rt1;
    +/* some inserting into the tree */
    +
    +std::vector<Value> result;
    +rt1.query(Box(/*...*/), std::back_inserter(result));
    +RTree rt2(result.begin(), result.end());
    +
    +

    + However there are better ways. One of these methods is mentioned in the + "Creation and modification" section. The insert iterator may + be passed directly to the query, which will be the fastest way of inserting + query results because temporary container won't be used. +

    +
    RTree rt3;
    +rt1.query(Box(/*...*/), bgi::inserter(rt3));
    +
    +

    + If you like Boost.Range you'll appreciate the third option. You may pass + the result Range directly to the constructor. However in this case the + temporary container is created. +

    +
    RTree rt4(rt1 | bgi::adaptors::queried(Box(/*...*/)));
    +
    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/geometry_index/r_tree/r_tree_creation.html b/doc/html/geometry_index/r_tree/r_tree_creation.html deleted file mode 100644 index 649317bf6..000000000 --- a/doc/html/geometry_index/r_tree/r_tree_creation.html +++ /dev/null @@ -1,184 +0,0 @@ - - - -R-tree creation - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - - -
    - -

    - R-tree has 4 parameters: -

    -
    rtree<Value, Parameters, Translator, Allocator>
    -
    -
      -
    • - Value - type of object - which will be stored in the container. -
    • -
    • - Parameters - compile-time - parameters, e.g. inserting/splitting algorithm with min and max nodes' - elements numbers. -
    • -
    • - Translator - type of - object translating Value - objects to Indexable - objects (Point - or Box) - which R-tree can handle. -
    • -
    • - Allocator - the allocator. -
    • -
    -
    -
    - -

    - R-tree may store Values of any type as long the Translator - is passed as parameter. It knows how to interpret those Values - and extract an object understandable by the R-tree. Those objects are called - 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. -

    -
      -
    • - Indexable = Point - | Box -
    • -
    • - BasicValue = - Indexable | - std::pair<Indexable, T> | std::pair<T, Indexable> -
    • -
    • - Value = BasicValue - | BasicValue* | Iterator<BasicValue> - | SmartPtr<BasicValue> -
    • -
    -

    - Examples of Value types: -

    -
    geometry::model::point<...>
    -geometry::model::point_xy<...>
    -geometry::model::box<...>
    -std::pair<geometry::model::box<...>, size_t>
    -
    -
    -
    - -

    - Values may be inserted to the R-tree in many various ways. - Final internal structure of the R-tree depends on algorithms used in the - insertion process. The most important is nodes' splitting algorithm. Currently, - three well-known types of R-trees may be created. -

    -

    - Linear - classic R-tree using splitting algorithm of linear complexity -

    -
    index::rtree< Value, index::linear<32, 8> > rt;
    -
    -

    - Quadratic - classic R-tree using splitting algorithm of quadratic complexity -

    -
    index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -

    - R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions -

    -
    index::rtree< Value, index::rstar<32, 8> > rt;
    -
    -
    -
    - -

    - Following code creates an R-tree using quadratic algorithm. -

    -
    using namespace boost::geometry;
    -typedef std::pair<Box, int> Value;
    -index::rtree< Value, index::quadratic<32, 8> > rt;
    -
    -

    - To insert or remove Value's by method calls one may use the following code. -

    -
    Value v = std::make_pair(Box(...), 0);
    -rt.insert(v);
    -rt.remove(v);
    -
    -

    - To insert or remove Value's by function calls one may use the following - code. -

    -
    Value v = std::make_pair(Box(...), 0);
    -index::insert(rt, v);
    -index::remove(rt, v);
    -
    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 2f968054b..4afc486ec 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -6,7 +6,7 @@ - + @@ -19,7 +19,7 @@

    -PrevUpHome +PrevUpHome

    @@ -47,7 +47,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    @@ -6913,7 +6913,7 @@ The R-tree spatial index. boost::geometry::index::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -6988,7 +6988,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -7063,7 +7063,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

    - + R*-tree creation algorithm parameters.

    @@ -7167,7 +7167,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -7303,7 +7303,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -7439,7 +7439,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

    - + R*-tree creation algorithm parameters.

    @@ -10167,7 +10167,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -10237,7 +10237,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    @@ -10533,7 +10533,7 @@ The index translator.

    -PrevUpHome +PrevUpHome
    diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index ca0b0696c..e0430d0a4 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -116,7 +116,7 @@
    // 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));
    +rtree.query(query_box, std::back_inserter(result_s));
     

    @@ -130,7 +130,7 @@

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

    diff --git a/doc/html/geometry_index/r_tree/spatial_queries.html b/doc/html/geometry_index/r_tree/spatial_queries.html deleted file mode 100644 index bef9c43e5..000000000 --- a/doc/html/geometry_index/r_tree/spatial_queries.html +++ /dev/null @@ -1,308 +0,0 @@ - - - -Spatial queries - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - - -

    - 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. Names of predicates - corresponds to names of Boost.Geometry - algorithms. The examples of some basic queries may be found in tables below. - The query region and result Values - are orange. -

    -
    ------- - - - - - - - - - - - - - - -
    -

    - intersects(Box) - default -

    -
    -

    - covered_by(Box) -

    -
    -

    - disjoint(Box) -

    -
    -

    - overlaps(Box) -

    -
    -

    - within(Box) -

    -
    -

    - intersects -

    -
    -

    - within -

    -
    -

    - disjoint -

    -
    -

    - overlaps -

    -
    -

    - within -

    -
    -
    ----- - - - - - - - - - - -
    -

    - intersects(Ring) -

    -
    -

    - intersects(Polygon) -

    -
    -

    - intersects(MultiPolygon) -

    -
    -

    - intersects_ring -

    -
    -

    - intersects_poly -

    -
    -

    - intersects_mpoly -

    -
    -
    - -

    - There are three ways to perform a spatial query. Following queries returns - Values intersecting some region defined as a box in this example. -

    -

    - Method call -

    -
    std::vector<Value> returned_values;
    -Box box_region(...);
    -rt.spatial_query(box_region, std::back_inserter(returned_values));
    -
    -

    - Function call -

    -
    std::vector<Value> returned_values;
    -Box box_region(...);
    -index::spatial_query(rt, box_region, std::back_inserter(returned_values));
    -
    -

    - Use of pipe operator generating a range -

    -
    Box box_region(...);
    -BOOST_FOREACH(Value & v, rt | index::adaptors::spatial_queried(box_region))
    -  ; // do something with v
    -
    -
    -
    - -

    - To explicitly define one of the predicates one may pass it to the spatial_query() - as the first argument. -

    -
    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.: -

    -
    rt.spatial_query(!index::intersects(box), std::back_inserter(result));
    -// the same as
    -rt.spatial_query(index::disjoint(box), std::back_inserter(result));
    -
    -
    -
    - -

    - It's possible to use some number of predicates in one time by passing - std::pair<Pred1, Pred2> - or boost::tuple<Pred1, Pred2, Pred3, ...>. These predicates are connected - by logical AND. Passing all predicates together not only makes possible - to construct advanced queries but is also faster than separate calls because - the tree is traversed only once. Traversing is continued and Values are returned only if all predicates - are met. Predicates are checked left-to-right so placing most restictive - predicates first should accelerate the search. -

    -
    rt.spatial_query(
    -  std::make_pair(
    -    index::intersects(box1), !index::within(box2) ),
    -  std::back_inserter(result));
    -
    -rt.spatial_query(
    -  boost::make_tuple(
    -    index::intersects(box1), !index::within(box2), index::overlaps(box3) ),
    -  std::back_inserter(result));
    -
    -
    -
    - -

    - There is also a unique predicate index::value(...) taking user-defined function/functor - which checks if Value should be returned by the query. -

    -
    bool fun(Value const& v)
    -{
    -  return v.is_red();
    -}
    -
    -// ...
    -
    -rt.spatial_query(
    -  boost::make_pair(
    -    index::intersects(box), index::value(fun) ),
    -  std::back_inserter(result));
    -
    -
    -
    - -

    - There are several ways of inserting Values returned by a query to the other - R-tree container. The most basic way is creating a temporary container - for Values and insert them later. -

    -
    namespace bgi = boost::geometry::index;
    -typedef std::pair<Box, int> Value;
    -typedef bgi::rtree< Value, bgi::linear<32, 8> > RTree;
    -
    -RTree rt1;
    -/* some inserting into the tree */
    -
    -std::vector<Value> result;
    -rt1.spatial_query(Box(/*...*/), std::back_inserter(result));
    -RTree rt2(result.begin(), result.end());
    -
    -

    - However there are better ways. One of these methods is mentioned in the - "Creation and modification" section. The insert iterator may - be passed directly to the query, which will be the fastest way of inserting - query results because temporary container won't be used. -

    -
    RTree rt3;
    -rt1.spatial_query(Box(/*...*/), bgi::inserter(rt3));
    -
    -

    - If you like Boost.Range you'll appreciate the third option. You may pass - the result Range directly to the constructor. -

    -
    RTree rt4(rt1 | bgi::adaptors::spatial_queried(Box(/*...*/)));
    -
    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/index.html b/doc/html/index.html index 3f2ec733d..edb363969 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -43,16 +43,14 @@
    Quick Start
    Creation and modification
    -
    Spatial queries
    -
    Nearest - neighbours queries
    +
    Queries
    Reference
    - +

    Last revised: January 26, 2013 at 00:31:44 GMT

    Last revised: January 26, 2013 at 01:20:57 GMT


    diff --git a/doc/rtree.qbk b/doc/rtree.qbk index ee42c8a74..8321a6d16 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -13,9 +13,7 @@ [include rtree/introduction.qbk] [include rtree/quickstart.qbk] [include rtree/creation.qbk] -[include rtree/spatial_query.qbk] -[include rtree/nearest_query.qbk] -[/include rtree/exception_safety.qbk] +[include rtree/query.qbk] [section:reference Reference] diff --git a/doc/rtree/nearest_query.qbk b/doc/rtree/nearest_query.qbk deleted file mode 100644 index f993de169..000000000 --- a/doc/rtree/nearest_query.qbk +++ /dev/null @@ -1,137 +0,0 @@ -[/============================================================================ - Boost.Geometry Index - - Copyright (c) 2011-2012 Adam Wulkiewicz. - - Use, modification and distribution is subject to the Boost Software License, - Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at - http://www.boost.org/LICENSE_1_0.txt) -=============================================================================/] - -[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 query - distance to Indexable's furthest point greather than ...] [knn query - distance to Indexable's closest point greather than ...]] -[[[$../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 -k `__value__`s closest to some point in space. For `__box__`es -`__indexable__`s the distance to the nearest point is calculated by default. - -Method call - - std::vector<__value__> returned_values; - __point__ pt(...); - rt.nearest_query(pt, k, std::back_inserter(returned_values)); - -Function call - - std::vector<__value__> returned_values; - __point__ pt(...); - index::nearest_query(rt, pt, k, std::back_inserter(returned_values)); - -Use of `operator |` - - __point__ pt(...); - BOOST_FOREACH(__value__ & v, rt | index::adaptors::nearest_queried(pt, k)) - ; // do something with v - -[endsect] - -[section One nearest neighbour] - -Another type of nearest neighbour query is searching for the one closest `__value__`. -If it is found, 1 is returned by the method or function. This kind of query -has only two forms. - -Method call - - __value__ returned_value; - __point__ pt(...); - size_t n = rt.nearest_query(pt, returned_value); - -Function call - - __value__ Value returned_value; - __point__ pt(...); - size_t n = index::nearest_query(rt, pt, returned_value); - -[endsect] - -[section Distances predicates] - -It is possible to define if calculated distance between query point and `__value__` should be -greater, lesser or between some other distances. Those are called `DistancesPredicate`s and -may be defined as follows. - - std::vector<__Value__> returned_values; - __point__ pt(...); - - /* default - without bounds */ - index::nearest_query(rt, pt, k, std::back_inserter(returned_values)); - - /* same as default */ - index::nearest_query(rt, index::unbounded(pt), k, std::back_inserter(returned_values)); - - /* distance must be greater than or equal to 10 */ - index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); - - /* distance must be lesser than or equal to 500 */ - index::nearest_query(rt, index::max_bounded(pt, 500), k, std::back_inserter(returned_values)); - - /* distance must be between 10 and 500 */ - index::nearest_query(rt, index::bounded(pt, 10, 500), k, std::back_inserter(returned_values)); - -Furthermore, it's possible to define if the closest, furthest or centroidal point of the -non-point `__indexable__` should be taken into account in the routine calculating distance. - - std::vector<__value__> returned_values; - __point__ pt(...); - - /* default - distance between Indexable's closest point and a query point - must be greater than 10 */ - index::nearest_query(rt, index::min_bounded(pt, 10), k, std::back_inserter(returned_values)); - - /* same as default - distance between Indexable's closest point and a query point - must be greater than 10 */ - index::nearest_query(rt, index::min_bounded(pt, index::to_nearest(10)), k, std::back_inserter(returned_values)); - - /* distance between Indexable's furthest point and a query point - must be greater than 10 */ - index::nearest_query(rt, index::min_bounded(pt, index::to_furthest(10)), k, std::back_inserter(returned_values)); - - /* distance between Indexable's centroid and a query point - must be greater than 10 */ - index::nearest_query(rt, index::min_bounded(pt, index::to_centroid(10)), k, std::back_inserter(returned_values)); - -[endsect] - -[section Using spatial predicates] - -It is possible to use spatial predicates described before in nearest neighbours queries. - - __value__ returned_value; - std::vector<__value__> returned_values; - - __point__ pt(...); - __box__ b(...); - - size_t n1 = rt.nearest_query(index::bounded(pt, index::to_furthest(1), 10), index::intersects(b), returned_value); - - size_t n2 = index::nearest_query(rt, pt, k, index::within(b), std::back_inserter(returned_values)); - - BOOST_FOREACH(Value & v, rt | index::adaptors::nearest_queried(pt, k, index::covered_by(b))) - ; // do something with v - -[endsect] - -[endsect] [/ Nearest neighbours queries /] diff --git a/doc/rtree/query.qbk b/doc/rtree/query.qbk new file mode 100644 index 000000000..3ce7f051f --- /dev/null +++ b/doc/rtree/query.qbk @@ -0,0 +1,273 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2012 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section Queries] + +Queries returns `Value`s which meets some predicates. Currently supported are three types of predicates: + +* spatial predicates - defining relationship between stored Values and some Geometry, +* nearest predicates - defining relationship between stored Values and some Point, +* value predicate - passing user-defined functor to the query. + +For example queries may be used to retrieve Values: + +* intersecting some area but not within other area, +* are nearest to some point, +* overlapping a box and has user-defined property. + +[section Performing a query] + +There are three ways to perform a query. In the following example `__box__` is used as +the predicate, this is a default spatial predicate described in the following section. +Following queries returns `__value__`s intersecting some region defined as a `__box__`. +These three methods are: + +Method call + + std::vector<__value__> returned_values; + __box__ box_region(...); + rt.query(box_region, std::back_inserter(returned_values)); + +Function call + + std::vector<__value__> returned_values; + __box__ box_region(...); + index::query(rt, box_region, std::back_inserter(returned_values)); + +Use of pipe operator generating a range + + __box__ box_region(...); + BOOST_FOREACH(__value__ & v, rt | index::adaptors::queried(box_region)) + ; // do something with v + +[endsect] + +[section Spatial queries] + +Spatial query returns Values which are related somehow to a geometry or some number of geometries. +Names of spatial predicates corresponds to names of __boost_geometry__ algorithms. Examples of some +basic queries may be found in tables below. The query region and result `Value`s are orange. + +[table +[[intersects(Box) - default] [covered_by(Box)] [disjoint(Box)] [overlaps(Box)] [within(Box)]] +[[[$../images/intersects.png]] [[$../images/within.png]] [[$../images/disjoint.png]] [[$../images/overlaps.png]] [[$../images/within.png]]] +] + +[table +[[intersects(Ring)] [intersects(Polygon)] [intersects(MultiPolygon)]] +[[[$../images/intersects_ring.png]] [[$../images/intersects_poly.png]] [[$../images/intersects_mpoly.png]]] +] + +To use a spatial predicate one may pass a geometry (which is a default case) or use one of the functions defined in +`boost::geometry::index` namespace to define it explicitly. + + 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)); + +All predicates may be negated, e.g.: + + rt.query(!index::intersects(box), std::back_inserter(result)); + // the same as + rt.query(index::disjoint(box), std::back_inserter(result)); + +[endsect] + +[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 query - distance to Indexable's furthest point greather than ...] [knn query - distance to Indexable's closest point greather than ...]] +[[[$../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 +k `__value__`s closest to some point in space. For `__box__`es +`__indexable__`s the distance to the nearest point is calculated by default. + +Method call + + std::vector<__value__> returned_values; + __point__ pt(...); + rt.query(index::nearest(pt, k), std::back_inserter(returned_values)); + +Function call + + std::vector<__value__> returned_values; + __point__ pt(...); + index::query(rt, index::nearest(pt, k), std::back_inserter(returned_values)); + +Use of `operator |` + + __point__ pt(...); + BOOST_FOREACH(__value__ & v, rt | index::adaptors::queried(index::nearest(pt, k))) + ; // do something with v + +[endsect] + +[section One nearest neighbour] + +Another type of nearest neighbour query is searching for the one closest `__value__`. +If it is found, 1 is returned by the method or function. This kind of query +has only two forms. + +Method call + + __value__ returned_value; + __point__ pt(...); + size_t n = rt.query(index::nearest(pt), returned_value); + +Function call + + __value__ Value returned_value; + __point__ pt(...); + size_t n = index::query(rt, index::nearest(pt), returned_value); + +[endsect] + +[section Distances predicates] + +It is possible to define if calculated distance between query point and `__value__` should be +greater, lesser or between some other distances. Those are called `DistancesPredicate`s and +may be defined as follows. + + std::vector<__Value__> returned_values; + __point__ pt(...); + + /* default - without bounds */ + index::query(rt, index::nearest(pt, k), std::back_inserter(returned_values)); + + /* same as default */ + index::query(rt, index::nearest(index::unbounded(pt), k), std::back_inserter(returned_values)); + + /* distance must be greater than or equal to 10 */ + index::query(rt, index::nearest(index::min_bounded(pt, 10), k), std::back_inserter(returned_values)); + + /* distance must be lesser than or equal to 500 */ + index::query(rt, index::nearest(index::max_bounded(pt, 500), k), std::back_inserter(returned_values)); + + /* distance must be between 10 and 500 */ + index::query(rt, index::nearest(index::bounded(pt, 10, 500), k), std::back_inserter(returned_values)); + +Furthermore, it's possible to define if the closest, furthest or centroidal point of the +non-point `__indexable__` should be taken into account in the routine calculating distance. + + std::vector<__value__> returned_values; + __point__ pt(...); + + /* default - distance between Indexable's closest point and a query point + must be greater than 10 */ + index::query(rt, index::nearest(index::min_bounded(pt, 10), k), std::back_inserter(returned_values)); + + /* same as default - distance between Indexable's closest point and a query point + must be greater than 10 */ + index::query(rt, index::nearest(index::min_bounded(pt, index::to_nearest(10)), k), std::back_inserter(returned_values)); + + /* distance between Indexable's furthest point and a query point + must be greater than 10 */ + index::query(rt, index::nearest(index::min_bounded(pt, index::to_furthest(10)), k), std::back_inserter(returned_values)); + + /* distance between Indexable's centroid and a query point + must be greater than 10 */ + index::query(rt, index::nearest(index::min_bounded(pt, index::to_centroid(10)), k), std::back_inserter(returned_values)); + +[endsect] + +[endsect] + +[section Value predicate] + +There is a unique predicate `index::value(...)` taking user-defined function/functor +which checks if `__value__` should be returned by the query. It may be used to check +some specific conditions for user-defined Values. + + bool fun(__value__ const& v) + { + return v.is_red(); + } + + // ... + + rt.query(index::intersects(box) && index::value(fun), + std::back_inserter(result)); + +[endsect] + +[section Passing a set of predicates] + +It's possible to use some number of predicates in one query by passing: + +* `std::pair`, +* `boost::tuple` +* predicates connected by `operator&&` e.g. `Pred1 && Pred2 && Pred3 && ...`. + +These predicates are connected by logical AND. Passing all predicates together not only makes possible +to construct advanced queries but is also faster than separate calls because the tree is traversed only once. +Traversing is continued and `Value`s are returned only if all predicates are met. Predicates are checked +left-to-right so placing most restictive predicates first should accelerate the search. + + rt.query(index::intersects(box1) && !index::within(box2), + std::back_inserter(result)); + + rt.query(index::intersects(box1) && !index::within(box2) && index::overlaps(box3), + std::back_inserter(result)); + +Of course it's possible to connect different types of predicates together. + + rt.query(index::nearest(index::bounded(pt, index::to_furthest(1), 10)) && index::intersects(b), returned_value); + + index::query(rt, index::nearest(pt, k) && index::within(b), std::back_inserter(returned_values)); + + BOOST_FOREACH(Value & v, rt | index::adaptors::queried(index::nearest(pt, k) && index::covered_by(b))) + ; // do something with v + +[endsect] + +[section Inserting query results into the other R-tree] + +There are several ways of inserting Values returned by a query to the other R-tree container. +The most basic way is creating a temporary container for Values and insert them later. + + namespace bgi = boost::geometry::index; + typedef std::pair __value__; + typedef bgi::rtree< __value__, bgi::linear<32, 8> > RTree; + + RTree rt1; + /* some inserting into the tree */ + + std::vector result; + rt1.query(Box(/*...*/), std::back_inserter(result)); + RTree rt2(result.begin(), result.end()); + +However there are better ways. One of these methods is mentioned in the "Creation and modification" section. +The insert iterator may be passed directly to the query, which will be the fastest way of inserting +query results because temporary container won't be used. + + RTree rt3; + rt1.query(Box(/*...*/), bgi::inserter(rt3)); + +If you like Boost.Range you'll appreciate the third option. You may pass the result Range directly to the +constructor. However in this case the temporary container is created. + + RTree rt4(rt1 | bgi::adaptors::queried(Box(/*...*/))); + +[endsect] + +[endsect] [/ Queries /] diff --git a/doc/rtree/spatial_query.qbk b/doc/rtree/spatial_query.qbk deleted file mode 100644 index 0d19e27b7..000000000 --- a/doc/rtree/spatial_query.qbk +++ /dev/null @@ -1,142 +0,0 @@ -[/============================================================================ - Boost.Geometry Index - - Copyright (c) 2011-2012 Adam Wulkiewicz. - - Use, modification and distribution is subject to the Boost Software License, - Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at - http://www.boost.org/LICENSE_1_0.txt) -=============================================================================/] - -[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. Names of predicates -corresponds to names of __boost_geometry__ algorithms. The examples of some -basic queries may be found in tables below. The query region and result `Value`s are orange. - -[table -[[intersects(Box) - default] [covered_by(Box)] [disjoint(Box)] [overlaps(Box)] [within(Box)]] -[[[$../images/intersects.png]] [[$../images/within.png]] [[$../images/disjoint.png]] [[$../images/overlaps.png]] [[$../images/within.png]]] -] - -[table -[[intersects(Ring)] [intersects(Polygon)] [intersects(MultiPolygon)]] -[[[$../images/intersects_ring.png]] [[$../images/intersects_poly.png]] [[$../images/intersects_mpoly.png]]] -] - -[section Basic queries] - -There are three ways to perform a spatial query. Following queries returns -`__value__`s intersecting some region defined as a box in this example. - -Method call - - std::vector<__value__> returned_values; - __box__ box_region(...); - rt.spatial_query(box_region, std::back_inserter(returned_values)); - -Function call - - std::vector<__value__> returned_values; - __box__ box_region(...); - index::spatial_query(rt, box_region, std::back_inserter(returned_values)); - -Use of pipe operator generating a range - - __box__ box_region(...); - BOOST_FOREACH(__value__ & v, rt | index::adaptors::spatial_queried(box_region)) - ; // do something with v -[endsect] - -[section Spatial predicates] - -To explicitly define one of the predicates one may pass it to the `spatial_query()` as -the first argument. - - 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.: - - rt.spatial_query(!index::intersects(box), std::back_inserter(result)); - // the same as - rt.spatial_query(index::disjoint(box), std::back_inserter(result)); - -[endsect] - -[section Connecting predicates] - -It's possible to use some number of predicates in one time by passing `std::pair` -or `boost::tuple`. These predicates are connected by logical AND. -Passing all predicates together not only makes possible to construct advanced queries but is also -faster than separate calls because the tree is traversed only once. Traversing is continued and -`Value`s are returned only if all predicates are met. Predicates are checked left-to-right so placing -most restictive predicates first should accelerate the search. - - rt.spatial_query( - std::make_pair( - index::intersects(box1), !index::within(box2) ), - std::back_inserter(result)); - - rt.spatial_query( - boost::make_tuple( - index::intersects(box1), !index::within(box2), index::overlaps(box3) ), - std::back_inserter(result)); - -[endsect] - -[section Value predicate] - -There is also a unique predicate `index::value(...)` taking user-defined function/functor -which checks if `__value__` should be returned by the query. - - bool fun(__value__ const& v) - { - return v.is_red(); - } - - // ... - - rt.spatial_query( - boost::make_pair( - index::intersects(box), index::value(fun) ), - std::back_inserter(result)); - -[endsect] - -[section Inserting query results into the other R-tree] - -There are several ways of inserting Values returned by a query to the other R-tree container. -The most basic way is creating a temporary container for Values and insert them later. - - namespace bgi = boost::geometry::index; - typedef std::pair __value__; - typedef bgi::rtree< __value__, bgi::linear<32, 8> > RTree; - - RTree rt1; - /* some inserting into the tree */ - - std::vector result; - rt1.spatial_query(Box(/*...*/), std::back_inserter(result)); - RTree rt2(result.begin(), result.end()); - -However there are better ways. One of these methods is mentioned in the "Creation and modification" section. -The insert iterator may be passed directly to the query, which will be the fastest way of inserting -query results because temporary container won't be used. - - RTree rt3; - rt1.spatial_query(Box(/*...*/), bgi::inserter(rt3)); - -If you like Boost.Range you'll appreciate the third option. You may pass the result Range directly to the -constructor. - - RTree rt4(rt1 | bgi::adaptors::spatial_queried(Box(/*...*/))); - -[endsect] - -[endsect] [/ Spatial queries /] diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index 806f2f08a..917fa1df7 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -55,13 +55,13 @@ int main(void) // 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.query(query_box, std::back_inserter(result_s)); //] //[rtree_quickstart_nearest_query // find 5 nearest values to a point std::vector result_n; - rtree.nearest_query(point(0, 0), 5, std::back_inserter(result_n)); + rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n)); //] //[rtree_quickstart_output From a90b56de261db5bb21d1a79ae05be36ab71e4ffd Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 6 Feb 2013 20:56:29 +0000 Subject: [PATCH 310/366] boost::container::vector used in dynamic nodes. detail::static_vector renamed to detail::varray. Added Alloc parameter to varray. rtree::envelope() renamed to rtree::bounds(). Tests moddified. Docs tweaked. [SVN r82766] --- doc/generated/rtree.qbk | 106 +- doc/generated/rtree_functions.qbk | 10 +- doc/generated/translator_index.qbk | 3 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 14 +- .../r_tree/creation_and_modification.html | 46 +- .../geometry_index/r_tree/introduction.html | 35 +- doc/html/geometry_index/r_tree/queries.html | 34 +- doc/html/geometry_index/r_tree/reference.html | 1099 +++++++---------- .../r_tree/rtree_quickstart.html | 4 +- doc/html/index.html | 4 +- doc/rtree/creation.qbk | 18 +- doc/rtree/introduction.qbk | 4 + doc/rtree/query.qbk | 16 +- .../detail/rtree/node/node_d_mem_dynamic.hpp | 8 +- .../detail/rtree/node/node_d_mem_static.hpp | 27 +- .../detail/rtree/node/node_s_mem_dynamic.hpp | 6 +- .../detail/rtree/node/node_s_mem_static.hpp | 13 +- .../index/detail/rtree/visitors/insert.hpp | 2 +- .../detail/{static_vector.hpp => varray.hpp} | 67 +- include/boost/geometry/index/rtree.hpp | 84 +- test/rtree/rtree_exceptions.cpp | 40 +- test/rtree/test_rtree.hpp | 49 +- test/rtree/test_rtree_exceptions.hpp | 8 +- test/rtree/test_throwing.hpp | 18 +- tests/additional_speed.cpp | 2 +- 26 files changed, 699 insertions(+), 1020 deletions(-) rename include/boost/geometry/index/detail/{static_vector.hpp => varray.hpp} (94%) diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 5dcc7d03d..b00bb7df3 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -70,7 +70,7 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[[#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d] `allocator_type`][The type of allocator used by the container. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6] `size_type`][Unsigned integral type used by the container. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1ac011da09678f034a7fab487a9b973bfc] `indexable_type`][The Indexable type to which Value is translated. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093] `envelope_type`][The Box type used by the R-tree. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f] `bounds_type`][The Box type used by the R-tree. ]] ] [heading Constructor(s) and destructor] @@ -89,31 +89,31 @@ The Translator translates from Value to Indexable each time r-tree requires it. [heading Member(s)] [table -[[Modifier][Function][Description]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949 `query(Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1abd965047110c9f8ef6ff097e97487312 `query(Predicates const &, value_type &)`]][Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e `envelope()`]][Returns the box able to contain all values stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] +[[Function][Description]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949 `query(Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1abd965047110c9f8ef6ff097e97487312 `query(Predicates const &, value_type &)`]][Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ace84997927e26d7cdb5aa67f14cdf6cc `bounds()`]][Returns the box able to contain all values stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] ] [#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b] @@ -126,8 +126,7 @@ The constructor. `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` ] -[heading Modifier(s)] -``explicit ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] @@ -210,8 +209,7 @@ The constructor. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` ] -[heading Modifier(s)] -``explicit ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] @@ -659,8 +657,7 @@ A set of predicates may be generated by: [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `query``(``Predicates const &` `predicates``,` `OutIter` `out_it``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Predicates const &`][ `predicates` ][Predicates. ]] @@ -738,8 +735,7 @@ A set of predicates may be generated by: [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `query``(``Predicates const &` `predicates``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `value``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Predicates const &`][ `predicates` ][Predicates. ]] @@ -790,8 +786,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] @@ -843,8 +838,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]] @@ -910,8 +904,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -961,8 +954,7 @@ MinRelation and MaxRelation describes bounds and can be generated by following f `OutIter` `out_it``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] @@ -1032,8 +1024,7 @@ Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[ `OutIter` `out_it``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]] @@ -1058,8 +1049,7 @@ Returns the number of stored values. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The number of stored values. [heading Throws] Nothing. @@ -1076,8 +1066,7 @@ Query if the container is empty. `bool` `empty``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] true if the container is empty. [heading Throws] Nothing. @@ -1099,19 +1088,18 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e] -[section envelope()] +[#classboost_1_1geometry_1_1index_1_1rtree_1ace84997927e26d7cdb5aa67f14cdf6cc] +[section bounds()] Returns the box able to contain all values stored in the container. [heading Description] Returns the box able to contain all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a2803990c71c40e6770744d29e5bbd093 envelope_type]]` const &` `envelope``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f bounds_type]]` const &` `bounds``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The box able to contain all values stored in the container or an invalid box if there are no values in the container. [heading Throws] Nothing. @@ -1129,8 +1117,7 @@ For indexable_type it returns the number of values which indexables equals the p [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)` ] -[heading Modifier(s)] -``const ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]] @@ -1152,8 +1139,7 @@ Returns parameters. [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The parameters object. [heading Throws] Nothing. @@ -1170,8 +1156,7 @@ Returns the translator object. [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The translator object. [heading Throws] Nothing. @@ -1188,8 +1173,7 @@ Returns allocator used by the rtree. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()` ] -[heading Modifier(s)] -``const ``[heading Returns] +[heading Returns] The allocator. [heading Throws] If allocator copy constructor throws. diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 166edb286..c51a47873 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -20,7 +20,7 @@ [[[link group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c `clear(rtree<...> &)`]][Remove all values from the index. ]] [[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] [[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] -[[[link group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4 `envelope(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1gae10fbc3d536235b89aa3cb3641768bca `bounds(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] ] [#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc] @@ -565,18 +565,18 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb9 true if there are no values in the index. [endsect] -[#group__rtree__functions_1ga73a9002187db81c57c71f9ec204d57e4] -[section envelope(rtree<...> const &)] +[#group__rtree__functions_1gae10fbc3d536235b89aa3cb3641768bca] +[section bounds(rtree<...> const &)] Get the box containing all stored values or an invalid box if the index has no values. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a131c273b6fc7e1c6d62cc5ebd015e77e rtree::envelope()]].[heading Synopsis] +It calls [^`rtree::envelope()`].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` `typename Translator``,` `typename Allocator``>` -`rtree::box_type const& boost::geometry::index::envelope``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +`rtree::bounds_type const& boost::geometry::index::bounds``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` ] [heading Parameter(s)] diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 12c4725ca..186c971cb 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -43,8 +43,7 @@ The constructor. `index``(``Container const &` `c``)` ] -[heading Modifier(s)] -``explicit ``[heading Parameter(s)] +[heading Parameter(s)] [table [[Type][Name][Description]] [[`Container const &`][ `c` ][The container which stores indexed values. ]] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index c00e43835..dd5718dbb 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 d8f3103ee..d90bd1ce7 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -36,14 +36,14 @@ parameters
    Values, Indexables and default Translator
    -
    Inserting - and splitting algorithms (compile-time)
    -
    Inserting - and splitting algorithms (run-time)
    +
    Balancing + algorithms (compile-time)
    +
    Balancing + algorithms (run-time)
    Copying, moving and swapping
    -
    Inserting - and removing of Values
    +
    Inserting + and removing Values
    Additional interface
    Insert 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 cce4835e6..d80f7223e 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 - + @@ -32,14 +32,14 @@ parameters
    Values, Indexables and default Translator
    -
    Inserting - and splitting algorithms (compile-time)
    -
    Inserting - and splitting algorithms (run-time)
    +
    Balancing + algorithms (compile-time)
    +
    Balancing + algorithms (run-time)
    Copying, moving and swapping
    -
    Inserting - and removing of Values
    +
    Inserting + and removing Values
    Additional interface
    Insert @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box @@ -156,38 +156,38 @@

                  Values may be inserted to the R-tree in many various ways. Final internal structure of the R-tree depends on algorithms used in the - insertion process and parameters. The most important is nodes' splitting + insertion process and parameters. The most important is nodes' balancing algorithm. Currently, three well-known types of R-trees may be created.

                  - Linear - classic R-tree using splitting algorithm of linear complexity + Linear - classic R-tree using balancing algorithm of linear complexity

                  index::rtree< Value, index::linear<32, 8> > rt;
                   

                  - Quadratic - classic R-tree using splitting algorithm of quadratic complexity + Quadratic - classic R-tree using balancing algorithm of quadratic complexity

                  index::rtree< Value, index::quadratic<32, 8> > rt;
                   

                  - R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions + R*-tree - balancing algorithm minimizing nodes' overlap with forced reinsertions

                  index::rtree< Value, index::rstar<32, 8> > rt;
                   

                  - Splitting algorithm parameters may be passed to the R-tree in run time. + Balancing algorithm parameters may be passed to the R-tree in run time. To use run-time versions of the R-tree one may pass parameters defined in index::runtime namespace.

                  @@ -235,11 +235,11 @@

                  - The following code creates an R-tree using quadratic algorithm. + The following code creates an R-tree using quadratic balancing algorithm.

                  using namespace boost::geometry;
                   typedef std::pair<Box, int> Value;
                  diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html
                  index 28ae3b6fd..d5d164868 100644
                  --- a/doc/html/geometry_index/r_tree/introduction.html
                  +++ b/doc/html/geometry_index/r_tree/introduction.html
                  @@ -3,7 +3,7 @@
                   
                   Introduction
                   
                  -
                  +
                   
                   
                   
                  @@ -28,10 +28,10 @@
                   

              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 + 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 [2]. + close to some point in space [2].

              The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

              The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -179,13 +179,13 @@

            - Implementation + Implementation details

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

            -
              +
              • capable to store arbitrary Value type,
              • @@ -207,15 +207,22 @@
              - Contributors + Dependencies +
              +

              + R-tree depends on Boost.Move, Boost.Container, Boost.Tuple. +

              +
              + + Contributors

              The spatial index was originally started by Federico J. Fernandez during the Google-Of-Summer project 2008, mentored by Hartmut Kaiser.

              - - Spatial + + Spatial thanks

              @@ -224,20 +231,20 @@ list for their help.

              -

              -

              [1] +


              +

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

              -

              [2] +

              [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

              -

              [3] +

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

              -

              [4] +

              [4] 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/queries.html b/doc/html/geometry_index/r_tree/queries.html index 7c642bc32..7a9de8480 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -41,10 +41,10 @@ query results into the other R-tree

    - Queries returns Values which - meets some predicates. Currently supported are three types of predicates: + Queries returns Values which meets some predicates. Currently + supported are three types of predicates:

    -
      +
      • spatial predicates - defining relationship between stored Values and some Geometry, @@ -60,7 +60,7 @@

        For example queries may be used to retrieve Values:

        -
          +
          • intersecting some area but not within other area,
          • @@ -81,7 +81,7 @@ is used as the predicate, this is a default spatial predicate described in the following section. Following queries returns Values intersecting some region defined as a Box. - These three methods are: + These three ways are:

            Method call @@ -111,9 +111,9 @@ queries

      - Spatial query returns Values which are related somehow to a geometry or - some number of geometries. Names of spatial predicates corresponds to names - of Boost.Geometry + Spatial query returns Values which are related somehow to + a geometry or some number of geometries. Names of spatial predicates corresponds + to names of Boost.Geometry algorithms. Examples of some basic queries may be found in tables below. The query region and result Values are orange. @@ -248,11 +248,12 @@ neighbours queries

    - 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. + Nearest neighbours queries returns Values which are closest + to some point in space. Additionally it is possible to pass define how + the distance to the Value + should be calculated or distance predicates defining 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.

    @@ -305,7 +306,8 @@

    There are three ways of performing knn queries. Following queries returns - k Values closest to some point in space. For Boxes + k Values + closest to some point in space. For Boxes Indexables the distance to the nearest point is calculated by default.

    @@ -440,7 +442,7 @@ must be greater than 10 */

    It's possible to use some number of predicates in one query by passing:

    -
      +
      • std::pair<Pred1, Pred2>, diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 4afc486ec..998b8ad46 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -47,12 +47,12 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    - Description + Description

    This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

    - Parameters + Parameters

    The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

    Predefined algorithms with compile-time parameters are:

    -
    @@ -208,7 +208,7 @@ The R-tree spatial index.
    - Typedef(s) + Typedef(s)
    @@ -303,7 +303,7 @@ The R-tree spatial index.

    - envelope_type + bounds_type

    @@ -316,7 +316,7 @@ The R-tree spatial index.
    - Constructor(s) + Constructor(s) and destructor
    @@ -458,20 +458,14 @@ The R-tree spatial index.
    - Member(s) + Member(s)
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Modifier -

    -

    Function @@ -485,8 +479,6 @@ The R-tree spatial index.

    -

    operator=(const rtree @@ -500,8 +492,6 @@ The R-tree spatial index.

    -

    operator=(rtree &&) @@ -514,8 +504,6 @@ The R-tree spatial index.

    -

    swap(rtree &) @@ -528,8 +516,6 @@ The R-tree spatial index.

    -

    insert(value_type const @@ -543,8 +529,6 @@ The R-tree spatial index.

    -

    insert(Iterator, @@ -558,8 +542,6 @@ The R-tree spatial index.

    -

    insert(Range const @@ -573,8 +555,6 @@ The R-tree spatial index.

    -

    remove(value_type const @@ -588,8 +568,6 @@ The R-tree spatial index.

    -

    remove(Iterator, @@ -603,8 +581,6 @@ The R-tree spatial index.

    -

    remove(Range const @@ -618,11 +594,6 @@ The R-tree spatial index.

    -

    - const -

    -

    query(Predicates const @@ -637,11 +608,6 @@ The R-tree spatial index.

    -

    - const -

    -

    query(Predicates const @@ -657,11 +623,6 @@ The R-tree spatial index.

    -

    - const -

    -

    spatial_query(Predicates const @@ -676,11 +637,6 @@ The R-tree spatial index.

    -

    - const -

    -

    nearest_query(DistancesPredicates const @@ -696,11 +652,6 @@ The R-tree spatial index.

    -

    - const -

    -

    nearest_query(DistancesPredicates const @@ -717,11 +668,6 @@ The R-tree spatial index.

    -

    - const -

    -

    nearest_query(DistancesPredicates const @@ -736,11 +682,6 @@ The R-tree spatial index.

    -

    - const -

    -

    nearest_query(DistancesPredicates const @@ -757,11 +698,6 @@ The R-tree spatial index.

    -

    - const -

    -

    size() @@ -774,11 +710,6 @@ The R-tree spatial index.

    -

    - const -

    -

    empty() @@ -791,8 +722,6 @@ The R-tree spatial index.

    -

    clear() @@ -807,12 +736,7 @@ The R-tree spatial index.

    - const -

    -
    -

    - envelope() + bounds()

    @@ -822,11 +746,6 @@ The R-tree spatial index.
    -

    - const -

    -

    count(ValueOrIndexable const @@ -840,11 +759,6 @@ The R-tree spatial index.

    -

    - const -

    -

    parameters() @@ -857,11 +771,6 @@ The R-tree spatial index.

    -

    - const -

    -

    translator() @@ -874,11 +783,6 @@ The R-tree spatial index.

    -

    - const -

    -

    get_allocator() @@ -901,22 +805,13 @@ The R-tree spatial index.

    - Synopsis + Synopsis
    rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
     
    - Modifier(s) -
    -

    -

    -
    explicit
    -

    -

    -
    - - Parameter(s) + Parameter(s)
    @@ -980,8 +875,8 @@ The R-tree spatial index.
    - - Throws + + Throws

    If allocator default constructor throws. @@ -997,7 +892,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis
    rtree(parameters_type parameters,
           translator_type const & translator,
    @@ -1005,7 +900,7 @@ The R-tree spatial index.
     
    - Parameter(s) + Parameter(s)
    @@ -1087,7 +982,7 @@ The R-tree spatial index.
    - Throws + Throws

    If allocator copy constructor throws. @@ -1103,7 +998,7 @@ The R-tree spatial index.

    - Synopsis + Synopsis
    template<typename Iterator>
     rtree(Iterator first,
    @@ -1114,7 +1009,7 @@ The R-tree spatial index.
     
    - Parameter(s) + Parameter(s)
    @@ -1230,9 +1125,9 @@ The R-tree spatial index.
    - Throws + Throws
    -
      +
      • If allocator copy constructor throws.
      • @@ -1257,7 +1152,7 @@ The R-tree spatial index.

        - Synopsis + Synopsis
        template<typename Range>
         rtree(Range const & rng,
        @@ -1267,16 +1162,7 @@ The R-tree spatial index.
         
        - Modifier(s) -
        -

        -

        -
        explicit
        -

        -

        -
        - - Parameter(s) + Parameter(s)
        @@ -1375,10 +1261,10 @@ The R-tree spatial index.
        - - Throws + + Throws
        -
          +
          • If allocator copy constructor throws.
          • @@ -1402,13 +1288,13 @@ The R-tree spatial index.

            - Synopsis + Synopsis
            ~rtree()
             
            - Throws + Throws

            Nothing. @@ -1424,20 +1310,20 @@ The R-tree spatial index.

            - Description + Description

            It uses parameters, translator and allocator from the source tree.

            - Synopsis + Synopsis
            rtree(rtree const & src)
             
            - Parameter(s) + Parameter(s)
            @@ -1483,9 +1369,9 @@ The R-tree spatial index.
            - Throws + Throws
            -
              +
              • If allocator copy constructor throws.
              • @@ -1510,20 +1396,20 @@ The R-tree spatial index.

                - Description + Description

                It uses Parameters and translator from the source tree.

                - Synopsis + Synopsis
                rtree(rtree const & src, allocator_type const & allocator)
                 
                - Parameter(s) + Parameter(s)
                @@ -1589,9 +1475,9 @@ The R-tree spatial index.
                - Throws + Throws
                -
                  +
                  • If allocator copy constructor throws.
                  • @@ -1616,20 +1502,20 @@ The R-tree spatial index.

                    - Description + Description

                    It uses parameters, translator and allocator from the source tree.

                    - Synopsis + Synopsis
                    rtree(rtree && src)
                     
                    - Parameter(s) + Parameter(s)
                    @@ -1675,7 +1561,7 @@ The R-tree spatial index.
                    - Throws + Throws

                    Nothing. @@ -1691,20 +1577,20 @@ The R-tree spatial index.

                    - Description + Description

                    It uses parameters and translator from the source tree.

                    - Synopsis + Synopsis
                    rtree(rtree && src, allocator_type const & allocator)
                     
                    - Parameter(s) + Parameter(s)
                    @@ -1770,9 +1656,9 @@ The R-tree spatial index.
                    - Throws + Throws
                    -
                      +
                      • If allocator copy constructor throws.
                      • @@ -1798,20 +1684,20 @@ The R-tree spatial index.

                        - Description + Description

                        It uses parameters and translator from the source tree.

                        - Synopsis + Synopsis
                        rtree & operator=(const rtree & src)
                         
                        - Parameter(s) + Parameter(s)
                        @@ -1857,9 +1743,9 @@ The R-tree spatial index.
                        - Throws + Throws
                        -
                          +
                          • If Value copy constructor throws.
                          • @@ -1881,20 +1767,20 @@ The R-tree spatial index.

                            - Description + Description

                            It uses parameters and translator from the source tree.

                            - Synopsis + Synopsis
                            rtree & operator=(rtree && src)
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1940,12 +1826,12 @@ The R-tree spatial index.
                            - Throws + Throws

                            Only if allocators aren't equal.

                            -
                              +
                              • If Value copy constructor throws.
                              • @@ -1967,20 +1853,20 @@ The R-tree spatial index.

                                - Description + Description

                                Parameters, translator and allocators are swapped as well.

                                - Synopsis + Synopsis
                                void swap(rtree & other)
                                 
                                - Parameter(s) + Parameter(s)
                                @@ -2026,7 +1912,7 @@ The R-tree spatial index.
                                - Throws + Throws

                                If allocators swap throws. @@ -2042,13 +1928,13 @@ The R-tree spatial index.

                                - Synopsis + Synopsis
                                void insert(value_type const & value)
                                 
                                - Parameter(s) + Parameter(s)
                                @@ -2094,9 +1980,9 @@ The R-tree spatial index.
                                - Throws + Throws
                                -
                                  +
                                  • If Value copy constructor or copy assignment throws.
                                  • @@ -2129,14 +2015,14 @@ The R-tree spatial index.

                                    - Synopsis + Synopsis
                                    template<typename Iterator>
                                     void insert(Iterator first, Iterator last)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -2200,9 +2086,9 @@ The R-tree spatial index.
                                    - Throws + Throws
                                    -
                                      +
                                      • If Value copy constructor or copy assignment throws.
                                      • @@ -2235,14 +2121,14 @@ The R-tree spatial index.

                                        - Synopsis + Synopsis
                                        template<typename Range>
                                         void insert(Range const & rng)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -2288,9 +2174,9 @@ The R-tree spatial index.
                                        - Throws + Throws
                                        -
                                          +
                                          • If Value copy constructor or copy assignment throws.
                                          • @@ -2323,7 +2209,7 @@ The R-tree spatial index.

                                            - Description + Description

                                            In contrast to the std::set @@ -2332,13 +2218,13 @@ The R-tree spatial index.

                                            - Synopsis + Synopsis
                                            size_type remove(value_type const & value)
                                             
                                            - Parameter(s) + Parameter(s)
                                            @@ -2384,16 +2270,16 @@ The R-tree spatial index.
                                            - Returns + Returns

                                            1 if the value was removed, 0 otherwise.

                                            - Throws + Throws
                                            -
                                              +
                                              • If Value copy constructor or copy assignment throws.
                                              • @@ -2426,7 +2312,7 @@ The R-tree spatial index.

                                                - Description + Description

                                                In contrast to the std::set @@ -2437,14 +2323,14 @@ The R-tree spatial index.

                                                - Synopsis + Synopsis
                                                template<typename Iterator>
                                                 size_type remove(Iterator first, Iterator last)
                                                 
                                                - Parameter(s) + Parameter(s)
                                                @@ -2508,16 +2394,16 @@ The R-tree spatial index.
                                                - Returns + Returns

                                                The number of removed values.

                                                - Throws + Throws
                                                -
                                                  +
                                                  • If Value copy constructor or copy assignment throws.
                                                  • @@ -2550,7 +2436,7 @@ The R-tree spatial index.

                                                    - Description + Description

                                                    In contrast to the std::set @@ -2560,14 +2446,14 @@ The R-tree spatial index.

                                                    - Synopsis + Synopsis
                                                    template<typename Range>
                                                     size_type remove(Range const & rng)
                                                     
                                                    - Parameter(s) + Parameter(s)
                                                    @@ -2613,16 +2499,16 @@ The R-tree spatial index.
                                                    - Returns + Returns

                                                    The number of removed values.

                                                    - Throws + Throws
                                                    -
                                                      +
                                                      • If Value copy constructor or copy assignment throws.
                                                      • @@ -2656,7 +2542,7 @@ The R-tree spatial index.

                                                        - Description + Description

                                                        This query function performs spatial and k-nearest neighbor searches. @@ -2672,7 +2558,7 @@ The R-tree spatial index. are returned. More spatial predicates may be generated by one of the functions listed below:

                                                        -
                                                          +
                                                          • boost::geometry::index::covered_by(),
                                                          • @@ -2693,7 +2579,7 @@ The R-tree spatial index.

                                                            It is possible to negate spatial predicates:

                                                            -
                                                              +
                                                              • ! boost::geometry::index::covered_by(),
                                                              • @@ -2718,7 +2604,7 @@ The R-tree spatial index. functor which checks if Value should be returned by the query. It's generated by:

                                                                -
                                                                • +

                                                                  @@ -2732,7 +2618,7 @@ The R-tree spatial index. output iterator. Only one nearest predicate may be passed to the query. It may be generated by:

                                                                  -
                                                                  • +

                                                                    @@ -2741,7 +2627,7 @@ The R-tree spatial index.

                                                                    A set of predicates may be generated by:

                                                                    -
                                                                      +
                                                                      • std::make_pair()
                                                                      • @@ -2754,23 +2640,14 @@ The R-tree spatial index.
                                                                      - Synopsis + Synopsis
                                                                      template<typename Predicates, typename OutIter>
                                                                       size_type query(Predicates const & predicates, OutIter out_it)
                                                                       
                                                                      - Modifier(s) -
                                                                      -

                                                                      -

                                                                      -
                                                                      const
                                                                      -

                                                                      -

                                                                      -
                                                                      - - Parameter(s) + Parameter(s)
                                                                      @@ -2833,15 +2710,15 @@ The R-tree spatial index.
                                                                      - - Returns + + Returns

                                                                      The number of values found.

                                                                      - - Example + + Example

                                                                      @@ -2854,8 +2731,8 @@ The R-tree spatial index.

                                                                      - - Throws + + Throws

                                                                      If Value copy constructor or copy assignment throws. @@ -2882,7 +2759,7 @@ The R-tree spatial index.

                                                                      - Description + Description

                                                                      This query function performs k-nearest neighbor searches. It allows to @@ -2900,7 +2777,7 @@ The R-tree spatial index. are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                      -
                                                                        +
                                                                        • boost::geometry::index::covered_by(),
                                                                        • @@ -2921,7 +2798,7 @@ The R-tree spatial index.

                                                                          It is possible to negate spatial predicates:

                                                                          -
                                                                            +
                                                                            • ! boost::geometry::index::covered_by(),
                                                                            • @@ -2946,7 +2823,7 @@ The R-tree spatial index. functor which checks if Value should be returned by the query. It's generated by:

                                                                              -
                                                                              • +

                                                                                @@ -2957,7 +2834,7 @@ The R-tree spatial index. predicate. It may be generated by nearest() taking only one parameter - distance predicates.

                                                                                -
                                                                                • +

                                                                                  @@ -2966,7 +2843,7 @@ The R-tree spatial index.

                                                                                  A set of predicates may be generated by:

                                                                                  -
                                                                                    +
                                                                                    • std::make_pair()
                                                                                    • @@ -2979,23 +2856,14 @@ The R-tree spatial index.
                                                                                    - Synopsis + Synopsis
                                                                                    template<typename Predicates>
                                                                                     size_type query(Predicates const & predicates, value_type & value)
                                                                                     
                                                                                    - Modifier(s) -
                                                                                    -

                                                                                    -

                                                                                    -
                                                                                    const
                                                                                    -

                                                                                    -

                                                                                    -
                                                                                    - - Parameter(s) + Parameter(s)
                                                                                    @@ -3059,15 +2927,15 @@ The R-tree spatial index.
                                                                                    - - Returns + + Returns

                                                                                    The number of values found (1 if value was found, 0 otherwise).

                                                                                    - - Example + + Example

                                                                                    @@ -3077,8 +2945,8 @@ The R-tree spatial index.

                                                                                    - - Throws + + Throws

                                                                                    If Value copy constructor or copy assignment throws. @@ -3104,7 +2972,7 @@ The R-tree spatial index.

                                                                                    - Description + Description

                                                                                    Spatial predicates may be a Geometry. In this case Values @@ -3114,7 +2982,7 @@ The R-tree spatial index.

                                                                                    It may be generated by one of the functions listed below:

                                                                                    -
                                                                                      +
                                                                                      • boost::geometry::index::covered_by(),
                                                                                      • @@ -3156,23 +3024,14 @@ The R-tree spatial index.

                                                                                        - Synopsis + Synopsis
                                                                                        template<typename Predicates, typename OutIter>
                                                                                         size_type spatial_query(Predicates const & pred, OutIter out_it)
                                                                                         
                                                                                        - Modifier(s) -
                                                                                        -

                                                                                        -

                                                                                        -
                                                                                        const
                                                                                        -

                                                                                        -

                                                                                        -
                                                                                        - - Parameter(s) + Parameter(s)
                                                                                        @@ -3236,17 +3095,17 @@ The R-tree spatial index.
                                                                                        - - Returns + + Returns

                                                                                        The number of values found.

                                                                                        - - Throws + + Throws
                                                                                        -
                                                                                          +
                                                                                          • If Value copy constructor or copy assignment throws.
                                                                                          • @@ -3265,7 +3124,7 @@ The R-tree spatial index.

                                                                                            - Description + Description

                                                                                            Distances predicates may be a Point. In this the case the @@ -3276,7 +3135,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                            -
                                                                                              +
                                                                                              • boost::geometry::index::to_nearest() - default, @@ -3293,7 +3152,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                -
                                                                                                  +
                                                                                                  • boost::geometry::index::unbounded() - default, @@ -3312,7 +3171,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                    -
                                                                                                      +
                                                                                                      - Synopsis + Synopsis
                                                                                                      template<typename DistancesPredicates>
                                                                                                       size_type nearest_query(DistancesPredicates const & dpred, value_type & v)
                                                                                                       
                                                                                                      - Modifier(s) -
                                                                                                      -

                                                                                                      -

                                                                                                      -
                                                                                                      const
                                                                                                      -

                                                                                                      -

                                                                                                      -
                                                                                                      - - Parameter(s) + Parameter(s)
                                                                                                      @@ -3406,15 +3256,15 @@ The R-tree spatial index.
                                                                                                      - - Returns + + Returns

                                                                                                      The number of values found.

                                                                                                      - - Throws + + Throws

                                                                                                      If Value copy constructor or copy assignment throws. @@ -3431,7 +3281,7 @@ The R-tree spatial index.

                                                                                                      - Description + Description

                                                                                                      Distances predicates may be a Point. In this the case the @@ -3442,7 +3292,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                      -
                                                                                                        +
                                                                                                        • boost::geometry::index::to_nearest() - default, @@ -3459,7 +3309,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                          -
                                                                                                            +
                                                                                                            • boost::geometry::index::unbounded() - default, @@ -3478,7 +3328,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                              -
                                                                                                                +
                                                                                                                • boost::geometry::index::to_nearest(),
                                                                                                                • @@ -3497,7 +3347,7 @@ The R-tree spatial index.

                                                                                                                  It may be generated by one of the functions listed below:

                                                                                                                  -
                                                                                                                    +
                                                                                                                    • boost::geometry::index::covered_by(),
                                                                                                                    • @@ -3539,7 +3389,7 @@ The R-tree spatial index.

                                                                                                                      - Synopsis + Synopsis
                                                                                                                      template<typename DistancesPredicates, typename Predicates>
                                                                                                                       size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                                      @@ -3548,16 +3398,7 @@ The R-tree spatial index.
                                                                                                                       
                                                                                                                      - Modifier(s) -
                                                                                                                      -

                                                                                                                      -

                                                                                                                      -
                                                                                                                      const
                                                                                                                      -

                                                                                                                      -

                                                                                                                      -
                                                                                                                      - - Parameter(s) + Parameter(s)
                                                                                                                      @@ -3639,15 +3480,15 @@ The R-tree spatial index.
                                                                                                                      - - Returns + + Returns

                                                                                                                      The number of values found.

                                                                                                                      - - Throws + + Throws

                                                                                                                      If Value copy constructor or copy assignment throws. @@ -3664,7 +3505,7 @@ The R-tree spatial index.

                                                                                                                      - Description + Description

                                                                                                                      Distances predicates may be a Point. In this the case the @@ -3675,7 +3516,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                                      -
                                                                                                                        +
                                                                                                                        • boost::geometry::index::to_nearest() - default, @@ -3692,7 +3533,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                                          -
                                                                                                                            +
                                                                                                                            • boost::geometry::index::unbounded() - default, @@ -3711,7 +3552,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                                              -
                                                                                                                                +
                                                                                                                                - Synopsis + Synopsis
                                                                                                                                template<typename DistancesPredicates, typename OutIter>
                                                                                                                                 size_type nearest_query(DistancesPredicates const & dpred,
                                                                                                                                @@ -3733,16 +3574,7 @@ The R-tree spatial index.
                                                                                                                                 
                                                                                                                                - Modifier(s) -
                                                                                                                                -

                                                                                                                                -

                                                                                                                                -
                                                                                                                                const
                                                                                                                                -

                                                                                                                                -

                                                                                                                                -
                                                                                                                                - - Parameter(s) + Parameter(s)
                                                                                                                                @@ -3823,15 +3655,15 @@ The R-tree spatial index.
                                                                                                                                - - Returns + + Returns

                                                                                                                                The number of values found.

                                                                                                                                - - Throws + + Throws

                                                                                                                                If Value copy constructor or copy assignment throws. If OutIter dereference @@ -3849,7 +3681,7 @@ The R-tree spatial index.

                                                                                                                                - Description + Description

                                                                                                                                Distances predicates may be a Point. In this the case the @@ -3860,7 +3692,7 @@ The R-tree spatial index. It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                                                -
                                                                                                                                  +
                                                                                                                                  • boost::geometry::index::to_nearest() - default, @@ -3877,7 +3709,7 @@ The R-tree spatial index. distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                                                    -
                                                                                                                                      +
                                                                                                                                      • boost::geometry::index::unbounded() - default, @@ -3896,7 +3728,7 @@ The R-tree spatial index. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                                                        -
                                                                                                                                          +
                                                                                                                                          - Functions + Functions
                                                                                                                                          @@ -4701,7 +4461,7 @@ The R-tree spatial index. @@ -4724,7 +4484,7 @@ The R-tree spatial index.

                                                                                                                                          - Description + Description

                                                                                                                                          It calls rtree::insert(value_type @@ -4732,7 +4492,7 @@ The R-tree spatial index.

                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                          template<typename Value,
                                                                                                                                                    typename Options,
                                                                                                                                          @@ -4742,7 +4502,7 @@ The R-tree spatial index.
                                                                                                                                           
                                                                                                                                          - Parameter(s) + Parameter(s)

                                                                                                                                          - envelope(rtree<...> + bounds(rtree<...> const &)

                                                                                                                                          @@ -4821,7 +4581,7 @@ The R-tree spatial index.

                                                                                                                                          - Description + Description

                                                                                                                                          It calls rtree::insert(Iterator, @@ -4829,7 +4589,7 @@ The R-tree spatial index.

                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                          template<typename Value,
                                                                                                                                                    typename Options,
                                                                                                                                          @@ -4842,7 +4602,7 @@ The R-tree spatial index.
                                                                                                                                           
                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                          @@ -4937,7 +4697,7 @@ The R-tree spatial index.

                                                                                                                                          - Description + Description

                                                                                                                                          It calls rtree::insert(Range @@ -4945,7 +4705,7 @@ The R-tree spatial index.

                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                          template<typename Value,
                                                                                                                                                    typename Options,
                                                                                                                                          @@ -4956,7 +4716,7 @@ The R-tree spatial index.
                                                                                                                                           
                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                          @@ -5035,7 +4795,7 @@ The R-tree spatial index.

                                                                                                                                          - Description + Description

                                                                                                                                          Remove a value from the container. In contrast to the std::set or std::map erase() method this function removes @@ -5047,7 +4807,7 @@ The R-tree spatial index.

                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                          template<typename Value,
                                                                                                                                                    typename Options,
                                                                                                                                          @@ -5057,7 +4817,7 @@ The R-tree spatial index.
                                                                                                                                           
                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                          @@ -5127,7 +4887,7 @@ The R-tree spatial index.
                                                                                                                                          - Returns + Returns

                                                                                                                                          1 if value was removed, 0 otherwise. @@ -5143,7 +4903,7 @@ The R-tree spatial index.

                                                                                                                                          - Description + Description

                                                                                                                                          Remove a range of values from the container. In contrast to the std::set or std::map erase() method it doesn't take iterators @@ -5157,7 +4917,7 @@ The R-tree spatial index.

                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                          template<typename Value,
                                                                                                                                                    typename Options,
                                                                                                                                          @@ -5170,7 +4930,7 @@ The R-tree spatial index.
                                                                                                                                           
                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                          @@ -5256,7 +5016,7 @@ The R-tree spatial index.
                                                                                                                                          - Returns + Returns

                                                                                                                                          The number of removed values. @@ -5272,7 +5032,7 @@ The R-tree spatial index.

                                                                                                                                          - Description + Description

                                                                                                                                          Remove a range of values from the container. In contrast to the std::set or std::map erase() method it removes values @@ -5285,7 +5045,7 @@ The R-tree spatial index.

                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                          template<typename Value,
                                                                                                                                                    typename Options,
                                                                                                                                          @@ -5296,7 +5056,7 @@ The R-tree spatial index.
                                                                                                                                           
                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                          @@ -5366,7 +5126,7 @@ The R-tree spatial index.
                                                                                                                                          - Returns + Returns

                                                                                                                                          The number of removed values. @@ -5383,7 +5143,7 @@ The R-tree spatial index.

                                                                                                                                          - Description + Description

                                                                                                                                          This query function performs spatial and k-nearest neighbor searches. @@ -5399,7 +5159,7 @@ The R-tree spatial index. are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                                                                                          -
                                                                                                                                            +
                                                                                                                                            • boost::geometry::index::covered_by(),
                                                                                                                                            • @@ -5420,7 +5180,7 @@ The R-tree spatial index.

                                                                                                                                              It is possible to negate spatial predicates:

                                                                                                                                              -
                                                                                                                                                +
                                                                                                                                                • ! boost::geometry::index::covered_by(),
                                                                                                                                                • @@ -5445,7 +5205,7 @@ The R-tree spatial index. functor which checks if Value should be returned by the query. It's generated by:

                                                                                                                                                  -
                                                                                                                                                  • +

                                                                                                                                                    @@ -5459,7 +5219,7 @@ The R-tree spatial index. output iterator. Only one nearest predicate may be passed to the query. It may be generated by:

                                                                                                                                                    -
                                                                                                                                                    • +

                                                                                                                                                      @@ -5468,7 +5228,7 @@ The R-tree spatial index.

                                                                                                                                                      A set of predicates may be generated by:

                                                                                                                                                      -
                                                                                                                                                        +
                                                                                                                                                        • std::make_pair()
                                                                                                                                                        • @@ -5481,7 +5241,7 @@ The R-tree spatial index.
                                                                                                                                                        - Synopsis + Synopsis
                                                                                                                                                        template<typename Value,
                                                                                                                                                                  typename Options,
                                                                                                                                                        @@ -5495,7 +5255,7 @@ The R-tree spatial index.
                                                                                                                                                         
                                                                                                                                                        - Parameter(s) + Parameter(s)
                                                                                                                                                        @@ -5581,14 +5341,14 @@ The R-tree spatial index.
                                                                                                                                                        - Returns + Returns

                                                                                                                                                        The number of values found.

                                                                                                                                                        - Example + Example

                                                                                                                                                        @@ -5602,7 +5362,7 @@ The R-tree spatial index.

                                                                                                                                                        - Throws + Throws

                                                                                                                                                        If Value copy constructor or copy assignment throws. @@ -5630,7 +5390,7 @@ The R-tree spatial index.

                                                                                                                                                        - Description + Description

                                                                                                                                                        This query function performs k-nearest neighbor searches. It allows to @@ -5648,7 +5408,7 @@ The R-tree spatial index. are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                                                                                                        -
                                                                                                                                                          +
                                                                                                                                                          • boost::geometry::index::covered_by(),
                                                                                                                                                          • @@ -5669,7 +5429,7 @@ The R-tree spatial index.

                                                                                                                                                            It is possible to negate spatial predicates:

                                                                                                                                                            -
                                                                                                                                                              +
                                                                                                                                                              • ! boost::geometry::index::covered_by(),
                                                                                                                                                              • @@ -5694,7 +5454,7 @@ The R-tree spatial index. functor which checks if Value should be returned by the query. It's generated by:

                                                                                                                                                                -

                                                                                                                                                                - + Linear r-tree creation algorithm parameters.

                                                                                                                                                                - Header + Header

                                                                                                                                                                #include <boost/geometry/index/parameters.hpp>

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<size_t MaxElements, size_t MinElements>
                                                                                                                                                                 struct linear
                                                                                                                                                                @@ -6935,7 +6695,7 @@ Linear r-tree creation algorithm parameters.
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -6988,19 +6748,19 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                                                                                                                                                                - + Quadratic r-tree creation algorithm parameters.

                                                                                                                                                                - Header + Header

                                                                                                                                                                #include <boost/geometry/index/parameters.hpp>

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<size_t MaxElements, size_t MinElements>
                                                                                                                                                                 struct quadratic
                                                                                                                                                                @@ -7010,7 +6770,7 @@ Quadratic r-tree creation algorithm parameters.
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -7063,19 +6823,19 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                                                                                                                                                                - + R*-tree creation algorithm parameters.

                                                                                                                                                                - Header + Header

                                                                                                                                                                #include <boost/geometry/index/parameters.hpp>

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<size_t MaxElements,
                                                                                                                                                                          size_t MinElements,
                                                                                                                                                                @@ -7088,7 +6848,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -7167,19 +6927,19 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

                                                                                                                                                                - + Linear r-tree creation algorithm parameters.

                                                                                                                                                                - Header + Header

                                                                                                                                                                #include <boost/geometry/index/parameters.hpp>

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                class linear
                                                                                                                                                                 {
                                                                                                                                                                @@ -7188,7 +6948,7 @@ Linear r-tree creation algorithm parameters.
                                                                                                                                                                 
                                                                                                                                                                - Constructor(s) + Constructor(s) and destructor
                                                                                                                                                                @@ -7231,11 +6991,11 @@ Linear r-tree creation algorithm parameters. The constructor.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                linear(size_t max_elements, size_t min_elements)
                                                                                                                                                                 
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -7303,19 +7063,19 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

                                                                                                                                                                - + Quadratic r-tree creation algorithm parameters.

                                                                                                                                                                - Header + Header

                                                                                                                                                                #include <boost/geometry/index/parameters.hpp>

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                class quadratic
                                                                                                                                                                 {
                                                                                                                                                                @@ -7324,7 +7084,7 @@ Quadratic r-tree creation algorithm parameters.
                                                                                                                                                                 
                                                                                                                                                                - Constructor(s) + Constructor(s) and destructor
                                                                                                                                                                @@ -7367,11 +7127,11 @@ Quadratic r-tree creation algorithm parameters. The constructor.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                quadratic(size_t max_elements, size_t min_elements)
                                                                                                                                                                 
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -7439,19 +7199,19 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

                                                                                                                                                                - + R*-tree creation algorithm parameters.

                                                                                                                                                                - Header + Header

                                                                                                                                                                #include <boost/geometry/index/parameters.hpp>

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                class rstar
                                                                                                                                                                 {
                                                                                                                                                                @@ -7460,7 +7220,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                 
                                                                                                                                                                - Constructor(s) + Constructor(s) and destructor
                                                                                                                                                                @@ -7503,14 +7263,14 @@ R*-tree creation algorithm parameters. The constructor.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                rstar(size_t max_elements,
                                                                                                                                                                       size_t min_elements,
                                                                                                                                                                       size_t overlap_cost_threshold = 0,
                                                                                                                                                                       size_t reinserted_elements = detail::default_rstar_reinserted_elements_d())
                                                                                                                                                                 
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -7617,7 +7377,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Functions + Functions
                                                                                                                                                                @@ -7759,7 +7519,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                Generate a predicate defining Value and Geometry relationship. Value @@ -7767,14 +7527,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<typename Geometry>
                                                                                                                                                                 detail::covered_by<Geometry> boost::geometry::index::covered_by(Geometry const & g)
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -7809,7 +7569,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -7865,7 +7625,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                Generate a predicate defining Value and Geometry relationship. Value @@ -7873,14 +7633,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<typename Geometry>
                                                                                                                                                                 detail::disjoint<Geometry> boost::geometry::index::disjoint(Geometry const & g)
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -7915,7 +7675,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -7971,7 +7731,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                Generate a predicate defining Value and Geometry relationship. Value @@ -7979,14 +7739,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<typename Geometry>
                                                                                                                                                                 detail::intersects<Geometry> boost::geometry::index::intersects(Geometry const & g)
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -8021,7 +7781,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -8077,7 +7837,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                Generate a predicate defining Value and Geometry relationship. Value @@ -8085,14 +7845,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<typename Geometry>
                                                                                                                                                                 detail::overlaps<Geometry> boost::geometry::index::overlaps(Geometry const & g)
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -8127,7 +7887,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -8183,7 +7943,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                Generate a predicate defining Value and Geometry relationship. Value @@ -8191,14 +7951,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<typename Geometry>
                                                                                                                                                                 detail::within<Geometry> boost::geometry::index::within(Geometry const & g)
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -8233,7 +7993,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -8288,7 +8048,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                A wrapper around user-defined functor describing if Value should be returned @@ -8296,14 +8056,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Synopsis + Synopsis
                                                                                                                                                                template<typename Fun>
                                                                                                                                                                 detail::value<Fun> boost::geometry::index::value(Fun const & fun)
                                                                                                                                                                 
                                                                                                                                                                - Template + Template parameter(s)
                                                                                                                                                                @@ -8338,7 +8098,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                                                @@ -8393,7 +8153,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                When nearest predicate is passed to the query, k-nearest neighbour search @@ -8409,7 +8169,7 @@ R*-tree creation algorithm parameters. is calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                                                                                -
                                                                                                                                                                  +
                                                                                                                                                                  • boost::geometry::index::to_nearest() - default, @@ -8426,7 +8186,7 @@ R*-tree creation algorithm parameters. must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                                                                                    -
                                                                                                                                                                @@ -8530,7 +8290,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                - Example + Example

                                                                                                                                                                @@ -8563,7 +8323,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                - Description + Description

                                                                                                                                                                When nearest predicate is passed to the query, k-nearest neighbour search @@ -8579,7 +8339,7 @@ R*-tree creation algorithm parameters. calculated. This is done by passing PointRelation. It can be generated by following functions:

                                                                                                                                                                -
                                                                                                                                                                  +
                                                                                                                                                                  • boost::geometry::index::to_nearest() - default, @@ -8596,7 +8356,7 @@ R*-tree creation algorithm parameters. must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions:

                                                                                                                                                                    -
                                                                                                                                                                      +
                                                                                                                                                                      • boost::geometry::index::unbounded() - default, @@ -8615,7 +8375,7 @@ R*-tree creation algorithm parameters. MinRelation and MaxRelation describes bounds and can be generated by following functions:

                                                                                                                                                                        -
                                                                                                                                                                    - Functions + Functions
                                                                                                                                                                    @@ -8848,7 +8608,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Generate a nearest query Point and Value's Indexable relationship while @@ -8861,14 +8621,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename T>
                                                                                                                                                                     detail::to_nearest<T> boost::geometry::index::to_nearest(T const & v)
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -8904,7 +8664,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -8960,7 +8720,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Generate a nearest query Point and Value's Indexable relationship while @@ -8971,14 +8731,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename T>
                                                                                                                                                                     detail::to_centroid<T> boost::geometry::index::to_centroid(T const & v)
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -9014,7 +8774,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -9070,7 +8830,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Generate a nearest query Point and Value's Indexable relationship while @@ -9083,14 +8843,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename T>
                                                                                                                                                                     detail::to_furthest<T> boost::geometry::index::to_furthest(T const & v)
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -9126,7 +8886,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -9182,7 +8942,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Generate a distance predicate. This defines distances bounds which are @@ -9193,14 +8953,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename PointRelation>
                                                                                                                                                                     detail::unbounded<PointRelation> boost::geometry::index::unbounded(PointRelation const & pr)
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -9235,7 +8995,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -9294,7 +9054,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Generate a distance predicate. This defines distances bounds which are @@ -9307,14 +9067,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename PointRelation, typename MinRelation>
                                                                                                                                                                     detail::min_bounded<PointRelation, MinRelation> boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -9363,7 +9123,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -9444,7 +9204,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Generate a distance predicate. This defines distances bounds which are @@ -9457,14 +9217,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename PointRelation, typename MaxRelation>
                                                                                                                                                                     detail::max_bounded<PointRelation, MaxRelation> boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -9513,7 +9273,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -9594,7 +9354,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Generate a distance predicate. This defines distances bounds which are @@ -9608,7 +9368,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename PointRelation,
                                                                                                                                                                              typename MinRelation,
                                                                                                                                                                    @@ -9619,7 +9379,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -9680,7 +9440,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -9778,7 +9538,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                    - Functions + Functions
                                                                                                                                                                    @@ -9863,7 +9623,7 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename DistancesPredicates, typename Predicates>
                                                                                                                                                                     detail::nearest_query<DistancesPredicates, Predicates> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred,
                                                                                                                                                                    @@ -9872,7 +9632,7 @@ R*-tree creation algorithm parameters.
                                                                                                                                                                     
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -9963,14 +9723,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename DistancesPredicates>
                                                                                                                                                                     detail::nearest_query<DistancesPredicates, index::detail::empty> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)
                                                                                                                                                                     
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -10044,14 +9804,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename Predicates>
                                                                                                                                                                     detail::query<Predicates> boost::geometry::index::adaptors::queried(Predicates const & pred)
                                                                                                                                                                     
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -10105,14 +9865,14 @@ R*-tree creation algorithm parameters.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename Predicates>
                                                                                                                                                                     detail::spatial_query<Predicates> boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)
                                                                                                                                                                     
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -10167,12 +9927,12 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

                                                                                                                                                                    - + The default translator.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    It translates Value object to Indexable object. The default version handles @@ -10181,14 +9941,14 @@ The default translator.

                                                                                                                                                                    - Header + Header

                                                                                                                                                                    #include <boost/geometry/index/translator/def.hpp>

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename Value>
                                                                                                                                                                     struct def
                                                                                                                                                                    @@ -10198,7 +9958,7 @@ The default translator.
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -10237,12 +9997,12 @@ The default translator. boost::geometry::index::translator::index

                                                                                                                                                                    - + The index translator.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    This translator translates from index of an element in an external Container @@ -10254,14 +10014,14 @@ The index translator.

                                                                                                                                                                    - Header + Header

                                                                                                                                                                    #include <boost/geometry/index/translator/index.hpp>

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename Container>
                                                                                                                                                                     class index
                                                                                                                                                                    @@ -10271,7 +10031,7 @@ The index translator.
                                                                                                                                                                     
                                                                                                                                                                    - Template + Template parameter(s)
                                                                                                                                                                    @@ -10306,7 +10066,7 @@ The index translator.
                                                                                                                                                                    - Constructor(s) + Constructor(s) and destructor
                                                                                                                                                                    @@ -10349,18 +10109,11 @@ The index translator. The constructor.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    index(Container const & c)
                                                                                                                                                                     
                                                                                                                                                                    - Modifier(s) -

                                                                                                                                                                    -

                                                                                                                                                                    -
                                                                                                                                                                    explicit
                                                                                                                                                                    -

                                                                                                                                                                    -

                                                                                                                                                                    - - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -10412,7 +10165,7 @@ The index translator.
                                                                                                                                                                    - Functions + Functions
                                                                                                                                                                    @@ -10454,7 +10207,7 @@ The index translator.

                                                                                                                                                                    - Description + Description

                                                                                                                                                                    Returns insert iterator capable to insert values to the container (spatial @@ -10462,14 +10215,14 @@ The index translator.

                                                                                                                                                                    - Synopsis + Synopsis
                                                                                                                                                                    template<typename Container>
                                                                                                                                                                     insert_iterator<Container> boost::geometry::index::inserter(Container & c)
                                                                                                                                                                     
                                                                                                                                                                    - Parameter(s) + Parameter(s)
                                                                                                                                                                    @@ -10515,7 +10268,7 @@ The index translator.
                                                                                                                                                                    - Returns + Returns

                                                                                                                                                                    The insert iterator inserting values to the container. diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index e0430d0a4..3df712603 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 - + @@ -150,7 +150,7 @@

                                                                                                                                                                    - More + More

                                                                                                                                                                    More information about the R-tree implementation, other algorithms and queries diff --git a/doc/html/index.html b/doc/html/index.html index edb363969..fe2d24007 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -50,7 +50,7 @@

                                                                                                                                                                - +

                                                                                                                                                                Last revised: January 26, 2013 at 01:20:57 GMT

                                                                                                                                                                Last revised: February 06, 2013 at 16:48:24 GMT


                                                                                                                                                                diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 4a70e0ef3..100204841 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -61,29 +61,29 @@ If comparison of two `__value__`s is required, the default translator: [endsect] -[section Inserting and splitting algorithms (compile-time)] +[section Balancing algorithms (compile-time)] `__value__`s may be inserted to the __rtree__ in many various ways. Final internal structure of the __rtree__ depends on algorithms used in the insertion process and parameters. The most important is -nodes' splitting algorithm. Currently, three well-known types of R-trees may be created. +nodes' balancing algorithm. Currently, three well-known types of R-trees may be created. -Linear - classic __rtree__ using splitting algorithm of linear complexity +Linear - classic __rtree__ using balancing algorithm of linear complexity index::rtree< __value__, index::linear<32, 8> > rt; -Quadratic - classic __rtree__ using splitting algorithm of quadratic complexity +Quadratic - classic __rtree__ using balancing algorithm of quadratic complexity index::rtree< __value__, index::quadratic<32, 8> > rt; -R*-tree - splitting algorithm minimizing nodes' overlap with forced reinsertions +R*-tree - balancing algorithm minimizing nodes' overlap with forced reinsertions index::rtree< __value__, index::rstar<32, 8> > rt; [endsect] -[section Inserting and splitting algorithms (run-time)] +[section Balancing algorithms (run-time)] -Splitting algorithm parameters may be passed to the __rtree__ in run time. +Balancing algorithm parameters may be passed to the __rtree__ in run time. To use run-time versions of the __rtree__ one may pass parameters defined in index::runtime namespace. @@ -125,9 +125,9 @@ which also supports compilers not supporting rvalue references. [endsect] -[section Inserting and removing of Values] +[section Inserting and removing Values] -The following code creates an __rtree__ using quadratic algorithm. +The following code creates an __rtree__ using quadratic balancing algorithm. using namespace boost::geometry; typedef std::pair __value__; diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index c55196dbe..75e05b0b2 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -52,6 +52,10 @@ Key features of this implementation of the __rtree__ are: * parameters (including maximal and minimal number of elements) may be passed as compile- or run-time parameters - compile-time version is faster, * advanced queries - e.g. search for 5 nearest values further than some minimal distance and intersecting some region but not within the other one. +[heading Dependencies] + +R-tree depends on *Boost.Move*, *Boost.Container*, *Boost.Tuple*. + [heading Contributors] The spatial index was originally started by Federico J. Fernandez during the Google-Of-Summer project 2008, mentored by Hartmut Kaiser. diff --git a/doc/rtree/query.qbk b/doc/rtree/query.qbk index 3ce7f051f..ecc8bef5f 100644 --- a/doc/rtree/query.qbk +++ b/doc/rtree/query.qbk @@ -10,10 +10,10 @@ [section Queries] -Queries returns `Value`s which meets some predicates. Currently supported are three types of predicates: +Queries returns `__value__`s which meets some predicates. Currently supported are three types of predicates: * spatial predicates - defining relationship between stored Values and some Geometry, -* nearest predicates - defining relationship between stored Values and some Point, +* nearest predicates - defining relationship between stored Values and some Point, * value predicate - passing user-defined functor to the query. For example queries may be used to retrieve Values: @@ -27,7 +27,7 @@ For example queries may be used to retrieve Values: There are three ways to perform a query. In the following example `__box__` is used as the predicate, this is a default spatial predicate described in the following section. Following queries returns `__value__`s intersecting some region defined as a `__box__`. -These three methods are: +These three ways are: Method call @@ -51,7 +51,7 @@ Use of pipe operator generating a range [section Spatial queries] -Spatial query returns Values which are related somehow to a geometry or some number of geometries. +Spatial query returns `__value__`s which are related somehow to a geometry or some number of geometries. Names of spatial predicates corresponds to names of __boost_geometry__ algorithms. Examples of some basic queries may be found in tables below. The query region and result `Value`s are orange. @@ -85,9 +85,9 @@ All predicates may be negated, e.g.: [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 +Nearest neighbours queries returns `__value__`s which are closest to some point in space. +Additionally it is possible to pass define how the distance to the `Value` should be calculated +or distance predicates defining 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. @@ -99,7 +99,7 @@ The query point, region and result Values are orange. [section k nearest neighbours] There are three ways of performing knn queries. Following queries returns -k `__value__`s closest to some point in space. For `__box__`es +`k` `__value__`s closest to some point in space. For `__box__`es `__indexable__`s the distance to the nearest point is calculated by default. Method call diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 0f100de46..c036554f8 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP -#include +#include #include @@ -23,7 +23,7 @@ template : public dynamic_node { - typedef std::vector< + typedef boost::container::vector< std::pair *>, typename Allocators::internal_node_elements_allocator_type > elements_type; @@ -42,7 +42,7 @@ template : public dynamic_node { - typedef std::vector< + typedef boost::container::vector< Value, typename Allocators::leaf_elements_allocator_type > elements_type; @@ -146,7 +146,7 @@ elements(Node const& n) template struct container_from_elements_type { - typedef std::vector type; + typedef boost::container::vector type; }; // allocators diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index 9634341a3..a806d5395 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -12,7 +12,7 @@ #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { @@ -22,12 +22,13 @@ template : public dynamic_node { - typedef detail::static_vector< + typedef detail::varray< std::pair< Box, dynamic_node * >, - Parameters::max_elements + 1 + Parameters::max_elements + 1, + typename Allocators::internal_node_elements_allocator_type > elements_type; template @@ -43,7 +44,11 @@ template : public dynamic_node { - typedef detail::static_vector elements_type; + typedef detail::varray< + Value, + Parameters::max_elements + 1, + typename Allocators::leaf_elements_allocator_type + > elements_type; template inline dynamic_leaf(Dummy) {} @@ -81,10 +86,10 @@ struct visitor -struct container_from_elements_type, NewValue> +template +struct container_from_elements_type, NewValue> { - typedef detail::static_vector type; + typedef detail::varray type; }; // allocators @@ -107,6 +112,14 @@ public: typename leaf::type >::other leaf_allocator_type; + typedef typename allocator_type::template rebind< + std::pair::type *> + >::other internal_node_elements_allocator_type; + + typedef typename allocator_type::template rebind< + Value + >::other leaf_elements_allocator_type; + inline allocators() : allocator() , internal_node_allocator() diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index d8dac9287..53a809583 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP -#include +#include #include @@ -24,7 +24,7 @@ namespace detail { namespace rtree { template struct static_internal_node { - typedef std::vector< + typedef boost::container::vector< std::pair< Box, typename node::type * @@ -42,7 +42,7 @@ struct static_internal_node template struct static_leaf { - typedef std::vector< + typedef boost::container::vector< Value, typename Allocators::leaf_elements_allocator_type > elements_type; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp index 64ba6b0c5..0aacd1106 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#include +#include #include @@ -24,12 +24,13 @@ namespace detail { namespace rtree { template struct static_internal_node { - typedef detail::static_vector< + typedef detail::varray< std::pair< Box, typename node::type * >, - Parameters::max_elements + 1 + Parameters::max_elements + 1, + typename Allocators::internal_node_elements_allocator_type > elements_type; template @@ -41,7 +42,11 @@ struct static_internal_node struct static_leaf { - typedef detail::static_vector elements_type; + typedef detail::varray< + Value, + Parameters::max_elements + 1, + typename Allocators::leaf_elements_allocator_type + > elements_type; template inline static_leaf(Dummy) {} diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index 84b25398a..10e3f5ff3 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -120,7 +120,7 @@ protected: typedef rtree::node_auto_ptr node_auto_ptr; public: - typedef index::detail::static_vector, 1> nodes_container_type; + typedef index::detail::varray, 1> nodes_container_type; template static inline void apply(nodes_container_type & additional_nodes, diff --git a/include/boost/geometry/index/detail/static_vector.hpp b/include/boost/geometry/index/detail/varray.hpp similarity index 94% rename from include/boost/geometry/index/detail/static_vector.hpp rename to include/boost/geometry/index/detail/varray.hpp index 7f336d70c..c08de73da 100644 --- a/include/boost/geometry/index/detail/static_vector.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -6,8 +6,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_INDEX_DETAIL_STATIC_VECTOR_HPP -#define BOOST_GEOMETRY_INDEX_DETAIL_STATIC_VECTOR_HPP +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_VARRAY_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_VARRAY_HPP #include #include @@ -32,56 +32,65 @@ namespace boost { namespace geometry { namespace index { namespace detail { -template -class static_vector +template +struct varray_default_alloc +{ + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef V * pointer; + typedef const V * const_pointer; +}; + +template > +class varray { BOOST_MPL_ASSERT_MSG( (0 < Capacity), INVALID_CAPACITY, - (static_vector)); + (varray)); public: typedef Value value_type; - typedef std::size_t size_type; typedef Value& reference; typedef Value const& const_reference; - typedef Value * pointer; - typedef const Value* const_pointer; - typedef Value* iterator; - typedef const Value * const_iterator; + typedef typename Al::size_type size_type; + typedef typename Al::difference_type difference_type; + typedef typename Al::pointer pointer; + typedef typename Al::const_pointer const_pointer; + typedef pointer iterator; + typedef const_pointer const_iterator; typedef boost::reverse_iterator reverse_iterator; typedef boost::reverse_iterator const_reverse_iterator; - typedef typename boost::iterator_difference::type difference_type; // nothrow - static_vector() + varray() : m_size(0) {} // strong - explicit static_vector(size_type count) + explicit varray(size_type count) : m_size(0) { resize(count); // may throw } // strong - static_vector(size_type count, value_type const& value) + varray(size_type count, value_type const& value) : m_size(0) { resize(count, value); // may throw } // strong - static_vector(static_vector const& other) + varray(varray const& other) : m_size(other.m_size) { this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw } // strong - template - static_vector(static_vector const& other) + template + varray(varray const& other) : m_size(other.m_size) { check_capacity(other.m_size); @@ -91,14 +100,14 @@ public: // strong template - static_vector(Iterator first, Iterator last) + varray(Iterator first, Iterator last) : m_size(0) { assign(first, last); // may throw } // basic - static_vector & operator=(static_vector const& other) + varray & operator=(varray const& other) { assign(other.begin(), other.end()); // may throw @@ -106,8 +115,8 @@ public: } // basic - template - static_vector & operator=(static_vector const& other) + template + varray & operator=(varray const& other) { assign(other.begin(), other.end()); // may throw @@ -115,7 +124,7 @@ public: } // nothrow - ~static_vector() + ~varray() { this->destroy(this->begin(), this->end()); } @@ -380,8 +389,8 @@ public: const_reverse_iterator crend() const { return reverse_iterator(this->begin()); } // nothrow - size_type capacity() const { return Capacity; } - size_type max_size() const { return Capacity; } + static size_type capacity() { return Capacity; } + static size_type max_size() { return Capacity; } size_type size() const { return m_size; } bool empty() const { return 0 == m_size; } @@ -787,14 +796,14 @@ private: );*/ } - Value * ptr() + pointer ptr() { - return (reinterpret_cast(m_storage.address())); + return pointer(m_storage.address()); } - const Value * ptr() const + const_pointer ptr() const { - return (reinterpret_cast(m_storage.address())); + return const_pointer(m_storage.address()); } boost::aligned_storage::value> m_storage; @@ -803,4 +812,4 @@ private: }}}} // namespace boost::geometry::index::detail -#endif // BOOST_GEOMETRY_INDEX_DETAIL_STATIC_VECTOR_HPP +#endif // BOOST_GEOMETRY_INDEX_DETAIL_VARRAY_HPP diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 8f33f8832..2e00ec1c7 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -116,12 +116,12 @@ public: /*! \brief The Indexable type to which Value is translated. */ typedef typename translator::indexable_type::type indexable_type; /*! \brief The Box type used by the R-tree. */ - typedef typename index::detail::default_box_type::type envelope_type; + typedef typename index::detail::default_box_type::type bounds_type; #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) private: #endif - typedef envelope_type box_type; + typedef bounds_type box_type; typedef typename detail::rtree::options_type::type options_type; typedef typename options_type::node_tag node_tag; typedef detail::rtree::allocators allocators_type; @@ -1113,7 +1113,7 @@ public: \par Throws Nothing. */ - inline envelope_type const& envelope() const + inline bounds_type const& bounds() const { return m_box; } @@ -1878,7 +1878,7 @@ It calls \c rtree::empty(). template inline bool empty(rtree const& tree) { - return tree.empty(); + return tree.bounds(); } /*! @@ -1893,82 +1893,12 @@ It calls \c rtree::envelope(). \return The box containing all stored values or an invalid box. */ template -inline typename rtree::box_type const& -envelope(rtree const& tree) +inline typename rtree::bounds_type const& +bounds(rtree const& tree) { - return tree.envelope(); + return tree.bounds(); } }}} // namespace boost::geometry::index -// Rtree adaptation to Box concept - -namespace boost { namespace geometry { - -// Traits specializations for box above -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - -template -struct tag< index::rtree > -{ - typedef box_tag type; -}; - -template -struct point_type< index::rtree > -{ - typedef typename geometry::point_type< - typename index::rtree::box_type - >::type type; -}; - -template -struct indexed_access, min_corner, Dimension> -{ - typedef typename geometry::coordinate_type< - typename geometry::point_type< - index::rtree - >::type - >::type coordinate_type; - - static inline coordinate_type get(index::rtree const& tree) - { - return geometry::get(tree.envelope()); - } - - static inline void set(index::rtree & tree, - coordinate_type const& value) - { - return geometry::set(tree.envelope(), value); - } -}; - -template -struct indexed_access, max_corner, Dimension> -{ - typedef typename geometry::coordinate_type< - typename geometry::point_type< - index::rtree - >::type - >::type coordinate_type; - - static inline coordinate_type get(index::rtree const& tree) - { - return geometry::get(tree.envelope()); - } - - static inline void set(index::rtree & tree, - coordinate_type const& value) - { - return geometry::set(tree.envelope(), value); - } -}; - -} // namespace traits -#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS - -}} //namespace boost::geometry - #endif // BOOST_GEOMETRY_INDEX_RTREE_HPP diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/rtree_exceptions.cpp index 85a8e130e..edb6d5560 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/rtree_exceptions.cpp @@ -104,61 +104,61 @@ void test_rtree_elements_exceptions(Parameters const& parameters = Parameters()) for ( size_t i = 0 ; i < 100 ; i += 2 ) { - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(10000); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); Tree tree(parameters); - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(i); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); - BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_static_vector_exception ); + BOOST_CHECK_THROW( tree.insert(input.begin(), input.end()), throwing_varray_exception ); } for ( size_t i = 0 ; i < 50 ; i += 2 ) { - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(10000); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); Tree tree(parameters); tree.insert(input.begin(), input.end()); - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(i); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); - BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_static_vector_exception ); + BOOST_CHECK_THROW( tree.remove(input.begin(), input.end()), throwing_varray_exception ); } for ( size_t i = 0 ; i < 50 ; i += 2 ) { - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(10000); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); Tree tree(parameters); tree.insert(input.begin(), input.end()); - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(i); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); - BOOST_CHECK_THROW( Tree tree2(tree), throwing_static_vector_exception ); + BOOST_CHECK_THROW( Tree tree2(tree), throwing_varray_exception ); } for ( size_t i = 0 ; i < 50 ; i += 2 ) { - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(10000); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(10000); Tree tree(parameters); Tree tree2(parameters); tree.insert(input.begin(), input.end()); - throwing_static_vector_settings::reset_calls_counter(); - throwing_static_vector_settings::set_max_calls(i); + throwing_varray_settings::reset_calls_counter(); + throwing_varray_settings::set_max_calls(i); - BOOST_CHECK_THROW(tree2 = tree, throwing_static_vector_exception ); + BOOST_CHECK_THROW(tree2 = tree, throwing_varray_exception ); } } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 40398196d..10a7a662c 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -1293,26 +1293,8 @@ void test_rtree_count(Parameters const& parameters) // test rtree box -template -struct test_geometry_algorithms -{ - template - static void apply(Rtree const& , Box const& ) {} -}; - -template <> -struct test_geometry_algorithms<2> -{ - template - static void apply(Rtree const& t, Box const& b) - { - BOOST_CHECK(bg::area(t) == bg::area(b)); - BOOST_CHECK(bg::perimeter(t) == bg::perimeter(b)); - } -}; - template -void test_rtree_envelope(Parameters const& parameters) +void test_rtree_bounds(Parameters const& parameters) { typedef bgi::rtree Tree; typedef typename Tree::box_type B; @@ -1325,24 +1307,15 @@ void test_rtree_envelope(Parameters const& parameters) std::vector input; B qbox; - BOOST_CHECK(bg::equals(t.envelope(), b)); + BOOST_CHECK(bg::equals(t.bounds(), b)); generate_rtree(t, input, qbox); BOOST_FOREACH(Value const& v, input) bg::expand(b, t.translator()(v)); - BOOST_CHECK(bg::equals(t.envelope(), b)); - - { - using namespace bg; - B temp_b; - envelope(t, temp_b); - BOOST_CHECK(equals(temp_b, b)); - } - BOOST_CHECK(bg::equals(bg::return_envelope(t), b)); - BOOST_CHECK(bg::equals(bg::return_centroid

                                                                                                                                                                (t), bg::return_centroid

                                                                                                                                                                (b))); - test_geometry_algorithms::value>::apply(t, b); + BOOST_CHECK(bg::equals(t.bounds(), b)); + BOOST_CHECK(bg::equals(t.bounds(), bgi::bounds(t))); size_t s = input.size(); while ( s/2 < input.size() && !input.empty() ) @@ -1355,21 +1328,21 @@ void test_rtree_envelope(Parameters const& parameters) BOOST_FOREACH(Value const& v, input) bg::expand(b, t.translator()(v)); - BOOST_CHECK(bg::equals(t.envelope(), b)); + BOOST_CHECK(bg::equals(t.bounds(), b)); Tree t2(t); - BOOST_CHECK(bg::equals(t2.envelope(), b)); + BOOST_CHECK(bg::equals(t2.bounds(), b)); t2.clear(); t2 = t; - BOOST_CHECK(bg::equals(t2.envelope(), b)); + BOOST_CHECK(bg::equals(t2.bounds(), b)); t2.clear(); t2 = boost::move(t); - BOOST_CHECK(bg::equals(t2.envelope(), b)); + BOOST_CHECK(bg::equals(t2.bounds(), b)); t.clear(); bg::assign_inverse(b); - BOOST_CHECK(bg::equals(t.envelope(), b)); + BOOST_CHECK(bg::equals(t.bounds(), b)); } // run all tests for one Algorithm for some number of rtrees @@ -1393,7 +1366,7 @@ void test_rtree_for_point(Parameters const& parameters = Parameters()) test_count_rtree_values(parameters); test_rtree_count(parameters); - test_rtree_envelope(parameters); + test_rtree_bounds(parameters); } template @@ -1413,7 +1386,7 @@ void test_rtree_for_box(Parameters const& parameters = Parameters()) test_count_rtree_values(parameters); test_rtree_count(parameters); - test_rtree_envelope(parameters); + test_rtree_bounds(parameters); } #endif diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index b90f217c8..af62ce201 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -75,7 +75,7 @@ template : public dynamic_node { - typedef throwing_static_vector< + typedef throwing_varray< std::pair< Box, dynamic_node * @@ -96,7 +96,7 @@ template : public dynamic_node { - typedef throwing_static_vector elements_type; + typedef throwing_varray elements_type; template inline dynamic_leaf(Dummy) {} @@ -109,9 +109,9 @@ struct dynamic_leaf -struct container_from_elements_type, NewValue> +struct container_from_elements_type, NewValue> { - typedef throwing_static_vector type; + typedef throwing_varray type; }; // nodes traits diff --git a/test/rtree/test_throwing.hpp b/test/rtree/test_throwing.hpp index 1dc56f1a9..819d3e4b9 100644 --- a/test/rtree/test_throwing.hpp +++ b/test/rtree/test_throwing.hpp @@ -141,20 +141,20 @@ struct generate_value< std::pair, throwing_value> > // //}}} // namespace boost::geometry::index -#include +#include -struct throwing_static_vector_exception : public std::exception +struct throwing_varray_exception : public std::exception { const char * what() const throw() { return "static vector exception."; } }; -struct throwing_static_vector_settings +struct throwing_varray_settings { static void throw_if_required() { // throw if counter meets max count if ( get_max_calls_ref() <= get_calls_counter_ref() ) - throw throwing_static_vector_exception(); + throw throwing_varray_exception(); else ++get_calls_counter_ref(); } @@ -167,10 +167,10 @@ struct throwing_static_vector_settings }; template -class throwing_static_vector - : public boost::geometry::index::detail::static_vector +class throwing_varray + : public boost::geometry::index::detail::varray { - typedef boost::geometry::index::detail::static_vector container; + typedef boost::geometry::index::detail::varray container; public: typedef typename container::value_type value_type; @@ -184,13 +184,13 @@ public: inline void resize(size_type s) { - throwing_static_vector_settings::throw_if_required(); + throwing_varray_settings::throw_if_required(); container::resize(s); } void push_back(Element const& v) { - throwing_static_vector_settings::throw_if_required(); + throwing_varray_settings::throw_if_required(); container::push_back(v); } }; diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 79704fa54..1d984d6d7 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -55,7 +55,7 @@ int main() typedef bgi::rtree > RT; //typedef bgi::rtree RT; //typedef bgi::rtree > RT; - // typedef bgi::rtree RT; + //typedef bgi::rtree RT; //typedef bgi::rtree > RT; //typedef bgi::rtree RT; From 8c6081100aa0f6fe189081546893048f042fd6a6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 11 Feb 2013 19:11:41 +0000 Subject: [PATCH 311/366] Removed spatial_query(), nearest_query(), related adaptors, distance predicates generators bounded(), min_bounded() etc., detail static_vector renamed to varray. Docs and tests updated. [SVN r82824] --- doc/generated/adaptors.qbk | 59 - doc/generated/distance_predicates.qbk | 197 - doc/generated/nearest_relations.qbk | 85 + doc/generated/predicates.qbk | 94 +- doc/generated/rtree.qbk | 457 +- doc/generated/rtree_functions.qbk | 270 +- doc/generated/translator_index.qbk | 3 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 6 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 28 +- doc/html/geometry_index/r_tree/queries.html | 171 +- doc/html/geometry_index/r_tree/reference.html | 4350 ++--------------- .../r_tree/rtree_quickstart.html | 4 +- doc/html/index.html | 4 +- doc/make_qbk.py | 2 +- doc/rtree.qbk | 2 +- doc/rtree/query.qbk | 92 +- .../geometry/index/adaptors/nearest_query.hpp | 122 - .../geometry/index/adaptors/spatial_query.hpp | 88 - .../index/detail/distance_predicates.hpp | 844 ++-- .../geometry/index/detail/predicates.hpp | 45 +- .../geometry/index/detail/rtree/adaptors.hpp | 56 - .../index/detail/rtree/visitors/gl_draw.hpp | 2 +- .../geometry/index/distance_predicates.hpp | 56 +- include/boost/geometry/index/predicates.hpp | 78 +- include/boost/geometry/index/rtree.hpp | 642 +-- test/Jamfile.v2 | 2 +- test/rtree/test_rtree.hpp | 150 +- test/{static_vector.cpp => varray.cpp} | 56 +- tests/additional_glut_vis.cpp | 27 +- tests/additional_sizes_and_times.cpp | 47 +- tests/additional_speed.cpp | 35 - 33 files changed, 1365 insertions(+), 6721 deletions(-) delete mode 100644 doc/generated/distance_predicates.qbk create mode 100644 doc/generated/nearest_relations.qbk delete mode 100644 include/boost/geometry/index/adaptors/nearest_query.hpp delete mode 100644 include/boost/geometry/index/adaptors/spatial_query.hpp rename test/{static_vector.cpp => varray.cpp} (92%) diff --git a/doc/generated/adaptors.qbk b/doc/generated/adaptors.qbk index 85255430d..ea2dc551f 100644 --- a/doc/generated/adaptors.qbk +++ b/doc/generated/adaptors.qbk @@ -4,51 +4,9 @@ [heading Functions] [table [[Function][Description]] -[[[link group__adaptors_1ga8e094e1f312fc00336a3536f51a69468 `nearest_queried(DistancesPredicates const &, size_t, Predicates const &)`]][The nearest query index adaptor generator. ]] -[[[link group__adaptors_1ga3478395ded5855dc0b6c2f36a89de9f6 `nearest_queried(DistancesPredicates const &, size_t)`]][The nearest query index adaptor generator. ]] [[[link group__adaptors_1ga4716cd5423bfed3ff3e69e9ec274ac81 `queried(Predicates const &)`]][The query index adaptor generator. ]] -[[[link group__adaptors_1ga3068771f0f9cca706269ec35a809db2a `spatial_queried(Predicates const &)`]][The spatial query index adaptor generator. ]] ] -[#group__adaptors_1ga8e094e1f312fc00336a3536f51a69468] -[section nearest_queried(DistancesPredicates const &, size_t, Predicates const &)] -The nearest query index adaptor generator. - -[heading Synopsis] -[pre -`template<``typename DistancesPredicates``,` `typename Predicates``>` -`detail::nearest_query boost::geometry::index::adaptors::nearest_queried``(``DistancesPredicates const &` `dpred``,` - `size_t` `k``,` - `Predicates const &` `pred``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`DistancesPredicates const &`][ `dpred` ][Distance predicates. ]] -[[`size_t`][ `k` ][The number of values to find. ]] -[[`Predicates const &`][ `pred` ][Spatial predicates. ]] -] -[endsect] - -[#group__adaptors_1ga3478395ded5855dc0b6c2f36a89de9f6] -[section nearest_queried(DistancesPredicates const &, size_t)] -The nearest query index adaptor generator. - -[heading Synopsis] -[pre -`template<``typename DistancesPredicates``>` -`detail::nearest_query boost::geometry::index::adaptors::nearest_queried``(``DistancesPredicates const &` `dpred``,` `size_t` `k``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`DistancesPredicates const &`][ `dpred` ][Distance predicates. ]] -[[`size_t`][ `k` ][The number of values to find. ]] -] -[endsect] - [#group__adaptors_1ga4716cd5423bfed3ff3e69e9ec274ac81] [section queried(Predicates const &)] The query index adaptor generator. @@ -66,22 +24,5 @@ The query index adaptor generator. ] [endsect] -[#group__adaptors_1ga3068771f0f9cca706269ec35a809db2a] -[section spatial_queried(Predicates const &)] -The spatial query index adaptor generator. - -[heading Synopsis] -[pre -`template<``typename Predicates``>` -`detail::spatial_query boost::geometry::index::adaptors::spatial_queried``(``Predicates const &` `pred``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`Predicates const &`][ `pred` ][Spatial predicates. ]] -] -[endsect] - [endsect] diff --git a/doc/generated/distance_predicates.qbk b/doc/generated/distance_predicates.qbk deleted file mode 100644 index 53aca24e3..000000000 --- a/doc/generated/distance_predicates.qbk +++ /dev/null @@ -1,197 +0,0 @@ -[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] -[/ Generated from xml/group__distance__predicates.xml] -[section:group__distance__predicates Distance predicates (boost::geometry::index::)] -[heading Functions] -[table -[[Function][Description]] -[[[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] relationship. ]] -[[[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 `to_centroid(T const &)`]][Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] relationship. ]] -[[[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 `to_furthest(T const &)`]][Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] relationship. ]] -[[[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db `unbounded(PointRelation const &)`]][Generate [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db unbounded()] distance predicate. ]] -[[[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 `min_bounded(PointRelation const &, MinRelation const &)`]][Generate [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 min_bounded()] distance predicate. ]] -[[[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 `max_bounded(PointRelation const &, MaxRelation const &)`]][Generate [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 max_bounded()] distance predicate. ]] -[[[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 `bounded(PointRelation const &, MinRelation const &, MaxRelation const &)`]][Generate [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 bounded()] distance predicate. ]] -] - -[#group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636] -[section to_nearest(T const &)] -Generate [link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] relationship. - -[heading Description] -Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it should be the distance to the nearest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation.[heading Synopsis] -[pre -`template<``typename T``>` -`detail::to_nearest boost::geometry::index::to_nearest``(``T const &` `v``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or CoordinateType for MinRelation or MaxRelation]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`T const &`][ `v` ][Point or distance value. ]] -] -[endsect] - -[#group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0] -[section to_centroid(T const &)] -Generate [link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] relationship. - -[heading Description] -Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v.[heading Synopsis] -[pre -`template<``typename T``>` -`detail::to_centroid boost::geometry::index::to_centroid``(``T const &` `v``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`T const &`][ `v` ][Point or distance value. ]] -] -[endsect] - -[#group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02] -[section to_furthest(T const &)] -Generate [link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] relationship. - -[heading Description] -Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it should be the distance to the furthest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v.[heading Synopsis] -[pre -`template<``typename T``>` -`detail::to_furthest boost::geometry::index::to_furthest``(``T const &` `v``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`T`][Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`T const &`][ `v` ][Point or distance value. ]] -] -[endsect] - -[#group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db] -[section unbounded(PointRelation const &)] -Generate [link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db unbounded()] distance predicate. - -[heading Description] -Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that there is no distance bounds and Values should be returned if distances between Point and Indexable are the smallest. Distance calculation is defined by PointRelation. This is default nearest predicate.[heading Synopsis] -[pre -`template<``typename PointRelation``>` -`detail::unbounded boost::geometry::index::unbounded``(``PointRelation const &` `pr``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type.]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 index::to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 index::to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 index::to_furthest()]] with [^`Point`] passed as a parameter. ]] -] -[endsect] - -[#group__distance__predicates_1ga39c7c94776ab840e164848e53d376098] -[section min_bounded(PointRelation const &, MinRelation const &)] -Generate [link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 min_bounded()] distance predicate. - -[heading Description] -Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance.[heading Synopsis] -[pre -`template<``typename PointRelation``,` `typename MinRelation``>` -`detail::min_bounded boost::geometry::index::min_bounded``(``PointRelation const &` `pr``,` `MinRelation const &` `minr``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type. ]] -[[`MinRelation`][MinRelation type.]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with [^`Point`] passed as a parameter. ]] -[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] -] -[endsect] - -[#group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079] -[section max_bounded(PointRelation const &, MaxRelation const &)] -Generate [link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 max_bounded()] distance predicate. - -[heading Description] -Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are closer than some distance.[heading Synopsis] -[pre -`template<``typename PointRelation``,` `typename MaxRelation``>` -`detail::max_bounded boost::geometry::index::max_bounded``(``PointRelation const &` `pr``,` `MaxRelation const &` `maxr``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type. ]] -[[`MaxRelation`][MaxRelation type.]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with [^`Point`] passed as a parameter. ]] -[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] -] -[endsect] - -[#group__distance__predicates_1ga20621ca608b1420c38182346b965f347] -[section bounded(PointRelation const &, MinRelation const &, MaxRelation const &)] -Generate [link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 bounded()] distance predicate. - -[heading Description] -Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance and closer than some other distance.[heading Synopsis] -[pre -`template<``typename PointRelation``,` - `typename MinRelation``,` - `typename MaxRelation``>` -`detail::bounded boost::geometry::index::bounded``(``PointRelation const &` `pr``,` - `MinRelation const &` `minr``,` - `MaxRelation const &` `maxr``)` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`PointRelation`][PointRelation type. ]] -[[`MinRelation`][MinRelation type. ]] -[[`MaxRelation`][MaxRelation type.]] -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`PointRelation const &`][ `pr` ][The point relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with [^`Point`] passed as a parameter. ]] -[[`MinRelation const &`][ `minr` ][The minimum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] -[[`MaxRelation const &`][ `maxr` ][The maximum bound relation. This may be generated by [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()]], [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()]] or [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()]] with distance value passed as a parameter. ]] -] -[endsect] - -[endsect] - diff --git a/doc/generated/nearest_relations.qbk b/doc/generated/nearest_relations.qbk new file mode 100644 index 000000000..7f0d9a711 --- /dev/null +++ b/doc/generated/nearest_relations.qbk @@ -0,0 +1,85 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/group__nearest__relations.xml] +[section:group__nearest__relations Nearest relations (boost::geometry::index::)] +[heading Functions] +[table +[[Function][Description]] +[[[link group__nearest__relations_1gace3c7dbc60840c2a61da36e975d56636 `to_nearest(T const &)`]][Generate [link group__nearest__relations_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] relationship. ]] +[[[link group__nearest__relations_1gaccbba95d864d8dcf8a694796c840fbe0 `to_centroid(T const &)`]][Generate [link group__nearest__relations_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] relationship. ]] +[[[link group__nearest__relations_1ga67dddd8a7fcaae150970e1db0401de02 `to_furthest(T const &)`]][Generate [link group__nearest__relations_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] relationship. ]] +] + +[#group__nearest__relations_1gace3c7dbc60840c2a61da36e975d56636] +[section to_nearest(T const &)] +Generate [link group__nearest__relations_1gace3c7dbc60840c2a61da36e975d56636 to_nearest()] relationship. + +[heading Description] +Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it should be the distance to the nearest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation.[heading Synopsis] +[pre +`template<``typename T``>` +`detail::to_nearest boost::geometry::index::to_nearest``(``T const &` `v``)` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or CoordinateType for MinRelation or MaxRelation]] +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`T const &`][ `v` ][Point or distance value. ]] +] +[endsect] + +[#group__nearest__relations_1gaccbba95d864d8dcf8a694796c840fbe0] +[section to_centroid(T const &)] +Generate [link group__nearest__relations_1gaccbba95d864d8dcf8a694796c840fbe0 to_centroid()] relationship. + +[heading Description] +Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v.[heading Synopsis] +[pre +`template<``typename T``>` +`detail::to_centroid boost::geometry::index::to_centroid``(``T const &` `v``)` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation]] +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`T const &`][ `v` ][Point or distance value. ]] +] +[endsect] + +[#group__nearest__relations_1ga67dddd8a7fcaae150970e1db0401de02] +[section to_furthest(T const &)] +Generate [link group__nearest__relations_1ga67dddd8a7fcaae150970e1db0401de02 to_furthest()] relationship. + +[heading Description] +Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it should be the distance to the furthest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v.[heading Synopsis] +[pre +`template<``typename T``>` +`detail::to_furthest boost::geometry::index::to_furthest``(``T const &` `v``)` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`T`][Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation]] +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`T const &`][ `v` ][Point or distance value. ]] +] +[endsect] + +[endsect] + diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 3b67d1348..6129af70b 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -10,8 +10,7 @@ [[[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 `overlaps(Geometry const &)`]][Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. ]] [[[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d `within(Geometry const &)`]][Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. ]] [[[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce `value(Fun const &)`]][Generate value predicate. ]] -[[[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b `nearest(DistancePredicates const &, unsigned)`]][Generate nearest predicate. ]] -[[[link group__predicates_1ga54f507955e8dba2c928d6592d5970638 `nearest(DistancePredicates const &)`]][Generate nearest predicate. ]] +[[[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 `nearest(PointOrRelation const &, unsigned)`]][Generate nearest predicate. ]] ] [#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61] @@ -158,46 +157,31 @@ A wrapper around user-defined functor describing if Value should be returned by ] [endsect] -[#group__predicates_1ga162233fd11b980853f8b8335cb70d57b] -[section nearest(DistancePredicates const &, unsigned)] +[#group__predicates_1gae80a2c204673a8b11c4fc137cfff6556] +[section nearest(PointOrRelation const &, unsigned)] Generate nearest predicate. [heading Description] When nearest predicate is passed to the query, k-nearest neighbour search will be performed. -[*Distances predicates] may be a [^`Point`]. In this the case values closest to [^`Point`] are returned. +The simplest way of defining the knn query is passing a [^`Point`] to which [^`Values`] must be closest. It is possible to define how distance between values and query Point is calculated. This is done by passing PointRelation. It can be generated by following functions: -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - - -It is possible to define distances bounds, for example that a distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - -* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, -* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], -* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], -* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. - - -MinRelation and MaxRelation describes bounds and can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. +* [^[link group__nearest__relations_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, +* [^[link group__nearest__relations_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], +* [^[link group__nearest__relations_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. [heading Synopsis] [pre -`template<``typename DistancePredicates``>` -`detail::nearest boost::geometry::index::nearest``(``DistancePredicates const &` `dpred``,` `unsigned` `k``)` +`template<``typename PointOrRelation``>` +`detail::nearest boost::geometry::index::nearest``(``PointOrRelation const &` `point_relation``,` `unsigned` `k``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`DistancePredicates const &`][ `dpred` ][The distance predicates. ]] +[[`PointOrRelation const &`][ `point_relation` ][The point or relation describing how the distance will be calculated. ]] [[`unsigned`][ `k` ][The maximum number of values to return. ]] ] [heading Example] @@ -206,66 +190,10 @@ MinRelation and MaxRelation describes bounds and can be generated by following f tree.query(bgi::nearest(pt, 5), std::back_inserter(result)); tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); -tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20)), 5), std::back_inserter(result)); `` -[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate may be used in a query. This version may be used only in queries returning a set of values - using output iterator.] - -[endsect] - -[#group__predicates_1ga54f507955e8dba2c928d6592d5970638] -[section nearest(DistancePredicates const &)] -Generate nearest predicate. - -[heading Description] -When nearest predicate is passed to the query, k-nearest neighbour search will be performed. - -[*Distances predicates] may be a [^`Point`]. In this the case value closest to [^`Point`] is returned. - -It is possible to define how distance between value and query Point is calculated. This is done by passing PointRelation. It can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - - -It is possible to define distances bounds, for example that a distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - -* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, -* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], -* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], -* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. - - -MinRelation and MaxRelation describes bounds and can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - -[heading Synopsis] -[pre -`template<``typename DistancePredicates``>` -`detail::nearest_one boost::geometry::index::nearest``(``DistancePredicates const &` `dpred``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`DistancePredicates const &`][ `dpred` ][The distance predicates. ]] -] -[heading Example] - -`` -tree.query(bgi::nearest(pt), value); -tree.query(bgi::nearest(pt) && bgi::intersects(box), value); -tree.query(bgi::nearest(bgi::to_centroid(pt)) && bgi::within(box), value); -tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20))), value); -`` - - -[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate may be used in a query. This version may be used only in queries returning one value.] +[warning Only one [^[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()]] predicate may be used in a query.] [endsect] diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index b00bb7df3..603fc41bb 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -89,31 +89,25 @@ The Translator translates from Value to Indexable each time r-tree requires it. [heading Member(s)] [table -[[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949 `query(Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1abd965047110c9f8ef6ff097e97487312 `query(Predicates const &, value_type &)`]][Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 `spatial_query(Predicates const &, OutIter)`]][Finds values meeting spatial predicates, e.g. intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 `nearest_query(DistancesPredicates const &, value_type &)`]][Finds one value meeting distances predicates, e.g. nearest to some Point. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc `nearest_query(DistancesPredicates const &, Predicates const &, value_type &)`]][Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d `nearest_query(DistancesPredicates const &, size_type, OutIter)`]][Finds k values meeting distances predicates, e.g. k nearest values to some Point. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301 `nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)`]][Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ace84997927e26d7cdb5aa67f14cdf6cc `bounds()`]][Returns the box able to contain all values stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] +[[Modifier][Function][Description]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949 `query(Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ace84997927e26d7cdb5aa67f14cdf6cc `bounds()`]][Returns the box able to contain all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] ] [#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b] @@ -126,7 +120,8 @@ The constructor. `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] @@ -209,7 +204,8 @@ The constructor. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] @@ -639,403 +635,47 @@ This is a special kind of predicate which allows to pass a user-defined functor [*Nearest predicate] -If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. Passing the first one will result in returning k number of values, the second one will result in returning only one, closest value. In both cases values will be returned to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by: +If the nearest predicate is passed a k-nearest neighbor search will be performed. This query will result in returning k values to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by: -* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. +* [^[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 boost::geometry::index::nearest()]]. [*Connecting predicates] -A set of predicates may be generated by: - -* [^`std::make_pair()`] -* [^`boost::make_tuple()`] -* [^`operator&&()`] - -[heading Synopsis] +Predicates may be passed together connected with [^`operator&&()`].[heading Synopsis] [pre `template<``typename Predicates``,` `typename OutIter``>` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `query``(``Predicates const &` `predicates``,` `OutIter` `out_it``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Predicates const &`][ `predicates` ][Predicates. ]] [[`OutIter`][ `out_it` ][The output iterator, e.g. generated by std::back_inserter().]] ] [heading Returns] -The number of values found. +The number of values found. [heading Example] `` -tree.query(box1, std::back_inserter(result)); -tree.query(std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); +// return elements intersecting box +tree.query(box, std::back_inserter(result)); +// return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); +// return elements overlapping box and meeting my_fun value predicate tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +// return 5 elements nearest to pt and elements are intersecting box tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +// return 5 elements which centroids are nearest to pt and elements aren't within box +tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && !bgi::within(box), std::back_inserter(result)); `` [heading Throws] -If Value copy constructor or copy assignment throws. +If Value copy constructor or copy assignment throws. -[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] perdicate may be passed to the query.] - -[endsect] - -[#classboost_1_1geometry_1_1index_1_1rtree_1abd965047110c9f8ef6ff097e97487312] -[section query(Predicates const &, value_type &)] -Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. - -[heading Description] -This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. The value will be returned only if all predicates are met. This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. - -[*Spatial predicates] - -The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: - -* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, -* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], - - -It is possible to negate spatial predicates: - -* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] - -[*Value predicate] - -This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: - -* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. - -[*Nearest predicate] - -This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. It may be generated by [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] taking only one parameter - distance predicates. - -* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. - -[*Connecting predicates] - -A set of predicates may be generated by: - -* [^`std::make_pair()`] -* [^`boost::make_tuple()`] -* [^`operator&&()`] - -[heading Synopsis] -[pre -`template<``typename Predicates``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `query``(``Predicates const &` `predicates``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `value``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`Predicates const &`][ `predicates` ][Predicates. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &`][ `value` ][The reference to value which will hold the result of the query.]] -] -[heading Returns] -The number of values found (1 if value was found, 0 otherwise). -[heading Example] - -`` -tree.query(std::make_pair(bgi::nearest(pt), bgi::within(box)), value); -tree.query(bgi::nearest(pt) && bgi::intersects(poly), value); -`` - - -[heading Throws] -If Value copy constructor or copy assignment throws. - -[warning This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate.] - -[endsect] - -[#classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920] -[section spatial_query(Predicates const &, OutIter)] -Finds values meeting spatial predicates, e.g. intersecting some Box. - -[heading Description] -[*Spatial predicates] may be a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. - -It may be generated by one of the functions listed below: - -* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, -* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], -* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. - - -Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] -[pre -`template<``typename Predicates``,` `typename OutIter``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `spatial_query``(``Predicates const &` `pred``,` `OutIter` `out_it``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] -[[`OutIter`][ `out_it` ][The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container)]] -] -[heading Returns] -The number of values found. -[heading Throws] - - -* If Value copy constructor or copy assignment throws. -* If OutIter dereference or increment throws. - - - -[endsect] - -[#classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909] -[section nearest_query(DistancesPredicates const &, value_type &)] -Finds one value meeting distances predicates, e.g. nearest to some Point. - -[heading Description] -[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. - -It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - - -It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - -* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, -* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], -* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], -* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. - - -MinRelation and MaxRelation describes bounds and can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - -[heading Synopsis] -[pre -`template<``typename DistancesPredicates``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point.]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &`][ `v` ][The reference to the object which will contain the result.]] -] -[heading Returns] -The number of values found. -[heading Throws] -If Value copy constructor or copy assignment throws. - -[endsect] - -[#classboost_1_1geometry_1_1index_1_1rtree_1a6552331dca4d67647ef2a03bd0fbedcc] -[section nearest_query(DistancesPredicates const &, Predicates const &, value_type &)] -Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box. - -[heading Description] -[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. - -It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - - -It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - -* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, -* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], -* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], -* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. - - -MinRelation and MaxRelation describes bounds and can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - -[*Spatial predicates] may be a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. - -It may be generated by one of the functions listed below: - -* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, -* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], -* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. - - -Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] -[pre -`template<``typename DistancesPredicates``,` `typename Predicates``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` - `Predicates const &` `pred``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &` `v``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] -[[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` &`][ `v` ][The reference to the object which will contain the result.]] -] -[heading Returns] -The number of values found. -[heading Throws] -If Value copy constructor or copy assignment throws. - -[endsect] - -[#classboost_1_1geometry_1_1index_1_1rtree_1a3101652211c9f2d6ed8626dae6ff5f9d] -[section nearest_query(DistancesPredicates const &, size_type, OutIter)] -Finds k values meeting distances predicates, e.g. k nearest values to some Point. - -[heading Description] -[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. - -It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - - -It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - -* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, -* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], -* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], -* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. - - -MinRelation and MaxRelation describes bounds and can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - -[heading Synopsis] -[pre -`template<``typename DistancesPredicates``,` `typename OutIter``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `k``,` - `OutIter` `out_it``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]]][ `k` ][The max number of values. ]] -[[`OutIter`][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] -] -[heading Returns] -The number of values found. -[heading Throws] -If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. - -[endsect] - -[#classboost_1_1geometry_1_1index_1_1rtree_1a31c23b87b01f12282ef0df6404ab7301] -[section nearest_query(DistancesPredicates const &, size_type, Predicates const &, OutIter)] -Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box. - -[heading Description] -[*Distances predicates] may be a [^`Point`]. In this the case the Value closest to [^`Point`] is returned. - -It is possible to define how distance to Value is calculated. This is done by passing PointRelation. It can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default, -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - - -It is possible to define define distances bounds, for example that some distance must be between min_distance and max_distance. This is done by passing DistancesPredicates which can be generated by following functions: - -* [^[link group__distance__predicates_1ga1b0f969b575a94ca710b9345861f64db boost::geometry::index::unbounded()]] - default, -* [^[link group__distance__predicates_1ga39c7c94776ab840e164848e53d376098 boost::geometry::index::min_bounded()]], -* [^[link group__distance__predicates_1ga843735643378288b0e14e19cc9b4e079 boost::geometry::index::max_bounded()]], -* [^[link group__distance__predicates_1ga20621ca608b1420c38182346b965f347 boost::geometry::index::bounded()]]. - - -MinRelation and MaxRelation describes bounds and can be generated by following functions: - -* [^[link group__distance__predicates_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]], -* [^[link group__distance__predicates_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]], -* [^[link group__distance__predicates_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]]. - -[*Spatial predicates] may be a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. - -It may be generated by one of the functions listed below: - -* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, -* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], -* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. - - -Those predicates may be passed together in [^`std::pair`] or [^`boost::tuple`].[heading Synopsis] -[pre -`template<``typename DistancesPredicates``,` - `typename Predicates``,` - `typename OutIter``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `nearest_query``(``DistancesPredicates const &` `dpred``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `k``,` - `Predicates const &` `pred``,` - `OutIter` `out_it``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates or a Point ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]]][ `k` ][The max number of values. ]] -[[`Predicates const &`][ `pred` ][The spatial predicates or a Geometry. ]] -[[`OutIter`][ `out_it` ][The output iterator of the result range. E.g. a back_insert_iterator.]] -] -[heading Returns] -The number of values found. -[heading Throws] -If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. +[warning Only one [^[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()]] perdicate may be passed to the query.] [endsect] @@ -1049,7 +689,8 @@ Returns the number of stored values. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The number of stored values. [heading Throws] Nothing. @@ -1066,7 +707,8 @@ Query if the container is empty. `bool` `empty``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] true if the container is empty. [heading Throws] Nothing. @@ -1099,7 +741,8 @@ Returns the box able to contain all values stored in the container. If the conta [^[link classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f bounds_type]]` const &` `bounds``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The box able to contain all values stored in the container or an invalid box if there are no values in the container. [heading Throws] Nothing. @@ -1117,7 +760,8 @@ For indexable_type it returns the number of values which indexables equals the p [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``const ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`ValueOrIndexable const &`][ `vori` ][The value or indexable which will be counted.]] @@ -1139,7 +783,8 @@ Returns parameters. [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The parameters object. [heading Throws] Nothing. @@ -1156,7 +801,8 @@ Returns the translator object. [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The translator object. [heading Throws] Nothing. @@ -1173,7 +819,8 @@ Returns allocator used by the rtree. [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()` ] -[heading Returns] +[heading Modifier(s)] +``const ``[heading Returns] The allocator. [heading Throws] If allocator copy constructor throws. diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index c51a47873..b28082e52 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -11,12 +11,6 @@ [[[link group__rtree__functions_1ga0219361de8b15c539af3f9bd027938ce `remove(rtree<...> &, Iterator, Iterator)`]][Remove a range of values from the container. ]] [[[link group__rtree__functions_1ga5885d6c90a91f238f72ab9b5ef24daf9 `remove(rtree<...> &, Range const &)`]][Remove a range of values from the container. ]] [[[link group__rtree__functions_1ga86e0808522ef6682b72b310a3891b276 `query(rtree<...> const &, Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] -[[[link group__rtree__functions_1ga35b54dcaed4e4d5fb38e9ef4b78ee3c7 `query(rtree<...> const &, Predicates const &, typename rtree<...>::value_type &)`]][Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. ]] -[[[link group__rtree__functions_1gadcec162d2391c2c9cc4215a5578d1721 `spatial_query(rtree<...> const &, Predicates const &, OutIter)`]][Find values meeting spatial predicates. ]] -[[[link group__rtree__functions_1gacabbd521b88b67a700e1246e5889d343 `nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)`]][Find the value meeting distances predicates. ]] -[[[link group__rtree__functions_1gaf963f417d4ab54a2782928020dd8c3ad `nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)`]][Find the value meeting distances and spatial predicates. ]] -[[[link group__rtree__functions_1ga74550ecb22e4ac69a445c1a6b0be9a1b `nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, OutIter)`]][Find k values meeting distances predicates. ]] -[[[link group__rtree__functions_1ga8057af533a3e28e09337bab2c7a146aa `nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, Predicates const &, OutIter)`]][Find k values meeting distances and spatial predicates. ]] [[[link group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c `clear(rtree<...> &)`]][Remove all values from the index. ]] [[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] [[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] @@ -211,19 +205,13 @@ This is a special kind of predicate which allows to pass a user-defined functor [*Nearest predicate] -If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. Passing the first one will result in returning k number of values, the second one will result in returning only one, closest value. In both cases values will be returned to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by: +If the nearest predicate is passed a k-nearest neighbor search will be performed. This query will result in returning k values to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by: -* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. +* [^[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 boost::geometry::index::nearest()]]. [*Connecting predicates] -A set of predicates may be generated by: - -* [^`std::make_pair()`] -* [^`boost::make_tuple()`] -* [^`operator&&()`] - -[heading Synopsis] +Predicates may be passed together connected with [^`operator&&()`].[heading Synopsis] [pre `template<``typename Value``,` `typename Options``,` @@ -239,265 +227,35 @@ A set of predicates may be generated by: [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][]] [[`Predicates const &`][ `predicates` ][Predicates. ]] [[`OutIter`][ `out_it` ][The output iterator, e.g. generated by std::back_inserter().]] ] [heading Returns] -The number of values found. +The number of values found. [heading Example] `` -bgi::query(tree, box1, std::back_inserter(result)); -bgi::query(tree, std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); +// return elements intersecting box +bgi::query(tree, box, std::back_inserter(result)); +// return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); +// return elements overlapping box and meeting my_fun value predicate bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +// return 5 elements nearest to pt and elements are intersecting box bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +// return 5 elements which centroids are nearest to pt and elements aren't within box +bgi::query(tree, bgi::nearest(bgi::to_centroid(pt), 5) && !bgi::within(box), std::back_inserter(result)); `` [heading Throws] -If Value copy constructor or copy assignment throws. +If Value copy constructor or copy assignment throws. -[warning Only one [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] perdicate may be passed to the query.] +[warning Only one [^[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()]] perdicate may be passed to the query.] [endsect] -[#group__rtree__functions_1ga35b54dcaed4e4d5fb38e9ef4b78ee3c7] -[section query(rtree<...> const &, Predicates const &, typename rtree<...>::value_type &)] -Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. - -[heading Description] -This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. The value will be returned only if all predicates are met. This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. - -[*Spatial predicates] - -The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: - -* [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, -* [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], - - -It is possible to negate spatial predicates: - -* [^`! `[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], -* [^`! `[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^`! `[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], -* [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], -* [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] - -[*Value predicate] - -This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: - -* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. - -[*Nearest predicate] - -This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate. It may be generated by [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] taking only one parameter - distance predicates. - -* [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b boost::geometry::index::nearest()]]. - -[*Connecting predicates] - -A set of predicates may be generated by: - -* [^`std::make_pair()`] -* [^`boost::make_tuple()`] -* [^`operator&&()`] - -[heading Synopsis] -[pre -`template<``typename Value``,` - `typename Options``,` - `typename Translator``,` - `typename Allocator``,` - `typename Predicates``>` -`rtree::size_type boost::geometry::index::query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` - `Predicates const &` `predicates``,` - `typename rtree< Value, Options, Translator, Allocator >::value_type &` `value``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] -[[`Predicates const &`][ `predicates` ][Predicates. ]] -[[`typename rtree< Value, Options, Translator, Allocator >::value_type &`][ `value` ][The reference to value which will hold the result of the query.]] -] -[heading Returns] -The number of values found (1 if value was found, 0 otherwise). -[heading Example] - -`` -bgi::query(tree, std::make_pair(bgi::nearest(pt), bgi::within(box)), value); -bgi::query(tree, bgi::nearest(pt) && bgi::intersects(poly), value); -`` - - -[heading Throws] -If Value copy constructor or copy assignment throws. - -[warning This query requires that one of the predicates must be one-value [^[link group__predicates_1ga162233fd11b980853f8b8335cb70d57b nearest()]] predicate.] - -[endsect] - -[#group__rtree__functions_1gadcec162d2391c2c9cc4215a5578d1721] -[section spatial_query(rtree<...> const &, Predicates const &, OutIter)] -Find values meeting spatial predicates. - -[heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a930bf17d595a91d8ae924383a0387920 rtree::spatial_query]] with parameters [^`(Predicates const&, OutIter)`].[heading Synopsis] -[pre -`template<``typename Value``,` - `typename Options``,` - `typename Translator``,` - `typename Allocator``,` - `typename Predicates``,` - `typename OutIter``>` -`size_t boost::geometry::index::spatial_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` - `Predicates const &` `pred``,` - `OutIter` `out_it``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] -[[`Predicates const &`][ `pred` ][The spatial predicates. ]] -[[`OutIter`][ `out_it` ][The output iterator of the result range.]] -] -[heading Returns] -The number of found values. -[endsect] - -[#group__rtree__functions_1gacabbd521b88b67a700e1246e5889d343] -[section nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)] -Find the value meeting distances predicates. - -[heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const& dpred, value_type & v)`].[heading Synopsis] -[pre -`template<``typename Value``,` - `typename Options``,` - `typename Translator``,` - `typename Allocator``,` - `typename DistancesPredicates``>` -`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` - `DistancesPredicates const &` `dpred``,` - `Value &` `v``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] -[[`Value &`][ `v` ][The result.]] -] -[heading Returns] -The number of found values. -[endsect] - -[#group__rtree__functions_1gaf963f417d4ab54a2782928020dd8c3ad] -[section nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)] -Find the value meeting distances and spatial predicates. - -[heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const& dpred, Predicates const& pred, value_type & v)`].[heading Synopsis] -[pre -`template<``typename Value``,` - `typename Options``,` - `typename Translator``,` - `typename Allocator``,` - `typename DistancesPredicates``,` - `typename Predicates``>` -`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` - `DistancesPredicates const &` `dpred``,` - `Predicates const &` `pred``,` - `Value &` `v``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] -[[`Predicates const &`][ `pred` ][The spatial predicates. ]] -[[`Value &`][ `v` ][The result.]] -] -[heading Returns] -The number of found values. -[endsect] - -[#group__rtree__functions_1ga74550ecb22e4ac69a445c1a6b0be9a1b] -[section nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, OutIter)] -Find k values meeting distances predicates. - -[heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const & dpred, size_type k, OutIter out_it)`].[heading Synopsis] -[pre -`template<``typename Value``,` - `typename Options``,` - `typename Translator``,` - `typename Allocator``,` - `typename DistancesPredicates``,` - `typename OutIter``>` -`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` - `DistancesPredicates const &` `dpred``,` - `typename rtree< Value, Options, Translator, Allocator >::size_type` `k``,` - `OutIter` `out_it``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] -[[`typename rtree< Value, Options, Translator, Allocator >::size_type`][ `k` ][The max number of values. ]] -[[`OutIter`][ `out_it` ][The output iterator of the result range.]] -] -[heading Returns] -The number of found values. -[endsect] - -[#group__rtree__functions_1ga8057af533a3e28e09337bab2c7a146aa] -[section nearest_query(rtree<...> const &, DistancesPredicates const &, typename rtree<...>::size_type, Predicates const &, OutIter)] -Find k values meeting distances and spatial predicates. - -[heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a788295b315bd0ddeb93b1cc050fdf909 rtree::nearest_query]] with parameters [^`(DistancesPredicates const & dpred, size_type k, Predicates const & pred, OutIter out_it)`].[heading Synopsis] -[pre -`template<``typename Value``,` - `typename Options``,` - `typename Translator``,` - `typename Allocator``,` - `typename DistancesPredicates``,` - `typename Predicates``,` - `typename OutIter``>` -`size_t boost::geometry::index::nearest_query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` - `DistancesPredicates const &` `dpred``,` - `typename rtree< Value, Options, Translator, Allocator >::size_type` `k``,` - `Predicates const &` `pred``,` - `OutIter` `out_it``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index. ]] -[[`DistancesPredicates const &`][ `dpred` ][The distances predicates. ]] -[[`typename rtree< Value, Options, Translator, Allocator >::size_type`][ `k` ][The max number of values. ]] -[[`Predicates const &`][ `pred` ][The spatial predicates. ]] -[[`OutIter`][ `out_it` ][The output iterator of the result range.]] -] -[heading Returns] -The number of found values. -[endsect] - [#group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c] [section clear(rtree<...> &)] Remove all values from the index. diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk index 186c971cb..12c4725ca 100644 --- a/doc/generated/translator_index.qbk +++ b/doc/generated/translator_index.qbk @@ -43,7 +43,8 @@ The constructor. `index``(``Container const &` `c``)` ] -[heading Parameter(s)] +[heading Modifier(s)] +``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] [[`Container const &`][ `c` ][The container which stores indexed values. ]] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd5718dbb..c00e43835 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 d90bd1ce7..4dd17eeba 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -73,8 +73,8 @@ parameters

                                                                                                                                                                Predicates (boost::geometry::index::)
                                                                                                                                                                -
                                                                                                                                                                Distance - predicates (boost::geometry::index::)
                                                                                                                                                                +
                                                                                                                                                                Nearest + relations (boost::geometry::index::)
                                                                                                                                                                Adaptors (boost::geometry::index::adaptors::)
                                                                                                                                                                Translators 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 d80f7223e..7909b5d67 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 - + @@ -55,7 +55,7 @@

                                                                                                                                                                rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
                                                                                                                                                                 
                                                                                                                                                                -
                                                                                                                                                                  +
                                                                                                                                                                  • Value - type of object which will be stored in the container,
                                                                                                                                                                  • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

                                                                                                                                                                    -
                                                                                                                                                                      +
                                                                                                                                                                      • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

                                                                                                                                                                        -
                                                                                                                                                                          +
                                                                                                                                                                          • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                                                                                                                                                                            If comparison of two Values is required, the default translator:

                                                                                                                                                                            -
                                                                                                                                                                              +
                                                                                                                                                                              • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index d5d164868..825cb4cae 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                                                                                                                                                                          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 + 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 [2]. + close to some point in space [2].

                                                                                                                                                                          The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                                                                                                                                                                          The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -179,13 +179,13 @@

    - Implementation + Implementation details

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

    -
    - +

    Last revised: February 06, 2013 at 16:48:24 GMT

    Last revised: February 11, 2013 at 19:05:08 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index c17eae014..f737f85b7 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -28,7 +28,7 @@ os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic", "rtr os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1rstar", "rtree_runtime_rstar")) os.system(cmd % ("group__predicates", "predicates")) -os.system(cmd % ("group__distance__predicates", "distance_predicates")) +os.system(cmd % ("group__nearest__relations", "nearest_relations")) os.system(cmd % ("group__adaptors", "adaptors")) os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_1_1def", "translator_def")) os.system(cmd % ("classboost_1_1geometry_1_1index_1_1translator_1_1index", "translator_index")) diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 8321a6d16..aeb717188 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -32,7 +32,7 @@ [endsect] [include generated/predicates.qbk] -[include generated/distance_predicates.qbk] +[include generated/nearest_relations.qbk] [include generated/adaptors.qbk] [section:translators Translators (boost::geometry::index::translators::)] diff --git a/doc/rtree/query.qbk b/doc/rtree/query.qbk index ecc8bef5f..cbbebb92d 100644 --- a/doc/rtree/query.qbk +++ b/doc/rtree/query.qbk @@ -86,15 +86,11 @@ All predicates may be negated, e.g.: [section Nearest neighbours queries] Nearest neighbours queries returns `__value__`s which are closest to some point in space. -Additionally it is possible to pass define how the distance to the `Value` should be calculated -or distance predicates defining 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. +Additionally it is possible to pass define how the distance to the `Value` should be calculated. +The examples of some knn queries may be found in the table below. All queries returns 5 closest `Values`. +The query point and Values are orange. -[table -[[Basic knn query] [knn query - distance to Indexable's furthest point greather than ...] [knn query - distance to Indexable's closest point greather than ...]] -[[[$../images/knn.png]] [[$../images/knn_inters.png]] [[$../images/knn_cover.png]]] -] +[$../images/knn.png] [section k nearest neighbours] @@ -122,71 +118,17 @@ Use of `operator |` [endsect] -[section One nearest neighbour] +[section Distance calculation] -Another type of nearest neighbour query is searching for the one closest `__value__`. -If it is found, 1 is returned by the method or function. This kind of query -has only two forms. +It is possible to define how distance to the non-point `__value__` should be calculated. To do this one may pass +a relation object generated as follows: -Method call - - __value__ returned_value; - __point__ pt(...); - size_t n = rt.query(index::nearest(pt), returned_value); - -Function call - - __value__ Value returned_value; - __point__ pt(...); - size_t n = index::query(rt, index::nearest(pt), returned_value); - -[endsect] - -[section Distances predicates] - -It is possible to define if calculated distance between query point and `__value__` should be -greater, lesser or between some other distances. Those are called `DistancesPredicate`s and -may be defined as follows. - - std::vector<__Value__> returned_values; - __point__ pt(...); - - /* default - without bounds */ - index::query(rt, index::nearest(pt, k), std::back_inserter(returned_values)); - - /* same as default */ - index::query(rt, index::nearest(index::unbounded(pt), k), std::back_inserter(returned_values)); - - /* distance must be greater than or equal to 10 */ - index::query(rt, index::nearest(index::min_bounded(pt, 10), k), std::back_inserter(returned_values)); - - /* distance must be lesser than or equal to 500 */ - index::query(rt, index::nearest(index::max_bounded(pt, 500), k), std::back_inserter(returned_values)); - - /* distance must be between 10 and 500 */ - index::query(rt, index::nearest(index::bounded(pt, 10, 500), k), std::back_inserter(returned_values)); - -Furthermore, it's possible to define if the closest, furthest or centroidal point of the -non-point `__indexable__` should be taken into account in the routine calculating distance. - - std::vector<__value__> returned_values; - __point__ pt(...); - - /* default - distance between Indexable's closest point and a query point - must be greater than 10 */ - index::query(rt, index::nearest(index::min_bounded(pt, 10), k), std::back_inserter(returned_values)); - - /* same as default - distance between Indexable's closest point and a query point - must be greater than 10 */ - index::query(rt, index::nearest(index::min_bounded(pt, index::to_nearest(10)), k), std::back_inserter(returned_values)); - - /* distance between Indexable's furthest point and a query point - must be greater than 10 */ - index::query(rt, index::nearest(index::min_bounded(pt, index::to_furthest(10)), k), std::back_inserter(returned_values)); - - /* distance between Indexable's centroid and a query point - must be greater than 10 */ - index::query(rt, index::nearest(index::min_bounded(pt, index::to_centroid(10)), k), std::back_inserter(returned_values)); + /* caluclate distance to the Indexables' nearest points */ + tree::query(index::nearest(index::to_nearest(pt), k), std::back_inserter(returned_values)); // default + /* caluclate distance to the Indexables' centroid */ + tree::query(index::nearest(index::to_centroid(pt), k), std::back_inserter(returned_values)); + /* caluclate distance to the Indexables' furthest points */ + tree::query(index::nearest(index::to_furthest(pt), k), std::back_inserter(returned_values)); [endsect] @@ -212,11 +154,7 @@ some specific conditions for user-defined Values. [section Passing a set of predicates] -It's possible to use some number of predicates in one query by passing: - -* `std::pair`, -* `boost::tuple` -* predicates connected by `operator&&` e.g. `Pred1 && Pred2 && Pred3 && ...`. +It's possible to use some number of predicates in one query by connecting them with `operator&&` e.g. `Pred1 && Pred2 && Pred3 && ...`. These predicates are connected by logical AND. Passing all predicates together not only makes possible to construct advanced queries but is also faster than separate calls because the tree is traversed only once. @@ -231,8 +169,6 @@ left-to-right so placing most restictive predicates first should accelerate the Of course it's possible to connect different types of predicates together. - rt.query(index::nearest(index::bounded(pt, index::to_furthest(1), 10)) && index::intersects(b), returned_value); - index::query(rt, index::nearest(pt, k) && index::within(b), std::back_inserter(returned_values)); BOOST_FOREACH(Value & v, rt | index::adaptors::queried(index::nearest(pt, k) && index::covered_by(b))) diff --git a/include/boost/geometry/index/adaptors/nearest_query.hpp b/include/boost/geometry/index/adaptors/nearest_query.hpp deleted file mode 100644 index 9c042ac85..000000000 --- a/include/boost/geometry/index/adaptors/nearest_query.hpp +++ /dev/null @@ -1,122 +0,0 @@ -// Boost.Geometry Index -// -// Nearest neighbour query range adaptor -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP -#define BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP - -/*! -\defgroup adaptors Adaptors (boost::geometry::index::adaptors::) -*/ - -namespace boost { namespace geometry { namespace index { - -namespace adaptors { - -namespace detail { - -template -class nearest_query_range -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_INDEX, - (nearest_query_range)); - - typedef int* iterator; - typedef const int* const_iterator; - - template - inline nearest_query_range( - Index const&, - DistancesPredicates const&, - size_t, - Predicates const& - ) - {} - - inline iterator begin() { return 0; } - inline iterator end() { return 0; } - inline const_iterator begin() const { return 0; } - inline const_iterator end() const { return 0; } -}; - -// TODO: awulkiew - consider removing references from predicates - -template -struct nearest_query -{ - inline nearest_query( - DistancesPredicates const& dpred, - size_t k, - Predicates const& pred - ) - : distances_predicates(dpred) - , count(k) - , predicates(pred) - {} - - DistancesPredicates const& distances_predicates; - size_t count; - Predicates const& predicates; -}; - -} // namespace detail - -/*! -\brief The nearest query index adaptor generator. - -\ingroup adaptors - -\param dpred Distance predicates. -\param k The number of values to find. -\param pred Spatial predicates. -*/ -template -detail::nearest_query -nearest_queried( - DistancesPredicates const& dpred, - size_t k, - Predicates const& pred) -{ - return detail::nearest_query(dpred, k, pred); -} - -/*! -\brief The nearest query index adaptor generator. - -\ingroup adaptors - -\param dpred Distance predicates. -\param k The number of values to find. -*/ -template -detail::nearest_query -nearest_queried( - DistancesPredicates const& dpred, - size_t k) -{ - return detail::nearest_query(dpred, k, index::detail::empty()); -} - -} // namespace adaptors - -template -index::adaptors::detail::nearest_query_range -operator|( - Index const& si, - index::adaptors::detail::nearest_query const& f) -{ - return index::adaptors::detail::nearest_query_range( - si, f.distances_predicates, f.count, f.predicates); -} - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_INDEX_ADAPTORS_NEAREST_QUERY_HPP diff --git a/include/boost/geometry/index/adaptors/spatial_query.hpp b/include/boost/geometry/index/adaptors/spatial_query.hpp deleted file mode 100644 index ef84fd325..000000000 --- a/include/boost/geometry/index/adaptors/spatial_query.hpp +++ /dev/null @@ -1,88 +0,0 @@ -// Boost.Geometry Index -// -// Spatial query range adaptor -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP -#define BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP - -/*! -\defgroup adaptors Adaptors (boost::geometry::index::adaptors::) -*/ - -namespace boost { namespace geometry { namespace index { - -namespace adaptors { - -namespace detail { - -template -class spatial_query_range -{ - BOOST_MPL_ASSERT_MSG( - (false), - NOT_IMPLEMENTED_FOR_THIS_INDEX, - (spatial_query_range)); - - typedef int* iterator; - typedef const int* const_iterator; - - template - inline spatial_query_range( - Index const&, - Predicates const&) - {} - - inline iterator begin() { return 0; } - inline iterator end() { return 0; } - inline const_iterator begin() const { return 0; } - inline const_iterator end() const { return 0; } -}; - -// TODO: awulkiew - consider removing reference from predicates - -template -struct spatial_query -{ - inline explicit spatial_query(Predicates const& pred) - : predicates(pred) - {} - - Predicates const& predicates; -}; - -} // namespace detail - -/*! -\brief The spatial query index adaptor generator. - -\ingroup adaptors - -\param pred Spatial predicates. -*/ -template -detail::spatial_query -spatial_queried(Predicates const& pred) -{ - return detail::spatial_query(pred); -} - -} // namespace adaptors - -template -index::adaptors::detail::spatial_query_range -operator|( - Index const& si, - index::adaptors::detail::spatial_query const& f) -{ - return index::adaptors::detail::spatial_query_range(si, f.predicates); -} - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_INDEX_ADAPTORS_SPATIAL_QUERY_HPP diff --git a/include/boost/geometry/index/detail/distance_predicates.hpp b/include/boost/geometry/index/detail/distance_predicates.hpp index e1bb2bf1f..4bfa3b5ae 100644 --- a/include/boost/geometry/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/index/detail/distance_predicates.hpp @@ -103,74 +103,74 @@ struct relation< to_furthest > // distance predicates // ------------------------------------------------------------------ // -template -struct unbounded - : nonassignable -{ - inline explicit unbounded(PointRelation const& pr) - : point_relation(pr) - {} - - PointRelation point_relation; -}; - -template -struct min_bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline min_bounded(PointRelation const& pr, MinRelation const& min_rel) - : point_relation(pr) - , comparable_min( - relation::value(min_rel) * - relation::value(min_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_min; -}; - -template -struct max_bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel) - : point_relation(pr) - , comparable_max( - relation::value(max_rel) * - relation::value(max_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_max; -}; - -template -struct bounded - : nonassignable -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel) - : point_relation(pr) - , comparable_min( - relation::value(min_rel) * - relation::value(min_rel) ) - , comparable_max( - relation::value(max_rel) * - relation::value(max_rel) ) - {} - - PointRelation point_relation; - distance_type comparable_min; - distance_type comparable_max; -}; +//template +//struct unbounded +// : nonassignable +//{ +// inline explicit unbounded(PointRelation const& pr) +// : point_relation(pr) +// {} +// +// PointRelation point_relation; +//}; +// +//template +//struct min_bounded +// : nonassignable +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename geometry::default_distance_result::type distance_type; +// +// inline min_bounded(PointRelation const& pr, MinRelation const& min_rel) +// : point_relation(pr) +// , comparable_min( +// relation::value(min_rel) * +// relation::value(min_rel) ) +// {} +// +// PointRelation point_relation; +// distance_type comparable_min; +//}; +// +//template +//struct max_bounded +// : nonassignable +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename geometry::default_distance_result::type distance_type; +// +// inline max_bounded(PointRelation const& pr, MaxRelation const& max_rel) +// : point_relation(pr) +// , comparable_max( +// relation::value(max_rel) * +// relation::value(max_rel) ) +// {} +// +// PointRelation point_relation; +// distance_type comparable_max; +//}; +// +//template +//struct bounded +// : nonassignable +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename geometry::default_distance_result::type distance_type; +// +// inline bounded(PointRelation const& pr, MinRelation const& min_rel, MaxRelation const& max_rel) +// : point_relation(pr) +// , comparable_min( +// relation::value(min_rel) * +// relation::value(min_rel) ) +// , comparable_max( +// relation::value(max_rel) * +// relation::value(max_rel) ) +// {} +// +// PointRelation point_relation; +// distance_type comparable_min; +// distance_type comparable_max; +//}; // ------------------------------------------------------------------ // // point_relation trait @@ -182,29 +182,29 @@ struct point_relation typedef PointRelation type; }; -template -struct point_relation< detail::unbounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::min_bounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::max_bounded > -{ - typedef PointRelation type; -}; - -template -struct point_relation< detail::bounded > -{ - typedef PointRelation type; -}; +//template +//struct point_relation< detail::unbounded > +//{ +// typedef PointRelation type; +//}; +// +//template +//struct point_relation< detail::min_bounded > +//{ +// typedef PointRelation type; +//}; +// +//template +//struct point_relation< detail::max_bounded > +//{ +// typedef PointRelation type; +//}; +// +//template +//struct point_relation< detail::bounded > +//{ +// typedef PointRelation type; +//}; // ------------------------------------------------------------------ // // helpers @@ -471,111 +471,111 @@ struct distances_calc } }; -template -struct distances_calc< - detail::unbounded, - Indexable, - value_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(detail::unbounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::min_bounded, - Indexable, - value_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag min_relation_tag; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::min_bounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::max_bounded, - Indexable, - value_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag max_relation_tag; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::max_bounded const& pp, Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::bounded, - Indexable, - value_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename detail::relation::tag point_relation_tag; - typedef typename geometry::default_distance_result::type distance_type; - typedef typename detail::relation::tag min_relation_tag; - typedef typename detail::relation::tag max_relation_tag; - - typedef typename detail::cdist_merge< - typename detail::cdist_merge< - cdist, - cdist - >::type, - cdist - >::type result_type; - - static inline result_type apply( - detail::bounded const& pp, - Indexable const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; +//template +//struct distances_calc< +// detail::unbounded, +// Indexable, +// value_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename detail::relation::tag point_relation_tag; +// typedef typename geometry::default_distance_result::type distance_type; +// +// typedef detail::cdist result_type; +// +// static inline result_type apply(detail::unbounded const& pp, Indexable const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; +// +//template +//struct distances_calc< +// detail::min_bounded, +// Indexable, +// value_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename detail::relation::tag point_relation_tag; +// typedef typename geometry::default_distance_result::type distance_type; +// typedef typename detail::relation::tag min_relation_tag; +// +// typedef typename detail::cdist_merge< +// cdist, +// cdist +// >::type result_type; +// +// static inline result_type apply(detail::min_bounded const& pp, Indexable const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; +// +//template +//struct distances_calc< +// detail::max_bounded, +// Indexable, +// value_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename detail::relation::tag point_relation_tag; +// typedef typename geometry::default_distance_result::type distance_type; +// typedef typename detail::relation::tag max_relation_tag; +// +// typedef typename detail::cdist_merge< +// cdist, +// cdist +// >::type result_type; +// +// static inline result_type apply(detail::max_bounded const& pp, Indexable const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; +// +//template +//struct distances_calc< +// detail::bounded, +// Indexable, +// value_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename detail::relation::tag point_relation_tag; +// typedef typename geometry::default_distance_result::type distance_type; +// typedef typename detail::relation::tag min_relation_tag; +// typedef typename detail::relation::tag max_relation_tag; +// +// typedef typename detail::cdist_merge< +// typename detail::cdist_merge< +// cdist, +// cdist +// >::type, +// cdist +// >::type result_type; +// +// static inline result_type apply( +// detail::bounded const& pp, +// Indexable const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; // ------------------------------------------------------------------ // // distance_predicates_check for value_tag @@ -591,79 +591,79 @@ struct distances_predicates_check } }; -template -struct distances_predicates_check< - detail::unbounded, - Indexable, - value_tag -> -{ - template - static inline bool apply(detail::unbounded const&, Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::min_bounded, - Indexable, - value_tag -> -{ - typedef typename detail::relation::tag min_relation_tag; - - template - static inline bool apply( - detail::min_bounded const& pred, - Distances const& d) - { - return pred.comparable_min <= - detail::cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::max_bounded, - Indexable, - value_tag -> -{ - typedef typename detail::relation::tag max_relation_tag; - - template - static inline bool apply( - detail::max_bounded const& pred, - Distances const& d) - { - return pred.comparable_max <= - detail::cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::bounded, - Indexable, - value_tag -> -{ - typedef typename detail::relation::tag min_relation_tag; - typedef typename detail::relation::tag max_relation_tag; - - template - static inline bool apply( - detail::bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= detail::cdist_value::template get(d) - && detail::cdist_value::template get(d) - <= pred.comparable_max; - } -}; +//template +//struct distances_predicates_check< +// detail::unbounded, +// Indexable, +// value_tag +//> +//{ +// template +// static inline bool apply(detail::unbounded const&, Distances const&) +// { +// return true; +// } +//}; +// +//template +//struct distances_predicates_check< +// detail::min_bounded, +// Indexable, +// value_tag +//> +//{ +// typedef typename detail::relation::tag min_relation_tag; +// +// template +// static inline bool apply( +// detail::min_bounded const& pred, +// Distances const& d) +// { +// return pred.comparable_min <= +// detail::cdist_value::template get(d); +// } +//}; +// +//template +//struct distances_predicates_check< +// detail::max_bounded, +// Indexable, +// value_tag +//> +//{ +// typedef typename detail::relation::tag max_relation_tag; +// +// template +// static inline bool apply( +// detail::max_bounded const& pred, +// Distances const& d) +// { +// return pred.comparable_max <= +// detail::cdist_value::template get(d); +// } +//}; +// +//template +//struct distances_predicates_check< +// detail::bounded, +// Indexable, +// value_tag +//> +//{ +// typedef typename detail::relation::tag min_relation_tag; +// typedef typename detail::relation::tag max_relation_tag; +// +// template +// static inline bool apply( +// detail::bounded const& pred, +// Distances const& d) +// { +// return pred.comparable_min +// <= detail::cdist_value::template get(d) +// && detail::cdist_value::template get(d) +// <= pred.comparable_max; +// } +//}; // ------------------------------------------------------------------ // // distance_calc for envelope_tag @@ -689,95 +689,95 @@ struct distances_calc< } }; -template -struct distances_calc< - detail::unbounded, - Box, - envelope_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef detail::cdist result_type; - - static inline result_type apply(detail::unbounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::min_bounded, - Box, - envelope_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::min_bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::max_bounded, - Box, - envelope_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef cdist result_type; - - static inline result_type apply(detail::max_bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; - -template -struct distances_calc< - detail::bounded, - Box, - envelope_tag -> -{ - typedef typename detail::relation::value_type point_type; - typedef typename geometry::default_distance_result::type distance_type; - - typedef typename detail::cdist_merge< - cdist, - cdist - >::type result_type; - - static inline result_type apply(detail::bounded const& pp, Box const& i) - { - result_type res; - distances_calc_impl - ::apply(res, relation::value(pp.point_relation), i); - return res; - } -}; +//template +//struct distances_calc< +// detail::unbounded, +// Box, +// envelope_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename geometry::default_distance_result::type distance_type; +// +// typedef detail::cdist result_type; +// +// static inline result_type apply(detail::unbounded const& pp, Box const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; +// +//template +//struct distances_calc< +// detail::min_bounded, +// Box, +// envelope_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename geometry::default_distance_result::type distance_type; +// +// typedef typename detail::cdist_merge< +// cdist, +// cdist +// >::type result_type; +// +// static inline result_type apply(detail::min_bounded const& pp, Box const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; +// +//template +//struct distances_calc< +// detail::max_bounded, +// Box, +// envelope_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename geometry::default_distance_result::type distance_type; +// +// typedef cdist result_type; +// +// static inline result_type apply(detail::max_bounded const& pp, Box const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; +// +//template +//struct distances_calc< +// detail::bounded, +// Box, +// envelope_tag +//> +//{ +// typedef typename detail::relation::value_type point_type; +// typedef typename geometry::default_distance_result::type distance_type; +// +// typedef typename detail::cdist_merge< +// cdist, +// cdist +// >::type result_type; +// +// static inline result_type apply(detail::bounded const& pp, Box const& i) +// { +// result_type res; +// distances_calc_impl +// ::apply(res, relation::value(pp.point_relation), i); +// return res; +// } +//}; // ------------------------------------------------------------------ // // distance_predicates_check for envelope_tag @@ -796,70 +796,70 @@ struct distances_predicates_check< } }; -template -struct distances_predicates_check< - detail::unbounded, - Box, - envelope_tag> -{ - template - static inline bool apply( - detail::unbounded const&, - Distances const&) - { - return true; - } -}; - -template -struct distances_predicates_check< - detail::min_bounded, - Box, - envelope_tag> -{ - template - static inline bool apply( - detail::min_bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= cdist_value::template get(d); - } -}; - -template -struct distances_predicates_check< - detail::max_bounded, - Box, - envelope_tag> -{ - template - static inline bool apply( - detail::max_bounded const& pred, - Distances const& d) - { - return cdist_value::template get(d) - <= pred.comparable_max; - } -}; - -template -struct distances_predicates_check< - detail::bounded, - Box, - envelope_tag> -{ - template - static inline bool apply( - detail::bounded const& pred, - Distances const& d) - { - return pred.comparable_min - <= cdist_value::template get(d) - && cdist_value::template get(d) - <= pred.comparable_max; - } -}; +//template +//struct distances_predicates_check< +// detail::unbounded, +// Box, +// envelope_tag> +//{ +// template +// static inline bool apply( +// detail::unbounded const&, +// Distances const&) +// { +// return true; +// } +//}; +// +//template +//struct distances_predicates_check< +// detail::min_bounded, +// Box, +// envelope_tag> +//{ +// template +// static inline bool apply( +// detail::min_bounded const& pred, +// Distances const& d) +// { +// return pred.comparable_min +// <= cdist_value::template get(d); +// } +//}; +// +//template +//struct distances_predicates_check< +// detail::max_bounded, +// Box, +// envelope_tag> +//{ +// template +// static inline bool apply( +// detail::max_bounded const& pred, +// Distances const& d) +// { +// return cdist_value::template get(d) +// <= pred.comparable_max; +// } +//}; +// +//template +//struct distances_predicates_check< +// detail::bounded, +// Box, +// envelope_tag> +//{ +// template +// static inline bool apply( +// detail::bounded const& pred, +// Distances const& d) +// { +// return pred.comparable_min +// <= cdist_value::template get(d) +// && cdist_value::template get(d) +// <= pred.comparable_max; +// } +//}; }}}} // namespace boost::geometry::index::detail diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index 465f76799..a5de1e58f 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -26,7 +26,7 @@ template struct value { value(Fun const& f) : fun(f) {} - Fun fun; + Fun const& fun; }; template @@ -116,8 +116,6 @@ struct not_within template struct nearest { - static const bool is_one = false; - nearest(DistancePredicates const& dpred, unsigned k) : distance_predicates(dpred) , count(k) @@ -126,17 +124,6 @@ struct nearest unsigned count; }; -template -struct nearest_one -{ - static const bool is_one = true; - - nearest_one(DistancePredicates const& dpred) - : distance_predicates(dpred) - {} - DistancePredicates const& distance_predicates; -}; - // ------------------------------------------------------------------ // // predicate_check // ------------------------------------------------------------------ // @@ -314,16 +301,6 @@ struct predicate_check, value_tag> } }; -template -struct predicate_check, value_tag> -{ - template - static inline bool apply(nearest_one const&, Value const&, Box const&) - { - return true; - } -}; - // ------------------------------------------------------------------ // // predicates_chec for envelope // ------------------------------------------------------------------ // @@ -456,7 +433,7 @@ template struct predicate_check, envelope_tag> { template - static bool apply(not_overlaps const& p, Value const&, Box const& i) + static bool apply(not_overlaps const& , Value const&, Box const& ) { return true; } @@ -492,16 +469,6 @@ struct predicate_check, envelope_tag> } }; -template -struct predicate_check, envelope_tag> -{ - template - static inline bool apply(nearest_one const&, Value const&, Box const&) - { - return true; - } -}; - // ------------------------------------------------------------------ // // predicates_length // ------------------------------------------------------------------ // @@ -643,7 +610,7 @@ template struct predicates_check_tuple { template - static inline bool apply(TuplePredicates const& p, Value const& v, Indexable const& i) + static inline bool apply(TuplePredicates const& , Value const& , Indexable const& ) { return true; } @@ -745,12 +712,6 @@ struct predicates_is_nearest< nearest > static const unsigned value = 1; }; -template -struct predicates_is_nearest< nearest_one > -{ - static const unsigned value = 1; -}; - // predicates_count_nearest template diff --git a/include/boost/geometry/index/detail/rtree/adaptors.hpp b/include/boost/geometry/index/detail/rtree/adaptors.hpp index c9c160394..8874000ef 100644 --- a/include/boost/geometry/index/detail/rtree/adaptors.hpp +++ b/include/boost/geometry/index/detail/rtree/adaptors.hpp @@ -14,8 +14,6 @@ #include #include -#include -#include #include namespace boost { namespace geometry { namespace index { @@ -25,60 +23,6 @@ class rtree; namespace adaptors { namespace detail { -template -class spatial_query_range< index::rtree > -{ -public: - typedef std::vector result_type; - typedef typename result_type::iterator iterator; - typedef typename result_type::const_iterator const_iterator; - - template - inline spatial_query_range( - index::rtree const& rtree, - Predicates const& pred - ) - { - rtree.spatial_query(pred, std::back_inserter(m_result)); - } - - inline iterator begin() { return m_result.begin(); } - inline iterator end() { return m_result.end(); } - inline const_iterator begin() const { return m_result.begin(); } - inline const_iterator end() const { return m_result.end(); } - -private: - result_type m_result; -}; - -template -class nearest_query_range< index::rtree > -{ -public: - typedef std::vector result_type; - typedef typename result_type::iterator iterator; - typedef typename result_type::const_iterator const_iterator; - - template - inline nearest_query_range( - index::rtree const& rtree, - DistancesPredicates const& dpred, - size_t k, - Predicates const& pred - ) - { - rtree.nearest_query(dpred, k, pred, std::back_inserter(m_result)); - } - - inline iterator begin() { return m_result.begin(); } - inline iterator end() { return m_result.end(); } - inline const_iterator begin() const { return m_result.begin(); } - inline const_iterator end() const { return m_result.end(); } - -private: - result_type m_result; -}; - template class query_range< index::rtree > { diff --git a/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp b/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp index a5fabdc01..14b1be42a 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp @@ -207,7 +207,7 @@ void gl_draw(rtree const& tree, if ( !tree.empty() ) { glColor3f(0.75f, 0.75f, 0.75f); - detail::rtree::visitors::detail::gl_draw_indexable(tree.box(), 0); + detail::rtree::visitors::detail::gl_draw_indexable(tree.bounds(), 0); } detail::rtree::visitors::gl_draw diff --git a/include/boost/geometry/index/distance_predicates.hpp b/include/boost/geometry/index/distance_predicates.hpp index 890c5a2c6..142108eb5 100644 --- a/include/boost/geometry/index/distance_predicates.hpp +++ b/include/boost/geometry/index/distance_predicates.hpp @@ -14,7 +14,7 @@ #include /*! -\defgroup distance_predicates Distance predicates (boost::geometry::index::) +\defgroup nearest_relations Nearest relations (boost::geometry::index::) */ namespace boost { namespace geometry { namespace index { @@ -31,7 +31,7 @@ should be the distance to the nearest Indexable's point. This function may be al to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation. -\ingroup distance_predicates +\ingroup nearest_relations \tparam T Type of wrapped object. This may be a Point for PointRelation or CoordinateType for MinRelation or MaxRelation @@ -53,7 +53,7 @@ between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v. -\ingroup distance_predicates +\ingroup nearest_relations \tparam T Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation @@ -76,7 +76,7 @@ should be the distance to the furthest Indexable's point. This function may be a to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v. -\ingroup distance_predicates +\ingroup nearest_relations \tparam T Type of wrapped object. This may be a Point for PointRelation or some CoordinateType for MinRelation or MaxRelation @@ -106,12 +106,12 @@ by PointRelation. This is default nearest predicate. \param pr The point relation. This may be generated by \c index::to_nearest(), \c index::to_centroid() or \c index::to_furthest() with \c Point passed as a parameter. */ -template -inline detail::unbounded -unbounded(PointRelation const& pr) -{ - return detail::unbounded(pr); -} +//template +//inline detail::unbounded +//unbounded(PointRelation const& pr) +//{ +// return detail::unbounded(pr); +//} /*! \brief Generate min_bounded() distance predicate. @@ -132,12 +132,12 @@ Point but only if nearest points are further than some distance. \param minr The minimum bound relation. This may be generated by \c to_nearest(), \c to_centroid() or \c to_furthest() with distance value passed as a parameter. */ -template -inline detail::min_bounded -min_bounded(PointRelation const& pr, MinRelation const& minr) -{ - return detail::min_bounded(pr, minr); -} +//template +//inline detail::min_bounded +//min_bounded(PointRelation const& pr, MinRelation const& minr) +//{ +// return detail::min_bounded(pr, minr); +//} /*! \brief Generate max_bounded() distance predicate. @@ -158,12 +158,12 @@ Point but only if nearest points are closer than some distance. \param maxr The maximum bound relation. This may be generated by \c to_nearest(), \c to_centroid() or \c to_furthest() with distance value passed as a parameter. */ -template -inline detail::max_bounded -max_bounded(PointRelation const& pr, MaxRelation const& maxr) -{ - return detail::max_bounded(pr, maxr); -} +//template +//inline detail::max_bounded +//max_bounded(PointRelation const& pr, MaxRelation const& maxr) +//{ +// return detail::max_bounded(pr, maxr); +//} /*! \brief Generate bounded() distance predicate. @@ -188,12 +188,12 @@ points are further than some distance and closer than some other distance. \param maxr The maximum bound relation. This may be generated by \c to_nearest(), \c to_centroid() or \c to_furthest() with distance value passed as a parameter. */ -template -inline detail::bounded -bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& maxr) -{ - return detail::bounded(pr, minr, maxr); -} +//template +//inline detail::bounded +//bounded(PointRelation const& pr, MinRelation const& minr, MaxRelation const& maxr) +//{ +// return detail::bounded(pr, minr, maxr); +//} }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index db9650398..baba6f890 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -164,7 +164,7 @@ inline detail::value value(Fun const& fun) When nearest predicate is passed to the query, k-nearest neighbour search will be performed. -Distances predicates may be a \c Point. In this the case values closest to \c Point are returned. +The simplest way of defining the knn query is passing a \c Point to which \c Values must be closest. It is possible to define how distance between values and query Point is calculated. This is done by passing PointRelation. It can be generated by following functions: @@ -172,90 +172,26 @@ It can be generated by following functions: \li \c boost::geometry::index::to_centroid(), \li \c boost::geometry::index::to_furthest(). -It is possible to define distances bounds, for example that a distance must be between -min_distance and max_distance. This is done by passing DistancesPredicates which can be generated -by following functions: -\li \c boost::geometry::index::unbounded() - default, -\li \c boost::geometry::index::min_bounded(), -\li \c boost::geometry::index::max_bounded(), -\li \c boost::geometry::index::bounded(). - -MinRelation and MaxRelation describes bounds and can be generated by following functions: -\li \c boost::geometry::index::to_nearest(), -\li \c boost::geometry::index::to_centroid(), -\li \c boost::geometry::index::to_furthest(). - \par Example \verbatim tree.query(bgi::nearest(pt, 5), std::back_inserter(result)); tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); -tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20)), 5), std::back_inserter(result)); \endverbatim \warning Only one \c nearest() predicate may be used in a query. -This version may be used only in queries returning a set of values - using output iterator. \ingroup predicates -\param dpred The distance predicates. -\param k The maximum number of values to return. +\param point_relation The point or relation describing how the distance will be calculated. +\param k The maximum number of values to return. */ -template inline -detail::nearest -nearest(DistancePredicates const& dpred, unsigned k) +template inline +detail::nearest +nearest(PointOrRelation const& point_relation, unsigned k) { - return detail::nearest(dpred, k); -} - -/*! -\brief Generate nearest predicate. - -When nearest predicate is passed to the query, k-nearest neighbour search will be performed. - -Distances predicates may be a \c Point. In this the case value closest to \c Point is returned. - -It is possible to define how distance between value and query Point is calculated. This is done by passing PointRelation. -It can be generated by following functions: -\li \c boost::geometry::index::to_nearest() - default, -\li \c boost::geometry::index::to_centroid(), -\li \c boost::geometry::index::to_furthest(). - -It is possible to define distances bounds, for example that a distance must be between -min_distance and max_distance. This is done by passing DistancesPredicates which can be generated -by following functions: -\li \c boost::geometry::index::unbounded() - default, -\li \c boost::geometry::index::min_bounded(), -\li \c boost::geometry::index::max_bounded(), -\li \c boost::geometry::index::bounded(). - -MinRelation and MaxRelation describes bounds and can be generated by following functions: -\li \c boost::geometry::index::to_nearest(), -\li \c boost::geometry::index::to_centroid(), -\li \c boost::geometry::index::to_furthest(). - -\par Example -\verbatim -tree.query(bgi::nearest(pt), value); -tree.query(bgi::nearest(pt) && bgi::intersects(box), value); -tree.query(bgi::nearest(bgi::to_centroid(pt)) && bgi::within(box), value); -tree.query(bgi::nearest(bgi::bounded(pt, bgi::to_furthest(10), bgi::to_nearest(20))), value); -\endverbatim - -\warning -Only one \c nearest() predicate may be used in a query. -This version may be used only in queries returning one value. - -\ingroup predicates - -\param dpred The distance predicates. -*/ -template inline -detail::nearest_one -nearest(DistancePredicates const& dpred) -{ - return detail::nearest_one(dpred); + return detail::nearest(point_relation, k); } namespace detail { diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 2e00ec1c7..fc606a182 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -661,42 +661,46 @@ public: Nearest predicate - If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. - Passing the first one will result in returning k number of values, the second one will result in returning - only one, closest value. In both cases values will be returned to the output iterator. Only one nearest - predicate may be passed to the query. It may be generated by: + If the nearest predicate is passed a k-nearest neighbor search will be performed. This query will result + in returning k values to the output iterator. Only one nearest predicate may be passed to the query. + It may be generated by: \li \c boost::geometry::index::nearest(). Connecting predicates - A set of predicates may be generated by: - \li \c std::make_pair() - \li \c boost::make_tuple() - \li \c operator&&() + Predicates may be passed together connected with \c operator&&(). \par Example \verbatim - tree.query(box1, std::back_inserter(result)); - tree.query(std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); + // return elements intersecting box + tree.query(box, std::back_inserter(result)); + // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); + // return elements overlapping box and meeting my_fun value predicate tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); + // return 5 elements nearest to pt and elements are intersecting box tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); + // return 5 elements which centroids are nearest to pt and elements aren't within box + tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && !bgi::within(box), std::back_inserter(result)); \endverbatim + \par Throws + If Value copy constructor or copy assignment throws. + \warning Only one \c nearest() perdicate may be passed to the query. - + \param predicates Predicates. \param out_it The output iterator, e.g. generated by std::back_inserter(). \return The number of values found. - - \par Throws - If Value copy constructor or copy assignment throws. */ template size_type query(Predicates const& predicates, OutIter out_it) const { + if ( !m_root ) + return 0; + static const unsigned nearest_count = detail::predicates_count_nearest::value; static const bool is_nearest = 0 < nearest_count; BOOST_MPL_ASSERT_MSG((nearest_count <= 1), PASS_ONLY_ONE_NEAREST_PREDICATE, (Predicates)); @@ -704,365 +708,6 @@ public: return query_dispatch(predicates, out_it, boost::mpl::bool_()); } - /*! - \brief Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. - - This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. - The value will be returned only if all predicates are met. This query requires that one of the - predicates must be one-value \c nearest() predicate. - - Spatial predicates - - The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. - More spatial predicates may be generated by one of the functions listed below: - \li \c boost::geometry::index::covered_by(), - \li \c boost::geometry::index::disjoint(), - \li \c boost::geometry::index::intersects() - default, - \li \c boost::geometry::index::overlaps(), - \li \c boost::geometry::index::within(), - - It is possible to negate spatial predicates: - \li ! boost::geometry::index::covered_by(), - \li ! boost::geometry::index::disjoint(), - \li ! boost::geometry::index::intersects(), - \li ! boost::geometry::index::overlaps(), - \li ! boost::geometry::index::within() - - Value predicate - - This is a special kind of predicate which allows to pass a user-defined functor which checks - if Value should be returned by the query. It's generated by: - \li \c boost::geometry::index::value(). - - Nearest predicate - - This query requires that one of the predicates must be one-value \c nearest() predicate. - It may be generated by \c nearest() taking only one parameter - distance predicates. - \li \c boost::geometry::index::nearest(). - - Connecting predicates - - A set of predicates may be generated by: - \li \c std::make_pair() - \li \c boost::make_tuple() - \li \c operator&&() - - \par Example - \verbatim - tree.query(std::make_pair(bgi::nearest(pt), bgi::within(box)), value); - tree.query(bgi::nearest(pt) && bgi::intersects(poly), value); - \endverbatim - - \warning - This query requires that one of the predicates must be one-value \c nearest() predicate. - - \param predicates Predicates. - \param value The reference to value which will hold the result of the query. - - \return The number of values found (1 if value was found, 0 otherwise). - - \par Throws - If Value copy constructor or copy assignment throws. - */ - template - size_type query(Predicates const& predicates, value_type & value) const - { - static const unsigned nearest_count = detail::predicates_count_nearest::value; - BOOST_MPL_ASSERT_MSG((nearest_count == 1), PASS_ONE_VALUE_NEAREST_PREDICATE_TO_GET_VALUE_AS_RESULT, (Predicates)); - - return query_dispatch(predicates, value, boost::mpl::bool_()); - } - -private: - - template - size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const - { - return spatial_query(predicates, out_it); - } - - template - size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const - { - static const unsigned nearest_index = detail::predicates_find_nearest::value; - static const bool is_one = detail::predicates_element::type::is_one; - - return query_dispatch_nearest(predicates, out_it, boost::mpl::bool_()); - } - - template - size_type query_dispatch(Predicates const& predicates, value_type & v, boost::mpl::bool_ const& /*is_nearest*/) const - { - static const unsigned nearest_index = detail::predicates_find_nearest::value; - static const bool is_one = detail::predicates_element::type::is_one; - BOOST_MPL_ASSERT_MSG((is_one == 1), PASS_ONE_VALUE_NEAREST_PREDICATE_TO_GET_VALUE_AS_RESULT, (Predicates)); - - typedef detail::predicates_element element_access; - typename element_access::type const& nearest_pred = element_access::get(predicates); - - return this->raw_nearest_one(nearest_pred.distance_predicates, predicates, v); - } - - template - size_type query_dispatch_nearest(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_one*/) const - { - static const unsigned nearest_index = detail::predicates_find_nearest::value; - typedef detail::predicates_element element_access; - typename element_access::type const& nearest_pred = element_access::get(predicates); - return this->raw_nearest_k(nearest_pred.distance_predicates, nearest_pred.count, predicates, out_it); - } - - template - size_type query_dispatch_nearest(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_one*/) const - { - static const unsigned nearest_index = detail::predicates_find_nearest::value; - typedef detail::predicates_element element_access; - typename element_access::type const& nearest_pred = element_access::get(predicates); - return this->raw_nearest_k(nearest_pred.distance_predicates, 1, predicates, out_it); - } - -public: - - /*! - \brief Finds values meeting spatial predicates, e.g. intersecting some Box. - - Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. - - It may be generated by one of the functions listed below: - \li \c boost::geometry::index::covered_by(), - \li \c boost::geometry::index::disjoint(), - \li \c boost::geometry::index::intersects() - default, - \li \c boost::geometry::index::overlaps(), - \li \c boost::geometry::index::within(), - \li ! boost::geometry::index::covered_by(), - \li ! boost::geometry::index::disjoint(), - \li ! boost::geometry::index::intersects(), - \li ! boost::geometry::index::overlaps(), - \li ! boost::geometry::index::within() - \li \c boost::geometry::index::value(). - - Those predicates may be passed together in - \c std::pair or \c boost::tuple. - - \param pred The spatial predicates or a Geometry. - \param out_it The output iterator of the result range. E.g. an iterator generated by - std::back_inserter(container) - - \return The number of values found. - - \par Throws - \li If Value copy constructor or copy assignment throws. - \li If OutIter dereference or increment throws. - */ - template 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); - - detail::rtree::apply_visitor(find_v, *m_root); - - return find_v.found_count; - } - - /*! - \brief Finds one value meeting distances predicates, e.g. nearest to some Point. - - Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. - - It is possible to define how distance to Value is calculated. This is done by passing PointRelation. - It can be generated by following functions: - \li \c boost::geometry::index::to_nearest() - default, - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - It is possible to define define distances bounds, for example that some distance must be between - min_distance and max_distance. This is done by passing DistancesPredicates which can be generated - by following functions: - \li \c boost::geometry::index::unbounded() - default, - \li \c boost::geometry::index::min_bounded(), - \li \c boost::geometry::index::max_bounded(), - \li \c boost::geometry::index::bounded(). - - MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li \c boost::geometry::index::to_nearest(), - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - \param dpred The distances predicates or a Point. - - \param v The reference to the object which will contain the result. - - \return The number of values found. - - \par Throws - If Value copy constructor or copy assignment throws. - */ - template - inline size_type nearest_query(DistancesPredicates const& dpred, value_type & v) const - { - return raw_nearest_one(dpred, detail::empty(), v); - } - - /*! - \brief Finds one value meeting distances predicates and spatial predicates, - e.g. nearest to some Point and intersecting some Box. - - Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. - - It is possible to define how distance to Value is calculated. This is done by passing PointRelation. - It can be generated by following functions: - \li \c boost::geometry::index::to_nearest() - default, - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - It is possible to define define distances bounds, for example that some distance must be between - min_distance and max_distance. This is done by passing DistancesPredicates which can be generated - by following functions: - \li \c boost::geometry::index::unbounded() - default, - \li \c boost::geometry::index::min_bounded(), - \li \c boost::geometry::index::max_bounded(), - \li \c boost::geometry::index::bounded(). - - MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li \c boost::geometry::index::to_nearest(), - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. - - It may be generated by one of the functions listed below: - \li \c boost::geometry::index::covered_by(), - \li \c boost::geometry::index::disjoint(), - \li \c boost::geometry::index::intersects() - default, - \li \c boost::geometry::index::overlaps(), - \li \c boost::geometry::index::within(), - \li ! boost::geometry::index::covered_by(), - \li ! boost::geometry::index::disjoint(), - \li ! boost::geometry::index::intersects(), - \li ! boost::geometry::index::overlaps(), - \li ! boost::geometry::index::within() - \li \c boost::geometry::index::value(). - - Those predicates may be passed together in - \c std::pair or \c boost::tuple. - - \param dpred The distances predicates or a Point. - \param pred The spatial predicates or a Geometry - \param v The reference to the object which will contain the result. - - \return The number of values found. - - \par Throws - If Value copy constructor or copy assignment throws. - */ - template - inline size_type nearest_query(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const - { - return raw_nearest_one(dpred, pred, v); - } - - /*! - \brief Finds k values meeting distances predicates, e.g. k nearest values to some Point. - - Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. - - It is possible to define how distance to Value is calculated. This is done by passing PointRelation. - It can be generated by following functions: - \li \c boost::geometry::index::to_nearest() - default, - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - It is possible to define define distances bounds, for example that some distance must be between - min_distance and max_distance. This is done by passing DistancesPredicates which can be generated - by following functions: - \li \c boost::geometry::index::unbounded() - default, - \li \c boost::geometry::index::min_bounded(), - \li \c boost::geometry::index::max_bounded(), - \li \c boost::geometry::index::bounded(). - - MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li \c boost::geometry::index::to_nearest(), - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - \param dpred The distances predicates or a Point. - \param k The max number of values. - \param out_it The output iterator of the result range. E.g. a back_insert_iterator. - - \return The number of values found. - - \par Throws - If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. - */ - template - inline size_type nearest_query(DistancesPredicates const& dpred, size_type k, OutIter out_it) const - { - return raw_nearest_k(dpred, k, detail::empty(), out_it); - } - - /*! - \brief Finds k values meeting distances predicates and spatial predicates, - e.g. k nearest values to some Point and intersecting some Box. - - Distances predicates may be a \c Point. In this the case the Value closest to \c Point is returned. - - It is possible to define how distance to Value is calculated. This is done by passing PointRelation. - It can be generated by following functions: - \li \c boost::geometry::index::to_nearest() - default, - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - It is possible to define define distances bounds, for example that some distance must be between - min_distance and max_distance. This is done by passing DistancesPredicates which can be generated - by following functions: - \li \c boost::geometry::index::unbounded() - default, - \li \c boost::geometry::index::min_bounded(), - \li \c boost::geometry::index::max_bounded(), - \li \c boost::geometry::index::bounded(). - - MinRelation and MaxRelation describes bounds and can be generated by following functions: - \li \c boost::geometry::index::to_nearest(), - \li \c boost::geometry::index::to_centroid(), - \li \c boost::geometry::index::to_furthest(). - - Spatial predicates may be a \c Geometry. In this case Values intersecting the \c Geometry are returned. - - It may be generated by one of the functions listed below: - \li \c boost::geometry::index::covered_by(), - \li \c boost::geometry::index::disjoint(), - \li \c boost::geometry::index::intersects() - default, - \li \c boost::geometry::index::overlaps(), - \li \c boost::geometry::index::within(), - \li ! boost::geometry::index::covered_by(), - \li ! boost::geometry::index::disjoint(), - \li ! boost::geometry::index::intersects(), - \li ! boost::geometry::index::overlaps(), - \li ! boost::geometry::index::within() - \li \c boost::geometry::index::value(). - - Those predicates may be passed together in - \c std::pair or \c boost::tuple. - - \param dpred The distances predicates or a Point - \param k The max number of values. - \param pred The spatial predicates or a Geometry. - \param out_it The output iterator of the result range. E.g. a back_insert_iterator. - - \return The number of values found. - - \par Throws - If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws. - */ - template - inline size_type nearest_query(DistancesPredicates const& dpred, size_type k, Predicates const& pred, OutIter out_it) const - { - return raw_nearest_k(dpred, k, pred, out_it); - } - /*! \brief Returns the number of stored values. @@ -1377,42 +1022,36 @@ private: } /*! - \brief Find one value meeting distances and spatial predicates. + \brief Return values meeting predicates. \par Exception-safety strong */ - template - inline size_type raw_nearest_one(DistancesPredicates const& dpred, Predicates const& pred, value_type & v) const + template + size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const { - if ( !m_root ) - return 0; + detail::rtree::visitors::spatial_query + find_v(m_translator, predicates, out_it); - typedef typename detail::point_relation::type point_relation; - typedef typename detail::relation::value_type point_type; + detail::rtree::apply_visitor(find_v, *m_root); - typedef detail::rtree::visitors::nearest_query_result_one< - value_type, - translator_type, - point_type - > result_type; + return find_v.found_count; + } - result_type result(v); + /*! + \brief Perform nearest neighbour search. + . + \par Exception-safety + strong + */ + template + size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const + { + static const unsigned nearest_index = detail::predicates_find_nearest::value; + typedef detail::predicates_element element_access; + typename element_access::type const& nearest_pred = element_access::get(predicates); - detail::rtree::visitors::nearest_query< - value_type, - options_type, - translator_type, - box_type, - allocators_type, - DistancesPredicates, - Predicates, - result_type - > nearest_v(m_parameters, m_translator, dpred, pred, result); - - detail::rtree::apply_visitor(nearest_v, *m_root); - - return result.finish(); + return raw_nearest_k(nearest_pred.distance_predicates, nearest_pred.count, predicates, out_it); } /*! @@ -1424,9 +1063,6 @@ 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; @@ -1616,41 +1252,42 @@ if Value should be returned by the query. It's generated by: Nearest predicate -If the nearest predicate is passed a k-nearest neighbor search will be performed. It has two variants. -Passing the first one will result in returning k number of values, the second one will result in returning -only one, closest value. In both cases values will be returned to the output iterator. Only one nearest -predicate may be passed to the query. It may be generated by: +If the nearest predicate is passed a k-nearest neighbor search will be performed. This query will result +in returning k values to the output iterator. Only one nearest predicate may be passed to the query. +It may be generated by: \li \c boost::geometry::index::nearest(). Connecting predicates -A set of predicates may be generated by: -\li \c std::make_pair() -\li \c boost::make_tuple() -\li \c operator&&() +Predicates may be passed together connected with \c operator&&(). \par Example \verbatim -bgi::query(tree, box1, std::back_inserter(result)); -bgi::query(tree, std::make_pair(bgi::intersects(poly), !bgi::within(box)), std::back_inserter(result)); +// return elements intersecting box +bgi::query(tree, box, std::back_inserter(result)); +// return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); +// return elements overlapping box and meeting my_fun value predicate bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +// return 5 elements nearest to pt and elements are intersecting box bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +// return 5 elements which centroids are nearest to pt and elements aren't within box +bgi::query(tree, bgi::nearest(bgi::to_centroid(pt), 5) && !bgi::within(box), std::back_inserter(result)); \endverbatim +\par Throws +If Value copy constructor or copy assignment throws. + \warning Only one \c nearest() perdicate may be passed to the query. \ingroup rtree_functions -\param tree The spatial index. +\param predicates The rtree. \param predicates Predicates. \param out_it The output iterator, e.g. generated by std::back_inserter(). \return The number of values found. - -\par Throws -If Value copy constructor or copy assignment throws. */ template inline typename rtree::size_type @@ -1661,177 +1298,6 @@ query(rtree const& tree, return tree.query(predicates, out_it); } -/*! -\brief Finds value meeting passed predicates e.g. nearest to some Point and intersecting some Box. - -This query function performs k-nearest neighbor searches. It allows to pass a set of predicates. -The value will be returned only if all predicates are met. This query requires that one of the -predicates must be one-value \c nearest() predicate. - -Spatial predicates - -The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. -More spatial predicates may be generated by one of the functions listed below: -\li \c boost::geometry::index::covered_by(), -\li \c boost::geometry::index::disjoint(), -\li \c boost::geometry::index::intersects() - default, -\li \c boost::geometry::index::overlaps(), -\li \c boost::geometry::index::within(), - -It is possible to negate spatial predicates: -\li ! boost::geometry::index::covered_by(), -\li ! boost::geometry::index::disjoint(), -\li ! boost::geometry::index::intersects(), -\li ! boost::geometry::index::overlaps(), -\li ! boost::geometry::index::within() - -Value predicate - -This is a special kind of predicate which allows to pass a user-defined functor which checks -if Value should be returned by the query. It's generated by: -\li \c boost::geometry::index::value(). - -Nearest predicate - -This query requires that one of the predicates must be one-value \c nearest() predicate. -It may be generated by \c nearest() taking only one parameter - distance predicates. -\li \c boost::geometry::index::nearest(). - -Connecting predicates - -A set of predicates may be generated by: -\li \c std::make_pair() -\li \c boost::make_tuple() -\li \c operator&&() - -\par Example -\verbatim -bgi::query(tree, std::make_pair(bgi::nearest(pt), bgi::within(box)), value); -bgi::query(tree, bgi::nearest(pt) && bgi::intersects(poly), value); -\endverbatim - -\warning -This query requires that one of the predicates must be one-value \c nearest() predicate. - -\ingroup rtree_functions - -\param tree The spatial index. -\param predicates Predicates. -\param value The reference to value which will hold the result of the query. - -\return The number of values found (1 if value was found, 0 otherwise). - -\par Throws -If Value copy constructor or copy assignment throws. -*/ -template inline -typename rtree::size_type -query(rtree const& tree, - Predicates const& predicates, - typename rtree::value_type & value) -{ - return tree.query(predicates, value); -} - -/*! -\brief Find values meeting spatial predicates. - -It calls \c rtree::spatial_query with parameters (Predicates const&, OutIter). - -\ingroup rtree_functions - -\param tree The spatial index. -\param pred The spatial predicates. -\param out_it The output iterator of the result range. - -\return The number of found values. -*/ -template -inline size_t spatial_query(rtree const& tree, Predicates const& pred, OutIter out_it) -{ - return tree.spatial_query(pred, out_it); -} - -/*! -\brief Find the value meeting distances predicates. - -It calls \c rtree::nearest_query with parameters (DistancesPredicates const& dpred, value_type & v). - -\ingroup rtree_functions - -\param tree The spatial index. -\param dpred The distances predicates. -\param v The result. - -\return The number of found values. -*/ -template -inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, Value & v) -{ - return tree.nearest_query(dpred, v); -} - -/*! -\brief Find the value meeting distances and spatial predicates. - -It calls \c rtree::nearest_query with parameters (DistancesPredicates const& dpred, Predicates const& pred, value_type & v). - -\ingroup rtree_functions - -\param tree The spatial index. -\param dpred The distances predicates. -\param pred The spatial predicates. -\param v The result. - -\return The number of found values. -*/ -template -inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, Predicates const& pred, Value & v) -{ - return tree.nearest_query(dpred, pred, v); -} - -/*! -\brief Find k values meeting distances predicates. - -It calls \c rtree::nearest_query with parameters (DistancesPredicates const & dpred, size_type k, OutIter out_it). - -\ingroup rtree_functions - -\param tree The spatial index. -\param dpred The distances predicates. -\param k The max number of values. -\param out_it The output iterator of the result range. - -\return The number of found values. -*/ -template -inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, typename rtree::size_type k, OutIter out_it) -{ - return tree.nearest_query(dpred, k, out_it); -} - -/*! -\brief Find k values meeting distances and spatial predicates. - -It calls \c rtree::nearest_query with parameters (DistancesPredicates const & dpred, size_type k, Predicates const & pred, OutIter out_it). - -\ingroup rtree_functions - -\param tree The spatial index. -\param dpred The distances predicates. -\param k The max number of values. -\param pred The spatial predicates. -\param out_it The output iterator of the result range. - -\return The number of found values. -*/ -template -inline size_t nearest_query(rtree const& tree, DistancesPredicates const& dpred, typename rtree::size_type k, Predicates const& pred, OutIter out_it) -{ - return tree.nearest_query(dpred, k, pred, out_it); -} - /*! \brief Remove all values from the index. diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f1bab92bd..f54509c5b 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -21,7 +21,7 @@ project boost-geometry-index-test test-suite boost-geometry-index : - [ run static_vector.cpp ] + [ run varray.cpp ] ; build-project algorithms ; diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 10a7a662c..f48a5d0a6 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -552,24 +552,18 @@ void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector output; - size_t n = rtree.spatial_query(pred, std::back_inserter(output)); + size_t n = rtree.query(pred, std::back_inserter(output)); BOOST_CHECK( expected_output.size() == n ); test_compare_outputs(rtree, output, expected_output); std::vector output2; - size_t n2 = spatial_query(rtree, pred, std::back_inserter(output2)); + size_t n2 = query(rtree, pred, std::back_inserter(output2)); BOOST_CHECK( n == n2 ); test_exactly_the_same_outputs(rtree, output, output2); - std::vector output3; - size_t n3 = rtree.query(pred, std::back_inserter(output3)); - - BOOST_CHECK( n == n3 ); - test_exactly_the_same_outputs(rtree, output, output3); - - test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::spatial_queried(pred)); + test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(pred)); } // rtree specific queries tests @@ -741,53 +735,6 @@ void test_within(bgi::rtree const& tree, std::vector const& // rtree nearest queries -template -void test_nearest_query(Rtree const& rtree, std::vector const& input, Point const& pt) -{ - // TODO: Nearest object may not be the same as found by the rtree if distances are equal - // Should all objects with the same closest distance be picked? - - typedef typename bg::default_distance_result::type D; - D smallest_d = (std::numeric_limits::max)(); - Value expected_output(generate_value_default::apply()); - BOOST_FOREACH(Value const& v, input) - { - D d = bgi::detail::comparable_distance_near(pt, rtree.translator()(v)); - if ( d < smallest_d ) - { - smallest_d = d; - expected_output = v; - } - } - size_t n = ( (std::numeric_limits::max)() == smallest_d ) ? 0 : 1; - - Value output(generate_value_default::apply()); - size_t n_res = rtree.nearest_query(pt, output); - - BOOST_CHECK(n == n_res); - if ( n == n_res && 0 < n ) - { - // TODO - perform explicit check here? - // should all objects which are closest be checked and should exactly the same be found? - - if ( !rtree.translator().equals(output, expected_output) ) - { - D d1 = bgi::detail::comparable_distance_near(pt, rtree.translator()(output)); - D d2 = bgi::detail::comparable_distance_near(pt, rtree.translator()(expected_output)); - BOOST_CHECK(d1 == d2); - } - } - - Value output2(generate_value_default::apply()); - size_t n_res2 = rtree.query(bgi::nearest(pt), output2); - - BOOST_CHECK(n == n_res2); - if ( 0 < n_res2 ) - { - BOOST_CHECK(rtree.translator().equals(output, output2)); - } -} - template struct TestNearestKLess { @@ -849,7 +796,7 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P // calculate output using rtree std::vector output; - rtree.nearest_query(pt, k, std::back_inserter(output)); + rtree.query(bgi::nearest(pt, k), std::back_inserter(output)); // check output bool are_sizes_ok = (expected_output.size() == output.size()); @@ -869,33 +816,30 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P } } - test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::nearest_queried(pt, k)); + test_exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(bgi::nearest(pt, k))); std::vector output2(k, generate_value_default::apply()); - size_t found_count = rtree.nearest_query(pt, k, output2.begin()); + size_t found_count = rtree.query(bgi::nearest(pt, k), output2.begin()); output2.resize(found_count, generate_value_default::apply()); test_exactly_the_same_outputs(rtree, output, output2); - - std::vector output3(k, generate_value_default::apply()); - found_count = rtree.query(bgi::nearest(pt, k), output3.begin()); - output3.resize(found_count, generate_value_default::apply()); - - test_exactly_the_same_outputs(rtree, output, output3); } // rtree nearest not found -template -void test_nearest_query_not_found(Rtree const& rtree, Point const& pt, CoordinateType max_distance_1, CoordinateType max_distance_k) +struct AlwaysFalse +{ + template + bool operator()(Value const& v) const { return false; } +}; + +template +void test_nearest_query_not_found(Rtree const& rtree, Point const& pt) { typedef typename Rtree::value_type Value; - Value output(generate_value_default::apply()); - size_t n_res = rtree.nearest_query(bgi::max_bounded(pt, max_distance_1), output); - BOOST_CHECK(0 == n_res); std::vector output_v; - n_res = rtree.nearest_query(bgi::max_bounded(pt, max_distance_k), 5, std::back_inserter(output_v)); + size_t n_res = rtree.query(bgi::nearest(pt, 5) && bgi::value(AlwaysFalse()), std::back_inserter(output_v)); BOOST_CHECK(output_v.size() == n_res); BOOST_CHECK(n_res < 5); } @@ -908,7 +852,7 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con size_t s = tree.size(); std::vector expected_output; - tree.spatial_query(qbox, std::back_inserter(expected_output)); + tree.query(qbox, std::back_inserter(expected_output)); // copy constructor bgi::rtree t1(tree); @@ -917,7 +861,7 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con BOOST_CHECK(tree.size() == t1.size()); std::vector output; - t1.spatial_query(qbox, std::back_inserter(output)); + t1.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); // copying assignment operator @@ -927,7 +871,7 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con BOOST_CHECK(tree.size() == t1.size()); output.clear(); - t1.spatial_query(qbox, std::back_inserter(output)); + t1.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); bgi::rtree t2(tree.parameters()); @@ -938,11 +882,11 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con BOOST_CHECK(0 == t1.size()); output.clear(); - t1.spatial_query(qbox, std::back_inserter(output)); + t1.query(qbox, std::back_inserter(output)); BOOST_CHECK(output.empty()); output.clear(); - t2.spatial_query(qbox, std::back_inserter(output)); + t2.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t2, output, expected_output); t2.swap(t1); @@ -953,7 +897,7 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con BOOST_CHECK(t1.size() == 0); output.clear(); - t3.spatial_query(qbox, std::back_inserter(output)); + t3.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t3, output, expected_output); // moving assignment operator @@ -963,7 +907,7 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con BOOST_CHECK(t3.size() == 0); output.clear(); - t1.spatial_query(qbox, std::back_inserter(output)); + t1.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); //TODO - test SWAP @@ -977,7 +921,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const typedef bgi::rtree T; std::vector expected_output; - tree.spatial_query(qbox, std::back_inserter(expected_output)); + tree.query(qbox, std::back_inserter(expected_output)); { T t(tree.parameters()); @@ -985,7 +929,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const t.insert(v); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.spatial_query(qbox, std::back_inserter(output)); + t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -993,21 +937,21 @@ void test_create_insert(bgi::rtree & tree, std::vector const std::copy(input.begin(), input.end(), bgi::inserter(t)); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.spatial_query(qbox, std::back_inserter(output)); + t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { T t(input.begin(), input.end(), tree.parameters()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.spatial_query(qbox, std::back_inserter(output)); + t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { T t(input, tree.parameters()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.spatial_query(qbox, std::back_inserter(output)); + t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1015,7 +959,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const t.insert(input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.spatial_query(qbox, std::back_inserter(output)); + t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1023,7 +967,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const t.insert(input); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.spatial_query(qbox, std::back_inserter(output)); + t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } @@ -1033,7 +977,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const bgi::insert(t, v); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::spatial_query(t, qbox, std::back_inserter(output)); + bgi::query(t, qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1041,7 +985,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const bgi::insert(t, input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::spatial_query(t, qbox, std::back_inserter(output)); + bgi::query(t, qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1049,7 +993,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const bgi::insert(t, input); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::spatial_query(t, qbox, std::back_inserter(output)); + bgi::query(t, qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } } @@ -1062,11 +1006,11 @@ void test_remove(bgi::rtree & tree, Box const& qbox) typedef bgi::rtree T; std::vector values_to_remove; - tree.spatial_query(qbox, std::back_inserter(values_to_remove)); + tree.query(qbox, std::back_inserter(values_to_remove)); BOOST_CHECK(0 < values_to_remove.size()); std::vector expected_output; - tree.spatial_query(bgi::disjoint(qbox), std::back_inserter(expected_output)); + tree.query(bgi::disjoint(qbox), std::back_inserter(expected_output)); size_t expected_removed_count = values_to_remove.size(); size_t expected_size_after_remove = tree.size() - values_to_remove.size(); @@ -1081,7 +1025,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) r += t.remove(v); BOOST_CHECK( r == expected_removed_count ); std::vector output; - t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); + t.query(bgi::disjoint(qbox), std::back_inserter(output)); BOOST_CHECK( t.size() == expected_size_after_remove ); BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); @@ -1091,7 +1035,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) size_t r = t.remove(values_to_remove.begin(), values_to_remove.end()); BOOST_CHECK( r == expected_removed_count ); std::vector output; - t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); + t.query(bgi::disjoint(qbox), std::back_inserter(output)); BOOST_CHECK( t.size() == expected_size_after_remove ); BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); @@ -1101,7 +1045,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) size_t r = t.remove(values_to_remove); BOOST_CHECK( r == expected_removed_count ); std::vector output; - t.spatial_query(bgi::disjoint(qbox), std::back_inserter(output)); + t.query(bgi::disjoint(qbox), std::back_inserter(output)); BOOST_CHECK( t.size() == expected_size_after_remove ); BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); @@ -1114,7 +1058,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) r += bgi::remove(t, v); BOOST_CHECK( r == expected_removed_count ); std::vector output; - bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); + bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output)); BOOST_CHECK( t.size() == expected_size_after_remove ); BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); @@ -1124,7 +1068,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) size_t r = bgi::remove(t, values_to_remove.begin(), values_to_remove.end()); BOOST_CHECK( r == expected_removed_count ); std::vector output; - bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); + bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output)); BOOST_CHECK( t.size() == expected_size_after_remove ); BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); @@ -1134,7 +1078,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) size_t r = bgi::remove(t, values_to_remove); BOOST_CHECK( r == expected_removed_count ); std::vector output; - bgi::spatial_query(t, bgi::disjoint(qbox), std::back_inserter(output)); + bgi::query(t, bgi::disjoint(qbox), std::back_inserter(output)); BOOST_CHECK( t.size() == expected_size_after_remove ); BOOST_CHECK( output.size() == tree.size() - expected_removed_count ); test_compare_outputs(t, output, expected_output); @@ -1147,7 +1091,7 @@ void test_clear(bgi::rtree & tree, std::vector const& input, typedef bgi::rtree T; std::vector values_to_remove; - tree.spatial_query(qbox, std::back_inserter(values_to_remove)); + tree.query(qbox, std::back_inserter(values_to_remove)); BOOST_CHECK(0 < values_to_remove.size()); //clear @@ -1155,7 +1099,7 @@ void test_clear(bgi::rtree & tree, std::vector const& input, T t(tree); std::vector expected_output; - t.spatial_query(bgi::intersects(qbox), std::back_inserter(expected_output)); + t.query(bgi::intersects(qbox), std::back_inserter(expected_output)); size_t s = t.size(); t.clear(); BOOST_CHECK(t.empty()); @@ -1163,7 +1107,7 @@ void test_clear(bgi::rtree & tree, std::vector const& input, t.insert(input); BOOST_CHECK(t.size() == s); std::vector output; - t.spatial_query(bgi::intersects(qbox), std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } } @@ -1196,9 +1140,8 @@ void test_rtree_by_value(Parameters const& parameters) P pt; bg::centroid(qbox, pt); - test_nearest_query(tree, input, pt); test_nearest_query_k(tree, input, pt, 10); - test_nearest_query_not_found(tree, generate_outside_point

    ::apply(), 1, 3); + test_nearest_query_not_found(tree, generate_outside_point

    ::apply()); test_copy_assignment_swap_move(tree, qbox); @@ -1217,9 +1160,8 @@ void test_rtree_by_value(Parameters const& parameters) 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_nearest_query_not_found(empty_tree, generate_outside_point

    ::apply()); test_copy_assignment_swap_move(empty_tree, qbox); } @@ -1243,7 +1185,7 @@ void test_count_rtree_values(Parameters const& parameters) BOOST_CHECK(t.size() + rest_count == Value::counter()); std::vector values_to_remove; - t.spatial_query(qbox, std::back_inserter(values_to_remove)); + t.query(qbox, std::back_inserter(values_to_remove)); rest_count += values_to_remove.size(); diff --git a/test/static_vector.cpp b/test/varray.cpp similarity index 92% rename from test/static_vector.cpp rename to test/varray.cpp index 03ea50e0e..37840f96f 100644 --- a/test/static_vector.cpp +++ b/test/varray.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include using namespace boost::geometry::index::detail; @@ -65,7 +65,7 @@ private: template void test_ctor_ndc() { - static_vector s; + varray s; BOOST_CHECK(s.size() == 0); BOOST_CHECK(s.capacity() == N); BOOST_CHECK_THROW( s.at(0), std::out_of_range ); @@ -74,7 +74,7 @@ void test_ctor_ndc() template void test_ctor_nc(size_t n) { - static_vector s(n); + varray s(n); BOOST_CHECK(s.size() == n); BOOST_CHECK(s.capacity() == N); BOOST_CHECK_THROW( s.at(n), std::out_of_range ); @@ -88,7 +88,7 @@ void test_ctor_nc(size_t n) template void test_ctor_nd(size_t n, T const& v) { - static_vector s(n, v); + varray s(n, v); BOOST_CHECK(s.size() == n); BOOST_CHECK(s.capacity() == N); BOOST_CHECK_THROW( s.at(n), std::out_of_range ); @@ -110,7 +110,7 @@ void test_ctor_nd(size_t n, T const& v) template void test_resize_nc(size_t n) { - static_vector s; + varray s; s.resize(n); BOOST_CHECK(s.size() == n); @@ -127,7 +127,7 @@ void test_resize_nc(size_t n) template void test_resize_nd(size_t n, T const& v) { - static_vector s; + varray s; s.resize(n, v); BOOST_CHECK(s.size() == n); @@ -151,7 +151,7 @@ void test_resize_nd(size_t n, T const& v) template void test_push_back_nd() { - static_vector s; + varray s; BOOST_CHECK(s.size() == 0); BOOST_CHECK_THROW( s.at(0), std::out_of_range ); @@ -171,7 +171,7 @@ void test_push_back_nd() template void test_pop_back_nd() { - static_vector s; + varray s; for ( size_t i = 0 ; i < N ; ++i ) s.push_back(T(i)); @@ -199,7 +199,7 @@ void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2) template void test_copy_and_assign_nd(T const& val) { - static_vector s; + varray s; std::vector v; std::list l; @@ -211,13 +211,13 @@ void test_copy_and_assign_nd(T const& val) } // copy ctor { - static_vector s1(s); + varray s1(s); BOOST_CHECK(s.size() == s1.size()); test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); } // copy assignment { - static_vector s1; + varray s1; BOOST_CHECK(0 == s1.size()); s1 = s; BOOST_CHECK(s.size() == s1.size()); @@ -225,37 +225,37 @@ void test_copy_and_assign_nd(T const& val) } // ctor(Iter, Iter) { - static_vector s1(s.begin(), s.end()); + varray s1(s.begin(), s.end()); BOOST_CHECK(s.size() == s1.size()); test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); } { - static_vector s1(v.begin(), v.end()); + varray s1(v.begin(), v.end()); BOOST_CHECK(v.size() == s1.size()); test_compare_ranges(v.begin(), v.end(), s1.begin(), s1.end()); } { - static_vector s1(l.begin(), l.end()); + varray s1(l.begin(), l.end()); BOOST_CHECK(l.size() == s1.size()); test_compare_ranges(l.begin(), l.end(), s1.begin(), s1.end()); } // assign(Iter, Iter) { - static_vector s1; + varray s1; BOOST_CHECK(0 == s1.size()); s1.assign(s.begin(), s.end()); BOOST_CHECK(s.size() == s1.size()); test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); } { - static_vector s1; + varray s1; BOOST_CHECK(0 == s1.size()); s1.assign(v.begin(), v.end()); BOOST_CHECK(v.size() == s1.size()); test_compare_ranges(v.begin(), v.end(), s1.begin(), s1.end()); } { - static_vector s1; + varray s1; BOOST_CHECK(0 == s1.size()); s1.assign(l.begin(), l.end()); BOOST_CHECK(l.size() == s1.size()); @@ -263,7 +263,7 @@ void test_copy_and_assign_nd(T const& val) } // assign(N, V) { - static_vector s1(s); + varray s1(s); test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); std::vector a(N, val); s1.assign(N, val); @@ -274,7 +274,7 @@ void test_copy_and_assign_nd(T const& val) template void test_iterators_nd() { - static_vector s; + varray s; std::vector v; for ( size_t i = 0 ; i < N ; ++i ) @@ -295,7 +295,7 @@ void test_iterators_nd() template void test_erase_nd() { - static_vector s; + varray s; for ( size_t i = 0 ; i < N ; ++i ) s.push_back(T(i)); @@ -304,7 +304,7 @@ void test_erase_nd() { for ( size_t i = 0 ; i < N ; ++i ) { - static_vector s1(s); + varray s1(s); s1.erase(s1.begin() + i); BOOST_CHECK(s1.size() == N - 1); for ( size_t j = 0 ; j < i ; ++j ) @@ -318,7 +318,7 @@ void test_erase_nd() size_t n = N/3; for ( size_t i = 0 ; i <= N ; ++i ) { - static_vector s1(s); + varray s1(s); size_t removed = i + n < N ? n : N - i; s1.erase(s1.begin() + i, s1.begin() + i + removed); BOOST_CHECK(s1.size() == N - removed); @@ -335,7 +335,7 @@ void test_insert_nd(T const& val) { size_t h = N/2; - static_vector s, ss; + varray s, ss; std::vector v; std::list l; @@ -351,7 +351,7 @@ void test_insert_nd(T const& val) { for ( size_t i = 0 ; i <= h ; ++i ) { - static_vector s1(s); + varray s1(s); s1.insert(s1.begin() + i, val); BOOST_CHECK(s1.size() == h+1); for ( size_t j = 0 ; j < i ; ++j ) @@ -366,7 +366,7 @@ void test_insert_nd(T const& val) size_t n = size_t(h/1.5f); for ( size_t i = 0 ; i <= h ; ++i ) { - static_vector s1(s); + varray s1(s); s1.insert(s1.begin() + i, n, val); BOOST_CHECK(s1.size() == h+n); for ( size_t j = 0 ; j < i ; ++j ) @@ -382,7 +382,7 @@ void test_insert_nd(T const& val) size_t n = size_t(h/1.5f); for ( size_t i = 0 ; i <= h ; ++i ) { - static_vector s1(s); + varray s1(s); s1.insert(s1.begin() + i, ss.begin(), ss.begin() + n); BOOST_CHECK(s1.size() == h+n); for ( size_t j = 0 ; j < i ; ++j ) @@ -397,7 +397,7 @@ void test_insert_nd(T const& val) size_t n = size_t(h/1.5f); for ( size_t i = 0 ; i <= h ; ++i ) { - static_vector s1(s); + varray s1(s); s1.insert(s1.begin() + i, v.begin(), v.begin() + n); BOOST_CHECK(s1.size() == h+n); for ( size_t j = 0 ; j < i ; ++j ) @@ -412,7 +412,7 @@ void test_insert_nd(T const& val) size_t n = size_t(h/1.5f); for ( size_t i = 0 ; i <= h ; ++i ) { - static_vector s1(s); + varray s1(s); typename std::list::iterator it = l.begin(); std::advance(it, n); s1.insert(s1.begin() + i, l.begin(), it); diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 9ab8b195d..9f0bf2417 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -42,8 +42,6 @@ std::vector vect; size_t found_count = 0; P search_point; -float min_distance = 10; -float max_distance = 30; size_t count = 5; std::vector nearest_boxes; B search_box; @@ -64,13 +62,8 @@ void knn() search_point = P(x, y); nearest_boxes.clear(); - found_count = t.nearest_query( - bgi::bounded( - search_point, - bgi::to_furthest(min_distance), - bgi::to_nearest(max_distance) - ), - count, + found_count = t.query( + bgi::nearest(search_point, count), std::back_inserter(nearest_boxes) ); @@ -101,13 +94,13 @@ void query() search_box = B(P(x - w, y - h), P(x + w, y + h)); nearest_boxes.clear(); - found_count = t.spatial_query(Predicate(search_box), std::back_inserter(nearest_boxes) ); + found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) ); } else { - search_box = t.box(); + search_box = t.bounds(); nearest_boxes.clear(); - found_count = t.spatial_query(Predicate(search_box), std::back_inserter(nearest_boxes) ); + found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) ); } if ( found_count > 0 ) @@ -153,7 +146,7 @@ void query_ring() search_ring.push_back(P(x - w, y - h)); nearest_boxes.clear(); - found_count = t.spatial_query(Predicate(search_ring), std::back_inserter(nearest_boxes) ); + found_count = t.query(Predicate(search_ring), std::back_inserter(nearest_boxes) ); if ( found_count > 0 ) { @@ -209,7 +202,7 @@ void query_poly() search_poly.inners()[0].push_back(P(x - w/2, y - h/2)); nearest_boxes.clear(); - found_count = t.spatial_query(Predicate(search_poly), std::back_inserter(nearest_boxes) ); + found_count = t.query(Predicate(search_poly), std::back_inserter(nearest_boxes) ); if ( found_count > 0 ) { @@ -281,7 +274,7 @@ void query_multi_poly() search_multi_poly[2].outer().push_back(P(x + 6*w/5, y + 6*h/5)); nearest_boxes.clear(); - found_count = t.spatial_query(Predicate(search_multi_poly), std::back_inserter(nearest_boxes) ); + found_count = t.query(Predicate(search_multi_poly), std::back_inserter(nearest_boxes) ); if ( found_count > 0 ) { @@ -338,7 +331,7 @@ void search() search_valid = true; } -void draw_knn_area() +void draw_knn_area(float min_distance, float max_distance) { float x = boost::geometry::get<0>(search_point); float y = boost::geometry::get<1>(search_point); @@ -428,7 +421,7 @@ void render_scene(void) glColor3f(1.0f, 0.5f, 0.0f); if ( query_mode == qm_knn ) - draw_knn_area(); + draw_knn_area(0, 0); else if ( query_mode == qm_ri ) draw_ring(search_ring); else if ( query_mode == qm_pi ) diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp index 41bbc22c2..8e2185746 100644 --- a/tests/additional_sizes_and_times.cpp +++ b/tests/additional_sizes_and_times.cpp @@ -202,7 +202,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -229,7 +229,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t_copy.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t_copy.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -248,7 +248,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.spatial_query(!bgi::disjoint(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.query(!bgi::disjoint(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -266,7 +266,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.spatial_query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -284,11 +284,9 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.spatial_query( - std::make_pair( - B(P(x - 10, y - 10), P(x + 10, y + 10)), - bgi::value(test_pred< std::pair >()) - ), std::back_inserter(result)); + t.query( + B(P(x - 10, y - 10), P(x + 10, y + 10)) && bgi::value(test_pred< std::pair >()) + , std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -306,11 +304,9 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.spatial_query( - boost::make_tuple( - B(P(x - 10, y - 10), P(x + 10, y + 10)), - bgi::value(test_pred< std::pair >()) - ), std::back_inserter(result)); + t.query( + B(P(x - 10, y - 10), P(x + 10, y + 10)) && bgi::value(test_pred< std::pair >()) + , std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -345,23 +341,6 @@ int main() std::cout << "found: " << temp << "\n"; } - // searching test - { - std::cout << "nearest searching time test... (" - << queries_count / 10 << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 10 ; ++i ) - { - float x = coords[i].first + 100; - float y = coords[i].second + 100; - std::pair result; - temp += t.nearest_query(bgi::unbounded(P(x, y)), result); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - // searching test { std::cout << "nearest 5 searching time test... (" @@ -373,7 +352,7 @@ int main() float x = coords[i].first + 100; float y = coords[i].second + 100; std::vector< std::pair > result; - temp += t.nearest_query(P(x, y), 5, std::back_inserter(result)); + temp += t.query(bgi::nearest(P(x, y), 5), std::back_inserter(result)); } std::cout << "time: " << tim.elapsed() << "s\n"; std::cout << "found: " << temp << "\n"; @@ -449,7 +428,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; @@ -493,7 +472,7 @@ int main() float x = coords[i].first; float y = coords[i].second; std::deque< std::pair > result; - t.spatial_query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } std::cout << "time: " << tim.elapsed() << "s\n"; diff --git a/tests/additional_speed.cpp b/tests/additional_speed.cpp index 1d984d6d7..014ae3fbc 100644 --- a/tests/additional_speed.cpp +++ b/tests/additional_speed.cpp @@ -129,19 +129,6 @@ int main() result.clear(); - { - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 10 ; ++i ) - { - float x = coords[i].first + 100; - float y = coords[i].second + 100; - temp += t.query(bgi::nearest(P(x, y)), result_one); - } - double time = tim.elapsed(); - std::cout << time << "s - query(nearest(P)) " << (queries_count / 10) << " found " << temp << '\n'; - } - { tim.restart(); size_t temp = 0; @@ -156,28 +143,6 @@ int main() std::cout << time << "s - query(nearest(P, 5)) " << (queries_count / 10) << " found " << temp << '\n'; } - { - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 10 ; ++i ) - { - float x = coords[i].first + 100; - float y = coords[i].second + 100; - result.clear(); - temp += t.query(bgi::nearest( - bgi::bounded( - bgi::to_nearest(P(x, y)), - bgi::to_centroid(0), - bgi::to_furthest(100000) - ), - 5), - std::back_inserter(result) - ); - } - double time = tim.elapsed(); - std::cout << time << "s - query(nearest(bounded(n, c, f), 5)) " << (queries_count / 10) << " found " << temp << '\n'; - } - { tim.restart(); for (size_t i = 0 ; i < values_count / 10 ; ++i ) From eb78310bc798a1d84f2c6b065a359b06f6b4f213 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 12 Feb 2013 18:24:13 +0000 Subject: [PATCH 312/366] Added rtree_interprocess test (doesn't executed for now), error fixed in detail::varray [SVN r82837] --- .../boost/geometry/index/detail/varray.hpp | 4 +- test/rtree/Jamfile.v2 | 11 +++ test/rtree/rtree_interprocess.cpp | 84 +++++++++++++++++++ test/rtree/test_rtree.hpp | 55 ++++++------ 4 files changed, 123 insertions(+), 31 deletions(-) create mode 100644 test/rtree/rtree_interprocess.cpp diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index c08de73da..64bc47bde 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -798,12 +798,12 @@ private: pointer ptr() { - return pointer(m_storage.address()); + return pointer(static_cast(m_storage.address())); } const_pointer ptr() const { - return const_pointer(m_storage.address()); + return const_pointer(static_cast(m_storage.address())); } boost::aligned_storage::value> m_storage; diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index a99fd208d..7880902fd 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -13,3 +13,14 @@ test-suite boost-geometry-index-rtree [ run rtree_exceptions.cpp ] ; +#test-suite boost-geometry-index-rtree_interprocess +# : [ run rtree_interprocess.cpp /boost/thread//boost_thread +# : # additional args +# : # test-files +# : # requirements +# acc:-lrt +# acc-pa_risc:-lrt +# gcc-mingw:"-lole32 -loleaut32 -lpsapi -ladvapi32" +# hpux,gcc:"-Wl,+as,mpas" +# ] : multi +# ; \ No newline at end of file diff --git a/test/rtree/rtree_interprocess.cpp b/test/rtree/rtree_interprocess.cpp new file mode 100644 index 000000000..bb8c5d534 --- /dev/null +++ b/test/rtree/rtree_interprocess.cpp @@ -0,0 +1,84 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include +#include + +#include +#include + +template +void test_rtree_interprocess(Parameters const& parameters = Parameters()) +{ + namespace bi = boost::interprocess; + struct shm_remove + { + shm_remove() { bi::shared_memory_object::remove("shmem"); } + ~shm_remove(){ bi::shared_memory_object::remove("shmem"); } + } remover; + + bi::managed_shared_memory segment(bi::create_only, "shmem", 65535); + typedef bi::allocator shmem_alloc; + + typedef bgi::rtree, shmem_alloc> Tree; + + Tree * tree = segment.construct("Tree")(parameters, bgi::translator::def(), shmem_alloc(segment.get_segment_manager())); + typedef typename Tree::bounds_type B; + + std::vector input; + B qbox; + + generate_rtree(*tree, input, qbox); + + test_intersects(*tree, input, qbox); + test_disjoint(*tree, input, qbox); + test_covered_by(*tree, input, qbox); + test_overlaps(*tree, input, qbox); + //test_touches(*tree, input, qbox); + test_within(*tree, input, qbox); + + typedef typename bgi::detail::traits::point_type::type P; + P pt; + bg::centroid(qbox, pt); + + test_nearest_query_k(*tree, input, pt, 10); + test_nearest_query_not_found(*tree, generate_outside_point

    ::apply()); + + segment.destroy_ptr(tree); +} + +int test_main(int, char* []) +{ + typedef bg::model::point P2d; + typedef bg::model::box B2d; + typedef std::pair PB2d; + + test_rtree_interprocess(bgi::linear<32, 8>()); + /*test_rtree_interprocess(bgi::runtime::linear(32, 8)); + test_rtree_interprocess(bgi::quadratic<32, 8>()); + test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); + test_rtree_interprocess(bgi::rstar<32, 8>()); + test_rtree_interprocess(bgi::runtime::rstar(32, 8)); + + typedef bg::model::point P3f; + typedef bg::model::box B3f; + typedef std::pair PB3f; + + test_rtree_interprocess(bgi::linear<32, 8>()); + test_rtree_interprocess(bgi::runtime::linear(32, 8)); + test_rtree_interprocess(bgi::quadratic<32, 8>()); + test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); + test_rtree_interprocess(bgi::rstar<32, 8>()); + test_rtree_interprocess(bgi::runtime::rstar(32, 8));*/ + + return 0; +} diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index f48a5d0a6..5f0129c2d 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -480,13 +480,10 @@ generate_value_outside() return generate_value_outside_impl::value>::apply(); } -template -void generate_rtree(bgi::rtree & tree, std::vector & input, Box & qbox) +template +void generate_rtree(Rtree & tree, Elements & input, Box & qbox) { - typedef bgi::rtree T; - typedef typename T::box_type B; - typedef typename T::value_type V; - typedef typename T::indexable_type I; + typedef typename Rtree::indexable_type I; generate_input< bgi::detail::traits::dimension::value @@ -568,8 +565,8 @@ void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector -void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -592,8 +589,8 @@ void test_intersects(bgi::rtree const& tree, std::vector con test_spatial_query(tree, !bgi::disjoint(qpoly), expected_output);*/ } -template -void test_disjoint(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_disjoint(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -614,8 +611,8 @@ void test_disjoint(bgi::rtree const& tree, std::vector const } -template -void test_covered_by(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_covered_by(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -637,8 +634,8 @@ void test_covered_by(bgi::rtree const& tree, std::vector con template struct test_overlap_impl { - template - static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) + template + static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -661,13 +658,13 @@ struct test_overlap_impl template <> struct test_overlap_impl { - template - static void apply(bgi::rtree const& /*tree*/, std::vector const& /*input*/, Box const& /*qbox*/) + template + static void apply(bgi::rtree const& /*tree*/, std::vector const& /*input*/, Box const& /*qbox*/) {} }; -template -void test_overlaps(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_overlaps(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { test_overlap_impl< typename bgi::detail::traits::tag< @@ -679,16 +676,16 @@ void test_overlaps(bgi::rtree const& tree, std::vector const //template //struct test_touches_impl //{ -// template -// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +// template +// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) // {} //}; // //template <> //struct test_touches_impl //{ -// template -// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +// template +// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) // { // std::vector expected_output; // @@ -700,21 +697,21 @@ void test_overlaps(bgi::rtree const& tree, std::vector const // } //}; // -//template -//void test_touches(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +//template +//void test_touches(bgi::rtree const& tree, std::vector const& input, Box const& qbox) //{ // test_touches_impl< // bgi::traits::tag< -// typename bgi::rtree::indexable_type +// typename bgi::rtree::indexable_type // >::type, // bgi::traits::dimension< -// typename bgi::rtree::indexable_type +// typename bgi::rtree::indexable_type // >::value // >::apply(tree, input, qbox); //} -template -void test_within(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_within(bgi::rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -830,7 +827,7 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P struct AlwaysFalse { template - bool operator()(Value const& v) const { return false; } + bool operator()(Value const& ) const { return false; } }; template From 6b270d31ecf5801466f766650afe795ee49ecf09 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 13 Feb 2013 14:33:11 +0000 Subject: [PATCH 313/366] raw pointers replaced by allocator pointer [SVN r82849] --- .../detail/rtree/node/dynamic_visitor.hpp | 12 +- .../index/detail/rtree/node/node_auto_ptr.hpp | 11 +- .../detail/rtree/node/node_d_mem_dynamic.hpp | 125 +++++++++++------- .../detail/rtree/node/node_d_mem_static.hpp | 22 +-- .../index/detail/rtree/visitors/destroy.hpp | 12 +- .../index/detail/rtree/visitors/insert.hpp | 20 ++- .../detail/rtree/visitors/nearest_query.hpp | 6 +- include/boost/geometry/index/rtree.hpp | 26 ++-- test/rtree/rtree_interprocess.cpp | 6 +- 9 files changed, 140 insertions(+), 100 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp b/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp index c254c1baf..93bad4178 100644 --- a/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp +++ b/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp @@ -72,12 +72,12 @@ inline Derived & get(dynamic_node & n) return static_cast(n); } -template -inline Derived * get(dynamic_node * n) -{ - BOOST_GEOMETRY_INDEX_ASSERT(dynamic_cast(n), "can't cast to a Derived type"); - return static_cast(n); -} +//template +//inline Derived * get(dynamic_node * n) +//{ +// BOOST_GEOMETRY_INDEX_ASSERT(dynamic_cast(n), "can't cast to a Derived type"); +// return static_cast(n); +//} // apply visitor diff --git a/include/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp b/include/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp index 4ae6707ef..5e25dcfbf 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_auto_ptr.hpp @@ -24,9 +24,10 @@ class node_auto_ptr : boost::noncopyable { typedef typename rtree::node::type node; + typedef typename Allocators::node_pointer pointer; public: - node_auto_ptr(node * ptr, Allocators & allocators) + node_auto_ptr(pointer ptr, Allocators & allocators) : m_ptr(ptr) , m_allocators(allocators) {} @@ -36,7 +37,7 @@ public: reset(); } - void reset(node * ptr = 0) + void reset(pointer ptr = 0) { if ( m_ptr ) { @@ -51,7 +52,7 @@ public: m_ptr = 0; } - node * get() const + pointer get() const { return m_ptr; } @@ -61,13 +62,13 @@ public: return *m_ptr; } - node * operator->() const + pointer operator->() const { return m_ptr; } private: - node * m_ptr; + pointer m_ptr; Allocators & m_allocators; }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index c036554f8..a4d142725 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -24,7 +24,7 @@ struct dynamic_internal_node { typedef boost::container::vector< - std::pair *>, + std::pair, typename Allocators::internal_node_elements_allocator_type > elements_type; @@ -85,39 +85,61 @@ struct visitor type; }; -// element's indexable type - -template -struct element_indexable_type +template +struct translator_wrapper_helper { - typedef typename translator::indexable_type::type type; + typedef typename Element::first_type element_indexable_type; + typedef typename Element::first_type const& element_indexable_result; }; -template -struct element_indexable_type< - std::pair *>, - Translator -> +template +struct translator_wrapper_helper { - typedef Box type; + typedef typename translator::indexable_type::type element_indexable_type; + typedef typename Translator::result_type element_indexable_result; +}; + +template +struct translator_wrapper + : public Translator +{ + translator_wrapper(Translator const& t = Translator()) : Translator(t) {} + + template + struct element_indexable_type + { + typedef typename translator_wrapper_helper::element_indexable_type type; + }; + + template + struct element_indexable_result + { + typedef typename translator_wrapper_helper::element_indexable_result type; + }; + + typename element_indexable_result::type + element_indexable(Value const& v) const { return Translator::operator()(v); } + + template + typename element_indexable_result::type + element_indexable(Element const& el) const { return el.first; } +}; + +// element's indexable type + +template +struct element_indexable_type +{ + typedef typename Translator::template element_indexable_type::type type; }; // element's indexable getter -template -inline typename Translator::result_type -element_indexable(Value const& el, Translator const& tr) +template +typename Translator::template element_indexable_result::type +element_indexable(Element const& el, Translator const& tr) { - return tr(el); -} - -template -inline Box const& -element_indexable( - std::pair< Box, dynamic_node *> const& el, - Translator const&) -{ - return el.first; + return tr.element_indexable(el); } // nodes elements @@ -161,6 +183,10 @@ public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::template rebind< + typename node::type + >::other::pointer node_pointer; + typedef typename allocator_type::template rebind< typename internal_node::type >::other internal_node_allocator_type; @@ -170,7 +196,7 @@ public: >::other leaf_allocator_type; typedef typename allocator_type::template rebind< - std::pair::type *> + std::pair >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< @@ -227,22 +253,25 @@ public: // create_node_impl -template +template struct create_dynamic_node { template - static inline BaseNode * apply(AllocNode & alloc_node, AllocElems & alloc_elems) + static inline BaseNodePtr apply(AllocNode & alloc_node, AllocElems & alloc_elems) { - Node * p = alloc_node.allocate(1); + typedef typename AllocNode::pointer P; + typedef typename AllocNode::value_type V; + + P p = alloc_node.allocate(1); if ( 0 == p ) - throw std::bad_alloc(); + throw std::bad_alloc(); // TODO throw different exception try { // NOTE/TODO // Here the whole node may be copied - alloc_node.construct(p, Node(alloc_elems)); + alloc_node.construct(p, V(alloc_elems)); } catch(...) { @@ -256,13 +285,15 @@ struct create_dynamic_node // destroy_node_impl -template struct destroy_dynamic_node { - template - static inline void apply(AllocNode & alloc_node, BaseNode * n) + template + static inline void apply(AllocNode & alloc_node, BaseNodePtr n) { - Node * p = rtree::get(n); + typedef typename AllocNode::value_type V; + typedef typename AllocNode::pointer P; + + P p(&static_cast(rtree::get(*n))); alloc_node.destroy(p); alloc_node.deallocate(p, 1); } @@ -276,12 +307,11 @@ struct create_node< dynamic_internal_node > { - static inline dynamic_node * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_dynamic_node< - dynamic_node, - dynamic_internal_node + typename Allocators::node_pointer >::apply(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); } }; @@ -292,13 +322,12 @@ struct create_node< dynamic_leaf > { - static inline dynamic_node * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_dynamic_node< - dynamic_node, - dynamic_leaf - >::template apply(allocators.leaf_allocator, allocators.leaf_elements_allocator); + typename Allocators::node_pointer + >::apply(allocators.leaf_allocator, allocators.leaf_elements_allocator); } }; @@ -310,11 +339,9 @@ struct destroy_node< dynamic_internal_node > { - static inline void apply(Allocators & allocators, dynamic_node * n) + static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { - destroy_dynamic_node< - dynamic_internal_node - >::apply(allocators.internal_node_allocator, n); + destroy_dynamic_node::apply(allocators.internal_node_allocator, n); } }; @@ -324,11 +351,9 @@ struct destroy_node< dynamic_leaf > { - static inline void apply(Allocators & allocators, dynamic_node * n) + static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { - destroy_dynamic_node< - dynamic_leaf - >::apply(allocators.leaf_allocator, n); + destroy_dynamic_node::apply(allocators.leaf_allocator, n); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index a806d5395..21ca4de1c 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -25,7 +25,7 @@ struct dynamic_internal_node * + typename Allocators::node_pointer >, Parameters::max_elements + 1, typename Allocators::internal_node_elements_allocator_type @@ -104,6 +104,10 @@ public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::template rebind< + typename node::type + >::other::pointer node_pointer; + typedef typename allocator_type::template rebind< typename internal_node::type >::other internal_node_allocator_type; @@ -113,7 +117,7 @@ public: >::other leaf_allocator_type; typedef typename allocator_type::template rebind< - std::pair::type *> + std::pair >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< @@ -164,13 +168,12 @@ struct create_node< dynamic_internal_node > { - static inline dynamic_node * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_dynamic_node< - dynamic_node, - dynamic_internal_node - >::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator); + typename Allocators::node_pointer + >::apply(allocators.internal_node_allocator, allocators.internal_node_allocator); } }; @@ -180,13 +183,12 @@ struct create_node< dynamic_leaf > { - static inline typename node::type * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_dynamic_node< - dynamic_node, - dynamic_leaf - >::template apply(allocators.leaf_allocator, allocators.leaf_allocator); + typename Allocators::node_pointer + >::apply(allocators.leaf_allocator, allocators.leaf_allocator); } }; diff --git a/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp index 2cc1e96b4..5227715d9 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp @@ -27,16 +27,18 @@ public: typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; - inline destroy(node * root_node, Allocators & allocators) + typedef typename Allocators::node_pointer node_pointer; + + inline destroy(node_pointer root_node, Allocators & allocators) : m_current_node(root_node) , m_allocators(allocators) {} inline void operator()(internal_node & n) { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_current_node), "invalid pointers"); + BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get(*m_current_node), "invalid pointers"); - node * node_to_destroy = m_current_node; + node_pointer node_to_destroy = m_current_node; typedef typename rtree::elements_type::type elements_type; elements_type & elements = rtree::elements(n); @@ -54,13 +56,13 @@ public: inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(l)) { - BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get(m_current_node), "invalid pointers"); + BOOST_GEOMETRY_INDEX_ASSERT(&l == &rtree::get(*m_current_node), "invalid pointers"); rtree::destroy_node::apply(m_allocators, m_current_node); } private: - node * m_current_node; + node_pointer m_current_node; Allocators & m_allocators; }; diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index 10e3f5ff3..034d1db8c 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -120,7 +120,10 @@ protected: typedef rtree::node_auto_ptr node_auto_ptr; public: - typedef index::detail::varray, 1> nodes_container_type; + typedef index::detail::varray< + typename rtree::elements_type::type::value_type, + 1 + > nodes_container_type; template static inline void apply(nodes_container_type & additional_nodes, @@ -230,8 +233,9 @@ protected: typedef typename rtree::leaf::type leaf; typedef rtree::node_auto_ptr node_auto_ptr; + typedef typename Allocators::node_pointer node_pointer; - inline insert(node* & root, + inline insert(node_pointer & root, size_t & leafs_level, Element const& element, parameters_type const& parameters, @@ -278,7 +282,7 @@ protected: inline void post_traverse(Node &n) { BOOST_GEOMETRY_INDEX_ASSERT(m_traverse_data.current_is_root() || - &n == rtree::get(m_traverse_data.current_element().second), + &n == &rtree::get(*m_traverse_data.current_element().second), "if node isn't the root current_child_index should be valid"); // handle overflow @@ -342,7 +346,7 @@ protected: // node is the root - add level else { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node should be the root"); + BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get(*m_root_node), "node should be the root"); // create new root and add nodes node_auto_ptr new_root(rtree::create_node::apply(m_allocators), m_allocators); // MAY THROW, STRONG (N:alloc) @@ -373,7 +377,7 @@ protected: const size_t m_relative_level; const size_t m_level; - node* & m_root_node; + node_pointer & m_root_node; size_t & m_leafs_level; // traversing input parameters @@ -403,8 +407,9 @@ public: typedef typename base::leaf leaf; typedef typename Options::parameters_type parameters_type; + typedef typename base::node_pointer node_pointer; - inline insert(node* & root, + inline insert(node_pointer & root, size_t & leafs_level, Element & element, parameters_type const& parameters, @@ -465,8 +470,9 @@ public: typedef typename base::leaf leaf; typedef typename Options::parameters_type parameters_type; + typedef typename base::node_pointer node_pointer; - inline insert(node* & root, + inline insert(node_pointer & root, size_t & leafs_level, Value const& value, parameters_type const& parameters, diff --git a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp index 345246ed5..18aee5404 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp @@ -201,7 +201,7 @@ public: // array of active nodes typename index::detail::rtree::container_from_elements_type< elements_type, - std::pair + std::pair >::type active_branch_list; active_branch_list.reserve(m_parameters.get_max_elements()); @@ -311,8 +311,8 @@ private: } static inline bool abl_less( - std::pair const& p1, - std::pair const& p2) + std::pair const& p1, + std::pair const& p2) { return index::detail::cdist_value ::template get(p1.first) diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index fc606a182..0121fc78f 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -130,7 +130,11 @@ private: typedef typename detail::rtree::internal_node::type internal_node; typedef typename detail::rtree::leaf::type leaf; + typedef detail::rtree::translator_wrapper translator_wrapper; + typedef typename allocators_type::node_pointer node_pointer; + public: + /*! \brief The constructor. @@ -782,7 +786,7 @@ public: if ( !m_root ) return 0; - detail::rtree::visitors::count + detail::rtree::visitors::count count_v(vori, m_translator); detail::rtree::apply_visitor(count_v, *m_root); @@ -900,7 +904,7 @@ private: detail::rtree::visitors::insert< value_type, - value_type, options_type, translator_type, box_type, allocators_type, + value_type, options_type, translator_wrapper, box_type, allocators_type, typename options_type::insert_tag > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); @@ -929,7 +933,7 @@ private: BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); detail::rtree::visitors::remove< - value_type, options_type, translator_type, box_type, allocators_type + value_type, options_type, translator_wrapper, box_type, allocators_type > remove_v(m_root, m_leafs_level, m_box, value, m_parameters, m_translator, m_allocators); detail::rtree::apply_visitor(remove_v, *m_root); @@ -975,7 +979,7 @@ private: { if ( t.m_root ) { - detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); + detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); detail::rtree::apply_visitor(del_v, *t.m_root); t.m_root = 0; @@ -996,7 +1000,7 @@ private: */ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { - detail::rtree::visitors::copy copy_v(dst.m_allocators); + 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) @@ -1011,7 +1015,7 @@ private: if ( dst.m_root ) { - detail::rtree::visitors::destroy del_v(dst.m_root, dst.m_allocators); + detail::rtree::visitors::destroy del_v(dst.m_root, dst.m_allocators); detail::rtree::apply_visitor(del_v, *dst.m_root); dst.m_root = 0; } @@ -1030,7 +1034,7 @@ private: template size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const { - detail::rtree::visitors::spatial_query + detail::rtree::visitors::spatial_query find_v(m_translator, predicates, out_it); detail::rtree::apply_visitor(find_v, *m_root); @@ -1068,7 +1072,7 @@ private: typedef detail::rtree::visitors::nearest_query_result_k< value_type, - translator_type, + translator_wrapper, point_type, OutIter > result_type; @@ -1078,7 +1082,7 @@ private: detail::rtree::visitors::nearest_query< value_type, options_type, - translator_type, + translator_wrapper, box_type, allocators_type, DistancesPredicates, @@ -1091,13 +1095,13 @@ private: return result.finish(); } - translator_type m_translator; + translator_wrapper m_translator; Parameters m_parameters; allocators_type m_allocators; size_type m_values_count; size_type m_leafs_level; - node * m_root; + node_pointer m_root; box_type m_box; }; diff --git a/test/rtree/rtree_interprocess.cpp b/test/rtree/rtree_interprocess.cpp index bb8c5d534..9e2af9e95 100644 --- a/test/rtree/rtree_interprocess.cpp +++ b/test/rtree/rtree_interprocess.cpp @@ -62,9 +62,9 @@ int test_main(int, char* []) typedef bg::model::box B2d; typedef std::pair PB2d; - test_rtree_interprocess(bgi::linear<32, 8>()); - /*test_rtree_interprocess(bgi::runtime::linear(32, 8)); - test_rtree_interprocess(bgi::quadratic<32, 8>()); + //test_rtree_interprocess(bgi::linear<32, 8>()); + test_rtree_interprocess(bgi::runtime::linear(32, 8)); + /*test_rtree_interprocess(bgi::quadratic<32, 8>()); test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); test_rtree_interprocess(bgi::rstar<32, 8>()); test_rtree_interprocess(bgi::runtime::rstar(32, 8)); From 1b806fc797c743d92ffcf1099f05b7571892129b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 13 Feb 2013 14:57:43 +0000 Subject: [PATCH 314/366] compilation errors related to detail::rtree::get fixed [SVN r82850] --- .../geometry/index/detail/predicates.hpp | 2 +- .../index/detail/rtree/rstar/insert.hpp | 6 +-- .../index/detail/rtree/visitors/remove.hpp | 2 +- test/rtree/test_rtree.hpp | 50 +++++++++---------- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index a5de1e58f..734358b16 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -554,7 +554,7 @@ template struct predicates_check_pair { template - static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) + static inline bool apply(PairPredicates const& , Value const& , Indexable const& ) { return true; } diff --git a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp index a20646922..cdca30e57 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp @@ -197,7 +197,7 @@ struct level_insert_base // node is root node else { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(base::m_root_node), "node should be the root node"); + BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get(*base::m_root_node), "node should be the root node"); base::split(n); // MAY THROW (V, E: alloc, copy, N: alloc) } } @@ -445,7 +445,7 @@ public: inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); + BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get(*m_root), "current node should be the root"); rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); @@ -460,7 +460,7 @@ public: inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n)) { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root), "current node should be the root"); + BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get(*m_root), "current node should be the root"); rstar::level_insert<0, Element, Value, Options, Translator, Box, Allocators> lins_v( m_root, m_leafs_level, m_element, m_parameters, m_translator, m_allocators, m_relative_level); diff --git a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp index f871e6447..75bdf2718 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp @@ -110,7 +110,7 @@ public: // n is root node else { - BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get(m_root_node), "node must be the root"); + BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get(*m_root_node), "node must be the root"); // assign new root's box assign_root_box(elements); diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 5f0129c2d..d55da9e73 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -565,8 +565,8 @@ void test_spatial_query(Rtree & rtree, Predicates const& pred, std::vector -void test_intersects(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_intersects(Rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -589,8 +589,8 @@ void test_intersects(bgi::rtree const& tree, std::vector -void test_disjoint(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_disjoint(Rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -611,8 +611,8 @@ void test_disjoint(bgi::rtree const& tree, std::vector } -template -void test_covered_by(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_covered_by(Rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -634,8 +634,8 @@ void test_covered_by(bgi::rtree const& tree, std::vector struct test_overlap_impl { - template - static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) + template + static void apply(Rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; @@ -658,17 +658,17 @@ struct test_overlap_impl template <> struct test_overlap_impl { - template - static void apply(bgi::rtree const& /*tree*/, std::vector const& /*input*/, Box const& /*qbox*/) + template + static void apply(Rtree const& /*tree*/, std::vector const& /*input*/, Box const& /*qbox*/) {} }; -template -void test_overlaps(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_overlaps(Rtree const& tree, std::vector const& input, Box const& qbox) { test_overlap_impl< typename bgi::detail::traits::tag< - typename bgi::rtree::indexable_type + typename Rtree::indexable_type >::type >::apply(tree, input, qbox); } @@ -676,16 +676,16 @@ void test_overlaps(bgi::rtree const& tree, std::vector //template //struct test_touches_impl //{ -// template -// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +// template +// static void apply(Rtree const& tree, std::vector const& input, Box const& qbox) // {} //}; // //template <> //struct test_touches_impl //{ -// template -// static void apply(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +// template +// static void apply(Rtree const& tree, std::vector const& input, Box const& qbox) // { // std::vector expected_output; // @@ -697,21 +697,17 @@ void test_overlaps(bgi::rtree const& tree, std::vector // } //}; // -//template -//void test_touches(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +//template +//void test_touches(Rtree const& tree, std::vector const& input, Box const& qbox) //{ // test_touches_impl< -// bgi::traits::tag< -// typename bgi::rtree::indexable_type -// >::type, -// bgi::traits::dimension< -// typename bgi::rtree::indexable_type -// >::value +// bgi::traits::tag::type, +// bgi::traits::dimension::value // >::apply(tree, input, qbox); //} -template -void test_within(bgi::rtree const& tree, std::vector const& input, Box const& qbox) +template +void test_within(Rtree const& tree, std::vector const& input, Box const& qbox) { std::vector expected_output; From ad50724a45a1d0ab83e19d79c1c0f9e41b6554cc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 13 Feb 2013 15:08:15 +0000 Subject: [PATCH 315/366] some tests modified to be able to use non-std allocator [SVN r82851] --- test/rtree/test_rtree.hpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index d55da9e73..767788433 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -839,16 +839,18 @@ void test_nearest_query_not_found(Rtree const& rtree, Point const& pt) // rtree copying and moving -template -void test_copy_assignment_swap_move(bgi::rtree const& tree, Box const& qbox) +template +void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) { + typedef typename Rtree::value_type Value; + size_t s = tree.size(); std::vector expected_output; tree.query(qbox, std::back_inserter(expected_output)); // copy constructor - bgi::rtree t1(tree); + Rtree t1(tree, tree.get_allocator()); BOOST_CHECK(tree.empty() == t1.empty()); BOOST_CHECK(tree.size() == t1.size()); @@ -867,7 +869,7 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con t1.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); - bgi::rtree t2(tree.parameters()); + Rtree t2(tree.parameters(), tree.translator(), tree.get_allocator()); t2.swap(t1); BOOST_CHECK(tree.empty() == t2.empty()); BOOST_CHECK(tree.size() == t2.size()); @@ -884,7 +886,7 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con t2.swap(t1); // moving constructor - bgi::rtree t3(boost::move(t1)); + Rtree t3(boost::move(t1), tree.get_allocator()); BOOST_CHECK(t3.size() == s); BOOST_CHECK(t1.size() == 0); @@ -908,16 +910,14 @@ void test_copy_assignment_swap_move(bgi::rtree const& tree, Box con // rtree creation and insertion -template -void test_create_insert(bgi::rtree & tree, std::vector const& input, Box const& qbox) +template +void test_create_insert(Rtree & tree, std::vector const& input, Box const& qbox) { - typedef bgi::rtree T; - std::vector expected_output; tree.query(qbox, std::back_inserter(expected_output)); { - T t(tree.parameters()); + Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_FOREACH(Value const& v, input) t.insert(v); BOOST_CHECK(tree.size() == t.size()); @@ -926,7 +926,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const test_exactly_the_same_outputs(t, output, expected_output); } { - T t(tree.parameters()); + Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); std::copy(input.begin(), input.end(), bgi::inserter(t)); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -934,21 +934,21 @@ void test_create_insert(bgi::rtree & tree, std::vector const test_exactly_the_same_outputs(t, output, expected_output); } { - T t(input.begin(), input.end(), tree.parameters()); + Rtree t(input.begin(), input.end(), tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { - T t(input, tree.parameters()); + Rtree t(input, tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; t.query(qbox, std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { - T t(tree.parameters()); + Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); t.insert(input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -956,7 +956,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const test_exactly_the_same_outputs(t, output, expected_output); } { - T t(tree.parameters()); + Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); t.insert(input); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -965,7 +965,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const } { - T t(tree.parameters()); + Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_FOREACH(Value const& v, input) bgi::insert(t, v); BOOST_CHECK(tree.size() == t.size()); @@ -974,7 +974,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const test_exactly_the_same_outputs(t, output, expected_output); } { - T t(tree.parameters()); + Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); bgi::insert(t, input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -982,7 +982,7 @@ void test_create_insert(bgi::rtree & tree, std::vector const test_exactly_the_same_outputs(t, output, expected_output); } { - T t(tree.parameters()); + Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); bgi::insert(t, input); BOOST_CHECK(tree.size() == t.size()); std::vector output; From b7f592f1f4f74f72eb21267ab3dd50cf02cf9ad1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 14 Feb 2013 01:11:17 +0000 Subject: [PATCH 316/366] rtree non-std allocators support implemented. interprocess test added. [SVN r82864] --- .../detail/rtree/node/node_d_mem_dynamic.hpp | 4 + .../detail/rtree/node/node_d_mem_static.hpp | 4 + .../index/detail/rtree/visitors/copy.hpp | 7 +- .../index/detail/rtree/visitors/remove.hpp | 14 +- .../boost/geometry/index/detail/varray.hpp | 20 +-- test/rtree/Jamfile.v2 | 22 +-- test/rtree/rtree_interprocess.cpp | 71 ++++------ test/rtree/test_rtree.hpp | 126 ++++++++++-------- test/rtree/test_rtree_exceptions.hpp | 20 ++- 9 files changed, 155 insertions(+), 133 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index a4d142725..92f5d6809 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -187,6 +187,10 @@ public: typename node::type >::other::pointer node_pointer; + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other::pointer internal_node_pointer; + typedef typename allocator_type::template rebind< typename internal_node::type >::other internal_node_allocator_type; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index 21ca4de1c..b6cc23966 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -108,6 +108,10 @@ public: typename node::type >::other::pointer node_pointer; + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other::pointer internal_node_pointer; + typedef typename allocator_type::template rebind< typename internal_node::type >::other internal_node_allocator_type; diff --git a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp index 1819f4a95..29b76326e 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp @@ -28,6 +28,7 @@ public: typedef typename rtree::leaf::type leaf; typedef rtree::node_auto_ptr node_auto_ptr; + typedef typename Allocators::node_pointer node_pointer; explicit inline copy(Allocators & allocators) : result(0) @@ -36,7 +37,7 @@ public: inline void operator()(internal_node & n) { - node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW, STRONG (N: alloc) + node_pointer raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW, STRONG (N: alloc) node_auto_ptr new_node(raw_new_node, m_allocators); typedef typename rtree::elements_type::type elements_type; @@ -63,7 +64,7 @@ public: inline void operator()(leaf & l) { - node * raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW, STRONG (N: alloc) + node_pointer raw_new_node = rtree::create_node::apply(m_allocators); // MAY THROW, STRONG (N: alloc) node_auto_ptr new_node(raw_new_node, m_allocators); typedef typename rtree::elements_type::type elements_type; @@ -81,7 +82,7 @@ public: new_node.release(); } - node * result; + node_pointer result; private: Allocators & m_allocators; diff --git a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp index 75bdf2718..52df1316c 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp @@ -34,9 +34,11 @@ class remove typedef typename rtree::leaf::type leaf; typedef rtree::node_auto_ptr node_auto_ptr; + typedef typename Allocators::node_pointer node_pointer; + typedef typename Allocators::internal_node_pointer internal_node_pointer; public: - inline remove(node* & root, + inline remove(node_pointer & root, size_t & leafs_level, Box & root_box, Value const& value, @@ -121,7 +123,7 @@ public: // shorten the tree if ( rtree::elements(n).size() == 1 ) { - node * root_to_destroy = m_root_node; + node_pointer root_to_destroy = m_root_node; m_root_node = rtree::elements(n)[0].second; --m_leafs_level; @@ -174,12 +176,12 @@ public: private: - typedef std::vector< std::pair > UnderflowNodes; + typedef std::vector< std::pair > UnderflowNodes; void traverse_apply_visitor(internal_node &n, size_t choosen_node_index) { // save previous traverse inputs and set new ones - internal_node * parent_bckup = m_parent; + internal_node_pointer parent_bckup = m_parent; size_t current_child_index_bckup = m_current_child_index; size_t current_level_bckup = m_current_level; @@ -308,7 +310,7 @@ private: Translator const& m_translator; Allocators & m_allocators; - node* & m_root_node; + node_pointer & m_root_node; Box & m_root_box; size_t & m_leafs_level; @@ -316,7 +318,7 @@ private: UnderflowNodes m_underflowed_nodes; // traversing input parameters - internal_node *m_parent; + internal_node_pointer m_parent; size_t m_current_child_index; size_t m_current_level; diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index 64bc47bde..2d8714a35 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -552,7 +552,7 @@ private: >::type use_memcpy; - this->copy_dispatch(first, last, dst, use_memcpy()); // may throw + this->copy_dispatch(&(*first), &(*last), &(*dst), use_memcpy()); // may throw } void copy_dispatch(const value_type * first, const value_type * last, value_type * dst, @@ -583,7 +583,7 @@ private: >::type use_memcpy; - this->uninitialized_copy_dispatch(first, last, dst, use_memcpy()); // may throw + this->uninitialized_copy_dispatch(&(*first), &(*last), &(*dst), use_memcpy()); // may throw } void uninitialized_copy_dispatch(const value_type * first, const value_type * last, value_type * dst, @@ -607,11 +607,11 @@ private: typedef typename mpl::and_< has_trivial_copy, - is_same + is_same >::type use_memcpy; - uninitialized_fill_dispatch(dst, v, use_memcpy()); // may throw + uninitialized_fill_dispatch(&(*dst), v, use_memcpy()); // may throw } void uninitialized_fill_dispatch(value_type * ptr, value_type const& v, @@ -633,7 +633,7 @@ private: void move(iterator first, iterator last, iterator dst) { - this->move_dispatch(first, last, dst, has_trivial_assign()); // may throw + this->move_dispatch(&(*first), &(*last), &(*dst), has_trivial_assign()); // may throw } void move_dispatch(value_type * first, value_type * last, value_type * dst, @@ -652,7 +652,7 @@ private: void move_backward(iterator first, iterator last, iterator dst) { - this->move_backward_dispatch(first, last, dst, has_trivial_assign()); // may throw + this->move_backward_dispatch(&(*first), &(*last), &(*dst), has_trivial_assign()); // may throw } void move_backward_dispatch(value_type * first, value_type * last, value_type * dst, @@ -673,7 +673,7 @@ private: template void fill(iterator dst, V const& v) { - fill_dispatch(dst, v, has_trivial_assign()); // may throw + fill_dispatch(&(*dst), v, has_trivial_assign()); // may throw } void fill_dispatch(value_type * ptr, value_type const& v, @@ -695,7 +695,7 @@ private: void destroy(iterator first, iterator last) { - this->destroy_dispatch(first, last, has_trivial_destructor()); + this->destroy_dispatch(&(*first), &(*last), has_trivial_destructor()); } void destroy_dispatch(value_type * /*first*/, value_type * /*last*/, @@ -713,7 +713,7 @@ private: void destroy(iterator it) { - this->destroy_dispatch(it, has_trivial_destructor()); + this->destroy_dispatch(&(*it), has_trivial_destructor()); } void destroy_dispatch(value_type * /*ptr*/, @@ -730,7 +730,7 @@ private: void construct(iterator first, iterator last) { - this->construct_dispatch(first, last, has_trivial_constructor()); // may throw + this->construct_dispatch(&(*first), &(*last), has_trivial_constructor()); // may throw } void construct_dispatch(value_type * /*first*/, value_type * /*last*/, diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index 7880902fd..e637ce08a 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -13,14 +13,14 @@ test-suite boost-geometry-index-rtree [ run rtree_exceptions.cpp ] ; -#test-suite boost-geometry-index-rtree_interprocess -# : [ run rtree_interprocess.cpp /boost/thread//boost_thread -# : # additional args -# : # test-files -# : # requirements -# acc:-lrt -# acc-pa_risc:-lrt -# gcc-mingw:"-lole32 -loleaut32 -lpsapi -ladvapi32" -# hpux,gcc:"-Wl,+as,mpas" -# ] : multi -# ; \ No newline at end of file +test-suite boost-geometry-index-rtree_interprocess + : [ run rtree_interprocess.cpp /boost/thread//boost_thread + : # additional args + : # test-files + : # requirements + acc:-lrt + acc-pa_risc:-lrt + gcc-mingw:"-lole32 -loleaut32 -lpsapi -ladvapi32" + hpux,gcc:"-Wl,+as,mpas" + ] : multi + ; \ No newline at end of file diff --git a/test/rtree/rtree_interprocess.cpp b/test/rtree/rtree_interprocess.cpp index 9e2af9e95..d7a8d0c16 100644 --- a/test/rtree/rtree_interprocess.cpp +++ b/test/rtree/rtree_interprocess.cpp @@ -16,7 +16,7 @@ #include #include -template +template void test_rtree_interprocess(Parameters const& parameters = Parameters()) { namespace bi = boost::interprocess; @@ -27,58 +27,43 @@ void test_rtree_interprocess(Parameters const& parameters = Parameters()) } remover; bi::managed_shared_memory segment(bi::create_only, "shmem", 65535); - typedef bi::allocator shmem_alloc; + typedef bi::allocator shmem_alloc; - typedef bgi::rtree, shmem_alloc> Tree; + test_rtree_for_box(parameters, shmem_alloc(segment.get_segment_manager())); - Tree * tree = segment.construct("Tree")(parameters, bgi::translator::def(), shmem_alloc(segment.get_segment_manager())); - typedef typename Tree::bounds_type B; - - std::vector input; - B qbox; - - generate_rtree(*tree, input, qbox); + //typedef bgi::rtree, shmem_alloc> Tree; - test_intersects(*tree, input, qbox); - test_disjoint(*tree, input, qbox); - test_covered_by(*tree, input, qbox); - test_overlaps(*tree, input, qbox); - //test_touches(*tree, input, qbox); - test_within(*tree, input, qbox); + //Tree * tree = segment.construct("Tree")(parameters, bgi::translator::def(), shmem_alloc(segment.get_segment_manager())); + //typedef typename Tree::bounds_type B; + // + //std::vector input; + //B qbox; + // + //generate_rtree(*tree, input, qbox); - typedef typename bgi::detail::traits::point_type::type P; - P pt; - bg::centroid(qbox, pt); + //test_intersects(*tree, input, qbox); + //test_disjoint(*tree, input, qbox); + //test_covered_by(*tree, input, qbox); + //test_overlaps(*tree, input, qbox); + ////test_touches(*tree, input, qbox); + //test_within(*tree, input, qbox); - test_nearest_query_k(*tree, input, pt, 10); - test_nearest_query_not_found(*tree, generate_outside_point

    ::apply()); + //typedef typename bgi::detail::traits::point_type::type P; + //P pt; + //bg::centroid(qbox, pt); - segment.destroy_ptr(tree); + //test_nearest_query_k(*tree, input, pt, 10); + //test_nearest_query_not_found(*tree, generate_outside_point

    ::apply()); + + //segment.destroy_ptr(tree); } int test_main(int, char* []) { - typedef bg::model::point P2d; - typedef bg::model::box B2d; - typedef std::pair PB2d; - - //test_rtree_interprocess(bgi::linear<32, 8>()); - test_rtree_interprocess(bgi::runtime::linear(32, 8)); - /*test_rtree_interprocess(bgi::quadratic<32, 8>()); - test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); - test_rtree_interprocess(bgi::rstar<32, 8>()); - test_rtree_interprocess(bgi::runtime::rstar(32, 8)); - - typedef bg::model::point P3f; - typedef bg::model::box B3f; - typedef std::pair PB3f; - - test_rtree_interprocess(bgi::linear<32, 8>()); - test_rtree_interprocess(bgi::runtime::linear(32, 8)); - test_rtree_interprocess(bgi::quadratic<32, 8>()); - test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); - test_rtree_interprocess(bgi::rstar<32, 8>()); - test_rtree_interprocess(bgi::runtime::rstar(32, 8));*/ + typedef bg::model::point P2f; + test_rtree_interprocess(bgi::linear<32, 8>()); + test_rtree_interprocess(bgi::runtime::linear(32, 8)); + return 0; } diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 767788433..8075a44f0 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -850,7 +850,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) tree.query(qbox, std::back_inserter(expected_output)); // copy constructor - Rtree t1(tree, tree.get_allocator()); + Rtree t1(tree); BOOST_CHECK(tree.empty() == t1.empty()); BOOST_CHECK(tree.size() == t1.size()); @@ -993,10 +993,10 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const // rtree removing -template -void test_remove(bgi::rtree & tree, Box const& qbox) +template +void test_remove(Rtree & tree, Box const& qbox) { - typedef bgi::rtree T; + typedef typename Rtree::value_type Value; std::vector values_to_remove; tree.query(qbox, std::back_inserter(values_to_remove)); @@ -1008,11 +1008,11 @@ void test_remove(bgi::rtree & tree, Box const& qbox) size_t expected_size_after_remove = tree.size() - values_to_remove.size(); // Add value which is not stored in the Rtree - Value outsider = generate_value_outside(); + Value outsider = generate_value_outside(); values_to_remove.push_back(outsider); { - T t(tree); + Rtree t(tree); size_t r = 0; BOOST_FOREACH(Value const& v, values_to_remove) r += t.remove(v); @@ -1024,7 +1024,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) test_compare_outputs(t, output, expected_output); } { - T t(tree); + Rtree t(tree); size_t r = t.remove(values_to_remove.begin(), values_to_remove.end()); BOOST_CHECK( r == expected_removed_count ); std::vector output; @@ -1034,7 +1034,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) test_compare_outputs(t, output, expected_output); } { - T t(tree); + Rtree t(tree); size_t r = t.remove(values_to_remove); BOOST_CHECK( r == expected_removed_count ); std::vector output; @@ -1045,7 +1045,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) } { - T t(tree); + Rtree t(tree); size_t r = 0; BOOST_FOREACH(Value const& v, values_to_remove) r += bgi::remove(t, v); @@ -1057,7 +1057,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) test_compare_outputs(t, output, expected_output); } { - T t(tree); + Rtree t(tree); size_t r = bgi::remove(t, values_to_remove.begin(), values_to_remove.end()); BOOST_CHECK( r == expected_removed_count ); std::vector output; @@ -1067,7 +1067,7 @@ void test_remove(bgi::rtree & tree, Box const& qbox) test_compare_outputs(t, output, expected_output); } { - T t(tree); + Rtree t(tree); size_t r = bgi::remove(t, values_to_remove); BOOST_CHECK( r == expected_removed_count ); std::vector output; @@ -1078,18 +1078,16 @@ void test_remove(bgi::rtree & tree, Box const& qbox) } } -template -void test_clear(bgi::rtree & tree, std::vector const& input, Box const& qbox) +template +void test_clear(Rtree & tree, std::vector const& input, Box const& qbox) { - typedef bgi::rtree T; - std::vector values_to_remove; tree.query(qbox, std::back_inserter(values_to_remove)); BOOST_CHECK(0 < values_to_remove.size()); //clear { - T t(tree); + Rtree t(tree); std::vector expected_output; t.query(bgi::intersects(qbox), std::back_inserter(expected_output)); @@ -1108,15 +1106,17 @@ void test_clear(bgi::rtree & tree, std::vector const& input, // run all tests for a single Algorithm and single rtree // defined by Value -template -void test_rtree_by_value(Parameters const& parameters) +template +void test_rtree_by_value(Parameters const& parameters, Allocator const& allocator) { - typedef bgi::rtree Tree; + typedef bgi::translator::def T; + typedef typename Allocator::template rebind::other A; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; // not empty tree test - Tree tree(parameters); + Tree tree(parameters, T(), allocator); std::vector input; B qbox; @@ -1144,7 +1144,7 @@ void test_rtree_by_value(Parameters const& parameters) // empty tree test - Tree empty_tree(parameters); + Tree empty_tree(parameters, T(), allocator); std::vector empty_input; test_intersects(empty_tree, empty_input, qbox); @@ -1160,14 +1160,17 @@ void test_rtree_by_value(Parameters const& parameters) // rtree inserting and removing of counting_value -template -void test_count_rtree_values(Parameters const& parameters) +template +void test_count_rtree_values(Parameters const& parameters, Allocator const& allocator) { typedef counting_value Value; - typedef bgi::rtree Tree; + + typedef bgi::translator::def T; + typedef typename Allocator::template rebind::other A; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; - Tree t(parameters); + Tree t(parameters, T(), allocator); std::vector input; B qbox; @@ -1199,14 +1202,17 @@ void test_count_rtree_values(Parameters const& parameters) // rtree count -template -void test_rtree_count(Parameters const& parameters) +template +void test_rtree_count(Parameters const& parameters, Allocator const& allocator) { typedef std::pair Value; - typedef bgi::rtree Tree; + + typedef bgi::translator::def T; + typedef typename Allocator::template rebind::other A; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; - Tree t(parameters); + Tree t(parameters, T(), allocator); std::vector input; B qbox; @@ -1228,17 +1234,19 @@ void test_rtree_count(Parameters const& parameters) // test rtree box -template -void test_rtree_bounds(Parameters const& parameters) +template +void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator) { - typedef bgi::rtree Tree; + typedef bgi::translator::def T; + typedef typename Allocator::template rebind::other A; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; typedef typename bg::traits::point_type::type P; B b; bg::assign_inverse(b); - Tree t(parameters); + Tree t(parameters, T(), allocator); std::vector input; B qbox; @@ -1283,45 +1291,57 @@ void test_rtree_bounds(Parameters const& parameters) // run all tests for one Algorithm for some number of rtrees // defined by some number of Values constructed from given Point -template -void test_rtree_for_point(Parameters const& parameters = Parameters()) +template +void test_rtree_for_point(Parameters const& parameters, Allocator const& allocator) { typedef std::pair PairP; typedef boost::tuple TupleP; typedef boost::shared_ptr< test_object > SharedPtrP; typedef value_no_dctor VNoDCtor; - test_rtree_by_value(parameters); - test_rtree_by_value(parameters); - test_rtree_by_value(parameters); - - test_rtree_by_value(parameters); - test_rtree_by_value(parameters); + test_rtree_by_value(parameters, allocator); + test_rtree_by_value(parameters, allocator); + test_rtree_by_value(parameters, allocator); - test_count_rtree_values(parameters); + test_rtree_by_value(parameters, allocator); + test_rtree_by_value(parameters, allocator); - test_rtree_count(parameters); - test_rtree_bounds(parameters); + test_count_rtree_values(parameters, allocator); + + test_rtree_count(parameters, allocator); + test_rtree_bounds(parameters, allocator); } -template -void test_rtree_for_box(Parameters const& parameters = Parameters()) +template +void test_rtree_for_box(Parameters const& parameters, Allocator const& allocator) { typedef bg::model::box Box; typedef std::pair PairB; typedef boost::tuple TupleB; typedef value_no_dctor VNoDCtor; - test_rtree_by_value(parameters); - test_rtree_by_value(parameters); - test_rtree_by_value(parameters); + test_rtree_by_value(parameters, allocator); + test_rtree_by_value(parameters, allocator); + test_rtree_by_value(parameters, allocator); - test_rtree_by_value(parameters); + test_rtree_by_value(parameters, allocator); - test_count_rtree_values(parameters); + test_count_rtree_values(parameters, allocator); - test_rtree_count(parameters); - test_rtree_bounds(parameters); + test_rtree_count(parameters, allocator); + test_rtree_bounds(parameters, allocator); +} + +template +void test_rtree_for_point(Parameters const& parameters) +{ + test_rtree_for_point(parameters, std::allocator()); +} + +template +void test_rtree_for_box(Parameters const& parameters) +{ + test_rtree_for_box(parameters, std::allocator()); } #endif diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index af62ce201..63c4a3c75 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -78,7 +78,7 @@ struct dynamic_internal_node * + typename Allocators::node_pointer >, Parameters::max_elements + 1 > elements_type; @@ -151,6 +151,14 @@ public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::template rebind< + typename node::type + >::other::pointer node_pointer; + + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other::pointer internal_node_pointer; + typedef typename allocator_type::template rebind< typename internal_node::type >::other internal_node_allocator_type; @@ -226,15 +234,14 @@ struct create_node< dynamic_internal_node > { - static inline dynamic_node * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { // throw if counter meets max count throwing_node_settings::throw_if_required(); return create_dynamic_node< - dynamic_node, - dynamic_internal_node + typename Allocators::node_pointer >::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator); } }; @@ -245,15 +252,14 @@ struct create_node< dynamic_leaf > { - static inline typename node::type * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { // throw if counter meets max count throwing_node_settings::throw_if_required(); return create_dynamic_node< - dynamic_node, - dynamic_leaf + typename Allocators::node_pointer >::template apply(allocators.leaf_allocator, allocators.leaf_allocator); } }; From 7914525ac34748234f32ef3014fa76e5563d46e7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 14 Feb 2013 03:11:55 +0000 Subject: [PATCH 317/366] Added rtree interprocess example, fixed compilation error in glut vis [SVN r82865] --- doc/src/examples/rtree/Jamfile.v2 | 15 +++- doc/src/examples/rtree/interprocess.cpp | 105 ++++++++++++++++++++++++ tests/additional_glut_vis.cpp | 2 +- 3 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 doc/src/examples/rtree/interprocess.cpp diff --git a/doc/src/examples/rtree/Jamfile.v2 b/doc/src/examples/rtree/Jamfile.v2 index 9a70926c8..57422ddc1 100644 --- a/doc/src/examples/rtree/Jamfile.v2 +++ b/doc/src/examples/rtree/Jamfile.v2 @@ -6,9 +6,16 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -project boost-geometry-index-doc-src-examples-rtree - : # requirements +exe quick_start : quick_start.cpp ; -exe quick_start : quick_start.cpp ; - +exe interprocess : interprocess.cpp /boost/thread//boost_thread + : + acc:-lrt + acc-pa_risc:-lrt + gcc-mingw:"-lole32 -loleaut32 -lpsapi -ladvapi32" + hpux,gcc:"-Wl,+as,mpas" + : + multi + : # requirements + ; diff --git a/doc/src/examples/rtree/interprocess.cpp b/doc/src/examples/rtree/interprocess.cpp new file mode 100644 index 000000000..be8b4a6d0 --- /dev/null +++ b/doc/src/examples/rtree/interprocess.cpp @@ -0,0 +1,105 @@ +// Boost.Geometry.Index Rtree interprocess example + +// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include //std::system + +//For parent process argc == 1, for child process argc > 1 +int main(int argc, char *argv[]) +{ + using namespace boost::interprocess; + namespace bg = boost::geometry; + namespace bgm = bg::model; + namespace bgi = bg::index; + + typedef bgm::point P; + typedef bgm::box

    B; + + typedef bgi::linear<32, 8> Par; + typedef bgi::translator::def Tr; + typedef allocator Alloc; + typedef bgi::rtree Rtree; + + //Parent process + if ( argc == 1 ) + { + struct shm_remove + { + shm_remove() { shared_memory_object::remove("MySharedMemory"); } + ~shm_remove(){ shared_memory_object::remove("MySharedMemory"); } + } remover; + + managed_shared_memory segment(create_only, "MySharedMemory", 65536); + + std::cout << "Parent: Constructing container\n"; + + Rtree * tree = segment.construct("Rtree")(Par(), Tr(), Alloc(segment.get_segment_manager())); + + std::cout << "Parent: Filling container with 100 boxes\n"; + + for ( float i = 0 ; i < 100 ; i += 1 ) + tree->insert(B(P(i, i), P(i+0.5f, i+0.5f))); + + std::cout << "Parent: Tree content\n"; + Rtree::bounds_type bb = tree->bounds(); + std::cout << "[(" << bg::get<0>(bb.min_corner()) << ", " << bg::get<1>(bb.min_corner()) + << ")(" << bg::get<0>(bb.max_corner()) << ", " << bg::get<1>(bb.max_corner()) << ")]\n"; + + std::cout << "Parent: Running child process\n"; + + std::string s(argv[0]); s += " child "; + if ( 0 != std::system(s.c_str()) ) + return 1; + + if ( segment.find("Rtree").first ) + return 1; + + std::cout << "Parent: Container was properly destroyed by the child process\n"; + } + //Child process + else + { + managed_shared_memory segment(open_only, "MySharedMemory"); + + std::cout << "Child: Searching of the container in shared memory\n"; + + Rtree * tree = segment.find("Rtree").first; + + std::cout << "Child: Querying for objects intersecting box = [(45, 45)(55, 55)]\n"; + + std::vector result; + unsigned k = tree->query(B(P(45, 45), P(55, 55)), std::back_inserter(result)); + + std::cout << "Child: Found objects:\n"; + std::cout << k << "\n"; + BOOST_FOREACH(B const& b, result) + { + std::cout << "[(" << bg::get<0>(b.min_corner()) << ", " << bg::get<1>(b.min_corner()) + << ")(" << bg::get<0>(b.max_corner()) << ", " << bg::get<1>(b.max_corner()) << ")]\n"; + } + std::cout << "\n"; + + std::cout << "Child: Destroying container\n"; + + segment.destroy("Rtree"); + } + + return 0; +}; diff --git a/tests/additional_glut_vis.cpp b/tests/additional_glut_vis.cpp index 9f0bf2417..3ac3bb71a 100644 --- a/tests/additional_glut_vis.cpp +++ b/tests/additional_glut_vis.cpp @@ -7,7 +7,7 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include #define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE From 214e9e82860047619c9a3f5f1b41e84f36e30ce6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 14 Feb 2013 04:34:34 +0000 Subject: [PATCH 318/366] rtree errors fixes related to non-std allocator pointers usage [SVN r82866] --- .../detail/rtree/node/node_d_mem_dynamic.hpp | 23 ++-- .../detail/rtree/node/node_d_mem_static.hpp | 6 +- .../detail/rtree/node/node_s_mem_dynamic.hpp | 71 ++++-------- .../detail/rtree/node/node_s_mem_static.hpp | 20 +++- .../index/detail/rtree/rstar/insert.hpp | 40 +++++-- .../index/detail/rtree/visitors/insert.hpp | 11 +- .../boost/geometry/index/detail/varray.hpp | 104 ++++++++++++------ test/rtree/rtree_interprocess.cpp | 4 + test/rtree/test_rtree_exceptions.hpp | 10 +- 9 files changed, 168 insertions(+), 121 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 92f5d6809..638c084f4 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -257,14 +257,13 @@ public: // create_node_impl -template +template struct create_dynamic_node { template static inline BaseNodePtr apply(AllocNode & alloc_node, AllocElems & alloc_elems) { typedef typename AllocNode::pointer P; - typedef typename AllocNode::value_type V; P p = alloc_node.allocate(1); @@ -275,7 +274,7 @@ struct create_dynamic_node { // NOTE/TODO // Here the whole node may be copied - alloc_node.construct(p, V(alloc_elems)); + alloc_node.construct(p, Node(alloc_elems)); } catch(...) { @@ -289,15 +288,15 @@ struct create_dynamic_node // destroy_node_impl +template struct destroy_dynamic_node { template static inline void apply(AllocNode & alloc_node, BaseNodePtr n) { - typedef typename AllocNode::value_type V; typedef typename AllocNode::pointer P; - P p(&static_cast(rtree::get(*n))); + P p(&static_cast(rtree::get(*n))); alloc_node.destroy(p); alloc_node.deallocate(p, 1); } @@ -315,7 +314,8 @@ struct create_node< apply(Allocators & allocators) { return create_dynamic_node< - typename Allocators::node_pointer + typename Allocators::node_pointer, + dynamic_internal_node >::apply(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); } }; @@ -330,7 +330,8 @@ struct create_node< apply(Allocators & allocators) { return create_dynamic_node< - typename Allocators::node_pointer + typename Allocators::node_pointer, + dynamic_leaf >::apply(allocators.leaf_allocator, allocators.leaf_elements_allocator); } }; @@ -345,7 +346,9 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { - destroy_dynamic_node::apply(allocators.internal_node_allocator, n); + destroy_dynamic_node< + dynamic_internal_node + >::apply(allocators.internal_node_allocator, n); } }; @@ -357,7 +360,9 @@ struct destroy_node< { static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { - destroy_dynamic_node::apply(allocators.leaf_allocator, n); + destroy_dynamic_node< + dynamic_leaf + >::apply(allocators.leaf_allocator, n); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index b6cc23966..314c24cac 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -176,7 +176,8 @@ struct create_node< apply(Allocators & allocators) { return create_dynamic_node< - typename Allocators::node_pointer + typename Allocators::node_pointer, + dynamic_internal_node >::apply(allocators.internal_node_allocator, allocators.internal_node_allocator); } }; @@ -191,7 +192,8 @@ struct create_node< apply(Allocators & allocators) { return create_dynamic_node< - typename Allocators::node_pointer + typename Allocators::node_pointer, + dynamic_leaf >::apply(allocators.leaf_allocator, allocators.leaf_allocator); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index 53a809583..b95316338 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -27,7 +27,7 @@ struct static_internal_node typedef boost::container::vector< std::pair< Box, - typename node::type * + typename Allocators::node_pointer >, typename Allocators::internal_node_elements_allocator_type > elements_type; @@ -85,39 +85,6 @@ struct visitor type; }; -// element's indexable type - -template -struct element_indexable_type< - std::pair< - Box, - boost::variant< - static_leaf, - static_internal_node - > * - >, - Translator -> -{ - typedef Box type; -}; - -// element's indexable getter - -template -inline Box const& -element_indexable(std::pair< - Box, - boost::variant< - static_leaf, - static_internal_node - > * - > const& el, - Translator const&) -{ - return el.first; -} - // allocators template @@ -130,12 +97,20 @@ public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::template rebind< + typename node::type + >::other::pointer node_pointer; + + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other::pointer internal_node_pointer; + typedef typename allocator_type::template rebind< typename node::type >::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair::type *> + std::pair >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< @@ -186,13 +161,13 @@ public: // create_node_variant -template +template struct create_static_node { template - static inline Variant * apply(AllocNode & alloc_node, AllocElems & alloc_elems) + static inline VariantPtr apply(AllocNode & alloc_node, AllocElems & alloc_elems) { - Variant * p = alloc_node.allocate(1); + VariantPtr p = alloc_node.allocate(1); if ( 0 == p ) throw std::bad_alloc(); @@ -218,8 +193,8 @@ struct create_static_node template struct destroy_static_node { - template - static inline void apply(AllocNode & alloc_node, Variant * n) + template + static inline void apply(AllocNode & alloc_node, VariantPtr n) { alloc_node.destroy(n); alloc_node.deallocate(n, 1); @@ -234,13 +209,13 @@ struct create_node< static_internal_node > { - static inline typename node::type * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_static_node< - typename node::type, + typename Allocators::node_pointer, static_internal_node - >::template apply(allocators.node_allocator, allocators.internal_node_elements_allocator); + >::apply(allocators.node_allocator, allocators.internal_node_elements_allocator); } }; @@ -250,13 +225,13 @@ struct create_node< static_leaf > { - static inline typename node::type * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_static_node< - typename node::type, + typename Allocators::node_pointer, static_leaf - >::template apply(allocators.node_allocator, allocators.leaf_elements_allocator); + >::apply(allocators.node_allocator, allocators.leaf_elements_allocator); } }; @@ -268,7 +243,7 @@ struct destroy_node< static_internal_node > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { destroy_static_node< static_internal_node @@ -282,7 +257,7 @@ struct destroy_node< static_leaf > { - static inline void apply(Allocators & allocators, typename node::type * n) + static inline void apply(Allocators & allocators, typename Allocators::node_pointer n) { destroy_static_node< static_leaf diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp index 0aacd1106..7d183538d 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp @@ -27,7 +27,7 @@ struct static_internal_node::type * + typename Allocators::node_pointer >, Parameters::max_elements + 1, typename Allocators::internal_node_elements_allocator_type @@ -97,12 +97,20 @@ public: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::template rebind< + typename node::type + >::other::pointer node_pointer; + + typedef typename allocator_type::template rebind< + typename internal_node::type + >::other::pointer internal_node_pointer; + typedef typename allocator_type::template rebind< typename node::type >::other node_allocator_type; typedef typename allocator_type::template rebind< - std::pair::type *> + std::pair >::other internal_node_elements_allocator_type; typedef typename allocator_type::template rebind< @@ -147,11 +155,11 @@ struct create_node< static_internal_node > { - static inline typename node::type * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_static_node< - typename node::type, + typename Allocators::node_pointer, static_internal_node >::template apply(allocators.node_allocator, allocators.node_allocator); } @@ -163,11 +171,11 @@ struct create_node< static_leaf > { - static inline typename node::type * + static inline typename Allocators::node_pointer apply(Allocators & allocators) { return create_static_node< - typename node::type, + typename Allocators::node_pointer, static_leaf >::template apply(allocators.node_allocator, allocators.node_allocator); } diff --git a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp index cdca30e57..fee7c64de 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp @@ -28,11 +28,12 @@ public: typedef typename rtree::leaf::type leaf; typedef typename Options::parameters_type parameters_type; + typedef typename Allocators::internal_node_pointer internal_node_pointer; - template - static inline void apply(typename rtree::elements_type::type & result_elements, + template + static inline void apply(ResultElements & result_elements, Node & n, - internal_node *parent, + internal_node_pointer parent, size_t current_child_index, parameters_type const& parameters, Translator const& translator, @@ -161,11 +162,18 @@ struct level_insert_base typedef typename base::leaf leaf; typedef typename level_insert_elements_type::type elements_type; + typedef typename index::detail::rtree::container_from_elements_type< + elements_type, + typename elements_type::value_type + >::type result_elements_type; + typedef typename Options::parameters_type parameters_type; - inline level_insert_base(node* & root, - size_t & leafs_level, - Element const& element, + typedef typename Allocators::node_pointer node_pointer; + + inline level_insert_base(node_pointer & root, + size_t & leafs_level, + Element const& element, parameters_type const& parameters, Translator const& translator, Allocators & allocators, @@ -225,7 +233,7 @@ struct level_insert_base } size_t result_relative_level; - elements_type result_elements; + result_elements_type result_elements; }; template @@ -239,7 +247,9 @@ struct level_insert typedef typename Options::parameters_type parameters_type; - inline level_insert(node* & root, + typedef typename Allocators::node_pointer node_pointer; + + inline level_insert(node_pointer & root, size_t & leafs_level, Element const& element, parameters_type const& parameters, @@ -321,7 +331,9 @@ struct level_insert typedef typename Options::parameters_type parameters_type; - inline level_insert(node* & root, + typedef typename Allocators::node_pointer node_pointer; + + inline level_insert(node_pointer & root, size_t & leafs_level, Value const& v, parameters_type const& parameters, @@ -430,8 +444,10 @@ class insert::type internal_node; typedef typename rtree::leaf::type leaf; + typedef typename Allocators::node_pointer node_pointer; + public: - inline insert(node* & root, + inline insert(node_pointer & root, size_t & leafs_level, Element const& element, parameters_type const& parameters, @@ -506,7 +522,7 @@ private: } } - node* & m_root; + node_pointer & m_root; size_t & m_leafs_level; Element const& m_element; diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index 034d1db8c..16c6465a5 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -180,7 +180,7 @@ public: namespace visitors { namespace detail { -template +template struct insert_traverse_data { typedef typename rtree::elements_type::type elements_type; @@ -190,7 +190,7 @@ struct insert_traverse_data : parent(0), current_child_index(0), current_level(0) {} - void move_to_next_level(InternalNode * new_parent, size_t new_child_index) + void move_to_next_level(InternalNodePtr new_parent, size_t new_child_index) { parent = new_parent; current_child_index = new_child_index; @@ -214,7 +214,7 @@ struct insert_traverse_data return rtree::elements(*parent)[current_child_index]; } - InternalNode * parent; + InternalNodePtr parent; size_t current_child_index; size_t current_level; }; @@ -234,6 +234,7 @@ protected: typedef rtree::node_auto_ptr node_auto_ptr; typedef typename Allocators::node_pointer node_pointer; + typedef typename Allocators::internal_node_pointer internal_node_pointer; inline insert(node_pointer & root, size_t & leafs_level, @@ -296,7 +297,7 @@ protected: inline void traverse_apply_visitor(Visitor & visitor, internal_node &n, size_t choosen_node_index) { // save previous traverse inputs and set new ones - insert_traverse_data backup_traverse_data = m_traverse_data; + insert_traverse_data backup_traverse_data = m_traverse_data; // calculate new traverse inputs m_traverse_data.move_to_next_level(&n, choosen_node_index); @@ -381,7 +382,7 @@ protected: size_t & m_leafs_level; // traversing input parameters - insert_traverse_data m_traverse_data; + insert_traverse_data m_traverse_data; Allocators & m_allocators; }; diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index 2d8714a35..f47a13761 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -548,21 +548,25 @@ private: mpl::or_< is_same, is_same + >, + mpl::or_< + is_same, + is_same > >::type use_memcpy; - this->copy_dispatch(&(*first), &(*last), &(*dst), use_memcpy()); // may throw + this->copy_dispatch(first, last, dst, use_memcpy()); // may throw } void copy_dispatch(const value_type * first, const value_type * last, value_type * dst, boost::mpl::bool_ const& /*use_memcpy*/) { - ::memcpy(dst, first, sizeof(value_type) * std::distance(first, last)); + ::memmove(dst, first, sizeof(value_type) * std::distance(first, last)); } template - void copy_dispatch(Iterator first, Iterator last, value_type * dst, + void copy_dispatch(Iterator first, Iterator last, iterator dst, boost::mpl::bool_ const& /*use_memcpy*/) { std::copy(first, last, dst); // may throw @@ -579,11 +583,15 @@ private: mpl::or_< is_same, is_same + >, + mpl::or_< + is_same, + is_same > >::type use_memcpy; - this->uninitialized_copy_dispatch(&(*first), &(*last), &(*dst), use_memcpy()); // may throw + this->uninitialized_copy_dispatch(first, last, dst, use_memcpy()); // may throw } void uninitialized_copy_dispatch(const value_type * first, const value_type * last, value_type * dst, @@ -593,7 +601,7 @@ private: } template - void uninitialized_copy_dispatch(Iterator first, Iterator last, value_type * dst, + void uninitialized_copy_dispatch(Iterator first, Iterator last, iterator dst, boost::mpl::bool_ const& /*use_memcpy*/) { std::uninitialized_copy(first, last, dst); // may throw @@ -611,39 +619,55 @@ private: >::type use_memcpy; - uninitialized_fill_dispatch(&(*dst), v, use_memcpy()); // may throw + uninitialized_fill_dispatch(dst, v, use_memcpy()); // may throw } - void uninitialized_fill_dispatch(value_type * ptr, value_type const& v, + void uninitialized_fill_dispatch(iterator ptr, value_type const& v, boost::mpl::bool_ const& /*use_memcpy*/) { // TODO - check if value_type has operator& defined and call this version only if it hasn't const value_type * vptr = &v; - ::memcpy(ptr, vptr, sizeof(value_type)); + ::memcpy(&(*ptr), vptr, sizeof(value_type)); } template - void uninitialized_fill_dispatch(value_type * ptr, V const& v, + void uninitialized_fill_dispatch(iterator ptr, V const& v, boost::mpl::bool_ const& /*use_memcpy*/) { - new (ptr) value_type(v); // may throw + new (&(*ptr)) value_type(v); // may throw } // move - void move(iterator first, iterator last, iterator dst) + template + void move(Iterator first, Iterator last, iterator dst) { - this->move_dispatch(&(*first), &(*last), &(*dst), has_trivial_assign()); // may throw + typedef typename + mpl::and_< + has_trivial_assign, + mpl::or_< + is_same, + is_same + >, + mpl::or_< + is_same, + is_same + > + >::type + use_memcpy; + + this->move_dispatch(first, last, dst, use_memcpy()); // may throw } - void move_dispatch(value_type * first, value_type * last, value_type * dst, - boost::true_type const& /*has_trivial_assign*/) + void move_dispatch(const value_type * first, const value_type * last, value_type * dst, + boost::mpl::bool_ const& /*use_mem*/) { ::memmove(dst, first, sizeof(value_type) * std::distance(first, last)); } - void move_dispatch(value_type * first, value_type * last, value_type * dst, - boost::false_type const& /*has_trivial_assign*/) + template + void move_dispatch(Iterator first, Iterator last, iterator dst, + boost::mpl::bool_ const& /*use_mem*/) { std::copy(first, last, dst); // may throw } @@ -652,18 +676,28 @@ private: void move_backward(iterator first, iterator last, iterator dst) { - this->move_backward_dispatch(&(*first), &(*last), &(*dst), has_trivial_assign()); // may throw + typedef typename + mpl::and_< + has_trivial_assign, + mpl::or_< + is_same, + is_same + > + >::type + use_memcpy; + + this->move_backward_dispatch(first, last, dst, use_memcpy()); // may throw } void move_backward_dispatch(value_type * first, value_type * last, value_type * dst, - boost::true_type const& /*has_trivial_assign*/) + boost::mpl::bool_ const& /*has_trivial_assign*/) { difference_type n = std::distance(first, last); ::memmove(dst - n, first, sizeof(value_type) * n); } - void move_backward_dispatch(value_type * first, value_type * last, value_type * dst, - boost::false_type const& /*has_trivial_assign*/) + void move_backward_dispatch(iterator first, iterator last, iterator dst, + boost::mpl::bool_ const& /*has_trivial_assign*/) { std::copy_backward(first, last, dst); // may throw } @@ -673,19 +707,19 @@ private: template void fill(iterator dst, V const& v) { - fill_dispatch(&(*dst), v, has_trivial_assign()); // may throw + fill_dispatch(dst, v, has_trivial_assign()); // may throw } - void fill_dispatch(value_type * ptr, value_type const& v, + void fill_dispatch(iterator ptr, value_type const& v, boost::true_type const& /*has_trivial_assign*/) { // TODO - check if value_type has operator& defined and call this version only if it hasn't const value_type * vptr = &v; - ::memcpy(ptr, vptr, sizeof(value_type)); + ::memcpy(&(*ptr), vptr, sizeof(value_type)); } template - void fill_dispatch(value_type * ptr, V const& v, + void fill_dispatch(iterator ptr, V const& v, boost::false_type const& /*has_trivial_assign*/) { *ptr = v; // may throw @@ -695,14 +729,14 @@ private: void destroy(iterator first, iterator last) { - this->destroy_dispatch(&(*first), &(*last), has_trivial_destructor()); + this->destroy_dispatch(first, last, has_trivial_destructor()); } - void destroy_dispatch(value_type * /*first*/, value_type * /*last*/, + void destroy_dispatch(iterator /*first*/, iterator /*last*/, boost::true_type const& /*has_trivial_destructor*/) {} - void destroy_dispatch(value_type * first, value_type * last, + void destroy_dispatch(iterator first, iterator last, boost::false_type const& /*has_trivial_destructor*/) { for ( ; first != last ; ++first ) @@ -713,14 +747,14 @@ private: void destroy(iterator it) { - this->destroy_dispatch(&(*it), has_trivial_destructor()); + this->destroy_dispatch(it, has_trivial_destructor()); } - void destroy_dispatch(value_type * /*ptr*/, + void destroy_dispatch(iterator /*ptr*/, boost::true_type const& /*has_trivial_destructor*/) {} - void destroy_dispatch(value_type * ptr, + void destroy_dispatch(iterator ptr, boost::false_type const& /*has_trivial_destructor*/) { ptr->~value_type(); @@ -730,21 +764,21 @@ private: void construct(iterator first, iterator last) { - this->construct_dispatch(&(*first), &(*last), has_trivial_constructor()); // may throw + this->construct_dispatch(first, last, has_trivial_constructor()); // may throw } - void construct_dispatch(value_type * /*first*/, value_type * /*last*/, + void construct_dispatch(iterator /*first*/, iterator /*last*/, boost::true_type const& /*has_trivial_constructor*/) {} - void construct_dispatch(value_type * first, value_type * last, + void construct_dispatch(iterator first, iterator last, boost::false_type const& /*has_trivial_constructor*/) { - value_type * it = first; + iterator it = first; try { for ( ; it != last ; ++it ) - new (it) value_type(); // may throw + new (&(*it)) value_type(); // may throw } catch(...) { diff --git a/test/rtree/rtree_interprocess.cpp b/test/rtree/rtree_interprocess.cpp index d7a8d0c16..82f524488 100644 --- a/test/rtree/rtree_interprocess.cpp +++ b/test/rtree/rtree_interprocess.cpp @@ -64,6 +64,10 @@ int test_main(int, char* []) test_rtree_interprocess(bgi::linear<32, 8>()); test_rtree_interprocess(bgi::runtime::linear(32, 8)); + test_rtree_interprocess(bgi::quadratic<32, 8>()); + test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); + test_rtree_interprocess(bgi::rstar<32, 8>()); + test_rtree_interprocess(bgi::runtime::rstar(32, 8)); return 0; } diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/test_rtree_exceptions.hpp index 63c4a3c75..97ba22037 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/test_rtree_exceptions.hpp @@ -241,8 +241,9 @@ struct create_node< throwing_node_settings::throw_if_required(); return create_dynamic_node< - typename Allocators::node_pointer - >::template apply(allocators.internal_node_allocator, allocators.internal_node_allocator); + typename Allocators::node_pointer, + dynamic_internal_node + >::apply(allocators.internal_node_allocator, allocators.internal_node_allocator); } }; @@ -259,8 +260,9 @@ struct create_node< throwing_node_settings::throw_if_required(); return create_dynamic_node< - typename Allocators::node_pointer - >::template apply(allocators.leaf_allocator, allocators.leaf_allocator); + typename Allocators::node_pointer, + dynamic_leaf + >::apply(allocators.leaf_allocator, allocators.leaf_allocator); } }; From bf815512ccce4b04a5a0b3b9d70a10e4f66afe1c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 14 Feb 2013 14:23:09 +0000 Subject: [PATCH 319/366] tests and examples files structure rearranged [SVN r82872] --- .../benchmark.cpp | 4 - .../glut_vis.cpp | 0 test/rtree/Jamfile.v2 | 19 +- test/rtree/exceptions/Jamfile.v2 | 13 + .../{ => exceptions}/rtree_exceptions.cpp | 2 +- .../test_rtree_exceptions.hpp | 2 +- test/rtree/{ => exceptions}/test_throwing.hpp | 0 test/rtree/generated/Jamfile.v2 | 113 +--- test/rtree/interprocess/Jamfile.v2 | 29 ++ .../rtree_interprocess_b2f_linear.cpp | 19 + .../rtree_interprocess_b2f_linear_rt.cpp | 19 + .../rtree_interprocess_b2f_quadratic.cpp | 19 + .../rtree_interprocess_b2f_quadratic_rt.cpp | 19 + .../rtree_interprocess_b2f_rstar.cpp | 19 + .../rtree_interprocess_b2f_rstar_rt.cpp | 19 + .../test_interprocess.hpp} | 14 - .../rtree}/rtree_test_generator.cpp | 0 tests/additional_sizes_and_times.cpp | 485 ------------------ 18 files changed, 173 insertions(+), 622 deletions(-) rename tests/additional_speed.cpp => example/benchmark.cpp (98%) rename tests/additional_glut_vis.cpp => example/glut_vis.cpp (100%) create mode 100644 test/rtree/exceptions/Jamfile.v2 rename test/rtree/{ => exceptions}/rtree_exceptions.cpp (99%) rename test/rtree/{ => exceptions}/test_rtree_exceptions.hpp (99%) rename test/rtree/{ => exceptions}/test_throwing.hpp (100%) create mode 100644 test/rtree/interprocess/Jamfile.v2 create mode 100644 test/rtree/interprocess/rtree_interprocess_b2f_linear.cpp create mode 100644 test/rtree/interprocess/rtree_interprocess_b2f_linear_rt.cpp create mode 100644 test/rtree/interprocess/rtree_interprocess_b2f_quadratic.cpp create mode 100644 test/rtree/interprocess/rtree_interprocess_b2f_quadratic_rt.cpp create mode 100644 test/rtree/interprocess/rtree_interprocess_b2f_rstar.cpp create mode 100644 test/rtree/interprocess/rtree_interprocess_b2f_rstar_rt.cpp rename test/rtree/{rtree_interprocess.cpp => interprocess/test_interprocess.hpp} (81%) rename {tests => test/rtree}/rtree_test_generator.cpp (100%) delete mode 100644 tests/additional_sizes_and_times.cpp diff --git a/tests/additional_speed.cpp b/example/benchmark.cpp similarity index 98% rename from tests/additional_speed.cpp rename to example/benchmark.cpp index 014ae3fbc..ec036560b 100644 --- a/tests/additional_speed.cpp +++ b/example/benchmark.cpp @@ -8,17 +8,13 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include -#include #include #include #include -#include - int main() { boost::timer tim; diff --git a/tests/additional_glut_vis.cpp b/example/glut_vis.cpp similarity index 100% rename from tests/additional_glut_vis.cpp rename to example/glut_vis.cpp diff --git a/test/rtree/Jamfile.v2 b/test/rtree/Jamfile.v2 index e637ce08a..d906c8880 100644 --- a/test/rtree/Jamfile.v2 +++ b/test/rtree/Jamfile.v2 @@ -6,21 +6,6 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +build-project exceptions ; +build-project interprocess ; build-project generated ; - -test-suite boost-geometry-index-rtree - : - [ run rtree_exceptions.cpp ] - ; - -test-suite boost-geometry-index-rtree_interprocess - : [ run rtree_interprocess.cpp /boost/thread//boost_thread - : # additional args - : # test-files - : # requirements - acc:-lrt - acc-pa_risc:-lrt - gcc-mingw:"-lole32 -loleaut32 -lpsapi -ladvapi32" - hpux,gcc:"-Wl,+as,mpas" - ] : multi - ; \ No newline at end of file diff --git a/test/rtree/exceptions/Jamfile.v2 b/test/rtree/exceptions/Jamfile.v2 new file mode 100644 index 000000000..dc5685ca6 --- /dev/null +++ b/test/rtree/exceptions/Jamfile.v2 @@ -0,0 +1,13 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +test-suite boost-geometry-index-rtree-exceptions + : + [ run rtree_exceptions.cpp ] + ; + diff --git a/test/rtree/rtree_exceptions.cpp b/test/rtree/exceptions/rtree_exceptions.cpp similarity index 99% rename from test/rtree/rtree_exceptions.cpp rename to test/rtree/exceptions/rtree_exceptions.cpp index edb6d5560..b28c7974b 100644 --- a/test/rtree/rtree_exceptions.cpp +++ b/test/rtree/exceptions/rtree_exceptions.cpp @@ -7,7 +7,7 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include #include #include diff --git a/test/rtree/test_rtree_exceptions.hpp b/test/rtree/exceptions/test_rtree_exceptions.hpp similarity index 99% rename from test/rtree/test_rtree_exceptions.hpp rename to test/rtree/exceptions/test_rtree_exceptions.hpp index 97ba22037..b2149a82e 100644 --- a/test/rtree/test_rtree_exceptions.hpp +++ b/test/rtree/exceptions/test_rtree_exceptions.hpp @@ -16,7 +16,7 @@ #include -#include +#include namespace boost { namespace geometry { namespace index { diff --git a/test/rtree/test_throwing.hpp b/test/rtree/exceptions/test_throwing.hpp similarity index 100% rename from test/rtree/test_throwing.hpp rename to test/rtree/exceptions/test_throwing.hpp diff --git a/test/rtree/generated/Jamfile.v2 b/test/rtree/generated/Jamfile.v2 index 9a9b5e510..7d1cb2cfa 100644 --- a/test/rtree/generated/Jamfile.v2 +++ b/test/rtree/generated/Jamfile.v2 @@ -1,108 +1,21 @@ # Boost.Geometry Index # -# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -test-suite boost-geometry-index-rtree-generated - : - [ run rtree_p2d_linear.cpp ] - [ run rtree_b2d_linear.cpp ] - [ run rtree_p2d_quadratic.cpp ] - [ run rtree_b2d_quadratic.cpp ] - [ run rtree_p2d_rstar.cpp ] - [ run rtree_b2d_rstar.cpp ] - [ run rtree_p2d_linear_rt.cpp ] - [ run rtree_b2d_linear_rt.cpp ] - [ run rtree_p2d_quadratic_rt.cpp ] - [ run rtree_b2d_quadratic_rt.cpp ] - [ run rtree_p2d_rstar_rt.cpp ] - [ run rtree_b2d_rstar_rt.cpp ] - [ run rtree_p2f_linear.cpp ] - [ run rtree_b2f_linear.cpp ] - [ run rtree_p2f_quadratic.cpp ] - [ run rtree_b2f_quadratic.cpp ] - [ run rtree_p2f_rstar.cpp ] - [ run rtree_b2f_rstar.cpp ] - [ run rtree_p2f_linear_rt.cpp ] - [ run rtree_b2f_linear_rt.cpp ] - [ run rtree_p2f_quadratic_rt.cpp ] - [ run rtree_b2f_quadratic_rt.cpp ] - [ run rtree_p2f_rstar_rt.cpp ] - [ run rtree_b2f_rstar_rt.cpp ] - [ run rtree_p2i_linear.cpp ] - [ run rtree_b2i_linear.cpp ] - [ run rtree_p2i_quadratic.cpp ] - [ run rtree_b2i_quadratic.cpp ] - [ run rtree_p2i_rstar.cpp ] - [ run rtree_b2i_rstar.cpp ] - [ run rtree_p2i_linear_rt.cpp ] - [ run rtree_b2i_linear_rt.cpp ] - [ run rtree_p2i_quadratic_rt.cpp ] - [ run rtree_b2i_quadratic_rt.cpp ] - [ run rtree_p2i_rstar_rt.cpp ] - [ run rtree_b2i_rstar_rt.cpp ] - [ run rtree_p2tt_linear.cpp ] - [ run rtree_b2tt_linear.cpp ] - [ run rtree_p2tt_quadratic.cpp ] - [ run rtree_b2tt_quadratic.cpp ] - [ run rtree_p2tt_rstar.cpp ] - [ run rtree_b2tt_rstar.cpp ] - [ run rtree_p2tt_linear_rt.cpp ] - [ run rtree_b2tt_linear_rt.cpp ] - [ run rtree_p2tt_quadratic_rt.cpp ] - [ run rtree_b2tt_quadratic_rt.cpp ] - [ run rtree_p2tt_rstar_rt.cpp ] - [ run rtree_b2tt_rstar_rt.cpp ] - [ run rtree_p3d_linear.cpp ] - [ run rtree_b3d_linear.cpp ] - [ run rtree_p3d_quadratic.cpp ] - [ run rtree_b3d_quadratic.cpp ] - [ run rtree_p3d_rstar.cpp ] - [ run rtree_b3d_rstar.cpp ] - [ run rtree_p3d_linear_rt.cpp ] - [ run rtree_b3d_linear_rt.cpp ] - [ run rtree_p3d_quadratic_rt.cpp ] - [ run rtree_b3d_quadratic_rt.cpp ] - [ run rtree_p3d_rstar_rt.cpp ] - [ run rtree_b3d_rstar_rt.cpp ] - [ run rtree_p3f_linear.cpp ] - [ run rtree_b3f_linear.cpp ] - [ run rtree_p3f_quadratic.cpp ] - [ run rtree_b3f_quadratic.cpp ] - [ run rtree_p3f_rstar.cpp ] - [ run rtree_b3f_rstar.cpp ] - [ run rtree_p3f_linear_rt.cpp ] - [ run rtree_b3f_linear_rt.cpp ] - [ run rtree_p3f_quadratic_rt.cpp ] - [ run rtree_b3f_quadratic_rt.cpp ] - [ run rtree_p3f_rstar_rt.cpp ] - [ run rtree_b3f_rstar_rt.cpp ] - [ run rtree_p3i_linear.cpp ] - [ run rtree_b3i_linear.cpp ] - [ run rtree_p3i_quadratic.cpp ] - [ run rtree_b3i_quadratic.cpp ] - [ run rtree_p3i_rstar.cpp ] - [ run rtree_b3i_rstar.cpp ] - [ run rtree_p3i_linear_rt.cpp ] - [ run rtree_b3i_linear_rt.cpp ] - [ run rtree_p3i_quadratic_rt.cpp ] - [ run rtree_b3i_quadratic_rt.cpp ] - [ run rtree_p3i_rstar_rt.cpp ] - [ run rtree_b3i_rstar_rt.cpp ] - [ run rtree_p3tt_linear.cpp ] - [ run rtree_b3tt_linear.cpp ] - [ run rtree_p3tt_quadratic.cpp ] - [ run rtree_b3tt_quadratic.cpp ] - [ run rtree_p3tt_rstar.cpp ] - [ run rtree_b3tt_rstar.cpp ] - [ run rtree_p3tt_linear_rt.cpp ] - [ run rtree_b3tt_linear_rt.cpp ] - [ run rtree_p3tt_quadratic_rt.cpp ] - [ run rtree_b3tt_quadratic_rt.cpp ] - [ run rtree_p3tt_rstar_rt.cpp ] - [ run rtree_b3tt_rstar_rt.cpp ] - ; +rule test_all +{ + local all_rules = ; + for local fileb in [ glob *.cpp ] + { + all_rules += [ run $(fileb) ] ; + } + + return $(all_rules) ; +} + +test-suite boost-geometry-index-rtree-generated : [ test_all r ] ; diff --git a/test/rtree/interprocess/Jamfile.v2 b/test/rtree/interprocess/Jamfile.v2 new file mode 100644 index 000000000..be709a43b --- /dev/null +++ b/test/rtree/interprocess/Jamfile.v2 @@ -0,0 +1,29 @@ +# Boost.Geometry Index +# +# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +# +# Use, modification and distribution is subject to the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +rule test_all +{ + local all_rules = ; + + for local fileb in [ glob *.cpp ] + { + all_rules += [ run $(fileb) /boost/thread//boost_thread + : # additional args + : # test-files + : # requirements + acc:-lrt + acc-pa_risc:-lrt + gcc-mingw:"-lole32 -loleaut32 -lpsapi -ladvapi32" + hpux,gcc:"-Wl,+as,mpas" + ] ; + } + + return $(all_rules) ; +} + +test-suite boost-geometry-index-rtree-interprocess : [ test_all r ] : multi ; diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_linear.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_linear.cpp new file mode 100644 index 000000000..72d22885c --- /dev/null +++ b/test/rtree/interprocess/rtree_interprocess_b2f_linear.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2f; + + test_rtree_interprocess(bgi::linear<32, 8>()); + + return 0; +} diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_linear_rt.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_linear_rt.cpp new file mode 100644 index 000000000..44c15b52d --- /dev/null +++ b/test/rtree/interprocess/rtree_interprocess_b2f_linear_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2f; + + test_rtree_interprocess(bgi::runtime::linear(32, 8)); + + return 0; +} diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_quadratic.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_quadratic.cpp new file mode 100644 index 000000000..91a93a5e1 --- /dev/null +++ b/test/rtree/interprocess/rtree_interprocess_b2f_quadratic.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2f; + + test_rtree_interprocess(bgi::quadratic<32, 8>()); + + return 0; +} diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_quadratic_rt.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_quadratic_rt.cpp new file mode 100644 index 000000000..1bc58b2e7 --- /dev/null +++ b/test/rtree/interprocess/rtree_interprocess_b2f_quadratic_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2f; + + test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); + + return 0; +} diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_rstar.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_rstar.cpp new file mode 100644 index 000000000..a47d89903 --- /dev/null +++ b/test/rtree/interprocess/rtree_interprocess_b2f_rstar.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2f; + + test_rtree_interprocess(bgi::rstar<32, 8>()); + + return 0; +} diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_rstar_rt.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_rstar_rt.cpp new file mode 100644 index 000000000..4a4504f15 --- /dev/null +++ b/test/rtree/interprocess/rtree_interprocess_b2f_rstar_rt.cpp @@ -0,0 +1,19 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +int test_main(int, char* []) +{ + typedef bg::model::point P2f; + + test_rtree_interprocess(bgi::runtime::rstar(32, 8)); + + return 0; +} diff --git a/test/rtree/rtree_interprocess.cpp b/test/rtree/interprocess/test_interprocess.hpp similarity index 81% rename from test/rtree/rtree_interprocess.cpp rename to test/rtree/interprocess/test_interprocess.hpp index 82f524488..b0694aceb 100644 --- a/test/rtree/rtree_interprocess.cpp +++ b/test/rtree/interprocess/test_interprocess.hpp @@ -57,17 +57,3 @@ void test_rtree_interprocess(Parameters const& parameters = Parameters()) //segment.destroy_ptr(tree); } - -int test_main(int, char* []) -{ - typedef bg::model::point P2f; - - test_rtree_interprocess(bgi::linear<32, 8>()); - test_rtree_interprocess(bgi::runtime::linear(32, 8)); - test_rtree_interprocess(bgi::quadratic<32, 8>()); - test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); - test_rtree_interprocess(bgi::rstar<32, 8>()); - test_rtree_interprocess(bgi::runtime::rstar(32, 8)); - - return 0; -} diff --git a/tests/rtree_test_generator.cpp b/test/rtree/rtree_test_generator.cpp similarity index 100% rename from tests/rtree_test_generator.cpp rename to test/rtree/rtree_test_generator.cpp diff --git a/tests/additional_sizes_and_times.cpp b/tests/additional_sizes_and_times.cpp deleted file mode 100644 index 8e2185746..000000000 --- a/tests/additional_sizes_and_times.cpp +++ /dev/null @@ -1,485 +0,0 @@ -// Boost.Geometry Index -// Additional tests - -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include - -#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE -#include -#include - -#include -#include - -#include -#include -#include - -template -struct test_pred -{ - bool operator()(V const& v) const - { - return v.second % 2 != 0; - } -}; - -int main() -{ - boost::timer tim; - - namespace bg = boost::geometry; - namespace bgi = bg::index; - - //typedef bg::model::d2::point_xy P; - typedef bg::model::point P; - typedef bg::model::box

    B; - typedef bgi::rtree< - std::pair, - bgi::linear<32, 8>, - bgi::translator::def< std::pair >/*, - boost::fast_pool_allocator< std::pair >*/ - > RT; - //typedef bgi::rtree, bgi::quadratic<32, 8> > RT; - //typedef bgi::rtree, bgi::rstar<32, 8> > RT; - /*typedef bgi::rtree< - std::pair, - bgi::options::rtree, bgi::reinsert_tag, bgi::choose_by_area_diff_tag, bgi::rstar_tag, bgi::default_tag> - > RT;*/ - - // load config file - std::ifstream file_cfg("config.txt"); - size_t values_count = 0; - size_t remove_count = 0; - size_t queries_count = 0; - std::string file_name(""); - file_cfg >> values_count; - file_cfg >> remove_count; - file_cfg >> queries_count; - file_cfg >> file_name; - std::cout << "v: " << values_count << ", r: " << remove_count << ", q: " << queries_count << "\n"; - - if ( values_count < remove_count ) - { - std::cout << "can't remove more data than was inserted\n"; - return 0; - } - - // prepare data buffer - std::vector< std::pair > coords; - coords.reserve(values_count); - - // load test coordinates - if ( file_name != "" ) - { - std::ifstream file(file_name.c_str()); - if ( !file.is_open() ) - { - std::cout << "can't open file containing coordinates\n"; - return 0; - } - - std::cout << "loading data\n"; - for ( size_t i = 0 ; i < values_count ; ++i ) - { - std::pair v; - file >> v.first; - file >> v.second; - coords.push_back(v); - } - std::cout << "loaded\n"; - - if ( coords.size() != values_count || coords.size() < remove_count ) - { - std::cout << "not enough coordinates loaded\n"; - return 0; - } - } - // randomize - else - { - boost::mt19937 rng; - //rng.seed(static_cast(std::time(0))); - float max_val = static_cast(values_count / 2); - boost::uniform_real range(-max_val, max_val); - boost::variate_generator > rnd(rng, range); - - //::srand( ::time(NULL) ); - //float factor = values_count / float(RAND_MAX); - //float comp = values_count / 2; - - std::cout << "randomizing data\n"; - for ( size_t i = 0 ; i < values_count ; ++i ) - { - coords.push_back(std::make_pair(rnd(), rnd())); - //float x = rand() * factor + comp; - //float y = rand() * factor + comp; - //coords.push_back( std::make_pair( x, y )); - } - std::cout << "randomized\n"; - } - - // create rtree - RT t; - - // elements inserting test - { - std::cout << "rtree inserting time test... (" - << values_count << ")\n"; - tim.restart(); - for (size_t i = 0 ; i < values_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - - t.insert(std::make_pair(b, i)); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - } - - // elements inserting test using insert_iterator - { - RT t; - - std::cout << "rtree inserting time test using insert_iterator<>... (" - << values_count << ")\n"; - bgi::insert_iterator ii = bgi::inserter(t); - tim.restart(); - for (size_t i = 0 ; i < values_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - - *ii++ = std::make_pair(b, i); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - } - - std::vector< std::pair > v; - - // elements inserting test - { - std::cout << "vector inserting time test... (" - << values_count << ")\n"; - tim.restart(); - for (size_t i = 0 ; i < values_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - - v.push_back(std::make_pair(b, i)); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - } - - // check - if ( bgi::detail::rtree::are_boxes_ok(t) ) - std::cout << "BOXES OK\n"; - else - std::cout << "WRONG BOXES\n"; - if ( bgi::detail::rtree::are_levels_ok(t) ) - std::cout << "LEVELS OK\n"; - else - std::cout << "WRONG LEVELS\n"; - - // searching test - { - std::cout << "query(intersects(B)) searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // copying test - { - std::cout << "rtree copying time test... (" - << values_count << ")\n"; - tim.restart(); - RT t_copy(t); - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "new size: " << t_copy.size() << '\n'; - - // t_copy searching test - { - std::cout << "tree copy query(intersects(B)) searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t_copy.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - } - - // searching test - { - std::cout << "query(!disjoint(B)) searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.query(!bgi::disjoint(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // searching test - { - std::cout << "query(B) searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // searching test - { - std::cout << "pair: query(B) and value(odd index) searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.query( - B(P(x - 10, y - 10), P(x + 10, y + 10)) && bgi::value(test_pred< std::pair >()) - , std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // searching test - { - std::cout << "tuple: query(B) and value(odd index) searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.query( - B(P(x - 10, y - 10), P(x + 10, y + 10)) && bgi::value(test_pred< std::pair >()) - , std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // searching test - { - std::cout << "vector searching time test... (" - << queries_count / 1000 << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 1000 ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - for ( std::vector< std::pair >::const_iterator it = v.begin(); - it != v.end() ; - ++it ) - { - if ( bg::intersects( - it->first, - B(P(x - 10, y - 10), P(x + 10, y + 10)) - ) - ) - result.push_back(*it); - } - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // searching test - { - std::cout << "nearest 5 searching time test... (" - << queries_count / 10 << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 10 ; ++i ) - { - float x = coords[i].first + 100; - float y = coords[i].second + 100; - std::vector< std::pair > result; - temp += t.query(bgi::nearest(P(x, y), 5), std::back_inserter(result)); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // searching test - { - std::cout << "vector nearest searching time test... (" - << queries_count / 1000 << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count / 1000 ; ++i ) - { - typedef bg::default_distance_result::type distance_type; - - float x = coords[i].first + 100; - float y = coords[i].second + 100; - std::pair result; - distance_type dist = (std::numeric_limits::max)(); - - for ( std::vector< std::pair >::const_iterator it = v.begin(); - it != v.end(); - ++it ) - { - distance_type cd = bgi::detail::comparable_distance_near(P(x, y), it->first); - - if ( cd < dist ) - { - result = *it; - dist = cd; - } - } - temp += dist < (std::numeric_limits::max)() ? 1 : 0; - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // elements removing test - { - std::cout << "removing time test... (" - << remove_count << ")\n"; - tim.restart(); - for (size_t i = 0 ; i < remove_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - - t.remove(std::make_pair(b, i)); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - } - - // check - if ( bgi::detail::rtree::are_boxes_ok(t) ) - std::cout << "BOXES OK\n"; - else - std::cout << "WRONG BOXES\n"; - if ( bgi::detail::rtree::are_levels_ok(t) ) - std::cout << "LEVELS OK\n"; - else - std::cout << "WRONG LEVELS\n"; - - // searching test - { - std::cout << "searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - // inserting test - { - std::cout << "inserting time test... (" - << remove_count << ")\n"; - tim.restart(); - for (size_t i = 0 ; i < remove_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - B b(P(x - 0.5f, y - 0.5f), P(x + 0.5f, y + 0.5f)); - - t.insert(std::make_pair(b, i)); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - } - - // check - if ( bgi::detail::rtree::are_boxes_ok(t) ) - std::cout << "BOXES OK\n"; - else - std::cout << "WRONG BOXES\n"; - if ( bgi::detail::rtree::are_levels_ok(t) ) - std::cout << "LEVELS OK\n"; - else - std::cout << "WRONG LEVELS\n"; - - // searching test - { - std::cout << "searching time test... (" - << queries_count << ")\n"; - tim.restart(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - std::deque< std::pair > result; - t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); - temp += result.size(); - } - std::cout << "time: " << tim.elapsed() << "s\n"; - std::cout << "found: " << temp << "\n"; - } - - std::cin.get(); - - return 0; -} From b2cf4855121e5779639674cfd080a087bcd97c50 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 14 Feb 2013 14:33:47 +0000 Subject: [PATCH 320/366] Added Examples to the rtree docs. [SVN r82873] --- doc/html/geometry_index/r_tree.html | 6 + doc/html/geometry_index/r_tree/queries.html | 6 +- doc/html/geometry_index/r_tree/reference.html | 24 +- .../geometry_index/r_tree/rtree_examples.html | 218 ++++++++++++++++++ doc/html/index.html | 3 +- doc/imports.qbk | 1 + doc/rtree.qbk | 1 + doc/rtree/examples.qbk | 21 ++ doc/src/examples/rtree/interprocess.cpp | 4 + doc/src/examples/rtree/quick_start.cpp | 4 + 10 files changed, 272 insertions(+), 16 deletions(-) create mode 100644 doc/html/geometry_index/r_tree/rtree_examples.html create mode 100644 doc/rtree/examples.qbk diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 4dd17eeba..582c55af6 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -64,6 +64,12 @@

    Inserting query results into the other R-tree
    +
    Examples
    +
    +
    Quick + start
    +
    Interprocess
    +
    Reference
    boost::geometry::index::rtree
    diff --git a/doc/html/geometry_index/r_tree/queries.html b/doc/html/geometry_index/r_tree/queries.html index 90cacf35b..e32d7352f 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext

    @@ -417,7 +417,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index a3868558f..893f01555 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -6,7 +6,7 @@ - + @@ -19,7 +19,7 @@

    -PrevUpHome +PrevUpHome

    @@ -47,7 +47,7 @@ boost::geometry::index::rtree

    - + The R-tree spatial index.

    @@ -4500,7 +4500,7 @@ The R-tree spatial index. boost::geometry::index::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -4575,7 +4575,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -4650,7 +4650,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

    - + R*-tree creation algorithm parameters.

    @@ -4754,7 +4754,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

    - + Linear r-tree creation algorithm parameters.

    @@ -4890,7 +4890,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -5026,7 +5026,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

    - + R*-tree creation algorithm parameters.

    @@ -6606,7 +6606,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

    - + The default translator.

    @@ -6676,7 +6676,7 @@ The default translator. boost::geometry::index::translator::index

    - + The index translator.

    @@ -6972,7 +6972,7 @@ The index translator.
    -PrevUpHome +PrevUpHome
    diff --git a/doc/html/geometry_index/r_tree/rtree_examples.html b/doc/html/geometry_index/r_tree/rtree_examples.html new file mode 100644 index 000000000..cd65d78a3 --- /dev/null +++ b/doc/html/geometry_index/r_tree/rtree_examples.html @@ -0,0 +1,218 @@ + + + +Examples + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + + +
    + +

    +

    +
    #include <boost/geometry.hpp>
    +#include <boost/geometry/geometries/point_xy.hpp>
    +#include <boost/geometry/geometries/box.hpp>
    +
    +#include <boost/geometry/index/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;
    +
    +int main(void)
    +{
    +    typedef bg::model::point<float, 2, bg::cs::cartesian> point;
    +    typedef bg::model::box<point> box;
    +    typedef std::pair<box, unsigned> value;
    +
    +    // create the rtree using default constructor
    +    bgi::rtree< value, bgi::quadratic<32, 8> > rtree;
    +
    +    // 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));
    +    }
    +
    +    // find values intersecting some area defined by a box
    +    box query_box(point(0, 0), point(5, 5));
    +    std::vector<value> result_s;
    +    rtree.query(query_box, std::back_inserter(result_s));
    +
    +    // find 5 nearest values to a point
    +    std::vector<value> result_n;
    +    rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
    +
    +    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;
    +
    +    return 0;
    +}
    +
    +

    +

    +
    +
    + +

    +

    +
    #include <boost/geometry.hpp>
    +#include <boost/geometry/geometries/point.hpp>
    +#include <boost/geometry/geometries/box.hpp>
    +
    +#include <boost/geometry/index/rtree.hpp>
    +
    +#include <boost/foreach.hpp>
    +
    +#include <boost/interprocess/managed_shared_memory.hpp>
    +#include <boost/interprocess/allocators/allocator.hpp>
    +
    +#include <vector>
    +#include <string>
    +#include <cstdlib> //std::system
    +
    +//For parent process argc == 1, for child process argc > 1
    +int main(int argc, char *argv[])
    +{
    +    using namespace boost::interprocess;
    +    namespace bg = boost::geometry;
    +    namespace bgm = bg::model;
    +    namespace bgi = bg::index;
    +
    +    typedef bgm::point<float, 2, bg::cs::cartesian> P;
    +    typedef bgm::box<P> B;
    +
    +    typedef bgi::linear<32, 8> Par;
    +    typedef bgi::translator::def<B> Tr;
    +    typedef allocator<B, managed_shared_memory::segment_manager> Alloc;
    +    typedef bgi::rtree<B, Par, Tr, Alloc> Rtree;
    +
    +    //Parent process
    +    if ( argc == 1 )
    +    {
    +        struct shm_remove
    +        {
    +            shm_remove() { shared_memory_object::remove("MySharedMemory"); }
    +            ~shm_remove(){ shared_memory_object::remove("MySharedMemory"); }
    +        } remover;
    +
    +        managed_shared_memory segment(create_only, "MySharedMemory", 65536);
    +
    +        std::cout << "Parent: Constructing container\n";
    +
    +        Rtree * tree = segment.construct<Rtree>("Rtree")(Par(), Tr(), Alloc(segment.get_segment_manager()));
    +
    +        std::cout << "Parent: Filling container with 100 boxes\n";
    +
    +        for ( float i = 0 ; i < 100 ; i += 1 )
    +            tree->insert(B(P(i, i), P(i+0.5f, i+0.5f)));
    +
    +        std::cout << "Parent: Tree content\n";
    +        Rtree::bounds_type bb = tree->bounds();
    +        std::cout << "[(" << bg::get<0>(bb.min_corner()) << ", " << bg::get<1>(bb.min_corner())
    +                  << ")(" << bg::get<0>(bb.max_corner()) << ", " << bg::get<1>(bb.max_corner()) << ")]\n";
    +
    +        std::cout << "Parent: Running child process\n";
    +
    +        std::string s(argv[0]); s += " child ";
    +        if ( 0 != std::system(s.c_str()) )
    +            return 1;
    +
    +        if ( segment.find<Rtree>("Rtree").first )
    +            return 1;
    +
    +        std::cout << "Parent: Container was properly destroyed by the child process\n";
    +   }
    +   //Child process
    +   else
    +   {
    +      managed_shared_memory segment(open_only, "MySharedMemory");
    +
    +      std::cout << "Child: Searching of the container in shared memory\n";
    +
    +      Rtree * tree = segment.find<Rtree>("Rtree").first;
    +
    +      std::cout << "Child: Querying for objects intersecting box = [(45, 45)(55, 55)]\n";
    +
    +      std::vector<B> result;
    +      unsigned k = tree->query(B(P(45, 45), P(55, 55)), std::back_inserter(result));
    +
    +      std::cout << "Child: Found objects:\n";
    +      std::cout << k << "\n";
    +      BOOST_FOREACH(B const& b, result)
    +      {
    +        std::cout << "[(" << bg::get<0>(b.min_corner()) << ", " << bg::get<1>(b.min_corner())
    +                  << ")(" << bg::get<0>(b.max_corner()) << ", " << bg::get<1>(b.max_corner()) << ")]\n";
    +      }
    +      std::cout << "\n";
    +
    +      std::cout << "Child: Destroying container\n";
    +
    +      segment.destroy<Rtree>("Rtree");
    +   }
    +
    +   return 0;
    +};
    +
    +

    +

    +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/index.html b/doc/html/index.html index b06e49ed0..2fd9c8890 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -44,13 +44,14 @@
    Creation and modification
    Queries
    +
    Examples
    Reference
    - +

    Last revised: February 11, 2013 at 19:05:08 GMT

    Last revised: February 14, 2013 at 14:32:07 GMT


    diff --git a/doc/imports.qbk b/doc/imports.qbk index f05ec3443..79c49edbd 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -9,3 +9,4 @@ =============================================================================/] [import src/examples/rtree/quick_start.cpp] +[import src/examples/rtree/interprocess.cpp] diff --git a/doc/rtree.qbk b/doc/rtree.qbk index aeb717188..67cc13ffe 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -14,6 +14,7 @@ [include rtree/quickstart.qbk] [include rtree/creation.qbk] [include rtree/query.qbk] +[include rtree/examples.qbk] [section:reference Reference] diff --git a/doc/rtree/examples.qbk b/doc/rtree/examples.qbk new file mode 100644 index 000000000..5691be531 --- /dev/null +++ b/doc/rtree/examples.qbk @@ -0,0 +1,21 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2013 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section:rtree_examples Examples] + +[section Quick start] +[rtree_quickstart] +[endsect] + +[section Interprocess] +[rtree_interprocess] +[endsect] + +[endsect] diff --git a/doc/src/examples/rtree/interprocess.cpp b/doc/src/examples/rtree/interprocess.cpp index be8b4a6d0..612d8c88f 100644 --- a/doc/src/examples/rtree/interprocess.cpp +++ b/doc/src/examples/rtree/interprocess.cpp @@ -6,6 +6,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +//[rtree_interprocess + #include #include #include @@ -103,3 +105,5 @@ int main(int argc, char *argv[]) return 0; }; + +//] \ No newline at end of file diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index 917fa1df7..d64d38a29 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -8,6 +8,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +//[rtree_quickstart + //[rtree_quickstart_include #include @@ -75,3 +77,5 @@ int main(void) return 0; } + +//] \ No newline at end of file From 322c1ad76024133802c62eb0ead4b337964bfd85 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 14 Feb 2013 22:37:12 +0000 Subject: [PATCH 321/366] Updated docs - key features of the R-tree implementation [SVN r82895] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 44 +- doc/html/geometry_index/r_tree/queries.html | 6 +- doc/html/geometry_index/r_tree/reference.html | 560 +++++++++--------- .../geometry_index/r_tree/rtree_examples.html | 2 +- .../r_tree/rtree_quickstart.html | 4 +- doc/html/index.html | 4 +- doc/rtree/introduction.qbk | 7 +- 10 files changed, 322 insertions(+), 319 deletions(-) diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index c00e43835..dd5718dbb 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 582c55af6..f5f56bd76 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 7909b5d67..d80f7223e 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 825cb4cae..787f33d58 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

              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 + 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 [2]. + close to some point in space [2].

              The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

              The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -179,42 +179,44 @@

            - Implementation + Implementation details

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

            -
              +
              • capable to store arbitrary Value type,
              • -
              • - capable to store Value type with no default constructor, -
              • 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, + passed as compile- or run-time parameters,
              • - advanced queries - e.g. search for 5 nearest values further than some - minimal distance and intersecting some region but not within the other - one. + advanced queries - e.g. search for 5 nearest values to some point and + intersecting some region but not within the other one, +
              • +
              • + C++11 conformant: move semantics, stateful allocators, +
              • +
              • + capable to store Value type with no default constructor.
              - Dependencies + Dependencies

              R-tree depends on Boost.Move, Boost.Container, Boost.Tuple.

              - Contributors + Contributors

              The spatial index was originally started by Federico J. Fernandez during @@ -222,7 +224,7 @@

              - Spatial + Spatial thanks

              @@ -231,20 +233,20 @@ list for their help.

              -

              -

              [1] +


              +

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

              -

              [2] +

              [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

              -

              [3] +

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

              -

              [4] +

              [4] 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/queries.html b/doc/html/geometry_index/r_tree/queries.html index e32d7352f..7a2a90633 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -44,7 +44,7 @@ Queries returns Values which meets some predicates. Currently supported are three types of predicates:

              -
                +
                • spatial predicates - defining relationship between stored Values and some Geometry, @@ -60,7 +60,7 @@

                  For example queries may be used to retrieve Values:

                  -
                    +
                    • intersecting some area but not within other area,
                    • diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 893f01555..be071fa37 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -47,12 +47,12 @@ boost::geometry::index::rtree

                - + The R-tree spatial index.

                - Description + Description

                This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

                - Parameters + Parameters

                The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

                Predefined algorithms with compile-time parameters are:

                -
                  +
                  • boost::geometry::index::linear,
                  • @@ -84,7 +84,7 @@ The R-tree spatial index.

                    Predefined algorithms with run-time parameters are:

                    -
                      +
                      - Translator + Translator

                      The Translator translates from Value to Indexable each time r-tree requires @@ -114,14 +114,14 @@ The R-tree spatial index.

                      - Header + Header

                      #include <boost/geometry/index/rtree.hpp>

                      - Synopsis + Synopsis
                      template<typename Value,
                                typename Parameters,
                      @@ -134,7 +134,7 @@ The R-tree spatial index.
                       
                      - Template + Template parameter(s)
                      @@ -208,7 +208,7 @@ The R-tree spatial index.
                      - Typedef(s) + Typedef(s)
                      @@ -316,7 +316,7 @@ The R-tree spatial index.
                      - Constructor(s) + Constructor(s) and destructor
                      @@ -458,7 +458,7 @@ The R-tree spatial index.
                      - Member(s) + Member(s)
                      @@ -781,13 +781,13 @@ The R-tree spatial index.

                      - Synopsis + Synopsis
                      rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                       
                      - Modifier(s) + Modifier(s)

                      @@ -796,7 +796,7 @@ The R-tree spatial index.

                      - Parameter(s) + Parameter(s)
                      @@ -861,7 +861,7 @@ The R-tree spatial index.
                      - Throws + Throws

                      If allocator default constructor throws. @@ -877,7 +877,7 @@ The R-tree spatial index.

                      - Synopsis + Synopsis
                      rtree(parameters_type parameters,
                             translator_type const & translator,
                      @@ -885,7 +885,7 @@ The R-tree spatial index.
                       
                      - Parameter(s) + Parameter(s)
                      @@ -967,7 +967,7 @@ The R-tree spatial index.
                      - Throws + Throws

                      If allocator copy constructor throws. @@ -983,7 +983,7 @@ The R-tree spatial index.

                      - Synopsis + Synopsis
                      template<typename Iterator>
                       rtree(Iterator first,
                      @@ -994,7 +994,7 @@ The R-tree spatial index.
                       
                      - Parameter(s) + Parameter(s)
                      @@ -1110,9 +1110,9 @@ The R-tree spatial index.
                      - Throws + Throws
                      -
                        +
                        • If allocator copy constructor throws.
                        • @@ -1137,7 +1137,7 @@ The R-tree spatial index.

                          - Synopsis + Synopsis
                          template<typename Range>
                           rtree(Range const & rng,
                          @@ -1147,7 +1147,7 @@ The R-tree spatial index.
                           
                          - Modifier(s) + Modifier(s)

                          @@ -1156,7 +1156,7 @@ The R-tree spatial index.

                          - Parameter(s) + Parameter(s)
                          @@ -1256,9 +1256,9 @@ The R-tree spatial index.
                          - Throws + Throws
                          -
                            +
                            • If allocator copy constructor throws.
                            • @@ -1282,13 +1282,13 @@ The R-tree spatial index.

                              - Synopsis + Synopsis
                              ~rtree()
                               
                              - Throws + Throws

                              Nothing. @@ -1304,20 +1304,20 @@ The R-tree spatial index.

                              - Description + Description

                              It uses parameters, translator and allocator from the source tree.

                              - Synopsis + Synopsis
                              rtree(rtree const & src)
                               
                              - Parameter(s) + Parameter(s)
                              @@ -1363,9 +1363,9 @@ The R-tree spatial index.
                              - Throws + Throws
                              -
                                +
                                • If allocator copy constructor throws.
                                • @@ -1390,20 +1390,20 @@ The R-tree spatial index.

                                  - Description + Description

                                  It uses Parameters and translator from the source tree.

                                  - Synopsis + Synopsis
                                  rtree(rtree const & src, allocator_type const & allocator)
                                   
                                  - Parameter(s) + Parameter(s)
                                  @@ -1469,9 +1469,9 @@ The R-tree spatial index.
                                  - Throws + Throws
                                  -
                                    +
                                    • If allocator copy constructor throws.
                                    • @@ -1496,20 +1496,20 @@ The R-tree spatial index.

                                      - Description + Description

                                      It uses parameters, translator and allocator from the source tree.

                                      - Synopsis + Synopsis
                                      rtree(rtree && src)
                                       
                                      - Parameter(s) + Parameter(s)
                                      @@ -1555,7 +1555,7 @@ The R-tree spatial index.
                                      - Throws + Throws

                                      Nothing. @@ -1571,20 +1571,20 @@ The R-tree spatial index.

                                      - Description + Description

                                      It uses parameters and translator from the source tree.

                                      - Synopsis + Synopsis
                                      rtree(rtree && src, allocator_type const & allocator)
                                       
                                      - Parameter(s) + Parameter(s)
                                      @@ -1650,9 +1650,9 @@ The R-tree spatial index.
                                      - Throws + Throws
                                      -
                                        +
                                        • If allocator copy constructor throws.
                                        • @@ -1678,20 +1678,20 @@ The R-tree spatial index.

                                          - Description + Description

                                          It uses parameters and translator from the source tree.

                                          - Synopsis + Synopsis
                                          rtree & operator=(const rtree & src)
                                           
                                          - Parameter(s) + Parameter(s)
                                          @@ -1737,9 +1737,9 @@ The R-tree spatial index.
                                          - Throws + Throws
                                          -
                                            +
                                            • If Value copy constructor throws.
                                            • @@ -1761,20 +1761,20 @@ The R-tree spatial index.

                                              - Description + Description

                                              It uses parameters and translator from the source tree.

                                              - Synopsis + Synopsis
                                              rtree & operator=(rtree && src)
                                               
                                              - Parameter(s) + Parameter(s)
                                              @@ -1820,12 +1820,12 @@ The R-tree spatial index.
                                              - Throws + Throws

                                              Only if allocators aren't equal.

                                              -
                                                +
                                                • If Value copy constructor throws.
                                                • @@ -1847,20 +1847,20 @@ The R-tree spatial index.

                                                  - Description + Description

                                                  Parameters, translator and allocators are swapped as well.

                                                  - Synopsis + Synopsis
                                                  void swap(rtree & other)
                                                   
                                                  - Parameter(s) + Parameter(s)
                                                  @@ -1906,7 +1906,7 @@ The R-tree spatial index.
                                                  - Throws + Throws

                                                  If allocators swap throws. @@ -1922,13 +1922,13 @@ The R-tree spatial index.

                                                  - Synopsis + Synopsis
                                                  void insert(value_type const & value)
                                                   
                                                  - Parameter(s) + Parameter(s)
                                                  @@ -1974,9 +1974,9 @@ The R-tree spatial index.
                                                  - Throws + Throws
                                                  -
                                                    +
                                                    • If Value copy constructor or copy assignment throws.
                                                    • @@ -2009,14 +2009,14 @@ The R-tree spatial index.

                                                      - Synopsis + Synopsis
                                                      template<typename Iterator>
                                                       void insert(Iterator first, Iterator last)
                                                       
                                                      - Parameter(s) + Parameter(s)
                                                      @@ -2080,9 +2080,9 @@ The R-tree spatial index.
                                                      - Throws + Throws
                                                      -
                                                        +
                                                        • If Value copy constructor or copy assignment throws.
                                                        • @@ -2115,14 +2115,14 @@ The R-tree spatial index.

                                                          - Synopsis + Synopsis
                                                          template<typename Range>
                                                           void insert(Range const & rng)
                                                           
                                                          - Parameter(s) + Parameter(s)
                                                          @@ -2168,9 +2168,9 @@ The R-tree spatial index.
                                                          - Throws + Throws
                                                          -
                                                            +
                                                            • If Value copy constructor or copy assignment throws.
                                                            • @@ -2203,7 +2203,7 @@ The R-tree spatial index.

                                                              - Description + Description

                                                              In contrast to the std::set @@ -2212,13 +2212,13 @@ The R-tree spatial index.

                                                              - Synopsis + Synopsis
                                                              size_type remove(value_type const & value)
                                                               
                                                              - Parameter(s) + Parameter(s)
                                                              @@ -2264,16 +2264,16 @@ The R-tree spatial index.
                                                              - Returns + Returns

                                                              1 if the value was removed, 0 otherwise.

                                                              - Throws + Throws
                                                              -
                                                                +
                                                                • If Value copy constructor or copy assignment throws.
                                                                • @@ -2306,7 +2306,7 @@ The R-tree spatial index.

                                                                  - Description + Description

                                                                  In contrast to the std::set @@ -2317,14 +2317,14 @@ The R-tree spatial index.

                                                                  - Synopsis + Synopsis
                                                                  template<typename Iterator>
                                                                   size_type remove(Iterator first, Iterator last)
                                                                   
                                                                  - Parameter(s) + Parameter(s)
                                                                  @@ -2388,16 +2388,16 @@ The R-tree spatial index.
                                                                  - Returns + Returns

                                                                  The number of removed values.

                                                                  - Throws + Throws
                                                                  -
                                                                    +
                                                                    • If Value copy constructor or copy assignment throws.
                                                                    • @@ -2430,7 +2430,7 @@ The R-tree spatial index.

                                                                      - Description + Description

                                                                      In contrast to the std::set @@ -2440,14 +2440,14 @@ The R-tree spatial index.

                                                                      - Synopsis + Synopsis
                                                                      template<typename Range>
                                                                       size_type remove(Range const & rng)
                                                                       
                                                                      - Parameter(s) + Parameter(s)
                                                                      @@ -2493,16 +2493,16 @@ The R-tree spatial index.
                                                                      - Returns + Returns

                                                                      The number of removed values.

                                                                      - Throws + Throws
                                                                      -
                                                                        +
                                                                        • If Value copy constructor or copy assignment throws.
                                                                        • @@ -2536,7 +2536,7 @@ The R-tree spatial index.

                                                                          - Description + Description

                                                                          This query function performs spatial and k-nearest neighbor searches. @@ -2552,7 +2552,7 @@ The R-tree spatial index. are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                          -
                                                                            +
                                                                            - +

                                                                            Last revised: February 14, 2013 at 14:32:07 GMT

                                                                            Last revised: February 14, 2013 at 22:35:32 GMT


                                                                            diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index 75e05b0b2..29abdc55a 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -47,10 +47,11 @@ and vice versa. Example structures of trees created by use of three different al Key features of this implementation of the __rtree__ are: * capable to store arbitrary __value__ type, -* capable to store __value__ type with no default constructor, * 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, -* advanced queries - e.g. search for 5 nearest values further than some minimal distance and intersecting some region but not within the other one. +* parameters (including maximal and minimal number of elements) may be passed as compile- or run-time parameters, +* advanced queries - e.g. search for 5 nearest values to some point and intersecting some region but not within the other one, +* C++11 conformant: move semantics, stateful allocators, +* capable to store __value__ type with no default constructor. [heading Dependencies] From ba8d3a2e34776dc0197abb77316cb7437f885d11 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 15 Feb 2013 02:56:24 +0000 Subject: [PATCH 322/366] Rtree introduction improved [SVN r82896] --- .../geometry_index/r_tree/introduction.html | 30 ++++++++++--------- doc/html/geometry_index/r_tree/reference.html | 18 +++++------ doc/html/index.html | 2 +- doc/rtree/introduction.qbk | 14 +++++---- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 787f33d58..9f9428e31 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -56,9 +56,11 @@ algorithms analyses elements better and produces less overlapping nodes. 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. + faster inserting will result in slower searching and vice versa. The performance + of the R-tree depends on balancing algorithm, parameters and data inserted + into the container. Example structures of trees created by use of three different + algorithms and operations time are presented below. Data used in benchmark + was random, non-overlapping boxes.

                                                                            @@ -90,7 +92,7 @@ @@ -161,17 +163,17 @@ diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index be071fa37..380068354 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                                                                            - + The R-tree spatial index.

                                                                            @@ -4500,7 +4500,7 @@ The R-tree spatial index. boost::geometry::index::linear

                                                                            - + Linear r-tree creation algorithm parameters.

                                                                            @@ -4575,7 +4575,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                                                                            - + Quadratic r-tree creation algorithm parameters.

                                                                            @@ -4650,7 +4650,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                                                                            - + R*-tree creation algorithm parameters.

                                                                            @@ -4754,7 +4754,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

                                                                            - + Linear r-tree creation algorithm parameters.

                                                                            @@ -4890,7 +4890,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

                                                                            - + Quadratic r-tree creation algorithm parameters.

                                                                            @@ -5026,7 +5026,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

                                                                            - + R*-tree creation algorithm parameters.

                                                                            @@ -6606,7 +6606,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

                                                                            - + The default translator.

                                                                            @@ -6676,7 +6676,7 @@ The default translator. boost::geometry::index::translator::index

                                                                            - + The index translator.

                                                                            diff --git a/doc/html/index.html b/doc/html/index.html index 741b9bb47..05f454133 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@

                                                                            - Structure + Example structure

                                                                            @@ -117,39 +119,39 @@

                                                                            - 1.85s + 2.11s

                                                                            - 3.10s + 2.98s

                                                                            - 24.52s + 5.49s

                                                                            - 1M spatial queries + 100k spatial queries

                                                                            - 8.60s + 1.52s

                                                                            - 2.74s + 0.45s

                                                                            - 1.31s + 0.17s

                                                                            - 3.49s + 4.51s

                                                                            - 1.59s + 2.22s

                                                                            - 0.84s + 0.6s

                                                                            - +

                                                                            Last revised: February 14, 2013 at 22:35:32 GMT

                                                                            Last revised: February 15, 2013 at 02:55:42 GMT


                                                                            diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index 29abdc55a..4da39d38a 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -32,14 +32,16 @@ The __rtree__ is a self-balanced data structure. The key part of balancing algor Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired 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. +and vice versa. The performance of the R-tree depends on balancing algorithm, parameters and data inserted into the container. +Example structures of trees created by use of three different algorithms and operations time are presented below. Data used in benchmark was random, +non-overlapping boxes. [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]] +[[] [linear algorithm] [quadratic algorithm] [R*-tree]] +[[*Example structure*] [[$../images/linear.png]] [[$../images/quadratic.png]] [[$../images/rstar.png]]] +[[*1M Values inserts*] [2.11s] [2.98s] [5.49s]] +[[*100k spatial queries*] [1.52s] [0.45s] [0.17s]] +[[*100k knn queries*] [4.51s] [2.22s] [0.6s]] ] [heading Implementation details] From f43d5ca8f30c44f8e3653b0e62559a4b6d17348e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 16 Feb 2013 00:04:03 +0000 Subject: [PATCH 323/366] rtree object size decreased, bounds returned by copy, rtree members grouped in members_holder derived from potentially empty types [SVN r82917] --- .../geometry/index/detail/rtree/node/node.hpp | 8 +- .../detail/rtree/visitors/children_box.hpp | 4 +- .../index/detail/rtree/visitors/remove.hpp | 19 -- include/boost/geometry/index/rtree.hpp | 309 +++++++++--------- 4 files changed, 157 insertions(+), 183 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/node.hpp b/include/boost/geometry/index/detail/rtree/node/node.hpp index 6ed24e2b0..bc4c62d26 100644 --- a/include/boost/geometry/index/detail/rtree/node/node.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node.hpp @@ -34,10 +34,14 @@ namespace detail { namespace rtree { template inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr) { - BOOST_GEOMETRY_INDEX_ASSERT(first != last, "Can't calculate element's box"); - Box result; + if ( first == last ) + { + geometry::assign_inverse(result); + return result; + } + geometry::convert(element_indexable(*first, tr), result); ++first; diff --git a/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp index 0536d0043..4d5310b3a 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP -#include +#include namespace boost { namespace geometry { namespace index { @@ -20,7 +20,7 @@ namespace detail { namespace rtree { namespace visitors { template class children_box : public rtree::visitor::type - , index::nonassignable + , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; diff --git a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp index 52df1316c..4786df510 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp @@ -40,7 +40,6 @@ class remove public: inline remove(node_pointer & root, size_t & leafs_level, - Box & root_box, Value const& value, parameters_type const& parameters, Translator const& translator, @@ -50,7 +49,6 @@ public: , m_translator(translator) , m_allocators(allocators) , m_root_node(root) - , m_root_box(root_box) , m_leafs_level(leafs_level) , m_is_value_removed(false) , m_parent(0) @@ -114,9 +112,6 @@ public: { BOOST_GEOMETRY_INDEX_ASSERT(&n == &rtree::get(*m_root_node), "node must be the root"); - // assign new root's box - assign_root_box(elements); - // reinsert elements from removed nodes (underflows) reinsert_removed_nodes_elements(); // MAY THROW (V, E: alloc, copy, N: alloc) @@ -162,10 +157,6 @@ public: rtree::elements(*m_parent)[m_current_child_index].first = rtree::elements_box(elements.begin(), elements.end(), m_translator); } - else - { - assign_root_box(elements); - } } } @@ -296,22 +287,12 @@ private: } } - template - void assign_root_box(Elements const& elements) - { - if ( elements.empty() ) - geometry::assign_inverse(m_root_box); - else - m_root_box = rtree::elements_box(elements.begin(), elements.end(), m_translator); - } - Value const& m_value; parameters_type const& m_parameters; Translator const& m_translator; Allocators & m_allocators; node_pointer & m_root_node; - Box & m_root_box; size_t & m_leafs_level; bool m_is_value_removed; diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 0121fc78f..5eb555966 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -146,15 +147,8 @@ public: */ inline explicit rtree(parameters_type parameters = parameters_type(), translator_type const& translator = translator_type()) - : m_translator(translator) // SHOULDN'T THROW - , m_parameters(parameters) - , m_allocators() - , m_values_count(0) - , m_leafs_level(0) - , m_root(0) - { - geometry::assign_inverse(m_box); - } + : m_members(translator, parameters) + {} /*! \brief The constructor. @@ -169,15 +163,8 @@ public: inline rtree(parameters_type parameters, translator_type const& translator, allocator_type allocator) - : m_translator(translator) // SHOULDN'T THROW - , m_parameters(parameters) - , m_allocators(allocator) - , m_values_count(0) - , m_leafs_level(0) - , m_root(0) - { - geometry::assign_inverse(m_box); - } + : m_members(translator, parameters, allocator) + {} /*! \brief The constructor. @@ -199,15 +186,8 @@ public: parameters_type parameters = parameters_type(), translator_type const& translator = translator_type(), allocator_type allocator = allocator_type()) - : m_translator(translator) // SHOULDN'T THROW - , m_parameters(parameters) - , m_allocators(allocator) - , m_values_count(0) - , m_leafs_level(0) - , m_root(0) + : m_members(translator, parameters, allocator) { - geometry::assign_inverse(m_box); - try { this->insert(first, last); @@ -238,15 +218,8 @@ public: parameters_type parameters = parameters_type(), translator_type const& translator = translator_type(), allocator_type allocator = allocator_type()) - : m_translator(translator) // SHOULDN'T THROW - , m_parameters(parameters) - , m_allocators(allocator) - , m_values_count(0) - , m_leafs_level(0) - , m_root(0) + : m_members(translator, parameters, allocator) { - geometry::assign_inverse(m_box); - try { this->insert(rng); @@ -283,13 +256,7 @@ public: \li When memory allocation for Node fails. */ inline rtree(rtree const& src) - : m_translator(src.m_translator) // SHOULDN'T THROW - , m_parameters(src.m_parameters) - , m_allocators(src.m_allocators) - , m_values_count(0) - , m_leafs_level(0) - , m_root(0) - , m_box(src.m_box) + : m_members(src.m_members.translator(), src.m_members.parameters(), src.m_members.allocators()) { //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() this->raw_copy(src, *this, false); @@ -310,13 +277,7 @@ public: \li When memory allocation for Node fails. */ inline rtree(rtree const& src, allocator_type const& allocator) - : m_translator(src.m_translator) // SHOULDN'T THROW - , m_parameters(src.m_parameters) - , m_allocators(allocator) - , m_values_count(0) - , m_leafs_level(0) - , m_root(0) - , m_box(src.m_box) + : m_members(src.m_members.translator(), src.m_members.parameters(), allocator) { this->raw_copy(src, *this, false); } @@ -332,18 +293,13 @@ public: Nothing. */ inline rtree(BOOST_RV_REF(rtree) src) -// TODO - use boost::move() - : m_translator(src.m_translator) // SHOULDN'T THROW - , m_parameters(src.m_parameters) - , m_allocators(src.m_allocators) - , m_values_count(src.m_values_count) - , m_leafs_level(src.m_leafs_level) - , m_root(src.m_root) - , m_box(src.m_box) + : m_members(src.m_members.translator(), + src.m_members.parameters(), + boost::move(src.m_members.allocators())) { - src.m_values_count = 0; - src.m_leafs_level = 0; - src.m_root = 0; + boost::swap(m_members.values_count, src.m_members.values_count); + boost::swap(m_members.leafs_level, src.m_members.leafs_level); + boost::swap(m_members.root, src.m_members.root); } /*! @@ -361,20 +317,15 @@ public: \li When memory allocation for Node fails (only if allocators aren't equal). */ inline rtree(BOOST_RV_REF(rtree) src, allocator_type const& allocator) -// TODO - use boost::move() - : m_translator(src.m_translator) // SHOULDN'T THROW - , m_parameters(src.m_parameters) - , m_allocators(allocator) - , m_values_count(0) - , m_leafs_level(0) - , m_root(0) - , m_box(src.m_box) + : m_members(src.m_members.translator(), + src.m_members.parameters(), + boost::move(allocator)) { - if ( src.m_allocators.allocator == allocator ) + if ( src.m_members.allocators().allocator == allocator ) { - boost::swap(m_values_count, src.m_values_count); - boost::swap(m_leafs_level, src.m_leafs_level); - boost::swap(m_root, src.m_root); + boost::swap(m_members.values_count, src.m_members.values_count); + boost::swap(m_members.leafs_level, src.m_members.leafs_level); + boost::swap(m_members.root, src.m_members.root); } else { @@ -404,8 +355,6 @@ public: // It uses m_allocators this->raw_copy(src, *this, true); - m_box = src.m_box; - return *this; } @@ -429,20 +378,16 @@ public: //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( m_allocators.allocator == src.m_allocators.allocator ) + if ( m_members.allocators().allocator == src.m_members.allocators().allocator ) { -// TODO - use boost::move() - m_translator = src.m_translator; // SHOULDN'T THROW - m_parameters = src.m_parameters; - //m_allocators = src.m_allocators; + m_members.translator() = src.m_members.translator(); + m_members.parameters() = src.m_members.parameters(); - m_values_count = src.m_values_count; - m_leafs_level = src.m_leafs_level; - m_root = src.m_root; + this->raw_destroy(*this); - src.m_values_count = 0; - src.m_leafs_level = 0; - src.m_root = 0; + boost::swap(m_members.values_count, src.m_members.values_count); + boost::swap(m_members.leafs_level, src.m_members.leafs_level); + boost::swap(m_members.root, src.m_members.root); } else { @@ -450,8 +395,6 @@ public: this->raw_copy(src, *this, true); } - m_box = src.m_box; - return *this; } @@ -467,14 +410,13 @@ public: */ void swap(rtree & other) { - boost::swap(m_translator, other.m_translator); // SHOULDN'T THROW - boost::swap(m_parameters, other.m_parameters); - m_allocators.swap(other.m_allocators); + boost::swap(m_members.translator(), other.m_members.translator()); + boost::swap(m_members.parameters(), other.m_members.parameters()); + m_members.allocators().swap(other.m_members.allocators()); - boost::swap(m_values_count, other.m_values_count); - boost::swap(m_leafs_level, other.m_leafs_level); - boost::swap(m_root, other.m_root); - boost::swap(m_box, other.m_box); + boost::swap(m_members.values_count, other.m_members.values_count); + boost::swap(m_members.leafs_level, other.m_members.leafs_level); + boost::swap(m_members.root, other.m_members.root); } /*! @@ -493,7 +435,7 @@ public: */ inline void insert(value_type const& value) { - if ( !m_root ) + if ( !m_members.root ) this->raw_create(); this->raw_insert(value); @@ -517,7 +459,7 @@ public: template inline void insert(Iterator first, Iterator last) { - if ( !m_root ) + if ( !m_members.root ) this->raw_create(); for ( ; first != last ; ++first ) @@ -541,7 +483,7 @@ public: template inline void insert(Range const& rng) { - if ( !m_root ) + if ( !m_members.root ) this->raw_create(); typedef typename boost::range_const_iterator::type It; @@ -702,7 +644,7 @@ public: template size_type query(Predicates const& predicates, OutIter out_it) const { - if ( !m_root ) + if ( !m_members.root ) return 0; static const unsigned nearest_count = detail::predicates_count_nearest::value; @@ -722,7 +664,7 @@ public: */ inline size_type size() const { - return m_values_count; + return m_members.values_count; } /*! @@ -735,7 +677,7 @@ public: */ inline bool empty() const { - return 0 == m_values_count; + return 0 == m_members.values_count; } /*! @@ -747,7 +689,6 @@ public: inline void clear() { this->raw_destroy(*this); - geometry::assign_inverse(m_box); } /*! @@ -762,9 +703,20 @@ public: \par Throws Nothing. */ - inline bounds_type const& bounds() const + inline bounds_type bounds() const { - return m_box; + bounds_type result; + if ( !m_members.root ) + { + geometry::assign_inverse(result); + return result; + } + + detail::rtree::visitors::children_box + box_v(result, m_members.translator()); + detail::rtree::apply_visitor(box_v, *m_members.root); + + return result; } /*! @@ -783,13 +735,13 @@ public: template size_type count(ValueOrIndexable const& vori) const { - if ( !m_root ) + if ( !m_members.root ) return 0; detail::rtree::visitors::count - count_v(vori, m_translator); + count_v(vori, m_members.translator()); - detail::rtree::apply_visitor(count_v, *m_root); + detail::rtree::apply_visitor(count_v, *m_members.root); return count_v.found_count; } @@ -804,7 +756,7 @@ public: */ inline parameters_type const& parameters() const { - return m_parameters; + return m_members.parameters(); } /*! @@ -817,7 +769,7 @@ public: */ inline translator_type const& translator() const { - return m_translator; + return m_members.translator(); } /*! @@ -830,7 +782,7 @@ public: */ allocator_type get_allocator() const { - return m_allocators.allocator; + return m_members.allocators().allocator; } #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) @@ -850,8 +802,8 @@ private: template inline void apply_visitor(Visitor & visitor) const { - if ( m_root ) - detail::rtree::apply_visitor(visitor, *m_root); + if ( m_members.root ) + detail::rtree::apply_visitor(visitor, *m_members.root); } /*! @@ -866,7 +818,7 @@ private: */ inline size_type values_count() const { - return m_values_count; + return m_members.values_count; } /*! @@ -881,7 +833,7 @@ private: */ inline size_type depth() const { - return m_leafs_level; + return m_members.leafs_level; } private: @@ -897,18 +849,17 @@ private: */ inline void raw_insert(value_type const& value) { - BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); - BOOST_GEOMETRY_INDEX_ASSERT(detail::is_valid(m_translator(value)), "Indexable is invalid"); - - geometry::expand(m_box, m_translator(value)); + BOOST_GEOMETRY_INDEX_ASSERT(m_members.root, "The root must exist"); + BOOST_GEOMETRY_INDEX_ASSERT(detail::is_valid(m_members.translator()(value)), "Indexable is invalid"); detail::rtree::visitors::insert< value_type, value_type, options_type, translator_wrapper, box_type, allocators_type, typename options_type::insert_tag - > insert_v(m_root, m_leafs_level, value, m_parameters, m_translator, m_allocators); + > insert_v(m_members.root, m_members.leafs_level, value, + m_members.parameters(), m_members.translator(), m_members.allocators()); - detail::rtree::apply_visitor(insert_v, *m_root); + detail::rtree::apply_visitor(insert_v, *m_members.root); // TODO // Think about this: If exception is thrown, may the root be removed? @@ -916,7 +867,7 @@ private: // TODO // If exception is thrown, m_values_count may be invalid - ++m_values_count; + ++m_members.values_count; } /*! @@ -930,21 +881,22 @@ private: inline size_type raw_remove(value_type const& value) { // TODO: awulkiew - assert for correct value (indexable) ? - BOOST_GEOMETRY_INDEX_ASSERT(m_root, "The root must exist"); + BOOST_GEOMETRY_INDEX_ASSERT(m_members.root, "The root must exist"); detail::rtree::visitors::remove< value_type, options_type, translator_wrapper, box_type, allocators_type - > remove_v(m_root, m_leafs_level, m_box, value, m_parameters, m_translator, m_allocators); + > remove_v(m_members.root, m_members.leafs_level, value, + m_members.parameters(), m_members.translator(), m_members.allocators()); - detail::rtree::apply_visitor(remove_v, *m_root); + detail::rtree::apply_visitor(remove_v, *m_members.root); // If exception is thrown, m_values_count may be invalid if ( remove_v.is_value_removed() ) { - BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "unexpected state"); + BOOST_GEOMETRY_INDEX_ASSERT(0 < m_members.values_count, "unexpected state"); - --m_values_count; + --m_members.values_count; return 1; } @@ -960,11 +912,11 @@ private: */ inline void raw_create() { - BOOST_GEOMETRY_INDEX_ASSERT(0 == m_root, "the tree is already created"); + BOOST_GEOMETRY_INDEX_ASSERT(0 == m_members.root, "the tree is already created"); - m_root = detail::rtree::create_node::apply(m_allocators); // MAY THROW (N: alloc) - m_values_count = 0; - m_leafs_level = 0; + m_members.root = detail::rtree::create_node::apply(m_members.allocators()); // MAY THROW (N: alloc) + m_members.values_count = 0; + m_members.leafs_level = 0; } /*! @@ -977,15 +929,16 @@ private: */ inline void raw_destroy(rtree & t) { - if ( t.m_root ) + if ( t.m_members.root ) { - detail::rtree::visitors::destroy del_v(t.m_root, t.m_allocators); - detail::rtree::apply_visitor(del_v, *t.m_root); + detail::rtree::visitors::destroy + del_v(t.m_members.root, t.m_members.allocators()); + detail::rtree::apply_visitor(del_v, *t.m_members.root); - t.m_root = 0; + t.m_members.root = 0; } - t.m_values_count = 0; - t.m_leafs_level = 0; + t.m_members.values_count = 0; + t.m_members.leafs_level = 0; } /*! @@ -1000,29 +953,29 @@ private: */ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { - detail::rtree::visitors::copy copy_v(dst.m_allocators); + detail::rtree::visitors::copy + copy_v(dst.m_members.allocators()); - if ( src.m_root ) - detail::rtree::apply_visitor(copy_v, *src.m_root); // MAY THROW (V, E: alloc, copy, N: alloc) + if ( src.m_members.root ) + detail::rtree::apply_visitor(copy_v, *src.m_members.root); // MAY THROW (V, E: alloc, copy, N: alloc) if ( copy_all_internals ) { - dst.m_translator = src.m_translator; // SHOULDN'T THROW - - dst.m_parameters = src.m_parameters; - //dst.m_allocators = dst.m_allocators; + dst.m_members.translator() = src.m_members.translator(); // SHOULDN'T THROW + dst.m_members.parameters() = src.m_members.parameters(); } - if ( dst.m_root ) + if ( dst.m_members.root ) { - detail::rtree::visitors::destroy del_v(dst.m_root, dst.m_allocators); - detail::rtree::apply_visitor(del_v, *dst.m_root); - dst.m_root = 0; + detail::rtree::visitors::destroy + del_v(dst.m_members.root, dst.m_members.allocators()); + detail::rtree::apply_visitor(del_v, *dst.m_members.root); + dst.m_members.root = 0; } - dst.m_root = copy_v.result; - dst.m_values_count = src.m_values_count; - dst.m_leafs_level = src.m_leafs_level; + dst.m_members.root = copy_v.result; + dst.m_members.values_count = src.m_members.values_count; + dst.m_members.leafs_level = src.m_members.leafs_level; } /*! @@ -1035,9 +988,9 @@ private: size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const { detail::rtree::visitors::spatial_query - find_v(m_translator, predicates, out_it); + find_v(m_members.translator(), predicates, out_it); - detail::rtree::apply_visitor(find_v, *m_root); + detail::rtree::apply_visitor(find_v, *m_members.root); return find_v.found_count; } @@ -1088,22 +1041,58 @@ private: DistancesPredicates, Predicates, result_type - > nearest_v(m_parameters, m_translator, dpred, pred, result); + > nearest_v(m_members.parameters(), m_members.translator(), dpred, pred, result); - detail::rtree::apply_visitor(nearest_v, *m_root); + detail::rtree::apply_visitor(nearest_v, *m_members.root); return result.finish(); } - translator_wrapper m_translator; - Parameters m_parameters; - allocators_type m_allocators; + struct members_holder + : public translator_wrapper + , public Parameters + , public allocators_type + { + private: + members_holder(members_holder const&); - size_type m_values_count; - size_type m_leafs_level; - node_pointer m_root; + public: + template + members_holder(Transl const& transl, + Parameters const& parameters, + BOOST_FWD_REF(Alloc) alloc) + : translator_wrapper(transl) + , Parameters(parameters) + , allocators_type(boost::forward(alloc)) + , values_count(0) + , leafs_level(0) + , root(0) + {} - box_type m_box; + template + members_holder(Transl const& transl = Translator(), + Parameters const& parameters = Parameters()) + : translator_wrapper(transl) + , Parameters(parameters) + , allocators_type() + , values_count(0) + , leafs_level(0) + , root(0) + {} + + translator_wrapper const& translator() const { return *this; } + translator_wrapper & translator() { return *this; } + Parameters const& parameters() const { return *this; } + Parameters & parameters() { return *this; } + allocators_type const& allocators() const { return *this; } + allocators_type & allocators() { return *this; } + + size_type values_count; + size_type leafs_level; + node_pointer root; + }; + + members_holder m_members; }; /*! @@ -1363,7 +1352,7 @@ It calls \c rtree::envelope(). \return The box containing all stored values or an invalid box. */ template -inline typename rtree::bounds_type const& +inline typename rtree::bounds_type bounds(rtree const& tree) { return tree.bounds(); From cb38c7b0344e7fb39504cdab240d3261bd13dde4 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 16 Feb 2013 01:21:32 +0000 Subject: [PATCH 324/366] rtree object size decreased by deriving allocators holder from allocators [SVN r82918] --- example/benchmark.cpp | 2 + .../detail/rtree/node/node_d_mem_dynamic.hpp | 112 ++++++++++-------- .../detail/rtree/node/node_d_mem_static.hpp | 80 +++++++------ include/boost/geometry/index/rtree.hpp | 6 +- .../exceptions/test_rtree_exceptions.hpp | 74 ++++++------ 5 files changed, 152 insertions(+), 122 deletions(-) diff --git a/example/benchmark.cpp b/example/benchmark.cpp index ec036560b..07d2e03c0 100644 --- a/example/benchmark.cpp +++ b/example/benchmark.cpp @@ -55,6 +55,8 @@ int main() //typedef bgi::rtree > RT; //typedef bgi::rtree RT; + std::cout << "sizeof rtree: " << sizeof(RT) << std::endl; + for (;;) { RT t; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 638c084f4..3b82d5184 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -175,84 +175,96 @@ struct container_from_elements_type template class allocators - : nonassignable + : public Allocator::template rebind< + typename internal_node, node_d_mem_dynamic_tag>::type + >::other + , public Allocator::template rebind< + typename leaf, node_d_mem_dynamic_tag>::type + >::other + , public Allocator::template rebind< + std::pair< + Box, + typename Allocator::template rebind< + typename node, node_d_mem_dynamic_tag>::type + >::other::pointer + > + >::other + , public Allocator::template rebind< + Value + >::other + , nonassignable { - BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) - public: - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; + typedef typename Allocator::size_type size_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename node::type >::other::pointer node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other::pointer internal_node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other internal_node_allocator_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename leaf::type >::other leaf_allocator_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< std::pair >::other internal_node_elements_allocator_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< Value >::other leaf_elements_allocator_type; inline allocators() - : allocator() - , internal_node_allocator() - , leaf_allocator() - , internal_node_elements_allocator() - , leaf_elements_allocator() + : internal_node_allocator_type() + , leaf_allocator_type() + , internal_node_elements_allocator_type() + , leaf_elements_allocator_type() {} - inline explicit allocators(Allocator alloc) - : allocator(alloc) - , internal_node_allocator(allocator) - , leaf_allocator(allocator) - , internal_node_elements_allocator(allocator) - , leaf_elements_allocator(allocator) + inline explicit allocators(Allocator const& alloc) + : internal_node_allocator_type(alloc) + , leaf_allocator_type(alloc) + , internal_node_elements_allocator_type(alloc) + , leaf_elements_allocator_type(alloc) {} - inline allocators(allocators const& a) - : allocator(a.allocator) - , internal_node_allocator(a.internal_node_allocator) - , leaf_allocator(a.leaf_allocator) - , internal_node_elements_allocator(a.internal_node_elements_allocator) - , leaf_elements_allocator(a.leaf_elements_allocator) - {} - - inline allocators(BOOST_RV_REF(allocators) a) - : allocator(boost::move(a.allocator)) - , internal_node_allocator(boost::move(a.internal_node_allocator)) - , leaf_allocator(boost::move(a.leaf_allocator)) - , internal_node_elements_allocator(boost::move(a.internal_node_elements_allocator)) - , leaf_elements_allocator(boost::move(a.leaf_elements_allocator)) + inline allocators(BOOST_FWD_REF(allocators) a) + : internal_node_allocator_type(boost::move(a.internal_node_allocator())) + , leaf_allocator_type(boost::move(a.leaf_allocator())) + , internal_node_elements_allocator_type(boost::move(a.internal_node_elements_allocator())) + , leaf_elements_allocator_type(boost::move(a.leaf_elements_allocator())) {} void swap(allocators & a) { - boost::swap(allocator, a.allocator); - boost::swap(internal_node_allocator, a.internal_node_allocator); - boost::swap(leaf_allocator, a.leaf_allocator); - boost::swap(internal_node_elements_allocator, a.internal_node_elements_allocator); - boost::swap(leaf_elements_allocator, a.leaf_elements_allocator); + boost::swap(internal_node_allocator(), a.internal_node_allocator()); + boost::swap(leaf_allocator(), a.leaf_allocator()); + boost::swap(internal_node_elements_allocator(), a.internal_node_elements_allocator()); + boost::swap(leaf_elements_allocator(), a.leaf_elements_allocator()); } - allocator_type allocator; - internal_node_allocator_type internal_node_allocator; - leaf_allocator_type leaf_allocator; - internal_node_elements_allocator_type internal_node_elements_allocator; - leaf_elements_allocator_type leaf_elements_allocator; + bool operator==(allocators const& a) const { return leaf_elements_allocator() == a.leaf_elements_allocator(); } + bool operator==(leaf_elements_allocator_type const& a) const { return leaf_elements_allocator() == a; } + template + bool operator==(Alloc const& a) const { return leaf_elements_allocator() == leaf_elements_allocator_type(a); } + + Allocator allocator() const { return Allocator(leaf_elements_allocator()); } + + internal_node_allocator_type & internal_node_allocator() { return *this; } + internal_node_allocator_type const& internal_node_allocator() const { return *this; } + leaf_allocator_type & leaf_allocator() { return *this; } + leaf_allocator_type const& leaf_allocator() const { return *this; } + internal_node_elements_allocator_type & internal_node_elements_allocator() { return *this; } + internal_node_elements_allocator_type const& internal_node_elements_allocator() const { return *this; } + leaf_elements_allocator_type & leaf_elements_allocator() { return *this; } + leaf_elements_allocator_type const& leaf_elements_allocator() const { return *this; } }; // create_node_impl @@ -316,7 +328,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_internal_node - >::apply(allocators.internal_node_allocator, allocators.internal_node_elements_allocator); + >::apply(allocators.internal_node_allocator(), allocators.internal_node_elements_allocator()); } }; @@ -332,7 +344,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_leaf - >::apply(allocators.leaf_allocator, allocators.leaf_elements_allocator); + >::apply(allocators.leaf_allocator(), allocators.leaf_elements_allocator()); } }; @@ -348,7 +360,7 @@ struct destroy_node< { destroy_dynamic_node< dynamic_internal_node - >::apply(allocators.internal_node_allocator, n); + >::apply(allocators.internal_node_allocator(), n); } }; @@ -362,7 +374,7 @@ struct destroy_node< { destroy_dynamic_node< dynamic_leaf - >::apply(allocators.leaf_allocator, n); + >::apply(allocators.leaf_allocator(), n); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index 314c24cac..4c9df9790 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -96,72 +96,80 @@ struct container_from_elements_type, NewValue> template class allocators - : detail::nonassignable + : public Allocator::template rebind< + typename internal_node< + Value, Parameters, Box, + allocators, + node_d_mem_static_tag + >::type + >::other + , public Allocator::template rebind< + typename leaf< + Value, Parameters, Box, + allocators, + node_d_mem_static_tag + >::type + >::other + , detail::nonassignable { - BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) - public: - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; + typedef typename Allocator::size_type size_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename node::type >::other::pointer node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other::pointer internal_node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other internal_node_allocator_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename leaf::type >::other leaf_allocator_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< std::pair >::other internal_node_elements_allocator_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< Value >::other leaf_elements_allocator_type; inline allocators() - : allocator() - , internal_node_allocator() - , leaf_allocator() + : internal_node_allocator_type() + , leaf_allocator_type() {} - inline explicit allocators(Allocator alloc) - : allocator(alloc) - , internal_node_allocator(allocator) - , leaf_allocator(allocator) + inline explicit allocators(Allocator const& alloc) + : internal_node_allocator_type(alloc) + , leaf_allocator_type(alloc) {} - inline allocators(allocators const& a) - : allocator(a.allocator) - , internal_node_allocator(a.internal_node_allocator) - , leaf_allocator(a.leaf_allocator) - {} - - inline allocators(BOOST_RV_REF(allocators) a) - : allocator(boost::move(a.allocator)) - , internal_node_allocator(boost::move(a.internal_node_allocator)) - , leaf_allocator(boost::move(a.leaf_allocator)) + inline allocators(BOOST_FWD_REF(allocators) a) + : internal_node_allocator_type(boost::move(a.internal_node_allocator())) + , leaf_allocator_type(boost::move(a.leaf_allocator())) {} void swap(allocators & a) { - boost::swap(allocator, a.allocator); - boost::swap(internal_node_allocator, a.internal_node_allocator); - boost::swap(leaf_allocator, a.leaf_allocator); + boost::swap(internal_node_allocator(), a.internal_node_allocator()); + boost::swap(leaf_allocator(), a.leaf_allocator()); } - allocator_type allocator; - internal_node_allocator_type internal_node_allocator; - leaf_allocator_type leaf_allocator; + bool operator==(allocators const& a) const { return leaf_allocator() == a.leaf_allocator(); } + template + bool operator==(Alloc const& a) const { return leaf_allocator() == leaf_allocator_type(a); } + + Allocator allocator() const { return Allocator(leaf_allocator()); } + + internal_node_allocator_type & internal_node_allocator() { return *this; } + internal_node_allocator_type const& internal_node_allocator() const { return *this; } + leaf_allocator_type & leaf_allocator() { return *this; } + leaf_allocator_type const& leaf_allocator() const{ return *this; } }; // create_node @@ -178,7 +186,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_internal_node - >::apply(allocators.internal_node_allocator, allocators.internal_node_allocator); + >::apply(allocators.internal_node_allocator(), allocators.internal_node_allocator()); } }; @@ -194,7 +202,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_leaf - >::apply(allocators.leaf_allocator, allocators.leaf_allocator); + >::apply(allocators.leaf_allocator(), allocators.leaf_allocator()); } }; diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 5eb555966..878ef6970 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -321,7 +321,7 @@ public: src.m_members.parameters(), boost::move(allocator)) { - if ( src.m_members.allocators().allocator == allocator ) + if ( src.m_members.allocators() == allocator ) { boost::swap(m_members.values_count, src.m_members.values_count); boost::swap(m_members.leafs_level, src.m_members.leafs_level); @@ -378,7 +378,7 @@ public: //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( m_members.allocators().allocator == src.m_members.allocators().allocator ) + if ( m_members.allocators() == src.m_members.allocators() ) { m_members.translator() = src.m_members.translator(); m_members.parameters() = src.m_members.parameters(); @@ -782,7 +782,7 @@ public: */ allocator_type get_allocator() const { - return m_members.allocators().allocator; + return m_members.allocators().allocator(); } #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) diff --git a/test/rtree/exceptions/test_rtree_exceptions.hpp b/test/rtree/exceptions/test_rtree_exceptions.hpp index b2149a82e..ef39bd045 100644 --- a/test/rtree/exceptions/test_rtree_exceptions.hpp +++ b/test/rtree/exceptions/test_rtree_exceptions.hpp @@ -144,63 +144,71 @@ struct visitor class allocators + : public Allocator::template rebind< + typename internal_node< + Value, Parameters, Box, + allocators, + node_throwing_d_mem_static_tag + >::type + >::other + , Allocator::template rebind< + typename leaf< + Value, Parameters, Box, + allocators, + node_throwing_d_mem_static_tag + >::type + >::other { - BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) - public: - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; + typedef typename Allocator::size_type size_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename node::type >::other::pointer node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other::pointer internal_node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other internal_node_allocator_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename leaf::type >::other leaf_allocator_type; inline allocators() - : allocator() - , internal_node_allocator() - , leaf_allocator() + : internal_node_allocator_type() + , leaf_allocator_type() {} - inline explicit allocators(Allocator alloc) - : allocator(alloc) - , internal_node_allocator(allocator) - , leaf_allocator(allocator) + inline explicit allocators(Allocator const& alloc) + : internal_node_allocator_type(alloc) + , leaf_allocator_type(alloc) {} - inline allocators(allocators const& a) - : allocator(a.allocator) - , internal_node_allocator(a.internal_node_allocator) - , leaf_allocator(a.leaf_allocator) - {} - - inline allocators(BOOST_RV_REF(allocators) a) - : allocator(boost::move(a.allocator)) - , internal_node_allocator(boost::move(a.internal_node_allocator)) - , leaf_allocator(boost::move(a.leaf_allocator)) + inline allocators(BOOST_FWD_REF(allocators) a) + : internal_node_allocator_type(boost::move(a.internal_node_allocator())) + , leaf_allocator_type(boost::move(a.leaf_allocator())) {} void swap(allocators & a) { - boost::swap(allocator, a.allocator); - boost::swap(internal_node_allocator, a.internal_node_allocator); - boost::swap(leaf_allocator, a.leaf_allocator); + boost::swap(internal_node_allocator(), a.internal_node_allocator()); + boost::swap(leaf_allocator(), a.leaf_allocator()); } - allocator_type allocator; - internal_node_allocator_type internal_node_allocator; - leaf_allocator_type leaf_allocator; + bool operator==(allocators const& a) const { return leaf_allocator() == a.leaf_allocator(); } + template + bool operator==(Alloc const& a) const { return leaf_allocator() == leaf_allocator_type(a); } + + Allocator allocator() const { return Allocator(leaf_allocator()); } + + internal_node_allocator_type & internal_node_allocator() { return *this; } + internal_node_allocator_type const& internal_node_allocator() const { return *this; } + leaf_allocator_type & leaf_allocator() { return *this; } + leaf_allocator_type const& leaf_allocator() const { return *this; } }; struct node_bad_alloc : public std::exception @@ -243,7 +251,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_internal_node - >::apply(allocators.internal_node_allocator, allocators.internal_node_allocator); + >::apply(allocators.internal_node_allocator(), allocators.internal_node_allocator()); } }; @@ -262,7 +270,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_leaf - >::apply(allocators.leaf_allocator, allocators.leaf_allocator); + >::apply(allocators.leaf_allocator(), allocators.leaf_allocator()); } }; From 24626df0cfe3ae730e844221d5fb1c8f5dc24b78 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 16 Feb 2013 14:54:52 +0000 Subject: [PATCH 325/366] rtree: unneeded allocators removed from members. [SVN r82924] --- .../detail/rtree/node/node_d_mem_dynamic.hpp | 67 ++++-------- .../detail/rtree/node/node_d_mem_static.hpp | 38 +++---- .../detail/rtree/node/node_s_mem_dynamic.hpp | 103 ++++++++---------- .../detail/rtree/node/node_s_mem_static.hpp | 83 +++++++------- .../exceptions/test_rtree_exceptions.hpp | 13 +-- 5 files changed, 125 insertions(+), 179 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 3b82d5184..d0da104fc 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -23,12 +23,17 @@ template : public dynamic_node { + typedef typename Allocators::leaf_allocator_type::template rebind< + std::pair + >::other elements_allocator_type; + typedef boost::container::vector< std::pair, - typename Allocators::internal_node_elements_allocator_type + elements_allocator_type > elements_type; - inline dynamic_internal_node(typename Allocators::internal_node_elements_allocator_type & al) + template + inline dynamic_internal_node(Al const& al) : elements(al) {} @@ -42,12 +47,17 @@ template : public dynamic_node { + typedef typename Allocators::leaf_allocator_type::template rebind< + Value + >::other elements_allocator_type; + typedef boost::container::vector< Value, - typename Allocators::leaf_elements_allocator_type + elements_allocator_type > elements_type; - inline dynamic_leaf(typename Allocators::leaf_elements_allocator_type & al) + template + inline dynamic_leaf(Al const& al) : elements(al) {} @@ -181,18 +191,6 @@ class allocators , public Allocator::template rebind< typename leaf, node_d_mem_dynamic_tag>::type >::other - , public Allocator::template rebind< - std::pair< - Box, - typename Allocator::template rebind< - typename node, node_d_mem_dynamic_tag>::type - >::other::pointer - > - >::other - , public Allocator::template rebind< - Value - >::other - , nonassignable { public: typedef typename Allocator::size_type size_type; @@ -213,58 +211,37 @@ public: typename leaf::type >::other leaf_allocator_type; - typedef typename Allocator::template rebind< - std::pair - >::other internal_node_elements_allocator_type; - - typedef typename Allocator::template rebind< - Value - >::other leaf_elements_allocator_type; - inline allocators() : internal_node_allocator_type() , leaf_allocator_type() - , internal_node_elements_allocator_type() - , leaf_elements_allocator_type() {} inline explicit allocators(Allocator const& alloc) : internal_node_allocator_type(alloc) , leaf_allocator_type(alloc) - , internal_node_elements_allocator_type(alloc) - , leaf_elements_allocator_type(alloc) {} inline allocators(BOOST_FWD_REF(allocators) a) : internal_node_allocator_type(boost::move(a.internal_node_allocator())) , leaf_allocator_type(boost::move(a.leaf_allocator())) - , internal_node_elements_allocator_type(boost::move(a.internal_node_elements_allocator())) - , leaf_elements_allocator_type(boost::move(a.leaf_elements_allocator())) {} void swap(allocators & a) { boost::swap(internal_node_allocator(), a.internal_node_allocator()); boost::swap(leaf_allocator(), a.leaf_allocator()); - boost::swap(internal_node_elements_allocator(), a.internal_node_elements_allocator()); - boost::swap(leaf_elements_allocator(), a.leaf_elements_allocator()); } - bool operator==(allocators const& a) const { return leaf_elements_allocator() == a.leaf_elements_allocator(); } - bool operator==(leaf_elements_allocator_type const& a) const { return leaf_elements_allocator() == a; } + bool operator==(allocators const& a) const { return leaf_allocator() == a.leaf_allocator(); } template - bool operator==(Alloc const& a) const { return leaf_elements_allocator() == leaf_elements_allocator_type(a); } + bool operator==(Alloc const& a) const { return leaf_allocator() == leaf_allocator_type(a); } - Allocator allocator() const { return Allocator(leaf_elements_allocator()); } + Allocator allocator() const { return Allocator(leaf_allocator()); } internal_node_allocator_type & internal_node_allocator() { return *this; } internal_node_allocator_type const& internal_node_allocator() const { return *this; } leaf_allocator_type & leaf_allocator() { return *this; } leaf_allocator_type const& leaf_allocator() const { return *this; } - internal_node_elements_allocator_type & internal_node_elements_allocator() { return *this; } - internal_node_elements_allocator_type const& internal_node_elements_allocator() const { return *this; } - leaf_elements_allocator_type & leaf_elements_allocator() { return *this; } - leaf_elements_allocator_type const& leaf_elements_allocator() const { return *this; } }; // create_node_impl @@ -272,8 +249,8 @@ public: template struct create_dynamic_node { - template - static inline BaseNodePtr apply(AllocNode & alloc_node, AllocElems & alloc_elems) + template + static inline BaseNodePtr apply(AllocNode & alloc_node) { typedef typename AllocNode::pointer P; @@ -286,7 +263,7 @@ struct create_dynamic_node { // NOTE/TODO // Here the whole node may be copied - alloc_node.construct(p, Node(alloc_elems)); + alloc_node.construct(p, Node(alloc_node)); } catch(...) { @@ -328,7 +305,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_internal_node - >::apply(allocators.internal_node_allocator(), allocators.internal_node_elements_allocator()); + >::apply(allocators.internal_node_allocator()); } }; @@ -344,7 +321,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_leaf - >::apply(allocators.leaf_allocator(), allocators.leaf_elements_allocator()); + >::apply(allocators.leaf_allocator()); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index 4c9df9790..b263c4c5b 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -22,17 +22,18 @@ template : public dynamic_node { + typedef typename Allocators::leaf_allocator_type::template rebind< + std::pair + >::other elements_allocator_type; + typedef detail::varray< - std::pair< - Box, - typename Allocators::node_pointer - >, + std::pair, Parameters::max_elements + 1, - typename Allocators::internal_node_elements_allocator_type + elements_allocator_type > elements_type; - template - inline dynamic_internal_node(Dummy) {} + template + inline dynamic_internal_node(Alloc const&) {} void apply_visitor(dynamic_visitor & v) { v(*this); } void apply_visitor(dynamic_visitor & v) const { v(*this); } @@ -44,14 +45,18 @@ template : public dynamic_node { + typedef typename Allocators::leaf_allocator_type::template rebind< + Value + >::other elements_allocator_type; + typedef detail::varray< Value, Parameters::max_elements + 1, - typename Allocators::leaf_elements_allocator_type + elements_allocator_type > elements_type; - template - inline dynamic_leaf(Dummy) {} + template + inline dynamic_leaf(Alloc const&) {} void apply_visitor(dynamic_visitor & v) { v(*this); } void apply_visitor(dynamic_visitor & v) const { v(*this); } @@ -110,7 +115,6 @@ class allocators node_d_mem_static_tag >::type >::other - , detail::nonassignable { public: typedef typename Allocator::size_type size_type; @@ -131,14 +135,6 @@ public: typename leaf::type >::other leaf_allocator_type; - typedef typename Allocator::template rebind< - std::pair - >::other internal_node_elements_allocator_type; - - typedef typename Allocator::template rebind< - Value - >::other leaf_elements_allocator_type; - inline allocators() : internal_node_allocator_type() , leaf_allocator_type() @@ -186,7 +182,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_internal_node - >::apply(allocators.internal_node_allocator(), allocators.internal_node_allocator()); + >::apply(allocators.internal_node_allocator()); } }; @@ -202,7 +198,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_leaf - >::apply(allocators.leaf_allocator(), allocators.leaf_allocator()); + >::apply(allocators.leaf_allocator()); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index b95316338..e3f66544f 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -24,15 +24,17 @@ namespace detail { namespace rtree { template struct static_internal_node { + typedef typename Allocators::node_allocator_type::template rebind< + std::pair + >::other elements_allocator_type; + typedef boost::container::vector< - std::pair< - Box, - typename Allocators::node_pointer - >, - typename Allocators::internal_node_elements_allocator_type + std::pair, + elements_allocator_type > elements_type; - inline static_internal_node(typename Allocators::internal_node_elements_allocator_type & al) + template + inline static_internal_node(Al const& al) : elements(al) {} @@ -42,12 +44,17 @@ struct static_internal_node template struct static_leaf { + typedef typename Allocators::node_allocator_type::template rebind< + Value + >::other elements_allocator_type; + typedef boost::container::vector< Value, - typename Allocators::leaf_elements_allocator_type + elements_allocator_type > elements_type; - inline static_leaf(typename Allocators::leaf_elements_allocator_type & al) + template + inline static_leaf(Al const& al) : elements(al) {} @@ -89,74 +96,50 @@ struct visitor class allocators - : nonassignable + : public Allocator::template rebind< + typename node, node_s_mem_dynamic_tag>::type + >::other { - BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) - public: - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; + typedef typename Allocator::size_type size_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename node::type >::other::pointer node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other::pointer internal_node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename node::type >::other node_allocator_type; - typedef typename allocator_type::template rebind< - std::pair - >::other internal_node_elements_allocator_type; - - typedef typename allocator_type::template rebind< - Value - >::other leaf_elements_allocator_type; - inline allocators() - : allocator() - , node_allocator() - , internal_node_elements_allocator() - , leaf_elements_allocator() + : node_allocator_type() {} - inline explicit allocators(Allocator alloc) - : allocator(alloc) - , node_allocator(allocator) - , internal_node_elements_allocator(allocator) - , leaf_elements_allocator(allocator) + inline explicit allocators(Allocator const& alloc) + : node_allocator_type(alloc) {} - inline allocators(allocators const& a) - : allocator(a.allocator) - , node_allocator(a.node_allocator) - , internal_node_elements_allocator(a.internal_node_elements_allocator) - , leaf_elements_allocator(a.leaf_elements_allocator) - {} - - inline allocators(BOOST_RV_REF(allocators) a) - : allocator(boost::move(a.allocator)) - , node_allocator(boost::move(a.node_allocator)) - , internal_node_elements_allocator(boost::move(a.internal_node_elements_allocator)) - , leaf_elements_allocator(boost::move(a.leaf_elements_allocator)) + inline allocators(BOOST_FWD_REF(allocators) a) + : node_allocator_type(boost::move(a.node_allocator())) {} void swap(allocators & a) { - boost::swap(allocator, a.allocator); - boost::swap(node_allocator, a.node_allocator); - boost::swap(internal_node_elements_allocator, a.internal_node_elements_allocator); - boost::swap(leaf_elements_allocator, a.leaf_elements_allocator); + boost::swap(node_allocator(), a.node_allocator()); } - allocator_type allocator; - node_allocator_type node_allocator; - internal_node_elements_allocator_type internal_node_elements_allocator; - leaf_elements_allocator_type leaf_elements_allocator; + bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); } + template + bool operator==(Alloc const& a) const { return node_allocator() == node_allocator_type(a); } + + Allocator allocator() const { return Allocator(node_allocator()); } + + node_allocator_type & node_allocator() { return *this; } + node_allocator_type const& node_allocator() const { return *this; } }; // create_node_variant @@ -164,8 +147,8 @@ public: template struct create_static_node { - template - static inline VariantPtr apply(AllocNode & alloc_node, AllocElems & alloc_elems) + template + static inline VariantPtr apply(AllocNode & alloc_node) { VariantPtr p = alloc_node.allocate(1); @@ -176,7 +159,7 @@ struct create_static_node { // NOTE/TODO // Here the whole node may be copied - alloc_node.construct(p, Node(alloc_elems)); // implicit cast to Variant + alloc_node.construct(p, Node(alloc_node)); // implicit cast to Variant } catch(...) { @@ -215,7 +198,7 @@ struct create_node< return create_static_node< typename Allocators::node_pointer, static_internal_node - >::apply(allocators.node_allocator, allocators.internal_node_elements_allocator); + >::apply(allocators.node_allocator()); } }; @@ -231,7 +214,7 @@ struct create_node< return create_static_node< typename Allocators::node_pointer, static_leaf - >::apply(allocators.node_allocator, allocators.leaf_elements_allocator); + >::apply(allocators.node_allocator()); } }; @@ -247,7 +230,7 @@ struct destroy_node< { destroy_static_node< static_internal_node - >::apply(allocators.node_allocator, n); + >::apply(allocators.node_allocator(), n); } }; @@ -261,7 +244,7 @@ struct destroy_node< { destroy_static_node< static_leaf - >::apply(allocators.node_allocator, n); + >::apply(allocators.node_allocator(), n); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp index 7d183538d..a480034ef 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp @@ -24,17 +24,18 @@ namespace detail { namespace rtree { template struct static_internal_node { + typedef typename Allocators::node_allocator_type::template rebind< + std::pair + >::other elements_allocator_type; + typedef detail::varray< - std::pair< - Box, - typename Allocators::node_pointer - >, + std::pair, Parameters::max_elements + 1, - typename Allocators::internal_node_elements_allocator_type + elements_allocator_type > elements_type; - template - inline static_internal_node(Dummy) {} + template + inline static_internal_node(Alloc const&) {} elements_type elements; }; @@ -42,14 +43,18 @@ struct static_internal_node struct static_leaf { + typedef typename Allocators::node_allocator_type::template rebind< + Value + >::other elements_allocator_type; + typedef detail::varray< Value, Parameters::max_elements + 1, - typename Allocators::leaf_elements_allocator_type + elements_allocator_type > elements_type; - template - inline static_leaf(Dummy) {} + template + inline static_leaf(Alloc const&) {} elements_type elements; }; @@ -89,62 +94,50 @@ struct visitor struct allocators - : nonassignable + : public Allocator::template rebind< + typename node, node_s_mem_static_tag>::type + >::other { - BOOST_COPYABLE_AND_MOVABLE_ALT(allocators) - public: - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; + typedef typename Allocator::size_type size_type; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename node::type >::other::pointer node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename internal_node::type >::other::pointer internal_node_pointer; - typedef typename allocator_type::template rebind< + typedef typename Allocator::template rebind< typename node::type >::other node_allocator_type; - typedef typename allocator_type::template rebind< - std::pair - >::other internal_node_elements_allocator_type; - - typedef typename allocator_type::template rebind< - Value - >::other leaf_elements_allocator_type; - inline allocators() - : allocator() - , node_allocator() + : node_allocator_type() {} - inline explicit allocators(Allocator alloc) - : allocator(alloc) - , node_allocator(allocator) + inline explicit allocators(Allocator const& alloc) + : node_allocator_type(alloc) {} - inline allocators(allocators const& a) - : allocator(a.allocator) - , node_allocator(a.node_allocator) - {} - - inline allocators(BOOST_RV_REF(allocators) a) - : allocator(boost::move(a.allocator)) - , node_allocator(boost::move(a.node_allocator)) + inline allocators(BOOST_FWD_REF(allocators) a) + : node_allocator_type(boost::move(a.node_allocator())) {} void swap(allocators & a) { - boost::swap(allocator, a.allocator); - boost::swap(node_allocator, a.node_allocator); + boost::swap(node_allocator(), a.node_allocator()); } - allocator_type allocator; - node_allocator_type node_allocator; + bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); } + template + bool operator==(Alloc const& a) const { return node_allocator() == node_allocator_type(a); } + + Allocator allocator() const { return Allocator(node_allocator()); } + + node_allocator_type & node_allocator() { return *this; } + node_allocator_type const& node_allocator() const { return *this; } }; // create_node @@ -161,7 +154,7 @@ struct create_node< return create_static_node< typename Allocators::node_pointer, static_internal_node - >::template apply(allocators.node_allocator, allocators.node_allocator); + >::template apply(allocators.node_allocator()); } }; @@ -177,7 +170,7 @@ struct create_node< return create_static_node< typename Allocators::node_pointer, static_leaf - >::template apply(allocators.node_allocator, allocators.node_allocator); + >::template apply(allocators.node_allocator()); } }; diff --git a/test/rtree/exceptions/test_rtree_exceptions.hpp b/test/rtree/exceptions/test_rtree_exceptions.hpp index ef39bd045..db1520bcf 100644 --- a/test/rtree/exceptions/test_rtree_exceptions.hpp +++ b/test/rtree/exceptions/test_rtree_exceptions.hpp @@ -76,15 +76,12 @@ struct dynamic_internal_node { typedef throwing_varray< - std::pair< - Box, - typename Allocators::node_pointer - >, + std::pair, Parameters::max_elements + 1 > elements_type; template - inline dynamic_internal_node(Dummy) {} + inline dynamic_internal_node(Dummy const&) {} void apply_visitor(dynamic_visitor & v) { v(*this); } void apply_visitor(dynamic_visitor & v) const { v(*this); } @@ -99,7 +96,7 @@ struct dynamic_leaf elements_type; template - inline dynamic_leaf(Dummy) {} + inline dynamic_leaf(Dummy const&) {} void apply_visitor(dynamic_visitor & v) { v(*this); } void apply_visitor(dynamic_visitor & v) const { v(*this); } @@ -251,7 +248,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_internal_node - >::apply(allocators.internal_node_allocator(), allocators.internal_node_allocator()); + >::apply(allocators.internal_node_allocator()); } }; @@ -270,7 +267,7 @@ struct create_node< return create_dynamic_node< typename Allocators::node_pointer, dynamic_leaf - >::apply(allocators.leaf_allocator(), allocators.leaf_allocator()); + >::apply(allocators.leaf_allocator()); } }; From b122d309b75cb3f3e48338a5baecfd1a50f098b1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 17 Feb 2013 14:57:29 +0000 Subject: [PATCH 326/366] rtree: some params definition corrected, docs updated, reference definition moved to the separate file. [SVN r82949] --- doc/generated/rtree.qbk | 6 +- doc/generated/rtree_functions.qbk | 8 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 4 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 28 +- doc/html/geometry_index/r_tree/queries.html | 6 +- doc/html/geometry_index/r_tree/reference.html | 581 +++++++++--------- .../geometry_index/r_tree/rtree_examples.html | 2 +- .../r_tree/rtree_quickstart.html | 4 +- doc/html/index.html | 4 +- doc/rtree.qbk | 32 +- doc/rtree/reference.qbk | 40 ++ include/boost/geometry/index/rtree.hpp | 7 +- 14 files changed, 374 insertions(+), 360 deletions(-) create mode 100644 doc/rtree/reference.qbk diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 603fc41bb..f082a3eb6 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -103,7 +103,7 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] [[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ace84997927e26d7cdb5aa67f14cdf6cc `bounds()`]][Returns the box able to contain all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1aeba4f1afee40262204dd074a93536ebf `bounds()`]][Returns the box able to contain all values stored in the container. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] @@ -730,7 +730,7 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ace84997927e26d7cdb5aa67f14cdf6cc] +[#classboost_1_1geometry_1_1index_1_1rtree_1aeba4f1afee40262204dd074a93536ebf] [section bounds()] Returns the box able to contain all values stored in the container. @@ -738,7 +738,7 @@ Returns the box able to contain all values stored in the container. Returns the box able to contain all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f bounds_type]]` const &` `bounds``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f bounds_type]] `bounds``()` ] [heading Modifier(s)] diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index b28082e52..f757938e1 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -14,7 +14,7 @@ [[[link group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c `clear(rtree<...> &)`]][Remove all values from the index. ]] [[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] [[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] -[[[link group__rtree__functions_1gae10fbc3d536235b89aa3cb3641768bca `bounds(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1gadb11fdb8e75ba7652286ec6750b49c4f `bounds(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] ] [#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc] @@ -227,7 +227,7 @@ Predicates may be passed together connected with [^`operator&&()`].[heading Syno [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][]] +[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The rtree. ]] [[`Predicates const &`][ `predicates` ][Predicates. ]] [[`OutIter`][ `out_it` ][The output iterator, e.g. generated by std::back_inserter().]] ] @@ -323,7 +323,7 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb9 true if there are no values in the index. [endsect] -[#group__rtree__functions_1gae10fbc3d536235b89aa3cb3641768bca] +[#group__rtree__functions_1gadb11fdb8e75ba7652286ec6750b49c4f] [section bounds(rtree<...> const &)] Get the box containing all stored values or an invalid box if the index has no values. @@ -334,7 +334,7 @@ It calls [^`rtree::envelope()`].[heading Synopsis] `typename Options``,` `typename Translator``,` `typename Allocator``>` -`rtree::bounds_type const& boost::geometry::index::bounds``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +`rtree::bounds_type boost::geometry::index::bounds``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` ] [heading Parameter(s)] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd5718dbb..c00e43835 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 f5f56bd76..90a46002d 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -76,7 +76,7 @@
                                                                            Functions related to the rtree
                                                                            R-tree - parameters
                                                                            + parameters (boost::geometry::index::)
                                                                            Predicates (boost::geometry::index::)
                                                                            Nearest 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 d80f7223e..7909b5d67 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 - + @@ -55,7 +55,7 @@

                                                                            rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
                                                                             
                                                                            -
                                                                              +
                                                                              • Value - type of object which will be stored in the container,
                                                                              • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator::def<Value> are defined as follows:

                                                                                -
                                                                                  +
                                                                                  • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

                                                                                    -
                                                                                      +
                                                                                      • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                                                                                        If comparison of two Values is required, the default translator:

                                                                                        -
                                                                                          +
                                                                                          • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 9f9428e31..17f4bf92e 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                                                                                      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 + 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 [2]. + close to some point in space [2].

                                                                                      The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                                                                                      The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -181,13 +181,13 @@

                                                                                    - Implementation + Implementation details

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

                                                                                    -
                                                                                      +
                                                                                      • capable to store arbitrary Value type,
                                                                                      • @@ -211,14 +211,14 @@
                                                                                      - Dependencies + Dependencies

                                                                                      R-tree depends on Boost.Move, Boost.Container, Boost.Tuple.

                                                                                      - Contributors + Contributors

                                                                                      The spatial index was originally started by Federico J. Fernandez during @@ -226,7 +226,7 @@

                                                                                      - Spatial + Spatial thanks

                                                                                      @@ -235,20 +235,20 @@ list for their help.

                                                                                      -

                                                                                      -

                                                                                      [1] +


                                                                                      +

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

                                                                                      -

                                                                                      [2] +

                                                                                      [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                                                                                      -

                                                                                      [3] +

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

                                                                                      -

                                                                                      [4] +

                                                                                      [4] 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/queries.html b/doc/html/geometry_index/r_tree/queries.html index 7a2a90633..e32d7352f 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -44,7 +44,7 @@ Queries returns Values which meets some predicates. Currently supported are three types of predicates:

                                                                                      -
                                                                                        +
                                                                                        • spatial predicates - defining relationship between stored Values and some Geometry, @@ -60,7 +60,7 @@

                                                                                          For example queries may be used to retrieve Values:

                                                                                          -
                                                                                            +
                                                                                            • intersecting some area but not within other area,
                                                                                            • diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 380068354..447bf5d61 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -30,7 +30,7 @@
                                                                                              Functions related to the rtree
                                                                                              R-tree - parameters
                                                                                              + parameters (boost::geometry::index::)
                                                                            Predicates (boost::geometry::index::)
                                                                            Nearest @@ -47,12 +47,12 @@ boost::geometry::index::rtree

                                                                        - + The R-tree spatial index.

                                                                        - Description + Description

                                                                        This is self-balancing spatial index capable to store various types of @@ -60,7 +60,7 @@ The R-tree spatial index.

                                                                        - Parameters + Parameters

                                                                        The user must pass a type defining the Parameters which will be used in @@ -70,7 +70,7 @@ The R-tree spatial index.

                                                                        Predefined algorithms with compile-time parameters are:

                                                                        -
                                                                          +
                                                                          • boost::geometry::index::linear,
                                                                          • @@ -84,7 +84,7 @@ The R-tree spatial index.

                                                                            Predefined algorithms with run-time parameters are:

                                                                            -
                                                                              +
                                                                              - Translator + Translator

                                                                              The Translator translates from Value to Indexable each time r-tree requires @@ -114,14 +114,14 @@ The R-tree spatial index.

                                                                              - Header + Header

                                                                              #include <boost/geometry/index/rtree.hpp>

                                                                              - Synopsis + Synopsis
                                                                              template<typename Value,
                                                                                        typename Parameters,
                                                                              @@ -134,7 +134,7 @@ The R-tree spatial index.
                                                                               
                                                                              - Template + Template parameter(s)
                                                                              @@ -208,7 +208,7 @@ The R-tree spatial index.
                                                                              - Typedef(s) + Typedef(s)
                                                                              @@ -316,7 +316,7 @@ The R-tree spatial index.
                                                                              - Constructor(s) + Constructor(s) and destructor
                                                                              @@ -458,7 +458,7 @@ The R-tree spatial index.
                                                                              - Member(s) + Member(s)
                                                                              @@ -692,7 +692,7 @@ The R-tree spatial index. + + + +

                                                                              - bounds() + bounds()

                                                                              @@ -781,13 +781,13 @@ The R-tree spatial index.

                                                                              - Synopsis + Synopsis
                                                                              rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                                                                               
                                                                              - Modifier(s) + Modifier(s)

                                                                              @@ -796,7 +796,7 @@ The R-tree spatial index.

                                                                              - Parameter(s) + Parameter(s)
                                                                              @@ -861,7 +861,7 @@ The R-tree spatial index.
                                                                              - Throws + Throws

                                                                              If allocator default constructor throws. @@ -877,7 +877,7 @@ The R-tree spatial index.

                                                                              - Synopsis + Synopsis
                                                                              rtree(parameters_type parameters,
                                                                                     translator_type const & translator,
                                                                              @@ -885,7 +885,7 @@ The R-tree spatial index.
                                                                               
                                                                              - Parameter(s) + Parameter(s)
                                                                              @@ -967,7 +967,7 @@ The R-tree spatial index.
                                                                              - Throws + Throws

                                                                              If allocator copy constructor throws. @@ -983,7 +983,7 @@ The R-tree spatial index.

                                                                              - Synopsis + Synopsis
                                                                              template<typename Iterator>
                                                                               rtree(Iterator first,
                                                                              @@ -994,7 +994,7 @@ The R-tree spatial index.
                                                                               
                                                                              - Parameter(s) + Parameter(s)
                                                                              @@ -1110,9 +1110,9 @@ The R-tree spatial index.
                                                                              - Throws + Throws
                                                                              -
                                                                                +
                                                                                • If allocator copy constructor throws.
                                                                                • @@ -1137,7 +1137,7 @@ The R-tree spatial index.

                                                                                  - Synopsis + Synopsis
                                                                                  template<typename Range>
                                                                                   rtree(Range const & rng,
                                                                                  @@ -1147,7 +1147,7 @@ The R-tree spatial index.
                                                                                   
                                                                                  - Modifier(s) + Modifier(s)

                                                                                  @@ -1156,7 +1156,7 @@ The R-tree spatial index.

                                                                                  - Parameter(s) + Parameter(s)
                                                                                  @@ -1256,9 +1256,9 @@ The R-tree spatial index.
                                                                                  - Throws + Throws
                                                                                  -
                                                                                    +
                                                                                    • If allocator copy constructor throws.
                                                                                    • @@ -1282,13 +1282,13 @@ The R-tree spatial index.

                                                                                      - Synopsis + Synopsis
                                                                                      ~rtree()
                                                                                       
                                                                                      - Throws + Throws

                                                                                      Nothing. @@ -1304,20 +1304,20 @@ The R-tree spatial index.

                                                                                      - Description + Description

                                                                                      It uses parameters, translator and allocator from the source tree.

                                                                                      - Synopsis + Synopsis
                                                                                      rtree(rtree const & src)
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -1363,9 +1363,9 @@ The R-tree spatial index.
                                                                                      - Throws + Throws
                                                                                      -
                                                                                        +
                                                                                        • If allocator copy constructor throws.
                                                                                        • @@ -1390,20 +1390,20 @@ The R-tree spatial index.

                                                                                          - Description + Description

                                                                                          It uses Parameters and translator from the source tree.

                                                                                          - Synopsis + Synopsis
                                                                                          rtree(rtree const & src, allocator_type const & allocator)
                                                                                           
                                                                                          - Parameter(s) + Parameter(s)
                                                                                          @@ -1469,9 +1469,9 @@ The R-tree spatial index.
                                                                                          - Throws + Throws
                                                                                          -
                                                                                            +
                                                                                            • If allocator copy constructor throws.
                                                                                            • @@ -1496,20 +1496,20 @@ The R-tree spatial index.

                                                                                              - Description + Description

                                                                                              It uses parameters, translator and allocator from the source tree.

                                                                                              - Synopsis + Synopsis
                                                                                              rtree(rtree && src)
                                                                                               
                                                                                              - Parameter(s) + Parameter(s)
                                                                                              @@ -1555,7 +1555,7 @@ The R-tree spatial index.
                                                                                              - Throws + Throws

                                                                                              Nothing. @@ -1571,20 +1571,20 @@ The R-tree spatial index.

                                                                                              - Description + Description

                                                                                              It uses parameters and translator from the source tree.

                                                                                              - Synopsis + Synopsis
                                                                                              rtree(rtree && src, allocator_type const & allocator)
                                                                                               
                                                                                              - Parameter(s) + Parameter(s)
                                                                                              @@ -1650,9 +1650,9 @@ The R-tree spatial index.
                                                                                              - Throws + Throws
                                                                                              -
                                                                                                +
                                                                                                • If allocator copy constructor throws.
                                                                                                • @@ -1678,20 +1678,20 @@ The R-tree spatial index.

                                                                                                  - Description + Description

                                                                                                  It uses parameters and translator from the source tree.

                                                                                                  - Synopsis + Synopsis
                                                                                                  rtree & operator=(const rtree & src)
                                                                                                   
                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                  @@ -1737,9 +1737,9 @@ The R-tree spatial index.
                                                                                                  - Throws + Throws
                                                                                                  -
                                                                                                    +
                                                                                                    • If Value copy constructor throws.
                                                                                                    • @@ -1761,20 +1761,20 @@ The R-tree spatial index.

                                                                                                      - Description + Description

                                                                                                      It uses parameters and translator from the source tree.

                                                                                                      - Synopsis + Synopsis
                                                                                                      rtree & operator=(rtree && src)
                                                                                                       
                                                                                                      - Parameter(s) + Parameter(s)
                                                                                                      @@ -1820,12 +1820,12 @@ The R-tree spatial index.
                                                                                                      - Throws + Throws

                                                                                                      Only if allocators aren't equal.

                                                                                                      -
                                                                                                        +
                                                                                                        • If Value copy constructor throws.
                                                                                                        • @@ -1847,20 +1847,20 @@ The R-tree spatial index.

                                                                                                          - Description + Description

                                                                                                          Parameters, translator and allocators are swapped as well.

                                                                                                          - Synopsis + Synopsis
                                                                                                          void swap(rtree & other)
                                                                                                           
                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                          @@ -1906,7 +1906,7 @@ The R-tree spatial index.
                                                                                                          - Throws + Throws

                                                                                                          If allocators swap throws. @@ -1922,13 +1922,13 @@ The R-tree spatial index.

                                                                                                          - Synopsis + Synopsis
                                                                                                          void insert(value_type const & value)
                                                                                                           
                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                          @@ -1974,9 +1974,9 @@ The R-tree spatial index.
                                                                                                          - Throws + Throws
                                                                                                          -
                                                                                                            +
                                                                                                            • If Value copy constructor or copy assignment throws.
                                                                                                            • @@ -2009,14 +2009,14 @@ The R-tree spatial index.

                                                                                                              - Synopsis + Synopsis
                                                                                                              template<typename Iterator>
                                                                                                               void insert(Iterator first, Iterator last)
                                                                                                               
                                                                                                              - Parameter(s) + Parameter(s)
                                                                                                              @@ -2080,9 +2080,9 @@ The R-tree spatial index.
                                                                                                              - Throws + Throws
                                                                                                              -
                                                                                                                +
                                                                                                                • If Value copy constructor or copy assignment throws.
                                                                                                                • @@ -2115,14 +2115,14 @@ The R-tree spatial index.

                                                                                                                  - Synopsis + Synopsis
                                                                                                                  template<typename Range>
                                                                                                                   void insert(Range const & rng)
                                                                                                                   
                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                  @@ -2168,9 +2168,9 @@ The R-tree spatial index.
                                                                                                                  - Throws + Throws
                                                                                                                  -
                                                                                                                    +
                                                                                                                    • If Value copy constructor or copy assignment throws.
                                                                                                                    • @@ -2203,7 +2203,7 @@ The R-tree spatial index.

                                                                                                                      - Description + Description

                                                                                                                      In contrast to the std::set @@ -2212,13 +2212,13 @@ The R-tree spatial index.

                                                                                                                      - Synopsis + Synopsis
                                                                                                                      size_type remove(value_type const & value)
                                                                                                                       
                                                                                                                      - Parameter(s) + Parameter(s)
                                                                                                                      @@ -2264,16 +2264,16 @@ The R-tree spatial index.
                                                                                                                      - Returns + Returns

                                                                                                                      1 if the value was removed, 0 otherwise.

                                                                                                                      - Throws + Throws
                                                                                                                      -
                                                                                                                        +
                                                                                                                        • If Value copy constructor or copy assignment throws.
                                                                                                                        • @@ -2306,7 +2306,7 @@ The R-tree spatial index.

                                                                                                                          - Description + Description

                                                                                                                          In contrast to the std::set @@ -2317,14 +2317,14 @@ The R-tree spatial index.

                                                                                                                          - Synopsis + Synopsis
                                                                                                                          template<typename Iterator>
                                                                                                                           size_type remove(Iterator first, Iterator last)
                                                                                                                           
                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                          @@ -2388,16 +2388,16 @@ The R-tree spatial index.
                                                                                                                          - Returns + Returns

                                                                                                                          The number of removed values.

                                                                                                                          - Throws + Throws
                                                                                                                          -
                                                                                                                            +
                                                                                                                            • If Value copy constructor or copy assignment throws.
                                                                                                                            • @@ -2430,7 +2430,7 @@ The R-tree spatial index.

                                                                                                                              - Description + Description

                                                                                                                              In contrast to the std::set @@ -2440,14 +2440,14 @@ The R-tree spatial index.

                                                                                                                              - Synopsis + Synopsis
                                                                                                                              template<typename Range>
                                                                                                                               size_type remove(Range const & rng)
                                                                                                                               
                                                                                                                              - Parameter(s) + Parameter(s)
                                                                                                                              @@ -2493,16 +2493,16 @@ The R-tree spatial index.
                                                                                                                              - Returns + Returns

                                                                                                                              The number of removed values.

                                                                                                                              - Throws + Throws
                                                                                                                              -
                                                                                                                                +
                                                                                                                                • If Value copy constructor or copy assignment throws.
                                                                                                                                • @@ -2536,7 +2536,7 @@ The R-tree spatial index.

                                                                                                                                  - Description + Description

                                                                                                                                  This query function performs spatial and k-nearest neighbor searches. @@ -2552,7 +2552,7 @@ The R-tree spatial index. are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                                                                                  -
                                                                                                                                    +
                                                                                                                                    • boost::geometry::index::covered_by(),
                                                                                                                                    • @@ -2573,7 +2573,7 @@ The R-tree spatial index.

                                                                                                                                      It is possible to negate spatial predicates:

                                                                                                                                      -
                                                                                                                                        +
                                                                                                                                        - Functions + Functions
                                                                                                                                        @@ -3257,7 +3257,7 @@ The R-tree spatial index. @@ -3280,7 +3280,7 @@ The R-tree spatial index.

                                                                                                                                        - Description + Description

                                                                                                                                        It calls rtree::insert(value_type @@ -3288,7 +3288,7 @@ The R-tree spatial index.

                                                                                                                                        - Synopsis + Synopsis
                                                                                                                                        template<typename Value,
                                                                                                                                                  typename Options,
                                                                                                                                        @@ -3298,7 +3298,7 @@ The R-tree spatial index.
                                                                                                                                         
                                                                                                                                        - Parameter(s) + Parameter(s)

                                                                                                                                        - bounds(rtree<...> + bounds(rtree<...> const &)

                                                                                                                                        @@ -3377,7 +3377,7 @@ The R-tree spatial index.

                                                                                                                                        - Description + Description

                                                                                                                                        It calls rtree::insert(Iterator, @@ -3385,7 +3385,7 @@ The R-tree spatial index.

                                                                                                                                        - Synopsis + Synopsis
                                                                                                                                        template<typename Value,
                                                                                                                                                  typename Options,
                                                                                                                                        @@ -3398,7 +3398,7 @@ The R-tree spatial index.
                                                                                                                                         
                                                                                                                                        - Parameter(s) + Parameter(s)
                                                                                                                                        @@ -3493,7 +3493,7 @@ The R-tree spatial index.

                                                                                                                                        - Description + Description

                                                                                                                                        It calls rtree::insert(Range @@ -3501,7 +3501,7 @@ The R-tree spatial index.

                                                                                                                                        - Synopsis + Synopsis
                                                                                                                                        template<typename Value,
                                                                                                                                                  typename Options,
                                                                                                                                        @@ -3512,7 +3512,7 @@ The R-tree spatial index.
                                                                                                                                         
                                                                                                                                        - Parameter(s) + Parameter(s)
                                                                                                                                        @@ -3591,7 +3591,7 @@ The R-tree spatial index.

                                                                                                                                        - Description + Description

                                                                                                                                        Remove a value from the container. In contrast to the std::set or std::map erase() method this function removes @@ -3603,7 +3603,7 @@ The R-tree spatial index.

                                                                                                                                        - Synopsis + Synopsis
                                                                                                                                        template<typename Value,
                                                                                                                                                  typename Options,
                                                                                                                                        @@ -3613,7 +3613,7 @@ The R-tree spatial index.
                                                                                                                                         
                                                                                                                                        - Parameter(s) + Parameter(s)
                                                                                                                                        @@ -3683,7 +3683,7 @@ The R-tree spatial index.
                                                                                                                                        - Returns + Returns

                                                                                                                                        1 if value was removed, 0 otherwise. @@ -3699,7 +3699,7 @@ The R-tree spatial index.

                                                                                                                                        - Description + Description

                                                                                                                                        Remove a range of values from the container. In contrast to the std::set or std::map erase() method it doesn't take iterators @@ -3713,7 +3713,7 @@ The R-tree spatial index.

                                                                                                                                        - Synopsis + Synopsis
                                                                                                                                        template<typename Value,
                                                                                                                                                  typename Options,
                                                                                                                                        @@ -3726,7 +3726,7 @@ The R-tree spatial index.
                                                                                                                                         
                                                                                                                                        - Parameter(s) + Parameter(s)
                                                                                                                                        @@ -3812,7 +3812,7 @@ The R-tree spatial index.
                                                                                                                                        - Returns + Returns

                                                                                                                                        The number of removed values. @@ -3828,7 +3828,7 @@ The R-tree spatial index.

                                                                                                                                        - Description + Description

                                                                                                                                        Remove a range of values from the container. In contrast to the std::set or std::map erase() method it removes values @@ -3841,7 +3841,7 @@ The R-tree spatial index.

                                                                                                                                        - Synopsis + Synopsis
                                                                                                                                        template<typename Value,
                                                                                                                                                  typename Options,
                                                                                                                                        @@ -3852,7 +3852,7 @@ The R-tree spatial index.
                                                                                                                                         
                                                                                                                                        - Parameter(s) + Parameter(s)
                                                                                                                                        @@ -3922,7 +3922,7 @@ The R-tree spatial index.
                                                                                                                                        - Returns + Returns

                                                                                                                                        The number of removed values. @@ -3939,7 +3939,7 @@ The R-tree spatial index.

                                                                                                                                        - Description + Description

                                                                                                                                        This query function performs spatial and k-nearest neighbor searches. @@ -3955,7 +3955,7 @@ The R-tree spatial index. are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                                                                                        -
                                                                                                                                          +
                                                                                                                                          • boost::geometry::index::covered_by(),
                                                                                                                                          • @@ -3976,7 +3976,7 @@ The R-tree spatial index.

                                                                                                                                            It is possible to negate spatial predicates:

                                                                                                                                            -
                                                                                                                                            - +

                                                                                                                                            Last revised: February 15, 2013 at 02:55:42 GMT

                                                                                                                                            Last revised: February 17, 2013 at 14:52:29 GMT


                                                                                                                                            diff --git a/doc/rtree.qbk b/doc/rtree.qbk index 67cc13ffe..4e17ed29b 100644 --- a/doc/rtree.qbk +++ b/doc/rtree.qbk @@ -15,36 +15,6 @@ [include rtree/creation.qbk] [include rtree/query.qbk] [include rtree/examples.qbk] - -[section:reference Reference] - -[include generated/rtree.qbk] -[include generated/rtree_functions.qbk] - -[section:parameters R-tree parameters] - -[include generated/rtree_linear.qbk] -[include generated/rtree_quadratic.qbk] -[include generated/rtree_rstar.qbk] -[include generated/rtree_runtime_linear.qbk] -[include generated/rtree_runtime_quadratic.qbk] -[include generated/rtree_runtime_rstar.qbk] - -[endsect] - -[include generated/predicates.qbk] -[include generated/nearest_relations.qbk] -[include generated/adaptors.qbk] - -[section:translators Translators (boost::geometry::index::translators::)] - -[include generated/translator_def.qbk] -[include generated/translator_index.qbk] - -[endsect] - -[include generated/inserters.qbk] - -[endsect] +[include rtree/reference.qbk] [endsect] diff --git a/doc/rtree/reference.qbk b/doc/rtree/reference.qbk new file mode 100644 index 000000000..ff6ddd73d --- /dev/null +++ b/doc/rtree/reference.qbk @@ -0,0 +1,40 @@ +[/============================================================================ + Boost.Geometry Index + + Copyright (c) 2011-2013 Adam Wulkiewicz. + + Use, modification and distribution is subject to the Boost Software License, + Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================/] + +[section:reference Reference] + +[include ../generated/rtree.qbk] +[include ../generated/rtree_functions.qbk] + +[section:parameters R-tree parameters (boost::geometry::index::)] + +[include ../generated/rtree_linear.qbk] +[include ../generated/rtree_quadratic.qbk] +[include ../generated/rtree_rstar.qbk] +[include ../generated/rtree_runtime_linear.qbk] +[include ../generated/rtree_runtime_quadratic.qbk] +[include ../generated/rtree_runtime_rstar.qbk] + +[endsect] + +[include ../generated/predicates.qbk] +[include ../generated/nearest_relations.qbk] +[include ../generated/adaptors.qbk] + +[section:translators Translators (boost::geometry::index::translators::)] + +[include ../generated/translator_def.qbk] +[include ../generated/translator_index.qbk] + +[endsect] + +[include ../generated/inserters.qbk] + +[endsect] \ No newline at end of file diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 878ef6970..105dd1791 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -945,8 +945,9 @@ private: \brief Copy the R-tree i.e. whole nodes structure, values and other attributes. It uses destination's allocators to create the new structure. - \param src The source R-tree. - \param dst The destination R-tree. + \param src The source R-tree. + \param dst The destination R-tree. + \param copy_all_internals If true, translator and parameters will also be copied. \par Exception-safety strong @@ -1276,7 +1277,7 @@ Only one \c nearest() perdicate may be passed to the query. \ingroup rtree_functions -\param predicates The rtree. +\param tree The rtree. \param predicates Predicates. \param out_it The output iterator, e.g. generated by std::back_inserter(). From 9b2ebcde2e24418cb33333e81dffd3c158c1d48e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 18 Feb 2013 01:19:22 +0000 Subject: [PATCH 327/366] rtree detail varray rvref support added. ptr_pair added (not used for now). [SVN r82962] --- .../index/detail/rtree/node/ptr_pair.hpp | 49 ++++++++++++++++ .../boost/geometry/index/detail/varray.hpp | 57 ++++++++++++++----- 2 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp diff --git a/include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp b/include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp new file mode 100644 index 000000000..716d2145a --- /dev/null +++ b/include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp @@ -0,0 +1,49 @@ +// Boost.Geometry Index +// +// Movable-only pair intended to be used internally in nodes. +// It may be used to provide exclusive ownership of node pointers +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PTR_PAIR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PTR_PAIR_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +class ptr_pair +{ + BOOST_MOVABLE_BUT_NOT_COPYABLE(ptr_pair) +public: + typedef First first_type; + typedef Pointer second_type; + ptr_pair(First const& f, Pointer s) : first(f), second(s) {} + +// INFO - members aren't really moved! + ptr_pair(BOOST_RV_REF(ptr_pair) p) : first(p.first), second(p.second) { p.second = 0; } + ptr_pair & operator=(BOOST_RV_REF(ptr_pair) p) { first = p.first; second = p.second; p.second = 0; return *this; } + + first_type first; + second_type second; +}; + +template inline +ptr_pair +make_ptr_pair(First const& f, Pointer s) +{ + return ptr_pair(f, s); +} + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PTR_PAIR_HPP diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index f47a13761..32ed1c810 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -49,6 +49,8 @@ class varray INVALID_CAPACITY, (varray)); + BOOST_COPYABLE_AND_MOVABLE(varray) + public: typedef Value value_type; typedef Value& reference; @@ -82,20 +84,17 @@ public: } // strong - varray(varray const& other) + varray(BOOST_COPY_ASSIGN_REF(varray) other) : m_size(other.m_size) { this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw } // strong - template - varray(varray const& other) + varray(BOOST_RV_REF(varray) other) : m_size(other.m_size) { - check_capacity(other.m_size); - - this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw + this->uninitialized_move(other.begin(), other.end(), this->begin()); // may throw } // strong @@ -107,7 +106,7 @@ public: } // basic - varray & operator=(varray const& other) + varray & operator=(BOOST_COPY_ASSIGN_REF(varray) other) { assign(other.begin(), other.end()); // may throw @@ -115,8 +114,7 @@ public: } // basic - template - varray & operator=(varray const& other) + varray & operator=(BOOST_RV_REF(varray) other) { assign(other.begin(), other.end()); // may throw @@ -176,6 +174,14 @@ public: ++m_size; // update end } + void push_back(BOOST_RV_REF(value_type) value) + { + check_capacity(m_size + 1); + + this->uninitialized_fill(this->end(), value); // may throw + ++m_size; // update end + } + // nothrow void pop_back() { @@ -622,19 +628,26 @@ private: uninitialized_fill_dispatch(dst, v, use_memcpy()); // may throw } - void uninitialized_fill_dispatch(iterator ptr, value_type const& v, + void uninitialized_fill_dispatch(iterator dst, value_type const& v, boost::mpl::bool_ const& /*use_memcpy*/) { // TODO - check if value_type has operator& defined and call this version only if it hasn't const value_type * vptr = &v; - ::memcpy(&(*ptr), vptr, sizeof(value_type)); + ::memcpy(&(*dst), vptr, sizeof(value_type)); } template - void uninitialized_fill_dispatch(iterator ptr, V const& v, + void uninitialized_fill_dispatch(iterator dst, V const& v, boost::mpl::bool_ const& /*use_memcpy*/) { - new (&(*ptr)) value_type(v); // may throw + new (&(*dst)) value_type(v); // may throw + } + + template + void uninitialized_fill(iterator dst, BOOST_RV_REF(V) v) + { + // TODO optimized version if has_trivial_move + new (&(*dst)) value_type(v); // may throw } // move @@ -760,6 +773,24 @@ private: ptr->~value_type(); } + // uninitialized_move + + template + void uninitialized_move(Iterator first, Iterator last, iterator dst) + { + iterator o = dst; + try + { + for (; first != last; ++first, ++o ) + new (boost::addressof(*o)) value_type(boost::move(*first)); + } + catch(...) + { + destroy(dst, o); + throw; + } + } + // construct void construct(iterator first, iterator last) From 4270e53fe53ed4e488b807e6330164e45d48a116 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 18 Feb 2013 01:32:39 +0000 Subject: [PATCH 328/366] rtree detail varray error fixed [SVN r82963] --- include/boost/geometry/index/detail/varray.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index 32ed1c810..de63456db 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -84,7 +84,7 @@ public: } // strong - varray(BOOST_COPY_ASSIGN_REF(varray) other) + varray(varray const& other) : m_size(other.m_size) { this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw From a98548fe76f9bf360cf9c03d9b638a7534dbfdf7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 18 Feb 2013 03:02:28 +0000 Subject: [PATCH 329/366] rtree: copy_from_back() replaced by move_from_back(), auto_deallocator used instead of try-catch block in create_node, nonassignable removed, container::allocator_traits used in create_node [SVN r82964] --- .../geometry/index/detail/nonassignable.hpp | 23 ----------- .../detail/rtree/node/auto_deallocator.hpp | 38 +++++++++++++++++++ .../detail/rtree/node/dynamic_visitor.hpp | 7 ---- .../geometry/index/detail/rtree/node/node.hpp | 4 +- .../detail/rtree/node/node_d_mem_dynamic.hpp | 28 ++++++-------- .../detail/rtree/node/node_d_mem_static.hpp | 34 ----------------- .../detail/rtree/node/node_s_mem_dynamic.hpp | 27 +++++++------ .../rtree/quadratic/redistribute_elements.hpp | 10 ++--- .../index/detail/rtree/rstar/insert.hpp | 1 - .../rtree/rstar/redistribute_elements.hpp | 3 -- .../detail/rtree/visitors/children_box.hpp | 1 - .../index/detail/rtree/visitors/count.hpp | 2 - .../index/detail/rtree/visitors/insert.hpp | 1 - .../detail/rtree/visitors/nearest_query.hpp | 1 - .../index/detail/rtree/visitors/remove.hpp | 5 +-- .../detail/rtree/visitors/spatial_query.hpp | 1 - include/boost/geometry/index/rtree.hpp | 1 - 17 files changed, 72 insertions(+), 115 deletions(-) delete mode 100644 include/boost/geometry/index/detail/nonassignable.hpp create mode 100644 include/boost/geometry/index/detail/rtree/node/auto_deallocator.hpp diff --git a/include/boost/geometry/index/detail/nonassignable.hpp b/include/boost/geometry/index/detail/nonassignable.hpp deleted file mode 100644 index 944fc1547..000000000 --- a/include/boost/geometry/index/detail/nonassignable.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// Boost.Geometry Index -// -// Nonassignable base class. -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP -#define BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP - -namespace boost { namespace geometry { namespace index { namespace detail { - -class nonassignable -{ - nonassignable & operator=(nonassignable const&); -}; - -}}}} // namespace boost::geometry::index::detail - -#endif // BOOST_GEOMETRY_INDEX_DETAIL_NONASSIGNABLE_HPP diff --git a/include/boost/geometry/index/detail/rtree/node/auto_deallocator.hpp b/include/boost/geometry/index/detail/rtree/node/auto_deallocator.hpp new file mode 100644 index 000000000..dd55c6d76 --- /dev/null +++ b/include/boost/geometry/index/detail/rtree/node/auto_deallocator.hpp @@ -0,0 +1,38 @@ +// Boost.Geometry Index +// +// R-tree auto deallocator +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_AUTO_DEALLOCATOR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_AUTO_DEALLOCATOR_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +class auto_deallocator +{ + auto_deallocator(auto_deallocator const&); + auto_deallocator & operator=(auto_deallocator const&); +public: + typedef typename Alloc::pointer pointer; + inline auto_deallocator(Alloc & a, pointer p) : m_alloc(a), m_ptr(p) {} + inline ~auto_deallocator() { if ( m_ptr ) boost::container::allocator_traits::deallocate(m_alloc, m_ptr, 1); } + inline void release() { m_ptr = 0; } + inline pointer ptr() { return m_ptr; } +private: + Alloc & m_alloc; + pointer m_ptr; +}; + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_AUTO_DEALLOCATOR_HPP diff --git a/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp b/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp index 93bad4178..477d937db 100644 --- a/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp +++ b/include/boost/geometry/index/detail/rtree/node/dynamic_visitor.hpp @@ -72,13 +72,6 @@ inline Derived & get(dynamic_node & n) return static_cast(n); } -//template -//inline Derived * get(dynamic_node * n) -//{ -// BOOST_GEOMETRY_INDEX_ASSERT(dynamic_cast(n), "can't cast to a Derived type"); -// return static_cast(n); -//} - // apply visitor template diff --git a/include/boost/geometry/index/detail/rtree/node/node.hpp b/include/boost/geometry/index/detail/rtree/node/node.hpp index bc4c62d26..ad927dfdb 100644 --- a/include/boost/geometry/index/detail/rtree/node/node.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node.hpp @@ -148,14 +148,14 @@ struct clear_node }; template -void copy_from_back(Container & container, Iterator it) +void move_from_back(Container & container, Iterator it) { BOOST_GEOMETRY_INDEX_ASSERT(!container.empty(), "cannot copy from empty container"); Iterator back_it = container.end(); --back_it; if ( it != back_it ) { - *it = *back_it; // MAY THROW (copy) + *it = boost::move(*back_it); // MAY THROW (copy) } } diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index d0da104fc..48528dcf3 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -14,6 +14,7 @@ #include #include +#include namespace boost { namespace geometry { namespace index { @@ -252,25 +253,19 @@ struct create_dynamic_node template static inline BaseNodePtr apply(AllocNode & alloc_node) { - typedef typename AllocNode::pointer P; + typedef boost::container::allocator_traits Al; + typedef typename Al::pointer P; - P p = alloc_node.allocate(1); + P p = Al::allocate(alloc_node, 1); if ( 0 == p ) throw std::bad_alloc(); // TODO throw different exception - try - { - // NOTE/TODO - // Here the whole node may be copied - alloc_node.construct(p, Node(alloc_node)); - } - catch(...) - { - alloc_node.deallocate(p, 1); - throw; - } + auto_deallocator deallocator(alloc_node, p); + Al::construct(alloc_node, p, alloc_node); + + deallocator.release(); return p; } }; @@ -283,11 +278,12 @@ struct destroy_dynamic_node template static inline void apply(AllocNode & alloc_node, BaseNodePtr n) { - typedef typename AllocNode::pointer P; + typedef boost::container::allocator_traits Al; + typedef typename Al::pointer P; P p(&static_cast(rtree::get(*n))); - alloc_node.destroy(p); - alloc_node.deallocate(p, 1); + Al::destroy(alloc_node, p); + Al::deallocate(alloc_node, p, 1); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index b263c4c5b..8e35e8494 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -168,40 +168,6 @@ public: leaf_allocator_type const& leaf_allocator() const{ return *this; } }; -// create_node - -template -struct create_node< - Allocators, - dynamic_internal_node -> -{ - static inline typename Allocators::node_pointer - apply(Allocators & allocators) - { - return create_dynamic_node< - typename Allocators::node_pointer, - dynamic_internal_node - >::apply(allocators.internal_node_allocator()); - } -}; - -template -struct create_node< - Allocators, - dynamic_leaf -> -{ - static inline typename Allocators::node_pointer - apply(Allocators & allocators) - { - return create_dynamic_node< - typename Allocators::node_pointer, - dynamic_leaf - >::apply(allocators.leaf_allocator()); - } -}; - }} // namespace detail::rtree }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index e3f66544f..bfba1a61e 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -150,23 +150,19 @@ struct create_static_node template static inline VariantPtr apply(AllocNode & alloc_node) { - VariantPtr p = alloc_node.allocate(1); + typedef boost::container::allocator_traits Al; + typedef typename Al::pointer P; + + P p = Al::allocate(alloc_node, 1); if ( 0 == p ) throw std::bad_alloc(); - try - { - // NOTE/TODO - // Here the whole node may be copied - alloc_node.construct(p, Node(alloc_node)); // implicit cast to Variant - } - catch(...) - { - alloc_node.deallocate(p, 1); - throw; - } + auto_deallocator deallocator(alloc_node, p); + Al::construct(alloc_node, p, Node(alloc_node)); // implicit cast to Variant + + deallocator.release(); return p; } }; @@ -179,8 +175,11 @@ struct destroy_static_node template static inline void apply(AllocNode & alloc_node, VariantPtr n) { - alloc_node.destroy(n); - alloc_node.deallocate(n, 1); + typedef boost::container::allocator_traits Al; + typedef typename Al::pointer P; + + Al::destroy(alloc_node, n); + Al::deallocate(alloc_node, n, 1); } }; diff --git a/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp index eeda1adec..2ce58335a 100644 --- a/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp @@ -137,16 +137,16 @@ struct redistribute_elements template class insert : public rtree::visitor::type - , index::detail::nonassignable { typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp index 75c78f0b5..6e1b828ee 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_RSTAR_REDISTRIBUTE_ELEMENTS_HPP -#include - #include #include #include @@ -29,7 +27,6 @@ namespace rstar { template class element_axis_corner_less - : index::detail::nonassignable { public: element_axis_corner_less(Translator const& tr) diff --git a/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp index 4d5310b3a..90eba7c18 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp @@ -20,7 +20,6 @@ namespace detail { namespace rtree { namespace visitors { template class children_box : public rtree::visitor::type - , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; diff --git a/include/boost/geometry/index/detail/rtree/visitors/count.hpp b/include/boost/geometry/index/detail/rtree/visitors/count.hpp index 2c1d8717f..1c37dcf52 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/count.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/count.hpp @@ -20,7 +20,6 @@ namespace detail { namespace rtree { namespace visitors { template struct count : public rtree::visitor::type - , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; @@ -69,7 +68,6 @@ struct count template struct count : public rtree::visitor::type - , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index 16c6465a5..ff26419d9 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -223,7 +223,6 @@ struct insert_traverse_data template class insert : public rtree::visitor::type - , index::detail::nonassignable { protected: typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp index 18aee5404..fddb0e719 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp @@ -159,7 +159,6 @@ template < > class nearest_query : public rtree::visitor::type - , index::detail::nonassignable { public: typedef typename Options::parameters_type parameters_type; diff --git a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp index 4786df510..33cca203c 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp @@ -25,7 +25,6 @@ namespace detail { namespace rtree { namespace visitors { template class remove : public rtree::visitor::type - , index::detail::nonassignable { typedef typename Options::parameters_type parameters_type; @@ -138,7 +137,7 @@ public: { if ( m_translator.equals(*it, m_value) ) { - rtree::copy_from_back(elements, it); // MAY THROW (V: copy) + rtree::move_from_back(elements, it); // MAY THROW (V: copy) elements.pop_back(); m_is_value_removed = true; break; @@ -199,7 +198,7 @@ private: try { - rtree::copy_from_back(elements, underfl_el_it); // MAY THROW (E: copy) + rtree::move_from_back(elements, underfl_el_it); // MAY THROW (E: copy) elements.pop_back(); } catch(...) diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index 87b0e4904..986aec547 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -22,7 +22,6 @@ namespace detail { namespace rtree { namespace visitors { template struct spatial_query : public rtree::visitor::type - , index::detail::nonassignable { typedef typename rtree::node::type node; typedef typename rtree::internal_node::type internal_node; diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 105dd1791..4d0b5c80c 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -20,7 +20,6 @@ #include #include -#include #include #include From 9198afb7f95823933f4333d9069237fdecc196d4 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 18 Feb 2013 03:29:18 +0000 Subject: [PATCH 330/366] compile errors fixed: allocator_traits::construct() and destroyed() replaced by allocator calls because of errors in Boost.Container, nonasignable uses removed. [SVN r82965] --- .../index/detail/rtree/node/node_d_mem_dynamic.hpp | 8 ++++++-- .../index/detail/rtree/node/node_s_mem_dynamic.hpp | 8 ++++++-- .../geometry/index/detail/rtree/visitors/are_boxes_ok.hpp | 1 - .../index/detail/rtree/visitors/are_levels_ok.hpp | 1 - .../boost/geometry/index/detail/rtree/visitors/copy.hpp | 1 - .../geometry/index/detail/rtree/visitors/destroy.hpp | 1 - 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 48528dcf3..ca767c3b8 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -263,7 +263,9 @@ struct create_dynamic_node auto_deallocator deallocator(alloc_node, p); - Al::construct(alloc_node, p, alloc_node); + alloc_node.construct(p, Node(alloc_node)); + // TEMPORARILY COMMENTED OUT + //Al::construct(alloc_node, p, alloc_node); deallocator.release(); return p; @@ -282,7 +284,9 @@ struct destroy_dynamic_node typedef typename Al::pointer P; P p(&static_cast(rtree::get(*n))); - Al::destroy(alloc_node, p); + alloc_node.destroy(p); + // TEMPORARILY COMMENTED OUT + //Al::destroy(alloc_node, p); Al::deallocate(alloc_node, p, 1); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index bfba1a61e..b569dd5a7 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -160,7 +160,9 @@ struct create_static_node auto_deallocator deallocator(alloc_node, p); - Al::construct(alloc_node, p, Node(alloc_node)); // implicit cast to Variant + alloc_node.construct(p, Node(alloc_node)); + // TEMPORARILY COMMENTED OUT + //Al::construct(alloc_node, p, Node(alloc_node)); // implicit cast to Variant deallocator.release(); return p; @@ -178,7 +180,9 @@ struct destroy_static_node typedef boost::container::allocator_traits Al; typedef typename Al::pointer P; - Al::destroy(alloc_node, n); + alloc_node.destroy(n); + // TEMPORARILY COMMENTED OUT + //Al::destroy(alloc_node, n); Al::deallocate(alloc_node, n, 1); } }; diff --git a/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp index 81596b84b..7b85a15db 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp @@ -21,7 +21,6 @@ namespace visitors { template class are_boxes_ok : public rtree::visitor::type - , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; diff --git a/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp index b2a0d4134..24383e87d 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp @@ -20,7 +20,6 @@ namespace visitors { template class are_levels_ok : public rtree::visitor::type - , index::detail::nonassignable { typedef typename rtree::internal_node::type internal_node; typedef typename rtree::leaf::type leaf; diff --git a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp index 29b76326e..c832cb892 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp @@ -20,7 +20,6 @@ namespace detail { namespace rtree { namespace visitors { template class copy : public rtree::visitor::type - , boost::noncopyable { public: typedef typename rtree::node::type node; diff --git a/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp index 5227715d9..7c5129c31 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp @@ -20,7 +20,6 @@ namespace detail { namespace rtree { namespace visitors { template class destroy : public rtree::visitor::type - , boost::noncopyable { public: typedef typename rtree::node::type node; From c47f314aaa8028b9a660590eb3c59f6efafafd11 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 18 Feb 2013 03:37:52 +0000 Subject: [PATCH 331/366] calls to allocator_traits::construct() and ::destroy() used, this time with valid parameters, C++11 requires raw pointers [SVN r82966] --- .../index/detail/rtree/node/node_d_mem_dynamic.hpp | 8 ++------ .../index/detail/rtree/node/node_s_mem_dynamic.hpp | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index ca767c3b8..c282e91f0 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -263,9 +263,7 @@ struct create_dynamic_node auto_deallocator deallocator(alloc_node, p); - alloc_node.construct(p, Node(alloc_node)); - // TEMPORARILY COMMENTED OUT - //Al::construct(alloc_node, p, alloc_node); + Al::construct(alloc_node, boost::addressof(*p), alloc_node); deallocator.release(); return p; @@ -284,9 +282,7 @@ struct destroy_dynamic_node typedef typename Al::pointer P; P p(&static_cast(rtree::get(*n))); - alloc_node.destroy(p); - // TEMPORARILY COMMENTED OUT - //Al::destroy(alloc_node, p); + Al::destroy(alloc_node, boost::addressof(*p)); Al::deallocate(alloc_node, p, 1); } }; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index b569dd5a7..2090aabb3 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -160,9 +160,7 @@ struct create_static_node auto_deallocator deallocator(alloc_node, p); - alloc_node.construct(p, Node(alloc_node)); - // TEMPORARILY COMMENTED OUT - //Al::construct(alloc_node, p, Node(alloc_node)); // implicit cast to Variant + Al::construct(alloc_node, boost::addressof(*p), Node(alloc_node)); // implicit cast to Variant deallocator.release(); return p; @@ -178,11 +176,8 @@ struct destroy_static_node static inline void apply(AllocNode & alloc_node, VariantPtr n) { typedef boost::container::allocator_traits Al; - typedef typename Al::pointer P; - alloc_node.destroy(n); - // TEMPORARILY COMMENTED OUT - //Al::destroy(alloc_node, n); + Al::destroy(alloc_node, boost::addressof(*n)); Al::deallocate(alloc_node, n, 1); } }; From d16ffc0297a1b9e3ab2d2edbff8da0e4529ac0e3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 18 Feb 2013 19:40:39 +0000 Subject: [PATCH 332/366] rtree: added include missing for standalone usage of detail::varray [SVN r82979] --- include/boost/geometry/index/detail/varray.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index de63456db..f42d153a5 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -12,6 +12,7 @@ #include #include +#include #include #include From a3778c9097ab207b046d5ab64f00294dfb8cda5d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 19 Feb 2013 13:17:52 +0000 Subject: [PATCH 333/366] rtree: Geometries stored in predicates as const& instead of a copy, envelope_tag renamed to bounds_tag, MSVC warnings disabled/fixed. [SVN r82999] --- .../geometry/index/detail/config_begin.hpp | 29 +++++++++++ .../geometry/index/detail/config_end.hpp | 16 ++++++ .../index/detail/distance_predicates.hpp | 24 ++++----- .../geometry/index/detail/predicates.hpp | 52 +++++++++---------- .../rtree/linear/redistribute_elements.hpp | 2 + .../rtree/quadratic/redistribute_elements.hpp | 7 +-- .../detail/rtree/rstar/choose_next_node.hpp | 2 + .../index/detail/rtree/rstar/insert.hpp | 2 + .../rtree/rstar/redistribute_elements.hpp | 2 + .../detail/rtree/visitors/nearest_query.hpp | 6 +-- .../detail/rtree/visitors/spatial_query.hpp | 2 +- include/boost/geometry/index/detail/tags.hpp | 2 +- .../boost/geometry/index/detail/varray.hpp | 2 +- include/boost/geometry/index/rtree.hpp | 4 ++ 14 files changed, 105 insertions(+), 47 deletions(-) create mode 100644 include/boost/geometry/index/detail/config_begin.hpp create mode 100644 include/boost/geometry/index/detail/config_end.hpp diff --git a/include/boost/geometry/index/detail/config_begin.hpp b/include/boost/geometry/index/detail/config_begin.hpp new file mode 100644 index 000000000..6a3bee17f --- /dev/null +++ b/include/boost/geometry/index/detail/config_begin.hpp @@ -0,0 +1,29 @@ +// Boost.Geometry Index +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#ifdef BOOST_MSVC + + #define BOOST_GEOMETRY_INDEX_DETAIL_USE_PARAM(A) (void)A; + + #ifndef _CRT_SECURE_NO_DEPRECATE + #define BOOST_GEOMETRY_INDEX_DETAIL_CRT_SECURE_NO_DEPRECATE_ENABLED + #define _CRT_SECURE_NO_DEPRECATE + #endif + + #pragma warning (push) + #pragma warning (disable : 4512) // assignment operator could not be generated + #pragma warning (disable : 4127) // conditional expression is constant + +#else //BOOST_MSVC + + #define BOOST_GEOMETRY_INDEX_DETAIL_USE_PARAM(A) + +#endif //BOOST_MSVC + diff --git a/include/boost/geometry/index/detail/config_end.hpp b/include/boost/geometry/index/detail/config_end.hpp new file mode 100644 index 000000000..2d5e7250b --- /dev/null +++ b/include/boost/geometry/index/detail/config_end.hpp @@ -0,0 +1,16 @@ +// Boost.Geometry Index +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#if defined BOOST_MSVC + #pragma warning (pop) +/*#ifdef BOOST_GEOMETRY_INDEX_DETAIL_CRT_SECURE_NO_DEPRECATE_ENABLED +#undef BOOST_GEOMETRY_INDEX_DETAIL_CRT_SECURE_NO_DEPRECATE_ENABLED +#undef _CRT_SECURE_NO_DEPRECATE +#endif*/ +#endif + diff --git a/include/boost/geometry/index/detail/distance_predicates.hpp b/include/boost/geometry/index/detail/distance_predicates.hpp index 4bfa3b5ae..e80176ec0 100644 --- a/include/boost/geometry/index/detail/distance_predicates.hpp +++ b/include/boost/geometry/index/detail/distance_predicates.hpp @@ -666,14 +666,14 @@ struct distances_predicates_check //}; // ------------------------------------------------------------------ // -// distance_calc for envelope_tag +// distance_calc for bounds_tag // ------------------------------------------------------------------ // template struct distances_calc< PointRelation, Box, - envelope_tag> + bounds_tag> { typedef typename detail::relation::value_type point_type; typedef typename geometry::default_distance_result::type distance_type; @@ -693,7 +693,7 @@ struct distances_calc< //struct distances_calc< // detail::unbounded, // Box, -// envelope_tag +// bounds_tag //> //{ // typedef typename detail::relation::value_type point_type; @@ -714,7 +714,7 @@ struct distances_calc< //struct distances_calc< // detail::min_bounded, // Box, -// envelope_tag +// bounds_tag //> //{ // typedef typename detail::relation::value_type point_type; @@ -738,7 +738,7 @@ struct distances_calc< //struct distances_calc< // detail::max_bounded, // Box, -// envelope_tag +// bounds_tag //> //{ // typedef typename detail::relation::value_type point_type; @@ -759,7 +759,7 @@ struct distances_calc< //struct distances_calc< // detail::bounded, // Box, -// envelope_tag +// bounds_tag //> //{ // typedef typename detail::relation::value_type point_type; @@ -780,14 +780,14 @@ struct distances_calc< //}; // ------------------------------------------------------------------ // -// distance_predicates_check for envelope_tag +// distance_predicates_check for bounds_tag // ------------------------------------------------------------------ // template struct distances_predicates_check< PointRelation, Box, - envelope_tag> + bounds_tag> { template static inline bool apply(PointRelation const&, Distances const&) @@ -800,7 +800,7 @@ struct distances_predicates_check< //struct distances_predicates_check< // detail::unbounded, // Box, -// envelope_tag> +// bounds_tag> //{ // template // static inline bool apply( @@ -815,7 +815,7 @@ struct distances_predicates_check< //struct distances_predicates_check< // detail::min_bounded, // Box, -// envelope_tag> +// bounds_tag> //{ // template // static inline bool apply( @@ -831,7 +831,7 @@ struct distances_predicates_check< //struct distances_predicates_check< // detail::max_bounded, // Box, -// envelope_tag> +// bounds_tag> //{ // template // static inline bool apply( @@ -847,7 +847,7 @@ struct distances_predicates_check< //struct distances_predicates_check< // detail::bounded, // Box, -// envelope_tag> +// bounds_tag> //{ // template // static inline bool apply( diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index 734358b16..fa5067a31 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -33,28 +33,28 @@ template struct covered_by { covered_by(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template struct disjoint { disjoint(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template struct intersects { intersects(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template struct overlaps { overlaps(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; //template @@ -68,35 +68,35 @@ template struct within { within(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template struct not_covered_by { not_covered_by(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template struct not_disjoint { not_disjoint(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template struct not_intersects { not_intersects(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template struct not_overlaps { not_overlaps(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; //template @@ -110,7 +110,7 @@ template struct not_within { not_within(Geometry const& g) : geometry(g) {} - Geometry geometry; + Geometry const& geometry; }; template @@ -306,7 +306,7 @@ struct predicate_check, value_tag> // ------------------------------------------------------------------ // template -struct predicate_check +struct predicate_check { template static inline bool apply(Geometry const& g, Value const&, Indexable const& i) @@ -316,7 +316,7 @@ struct predicate_check }; template <> -struct predicate_check +struct predicate_check { template static inline bool apply(Geometry const&, Value const&, Indexable const&) @@ -326,7 +326,7 @@ struct predicate_check }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(value const&, Value const&, Box const&) @@ -336,7 +336,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(covered_by const& p, Value const&, Box const& i) @@ -346,7 +346,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(disjoint const& p, Value const&, Box const& i) @@ -356,7 +356,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static inline bool apply(intersects const& p, Value const&, Indexable const& i) @@ -366,7 +366,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static inline bool apply(overlaps const& p, Value const&, Box const& i) @@ -378,7 +378,7 @@ struct predicate_check, envelope_tag> }; //template -//struct predicate_check, envelope_tag> +//struct predicate_check, bounds_tag> //{ // template // static bool apply(touches const& p, Value const&, Box const& i) @@ -388,7 +388,7 @@ struct predicate_check, envelope_tag> //}; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(within const& p, Value const&, Box const& i) @@ -400,7 +400,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(not_covered_by const& p, Value const&, Box const& i) @@ -410,7 +410,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(not_disjoint const& p, Value const&, Box const& i) @@ -420,7 +420,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(not_intersects const& p, Value const&, Box const& i) @@ -430,7 +430,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(not_overlaps const& , Value const&, Box const& ) @@ -440,7 +440,7 @@ struct predicate_check, envelope_tag> }; //template -//struct predicate_check, envelope_tag> +//struct predicate_check, bounds_tag> //{ // template // static bool apply(not_touches const& p, Value const&, Box const& i) @@ -450,7 +450,7 @@ struct predicate_check, envelope_tag> //}; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static bool apply(not_within const& p, Value const&, Box const& i) @@ -460,7 +460,7 @@ struct predicate_check, envelope_tag> }; template -struct predicate_check, envelope_tag> +struct predicate_check, bounds_tag> { template static inline bool apply(nearest const&, Value const&, Box const&) diff --git a/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp index 17bc20a94..dc423777b 100644 --- a/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp @@ -111,6 +111,8 @@ struct find_greatest_normalized_separation seed1 = highest_low_index; seed2 = lowest_high_index; + + BOOST_GEOMETRY_INDEX_DETAIL_USE_PARAM(parameters) } }; diff --git a/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp index 2ce58335a..15ae3fa44 100644 --- a/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp @@ -70,6 +70,8 @@ struct pick_seeds } } } + + BOOST_GEOMETRY_INDEX_DETAIL_USE_PARAM(parameters) } }; @@ -102,9 +104,8 @@ struct redistribute_elements::type internal_node; typedef typename rtree::leaf::type leaf; - typedef index::detail::distances_calc node_distances_calc; + typedef index::detail::distances_calc node_distances_calc; typedef typename node_distances_calc::result_type node_distances_type; - typedef index::detail::distances_predicates_check node_distances_predicates_check; + typedef index::detail::distances_predicates_check node_distances_predicates_check; typedef index::detail::distances_calc< DistancesPredicates, @@ -212,7 +212,7 @@ public: { // if current node meets predicates // 0 - dummy value - if ( index::detail::predicates_check(m_pred, 0, it->first) ) + if ( index::detail::predicates_check(m_pred, 0, it->first) ) { // calculate node's distance(s) for distance predicate node_distances_type node_dist_data = node_distances_calc::apply(m_dist_pred, it->first); diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index 986aec547..9fd7f0e04 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -44,7 +44,7 @@ struct spatial_query { // if node meets predicates // 0 - dummy value - if ( index::detail::predicates_check(pred, 0, it->first) ) + if ( index::detail::predicates_check(pred, 0, it->first) ) rtree::apply_visitor(*this, *it->second); } } diff --git a/include/boost/geometry/index/detail/tags.hpp b/include/boost/geometry/index/detail/tags.hpp index 4d462df7e..e1a1716be 100644 --- a/include/boost/geometry/index/detail/tags.hpp +++ b/include/boost/geometry/index/detail/tags.hpp @@ -16,7 +16,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { struct value_tag {}; -struct envelope_tag {}; +struct bounds_tag {}; } // namespace detail diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index f42d153a5..0cbec3702 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -819,7 +819,7 @@ private: } } - void check_capacity(size_type s) const + void check_capacity(size_type BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(s)) const { BOOST_ASSERT_MSG(s <= Capacity, "size can't exceed the capacity"); //if ( Capacity < s ) throw std::bad_alloc(); diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 4d0b5c80c..bb6df47da 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -19,6 +19,8 @@ #include +#include + #include #include @@ -1360,4 +1362,6 @@ bounds(rtree const& tree) }}} // namespace boost::geometry::index +#include + #endif // BOOST_GEOMETRY_INDEX_RTREE_HPP From b09c83883da0fd9a3e4fe8aea23f6fe02994752f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 19 Feb 2013 14:20:06 +0000 Subject: [PATCH 334/366] rtree: translator_wrapper removed, detail::rtree::ptr_pair used in internal nodes instead of std::pair. [SVN r83000] --- .../geometry/index/detail/rtree/node/node.hpp | 9 ++- .../detail/rtree/node/node_d_mem_dynamic.hpp | 71 ++++++------------- .../detail/rtree/node/node_d_mem_static.hpp | 7 +- .../detail/rtree/node/node_s_mem_dynamic.hpp | 8 +-- .../detail/rtree/node/node_s_mem_static.hpp | 8 +-- .../index/detail/rtree/node/pairs.hpp | 69 ++++++++++++++++++ .../index/detail/rtree/node/ptr_pair.hpp | 49 ------------- .../index/detail/rtree/visitors/copy.hpp | 2 +- .../index/detail/rtree/visitors/insert.hpp | 4 +- include/boost/geometry/index/rtree.hpp | 31 ++++---- .../exceptions/test_rtree_exceptions.hpp | 2 +- 11 files changed, 123 insertions(+), 137 deletions(-) create mode 100644 include/boost/geometry/index/detail/rtree/node/pairs.hpp delete mode 100644 include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp diff --git a/include/boost/geometry/index/detail/rtree/node/node.hpp b/include/boost/geometry/index/detail/rtree/node/node.hpp index ad927dfdb..d35dcbb6f 100644 --- a/include/boost/geometry/index/detail/rtree/node/node.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node.hpp @@ -11,11 +11,18 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_HPP -#include +#include +#include +#include +#include +#include + +#include #include #include +#include #include #include diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index c282e91f0..0c3e89a11 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -11,11 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_HPP -#include - -#include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -25,11 +20,11 @@ struct dynamic_internal_node { typedef typename Allocators::leaf_allocator_type::template rebind< - std::pair + rtree::ptr_pair >::other elements_allocator_type; typedef boost::container::vector< - std::pair, + rtree::ptr_pair, elements_allocator_type > elements_type; @@ -96,61 +91,37 @@ struct visitor type; }; -template -struct translator_wrapper_helper -{ - typedef typename Element::first_type element_indexable_type; - typedef typename Element::first_type const& element_indexable_result; -}; - -template -struct translator_wrapper_helper -{ - typedef typename translator::indexable_type::type element_indexable_type; - typedef typename Translator::result_type element_indexable_result; -}; - -template -struct translator_wrapper - : public Translator -{ - translator_wrapper(Translator const& t = Translator()) : Translator(t) {} - - template - struct element_indexable_type - { - typedef typename translator_wrapper_helper::element_indexable_type type; - }; - - template - struct element_indexable_result - { - typedef typename translator_wrapper_helper::element_indexable_result type; - }; - - typename element_indexable_result::type - element_indexable(Value const& v) const { return Translator::operator()(v); } - - template - typename element_indexable_result::type - element_indexable(Element const& el) const { return el.first; } -}; - // element's indexable type template struct element_indexable_type { - typedef typename Translator::template element_indexable_type::type type; + typedef typename translator::indexable_type::type type; +}; + +template +struct element_indexable_type< + rtree::ptr_pair, + Translator +> +{ + typedef First type; }; // element's indexable getter template -typename Translator::template element_indexable_result::type +typename Translator::result_type element_indexable(Element const& el, Translator const& tr) { - return tr.element_indexable(el); + return tr(el); +} + +template +First const& +element_indexable(rtree::ptr_pair const& el, Translator const& /*tr*/) +{ + return el.first; } // nodes elements diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp index 8e35e8494..a73437045 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_static.hpp @@ -11,9 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_HPP -#include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -23,11 +20,11 @@ struct dynamic_internal_node { typedef typename Allocators::leaf_allocator_type::template rebind< - std::pair + rtree::ptr_pair >::other elements_allocator_type; typedef detail::varray< - std::pair, + rtree::ptr_pair, Parameters::max_elements + 1, elements_allocator_type > elements_type; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp index 2090aabb3..b3331e9c8 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_dynamic.hpp @@ -11,10 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP -#include - -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -25,11 +21,11 @@ template + rtree::ptr_pair >::other elements_allocator_type; typedef boost::container::vector< - std::pair, + rtree::ptr_pair, elements_allocator_type > elements_type; diff --git a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp index a480034ef..252db0c82 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_s_mem_static.hpp @@ -11,10 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_NODE_DEFAULT_STATIC_VARIANT_HPP -#include - -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { @@ -25,11 +21,11 @@ template { typedef typename Allocators::node_allocator_type::template rebind< - std::pair + rtree::ptr_pair >::other elements_allocator_type; typedef detail::varray< - std::pair, + rtree::ptr_pair, Parameters::max_elements + 1, elements_allocator_type > elements_type; diff --git a/include/boost/geometry/index/detail/rtree/node/pairs.hpp b/include/boost/geometry/index/detail/rtree/node/pairs.hpp new file mode 100644 index 000000000..8cdbdd131 --- /dev/null +++ b/include/boost/geometry/index/detail/rtree/node/pairs.hpp @@ -0,0 +1,69 @@ +// Boost.Geometry Index +// +// Pairs intended to be used internally in nodes. +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace rtree { + +template +class ptr_pair +{ +public: + typedef First first_type; + typedef Pointer second_type; + ptr_pair(First const& f, Pointer s) : first(f), second(s) {} + ptr_pair(ptr_pair const& p) : first(p.first), second(p.second) {} + ptr_pair & operator=(ptr_pair const& p) { first = p.first; second = p.second; return *this; } + + first_type first; + second_type second; +}; + +template inline +ptr_pair +make_ptr_pair(First const& f, Pointer s) +{ + return ptr_pair(f, s); +} + +template +class exclusive_ptr_pair +{ + BOOST_MOVABLE_BUT_NOT_COPYABLE(exclusive_ptr_pair) +public: + typedef First first_type; + typedef Pointer second_type; + exclusive_ptr_pair(First const& f, Pointer s) : first(f), second(s) {} + + // INFO - members aren't really moved! + exclusive_ptr_pair(BOOST_RV_REF(exclusive_ptr_pair) p) : first(p.first), second(p.second) { p.second = 0; } + exclusive_ptr_pair & operator=(BOOST_RV_REF(exclusive_ptr_pair) p) { first = p.first; second = p.second; p.second = 0; return *this; } + + first_type first; + second_type second; +}; + +template inline +exclusive_ptr_pair +make_exclusive_ptr_pair(First const& f, Pointer s) +{ + return exclusive_ptr_pair(f, s); +} + +}} // namespace detail::rtree + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PAIRS_HPP diff --git a/include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp b/include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp deleted file mode 100644 index 716d2145a..000000000 --- a/include/boost/geometry/index/detail/rtree/node/ptr_pair.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Boost.Geometry Index -// -// Movable-only pair intended to be used internally in nodes. -// It may be used to provide exclusive ownership of node pointers -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PTR_PAIR_HPP -#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PTR_PAIR_HPP - -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace rtree { - -template -class ptr_pair -{ - BOOST_MOVABLE_BUT_NOT_COPYABLE(ptr_pair) -public: - typedef First first_type; - typedef Pointer second_type; - ptr_pair(First const& f, Pointer s) : first(f), second(s) {} - -// INFO - members aren't really moved! - ptr_pair(BOOST_RV_REF(ptr_pair) p) : first(p.first), second(p.second) { p.second = 0; } - ptr_pair & operator=(BOOST_RV_REF(ptr_pair) p) { first = p.first; second = p.second; p.second = 0; return *this; } - - first_type first; - second_type second; -}; - -template inline -ptr_pair -make_ptr_pair(First const& f, Pointer s) -{ - return ptr_pair(f, s); -} - -}} // namespace detail::rtree - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_PTR_PAIR_HPP diff --git a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp index c832cb892..8a084d479 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp @@ -52,7 +52,7 @@ public: // for exception safety node_auto_ptr auto_result(result, m_allocators); - elements_dst.push_back( std::make_pair(it->first, result) ); // MAY THROW, STRONG (E: alloc, copy) + elements_dst.push_back( rtree::make_ptr_pair(it->first, result) ); // MAY THROW, STRONG (E: alloc, copy) auto_result.release(); } diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index ff26419d9..d872a14da 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -169,7 +169,7 @@ public: "unexpected number of elements"); // return the list of newly created nodes (this algorithm returns one) - additional_nodes.push_back(std::make_pair(box2, second_node.get())); // MAY THROW, STRONG (alloc, copy) + additional_nodes.push_back(rtree::make_ptr_pair(box2, second_node.get())); // MAY THROW, STRONG (alloc, copy) // release the ptr second_node.release(); @@ -352,7 +352,7 @@ protected: node_auto_ptr new_root(rtree::create_node::apply(m_allocators), m_allocators); // MAY THROW, STRONG (N:alloc) try { - rtree::elements(rtree::get(*new_root)).push_back(std::make_pair(n_box, m_root_node)); // MAY THROW, STRONG (E:alloc, copy) + rtree::elements(rtree::get(*new_root)).push_back(rtree::make_ptr_pair(n_box, m_root_node)); // MAY THROW, STRONG (E:alloc, copy) rtree::elements(rtree::get(*new_root)).push_back(additional_nodes[0]); // MAY THROW, STRONG (E:alloc, copy) } catch (...) { // clear new root to not delete in the ~node_auto_ptr() potentially stored old root node diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index bb6df47da..35a114eab 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -132,7 +132,6 @@ private: typedef typename detail::rtree::internal_node::type internal_node; typedef typename detail::rtree::leaf::type leaf; - typedef detail::rtree::translator_wrapper translator_wrapper; typedef typename allocators_type::node_pointer node_pointer; public: @@ -713,7 +712,7 @@ public: return result; } - detail::rtree::visitors::children_box + detail::rtree::visitors::children_box box_v(result, m_members.translator()); detail::rtree::apply_visitor(box_v, *m_members.root); @@ -739,7 +738,7 @@ public: if ( !m_members.root ) return 0; - detail::rtree::visitors::count + detail::rtree::visitors::count count_v(vori, m_members.translator()); detail::rtree::apply_visitor(count_v, *m_members.root); @@ -855,7 +854,7 @@ private: detail::rtree::visitors::insert< value_type, - value_type, options_type, translator_wrapper, box_type, allocators_type, + value_type, options_type, translator_type, box_type, allocators_type, typename options_type::insert_tag > insert_v(m_members.root, m_members.leafs_level, value, m_members.parameters(), m_members.translator(), m_members.allocators()); @@ -885,7 +884,7 @@ private: BOOST_GEOMETRY_INDEX_ASSERT(m_members.root, "The root must exist"); detail::rtree::visitors::remove< - value_type, options_type, translator_wrapper, box_type, allocators_type + value_type, options_type, translator_type, box_type, allocators_type > remove_v(m_members.root, m_members.leafs_level, value, m_members.parameters(), m_members.translator(), m_members.allocators()); @@ -932,7 +931,7 @@ private: { if ( t.m_members.root ) { - detail::rtree::visitors::destroy + detail::rtree::visitors::destroy del_v(t.m_members.root, t.m_members.allocators()); detail::rtree::apply_visitor(del_v, *t.m_members.root); @@ -955,7 +954,7 @@ private: */ inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const { - detail::rtree::visitors::copy + detail::rtree::visitors::copy copy_v(dst.m_members.allocators()); if ( src.m_members.root ) @@ -969,7 +968,7 @@ private: if ( dst.m_members.root ) { - detail::rtree::visitors::destroy + detail::rtree::visitors::destroy del_v(dst.m_members.root, dst.m_members.allocators()); detail::rtree::apply_visitor(del_v, *dst.m_members.root); dst.m_members.root = 0; @@ -989,7 +988,7 @@ private: template size_type query_dispatch(Predicates const& predicates, OutIter out_it, boost::mpl::bool_ const& /*is_nearest*/) const { - detail::rtree::visitors::spatial_query + detail::rtree::visitors::spatial_query find_v(m_members.translator(), predicates, out_it); detail::rtree::apply_visitor(find_v, *m_members.root); @@ -1027,7 +1026,7 @@ private: typedef detail::rtree::visitors::nearest_query_result_k< value_type, - translator_wrapper, + translator_type, point_type, OutIter > result_type; @@ -1037,7 +1036,7 @@ private: detail::rtree::visitors::nearest_query< value_type, options_type, - translator_wrapper, + translator_type, box_type, allocators_type, DistancesPredicates, @@ -1051,7 +1050,7 @@ private: } struct members_holder - : public translator_wrapper + : public translator_type , public Parameters , public allocators_type { @@ -1063,7 +1062,7 @@ private: members_holder(Transl const& transl, Parameters const& parameters, BOOST_FWD_REF(Alloc) alloc) - : translator_wrapper(transl) + : translator_type(transl) , Parameters(parameters) , allocators_type(boost::forward(alloc)) , values_count(0) @@ -1074,7 +1073,7 @@ private: template members_holder(Transl const& transl = Translator(), Parameters const& parameters = Parameters()) - : translator_wrapper(transl) + : translator_type(transl) , Parameters(parameters) , allocators_type() , values_count(0) @@ -1082,8 +1081,8 @@ private: , root(0) {} - translator_wrapper const& translator() const { return *this; } - translator_wrapper & translator() { return *this; } + translator_type const& translator() const { return *this; } + translator_type & translator() { return *this; } Parameters const& parameters() const { return *this; } Parameters & parameters() { return *this; } allocators_type const& allocators() const { return *this; } diff --git a/test/rtree/exceptions/test_rtree_exceptions.hpp b/test/rtree/exceptions/test_rtree_exceptions.hpp index db1520bcf..eea2ac6f8 100644 --- a/test/rtree/exceptions/test_rtree_exceptions.hpp +++ b/test/rtree/exceptions/test_rtree_exceptions.hpp @@ -76,7 +76,7 @@ struct dynamic_internal_node { typedef throwing_varray< - std::pair, + rtree::ptr_pair, Parameters::max_elements + 1 > elements_type; From 27c53a377962c5cee3e53c7b5f79cab4669950ee Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 19 Feb 2013 14:30:44 +0000 Subject: [PATCH 335/366] rtree: definition of _CRT_SECURE_NO_DEPRECATE removed [SVN r83001] --- include/boost/geometry/index/detail/config_begin.hpp | 5 ----- include/boost/geometry/index/detail/config_end.hpp | 4 ---- 2 files changed, 9 deletions(-) diff --git a/include/boost/geometry/index/detail/config_begin.hpp b/include/boost/geometry/index/detail/config_begin.hpp index 6a3bee17f..a5a488ff6 100644 --- a/include/boost/geometry/index/detail/config_begin.hpp +++ b/include/boost/geometry/index/detail/config_begin.hpp @@ -12,11 +12,6 @@ #define BOOST_GEOMETRY_INDEX_DETAIL_USE_PARAM(A) (void)A; - #ifndef _CRT_SECURE_NO_DEPRECATE - #define BOOST_GEOMETRY_INDEX_DETAIL_CRT_SECURE_NO_DEPRECATE_ENABLED - #define _CRT_SECURE_NO_DEPRECATE - #endif - #pragma warning (push) #pragma warning (disable : 4512) // assignment operator could not be generated #pragma warning (disable : 4127) // conditional expression is constant diff --git a/include/boost/geometry/index/detail/config_end.hpp b/include/boost/geometry/index/detail/config_end.hpp index 2d5e7250b..d144c3369 100644 --- a/include/boost/geometry/index/detail/config_end.hpp +++ b/include/boost/geometry/index/detail/config_end.hpp @@ -8,9 +8,5 @@ #if defined BOOST_MSVC #pragma warning (pop) -/*#ifdef BOOST_GEOMETRY_INDEX_DETAIL_CRT_SECURE_NO_DEPRECATE_ENABLED -#undef BOOST_GEOMETRY_INDEX_DETAIL_CRT_SECURE_NO_DEPRECATE_ENABLED -#undef _CRT_SECURE_NO_DEPRECATE -#endif*/ #endif From fd98aaab40dbc5102a241368de3062a6ea2bbd31 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 19 Feb 2013 19:36:43 +0000 Subject: [PATCH 336/366] rtree: allocator_traits used in ctor and operator= (e.g. propagate_XXX or select_XXX), index::swap() added, query_range operator| generator moved to index::detail, docs updated. [SVN r83019] --- doc/generated/rtree_functions.qbk | 23 +++ .../geometry_index/r_tree/introduction.html | 3 +- doc/html/geometry_index/r_tree/reference.html | 131 ++++++++++++++++-- doc/html/index.html | 2 +- doc/rtree/introduction.qbk | 2 +- .../boost/geometry/index/adaptors/query.hpp | 18 +-- include/boost/geometry/index/rtree.hpp | 61 ++++++-- 7 files changed, 208 insertions(+), 32 deletions(-) diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index f757938e1..f91bfe149 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -15,6 +15,7 @@ [[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] [[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] [[[link group__rtree__functions_1gadb11fdb8e75ba7652286ec6750b49c4f `bounds(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1ga043d21dc24c57fcabc5ee85093eb8b15 `swap(rtree<...> &, rtree<...> &)`]][Exchanges the contents of the container with those of other. ]] ] [#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc] @@ -346,5 +347,27 @@ It calls [^`rtree::envelope()`].[heading Synopsis] The box containing all stored values or an invalid box. [endsect] +[#group__rtree__functions_1ga043d21dc24c57fcabc5ee85093eb8b15] +[section swap(rtree<...> &, rtree<...> &)] +Exchanges the contents of the container with those of other. + +[heading Description] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 rtree::swap()]].[heading Synopsis] +[pre +`template<``typename Value``,` + `typename Options``,` + `typename Translator``,` + `typename Allocator``>` +`void boost::geometry::index::swap``(``rtree< Value, Options, Translator, Allocator > &` `l``,` `rtree< Value, Options, Translator, Allocator > &` `r``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `l` ][The first rtree. ]] +[[`rtree< Value, Options, Translator, Allocator > &`][ `r` ][The second rtree. ]] +] +[endsect] + [endsect] diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 17f4bf92e..00e5b8943 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -214,7 +214,8 @@ Dependencies

                                                                                                                                            - R-tree depends on Boost.Move, Boost.Container, Boost.Tuple. + R-tree depends on Boost.Move, Boost.Container, Boost.Tuple, + Boost.Utility, Boost.MPL.

                                                                                                                                            diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 447bf5d61..604920011 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                                                                                                                                      - + The R-tree spatial index.

                                                                                                                                      @@ -3268,6 +3268,19 @@ The R-tree spatial index.

                                                                              +

                                                                              + swap(rtree<...> + &, rtree<...> &) +

                                                                              +
                                                                              +

                                                                              + Exchanges the contents of the container with those of other. +

                                                                              +
                                                                              @@ -4492,6 +4505,106 @@ The R-tree spatial index. The box containing all stored values or an invalid box.

                                                                              +
                                                                              + +

                                                                              + Exchanges the contents of the container with those of other. +

                                                                              +
                                                                              + + Description +
                                                                              +

                                                                              + It calls rtree::swap(). +

                                                                              +
                                                                              + + Synopsis +
                                                                              +
                                                                              template<typename Value,
                                                                              +         typename Options,
                                                                              +         typename Translator,
                                                                              +         typename Allocator>
                                                                              +void boost::geometry::index::swap(rtree< Value, Options, Translator, Allocator > & l, rtree< Value, Options, Translator, Allocator > & r)
                                                                              +
                                                                              +
                                                                              + + Parameter(s) +
                                                                              +
                                                                              +++++ + + + + + + + + + + + + + + + + + +
                                                                              +

                                                                              + Type +

                                                                              +
                                                                              +

                                                                              + Name +

                                                                              +
                                                                              +

                                                                              + Description +

                                                                              +
                                                                              +

                                                                              + rtree< + Value, + Options, + Translator, + Allocator > + & +

                                                                              +
                                                                              +

                                                                              + l +

                                                                              +
                                                                              +

                                                                              + The first rtree. +

                                                                              +
                                                                              +

                                                                              + rtree< + Value, + Options, + Translator, + Allocator > + & +

                                                                              +
                                                                              +

                                                                              + r +

                                                                              +
                                                                              +

                                                                              + The second rtree. +

                                                                              +
                                                                              +

                                                                            @@ -4503,7 +4616,7 @@ The R-tree spatial index. boost::geometry::index::linear

                                                                            - + Linear r-tree creation algorithm parameters.

                                                                            @@ -4578,7 +4691,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

                                                                        - + Quadratic r-tree creation algorithm parameters.

                                                                        @@ -4653,7 +4766,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

                                                                  - + R*-tree creation algorithm parameters.

                                                                  @@ -4757,7 +4870,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

                                                            - + Linear r-tree creation algorithm parameters.

                                                            @@ -4893,7 +5006,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

                                                      - + Quadratic r-tree creation algorithm parameters.

                                                      @@ -5029,7 +5142,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

                                                - + R*-tree creation algorithm parameters.

                                                @@ -6609,7 +6722,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::translator::def

                                          - + The default translator.

                                          @@ -6679,7 +6792,7 @@ The default translator. boost::geometry::index::translator::index

                                    - + The index translator.

                                    diff --git a/doc/html/index.html b/doc/html/index.html index c4603e5a2..422519f60 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
                                - +

                                Last revised: February 17, 2013 at 14:52:29 GMT

                                Last revised: February 19, 2013 at 19:29:30 GMT


                                diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index 4da39d38a..d309dc6f4 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -57,7 +57,7 @@ Key features of this implementation of the __rtree__ are: [heading Dependencies] -R-tree depends on *Boost.Move*, *Boost.Container*, *Boost.Tuple*. +R-tree depends on *Boost.Move*, *Boost.Container*, *Boost.Tuple*, *Boost.Utility*, *Boost.MPL*. [heading Contributors] diff --git a/include/boost/geometry/index/adaptors/query.hpp b/include/boost/geometry/index/adaptors/query.hpp index d1647bcb6..472b3693b 100644 --- a/include/boost/geometry/index/adaptors/query.hpp +++ b/include/boost/geometry/index/adaptors/query.hpp @@ -56,6 +56,15 @@ struct query Predicates const& predicates; }; +template +index::adaptors::detail::query_range +operator|( + Index const& si, + index::adaptors::detail::query const& f) +{ + return index::adaptors::detail::query_range(si, f.predicates); +} + } // namespace detail /*! @@ -74,15 +83,6 @@ queried(Predicates const& pred) } // namespace adaptors -template -index::adaptors::detail::query_range -operator|( - Index const& si, - index::adaptors::detail::query const& f) -{ - return index::adaptors::detail::query_range(si, f.predicates); -} - }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_INDEX_ADAPTORS_QUERY_HPP diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 35a114eab..c57830576 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -133,6 +133,7 @@ private: typedef typename detail::rtree::leaf::type leaf; typedef typename allocators_type::node_pointer node_pointer; + typedef ::boost::container::allocator_traits allocator_traits_type; public: @@ -256,9 +257,10 @@ public: \li When memory allocation for Node fails. */ inline rtree(rtree const& src) - : m_members(src.m_members.translator(), src.m_members.parameters(), src.m_members.allocators()) + : m_members(src.m_members.translator(), + src.m_members.parameters(), + allocator_traits_type::select_on_container_copy_construction(src.get_allocator())) { - //TODO use Boost.Container allocator_traits_type::select_on_container_copy_construction() this->raw_copy(src, *this, false); } @@ -350,7 +352,12 @@ public: if ( this == &src ) return *this; - //TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment + typedef boost::mpl::bool_< + allocator_traits_type::propagate_on_container_copy_assignment::value + > propagate; + if ( propagate::value && !(m_members.allocators() == src.m_members.allocators()) ) + this->raw_destroy(*this); + assign_cond(m_members.allocators(), src.m_members.allocators(), propagate()); // It uses m_allocators this->raw_copy(src, *this, true); @@ -376,21 +383,25 @@ public: if ( this == &src ) return *this; -//TODO use Boost.Container allocator_traits_type::propagate_on_container_move_assignment - if ( m_members.allocators() == src.m_members.allocators() ) { - m_members.translator() = src.m_members.translator(); - m_members.parameters() = src.m_members.parameters(); - this->raw_destroy(*this); + m_members.translator() = src.m_members.translator(); + m_members.parameters() = src.m_members.parameters(); boost::swap(m_members.values_count, src.m_members.values_count); boost::swap(m_members.leafs_level, src.m_members.leafs_level); boost::swap(m_members.root, src.m_members.root); + + typedef boost::mpl::bool_< + allocator_traits_type::propagate_on_container_move_assignment::value + > propagate; + rtree::move_cond(m_members.allocators(), src.m_members.allocators(), propagate()); } else { +// TODO - shouldn't here propagate_on_container_copy_assignment be checked like in operator=(const&)? + // It uses m_allocators this->raw_copy(src, *this, true); } @@ -947,12 +958,12 @@ private: \param src The source R-tree. \param dst The destination R-tree. - \param copy_all_internals If true, translator and parameters will also be copied. + \param copy_tr_and_params If true, translator and parameters will also be copied. \par Exception-safety strong */ - inline void raw_copy(rtree const& src, rtree & dst, bool copy_all_internals) const + inline void raw_copy(rtree const& src, rtree & dst, bool copy_tr_and_params) const { detail::rtree::visitors::copy copy_v(dst.m_members.allocators()); @@ -960,7 +971,7 @@ private: if ( src.m_members.root ) detail::rtree::apply_visitor(copy_v, *src.m_members.root); // MAY THROW (V, E: alloc, copy, N: alloc) - if ( copy_all_internals ) + if ( copy_tr_and_params ) { dst.m_members.translator() = src.m_members.translator(); // SHOULDN'T THROW dst.m_members.parameters() = src.m_members.parameters(); @@ -1049,6 +1060,18 @@ private: return result.finish(); } + template + static inline void assign_cond(T &, T const&, boost::mpl::bool_ const&) {} + + template + static inline void assign_cond(T & l, T const& r, boost::mpl::bool_ const&) { l = r; } + + template + inline void move_cond(T &, T &, boost::mpl::bool_ const&) {} + + template + inline void move_cond(T & l, T & r, boost::mpl::bool_ const&) { l = ::boost::move(r); } + struct members_holder : public translator_type , public Parameters @@ -1359,6 +1382,22 @@ bounds(rtree const& tree) return tree.bounds(); } +/*! +\brief Exchanges the contents of the container with those of other. + +It calls \c rtree::swap(). + +\ingroup rtree_functions + +\param l The first rtree. +\param r The second rtree. +*/ +template +inline void swap(rtree & l, rtree & r) +{ + return l.swap(r); +} + }}} // namespace boost::geometry::index #include From 407dfbc89425d70de6894b141c8fe2976cc445bb Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 20 Feb 2013 13:02:55 +0000 Subject: [PATCH 337/366] chrono used instead of timer in rtree benchmark [SVN r83045] --- example/benchmark.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/example/benchmark.cpp b/example/benchmark.cpp index 07d2e03c0..fad858aa4 100644 --- a/example/benchmark.cpp +++ b/example/benchmark.cpp @@ -11,16 +11,16 @@ #include -#include +#include #include #include int main() { - boost::timer tim; - namespace bg = boost::geometry; namespace bgi = bg::index; + typedef boost::chrono::thread_clock clock_t; + typedef boost::chrono::duration dur_t; size_t values_count = 1000000; size_t queries_count = 100000; @@ -66,7 +66,7 @@ int main() // inserting test { - tim.restart(); + clock_t::time_point start = clock_t::now(); for (size_t i = 0 ; i < values_count ; ++i ) { float x = coords[i].first; @@ -75,8 +75,8 @@ int main() t.insert(b); } - double time = tim.elapsed(); - std::cout << time << "s - insert " << values_count << '\n'; + dur_t time = clock_t::now() - start; + std::cout << time << " - insert " << values_count << '\n'; } std::vector result; @@ -84,7 +84,7 @@ int main() B result_one; { - tim.restart(); + clock_t::time_point start = clock_t::now(); size_t temp = 0; for (size_t i = 0 ; i < queries_count ; ++i ) { @@ -94,12 +94,12 @@ int main() t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); temp += result.size(); } - double time = tim.elapsed(); - std::cout << time << "s - query(B) " << queries_count << " found " << temp << '\n'; + dur_t time = clock_t::now() - start; + std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n'; } { - tim.restart(); + clock_t::time_point start = clock_t::now(); size_t temp = 0; for (size_t i = 0 ; i < queries_count / 2 ; ++i ) { @@ -121,14 +121,14 @@ int main() ); temp += result.size(); } - double time = tim.elapsed(); - std::cout << time << "s - query(i && !w && !o) " << queries_count << " found " << temp << '\n'; + dur_t time = clock_t::now() - start; + std::cout << time << " - query(i && !w && !o) " << queries_count << " found " << temp << '\n'; } result.clear(); { - tim.restart(); + clock_t::time_point start = clock_t::now(); size_t temp = 0; for (size_t i = 0 ; i < queries_count / 10 ; ++i ) { @@ -137,12 +137,12 @@ int main() result.clear(); temp += t.query(bgi::nearest(P(x, y), 5), std::back_inserter(result)); } - double time = tim.elapsed(); - std::cout << time << "s - query(nearest(P, 5)) " << (queries_count / 10) << " found " << temp << '\n'; + dur_t time = clock_t::now() - start; + std::cout << time << " - query(nearest(P, 5)) " << (queries_count / 10) << " found " << temp << '\n'; } { - tim.restart(); + clock_t::time_point start = clock_t::now(); for (size_t i = 0 ; i < values_count / 10 ; ++i ) { float x = coords[i].first; @@ -151,8 +151,8 @@ int main() t.remove(b); } - double time = tim.elapsed(); - std::cout << time << "s - remove " << values_count / 10 << '\n'; + dur_t time = clock_t::now() - start; + std::cout << time << " - remove " << values_count / 10 << '\n'; } std::cout << "------------------------------------------------\n"; From d418dac57f63aa39466df21fff845115f774a370 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 22 Feb 2013 03:23:41 +0000 Subject: [PATCH 338/366] rtree predefined translator renamed to index::translator<> index::translator::def<> renamed to index::translator<> index::translator::index<> removed translator helpers removed or moved to index::default::translator namespace some unneeded includes removed docs updated [SVN r83077] --- doc/generated/rtree.qbk | 4 +- .../{translator_def.qbk => translator.qbk} | 12 +- doc/generated/translator_index.qbk | 55 --- doc/html/geometry_index/r_tree.html | 4 +- doc/html/geometry_index/r_tree/reference.html | 346 +++++------------- .../geometry_index/r_tree/rtree_examples.html | 2 +- doc/html/index.html | 2 +- doc/make_qbk.py | 6 +- doc/rtree/reference.qbk | 15 +- doc/src/examples/rtree/interprocess.cpp | 2 +- .../detail/rtree/visitors/children_box.hpp | 2 - .../index/detail/rtree/visitors/copy.hpp | 2 - .../index/detail/rtree/visitors/count.hpp | 2 - .../index/detail/rtree/visitors/destroy.hpp | 2 - .../index/detail/rtree/visitors/insert.hpp | 2 - .../index/detail/rtree/visitors/is_leaf.hpp | 2 - .../detail/rtree/visitors/nearest_query.hpp | 5 - .../index/detail/rtree/visitors/remove.hpp | 2 - .../detail/rtree/visitors/spatial_query.hpp | 4 - include/boost/geometry/index/rtree.hpp | 7 +- .../{translator/def.hpp => translator.hpp} | 101 +++-- .../geometry/index/translator/helpers.hpp | 194 ---------- .../boost/geometry/index/translator/index.hpp | 63 ---- .../geometry/index/translator/translator.hpp | 29 -- test/rtree/test_rtree.hpp | 52 +-- 25 files changed, 220 insertions(+), 697 deletions(-) rename doc/generated/{translator_def.qbk => translator.qbk} (75%) delete mode 100644 doc/generated/translator_index.qbk rename include/boost/geometry/index/{translator/def.hpp => translator.hpp} (57%) delete mode 100644 include/boost/geometry/index/translator/helpers.hpp delete mode 100644 include/boost/geometry/index/translator/index.hpp delete mode 100644 include/boost/geometry/index/translator/translator.hpp diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index f082a3eb6..bda3bd984 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -44,7 +44,7 @@ The Translator translates from Value to Indexable each time r-tree requires it. [pre `template<``typename Value``,` `typename Parameters``,` - `typename Translator` = [^[link structboost_1_1geometry_1_1index_1_1translator_1_1def translator::def]]```,` + `typename Translator` = [^[link structboost_1_1geometry_1_1index_1_1translator index::translator]]```,` `typename Allocator` = `std::allocator``>` `class rtree` `{` @@ -69,7 +69,7 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[[#classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91] `translator_type`][Value to Indexable Translator type. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d] `allocator_type`][The type of allocator used by the container. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6] `size_type`][Unsigned integral type used by the container. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1ac011da09678f034a7fab487a9b973bfc] `indexable_type`][The Indexable type to which Value is translated. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a6533b05d4a2eea9d4a0033e192add466] `indexable_type`][The Indexable type to which Value is translated. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f] `bounds_type`][The Box type used by the R-tree. ]] ] diff --git a/doc/generated/translator_def.qbk b/doc/generated/translator.qbk similarity index 75% rename from doc/generated/translator_def.qbk rename to doc/generated/translator.qbk index a1d8ff7e2..d01eaf0ab 100644 --- a/doc/generated/translator_def.qbk +++ b/doc/generated/translator.qbk @@ -1,21 +1,21 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] -[/ Generated from xml/structboost_1_1geometry_1_1index_1_1translator_1_1def.xml] -[#structboost_1_1geometry_1_1index_1_1translator_1_1def] -[section:boost_geometry_index_translator_def boost::geometry::index::translator::def] +[/ Generated from xml/structboost_1_1geometry_1_1index_1_1translator.xml] +[#structboost_1_1geometry_1_1index_1_1translator] +[section:boost_geometry_index_translator boost::geometry::index::translator] -'''boostgeometryindextranslatordef''' +'''boostgeometryindextranslator''' The default translator. [heading Description] It translates Value object to Indexable object. The default version handles Values which are Indexables. This translator is also specialized for std::pair and boost::tuple. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre `template<``typename Value``>` -`struct def` +`struct translator` `{` ` // ...` `};` diff --git a/doc/generated/translator_index.qbk b/doc/generated/translator_index.qbk deleted file mode 100644 index 12c4725ca..000000000 --- a/doc/generated/translator_index.qbk +++ /dev/null @@ -1,55 +0,0 @@ -[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] -[/ Generated from xml/classboost_1_1geometry_1_1index_1_1translator_1_1index.xml] -[#classboost_1_1geometry_1_1index_1_1translator_1_1index] -[section:boost_geometry_index_translator_index boost::geometry::index::translator::index] - -'''boostgeometryindextranslatorindex''' -The index translator. - -[heading Description] -This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size\u005ftype) defined. Index translator uses [link structboost_1_1geometry_1_1index_1_1translator_1_1def translator::def]<...> to translate from Container::value\u005ftype to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. - -[heading Header] -`#include ` - -[heading Synopsis] -[pre -`template<``typename Container``>` -`class index` -`{` -` // ...` -`};` -] - -[heading Template parameter(s)] -[table -[[Parameter] [Description]] -[[`Container`][The Container type. ]] -] - -[heading Constructor(s) and destructor] -[table -[[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1translator_1_1index_1a87e7e498c20aa3bf38e350a6ab19e736 `index(Container const &)`]][The constructor. ]] -] - -[#classboost_1_1geometry_1_1index_1_1translator_1_1index_1a87e7e498c20aa3bf38e350a6ab19e736] -[section index(Container const &)] -The constructor. - -[heading Synopsis] -[pre - -`index``(``Container const &` `c``)` -] - -[heading Modifier(s)] -``explicit ``[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`Container const &`][ `c` ][The container which stores indexed values. ]] -] -[endsect] - -[endsect] - diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 90a46002d..dc6a7e6de 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -77,14 +77,14 @@ related to the rtree
                                R-tree parameters (boost::geometry::index::)
                                +
                                Translator + (boost::geometry::index::translator)
                                Predicates (boost::geometry::index::)
                                Nearest relations (boost::geometry::index::)
                                Adaptors (boost::geometry::index::adaptors::)
                                -
                                Translators - (boost::geometry::index::translators::)
                                Inserters (boost::geometry::index::)
                                diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 604920011..742a3136f 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -31,14 +31,14 @@ related to the rtree
                                R-tree parameters (boost::geometry::index::)
                                +
                                Translator + (boost::geometry::index::translator)
                                Predicates (boost::geometry::index::)
                                Nearest relations (boost::geometry::index::)
                                Adaptors (boost::geometry::index::adaptors::)
                                -
                                Translators - (boost::geometry::index::translators::)
                                Inserters (boost::geometry::index::)
                              @@ -47,7 +47,7 @@ boost::geometry::index::rtree

                        - + The R-tree spatial index.

                        @@ -125,7 +125,7 @@ The R-tree spatial index.
                        template<typename Value,
                                  typename Parameters,
                        -         typename Translator = translator::def<Value>,
                        +         typename Translator = index::translator<Value>,
                                  typename Allocator = std::allocator<Value>>
                         class rtree
                         {
                        @@ -291,7 +291,7 @@ The R-tree spatial index.
                         
                         
                                           

                        - indexable_type + indexable_type

                        @@ -4616,7 +4616,7 @@ The R-tree spatial index. boost::geometry::index::linear

                  - + Linear r-tree creation algorithm parameters.

                  @@ -4691,7 +4691,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::quadratic

              - + Quadratic r-tree creation algorithm parameters.

              @@ -4766,7 +4766,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::rstar

              - + R*-tree creation algorithm parameters.

              @@ -4870,7 +4870,7 @@ R*-tree creation algorithm parameters. boost::geometry::index::runtime::linear

          - + Linear r-tree creation algorithm parameters.

          @@ -5006,7 +5006,7 @@ Linear r-tree creation algorithm parameters. boost::geometry::index::runtime::quadratic

    - + Quadratic r-tree creation algorithm parameters.

    @@ -5142,7 +5142,7 @@ Quadratic r-tree creation algorithm parameters. boost::geometry::index::runtime::rstar

    - + R*-tree creation algorithm parameters.

    @@ -5315,6 +5315,82 @@ R*-tree creation algorithm parameters.
    +
    + +

    + +The default translator. +

    +
    + + Description +
    +

    + It translates Value object to Indexable object. The default version handles + Values which are Indexables. This translator is also specialized for + std::pair<Indexable, Second> and boost::tuple<Indexable, ...>. +

    +
    + + Header +
    +

    + #include <boost/geometry/index/translator.hpp> +

    +
    + + Synopsis +
    +
    template<typename Value>
    +struct translator
    +{
    +  // ...
    +};
    +
    +
    + + Template + parameter(s) +
    +
    ++++ + + + + + + + + +
    +

    + Parameter +

    +
    +

    + Description +

    +
    +

    + Value +

    +
    +

    + The Value type which may be translated directly to the Indexable. +

    +
    +
    +
    +
    + @@ -6714,254 +6790,6 @@ R*-tree creation algorithm parameters.
    -
    - -

    - -The default translator. -

    -
    - - Description -
    -

    - It translates Value object to Indexable object. The default version handles - Values which are Indexables. This translator is also specialized for - std::pair<Indexable, Second> and boost::tuple<Indexable, ...>. -

    -
    - - Header -
    -

    - #include <boost/geometry/index/translator/def.hpp> -

    -
    - - Synopsis -
    -
    template<typename Value>
    -struct def
    -{
    -  // ...
    -};
    -
    -
    - - Template - parameter(s) -
    -
    ---- - - - - - - - - -
    -

    - Parameter -

    -
    -

    - Description -

    -
    -

    - Value -

    -
    -

    - The Value type which may be translated directly to the Indexable. -

    -
    -
    -
    - -

    - -The index translator. -

    -
    - - Description -
    -

    - This translator translates from index of an element in an external Container - to the Indexable. The container should have operator[](size_type) defined. - Index translator uses translator::def<...> - to translate from Container::value_type to the Indexable which means - that it can handle Indexables, std::pairs and boost::tuples stored in - an external Container. -

    -
    - - Header -
    -

    - #include <boost/geometry/index/translator/index.hpp> -

    -
    - - Synopsis -
    -
    template<typename Container>
    -class index
    -{
    -  // ...
    -};
    -
    -
    - - Template - parameter(s) -
    -
    ---- - - - - - - - - -
    -

    - Parameter -

    -
    -

    - Description -

    -
    -

    - Container -

    -
    -

    - The Container type. -

    -
    -
    - - Constructor(s) - and destructor -
    -
    ---- - - - - - - - - -
    -

    - Function -

    -
    -

    - Description -

    -
    -

    - index(Container const - &) -

    -
    -

    - The constructor. -

    -
    -
    - -

    - The constructor. -

    - - Synopsis -
    index(Container const & c)
    -
    - - Modifier(s) -

    -

    -
    explicit
    -

    -

    - - Parameter(s) -
    ----- - - - - - - - - - - -
    -

    - Type -

    -
    -

    - Name -

    -
    -

    - Description -

    -
    -

    - Container const & -

    -
    -

    - c -

    -
    -

    - The container which stores indexed values. -

    -
    -
    -
    -
    -
    - diff --git a/doc/html/geometry_index/r_tree/rtree_examples.html b/doc/html/geometry_index/r_tree/rtree_examples.html index cd65d78a3..7642a31b2 100644 --- a/doc/html/geometry_index/r_tree/rtree_examples.html +++ b/doc/html/geometry_index/r_tree/rtree_examples.html @@ -127,7 +127,7 @@ typedef bgm::box<P> B; typedef bgi::linear<32, 8> Par; - typedef bgi::translator::def<B> Tr; + typedef bgi::translator<B> Tr; typedef allocator<B, managed_shared_memory::segment_manager> Alloc; typedef bgi::rtree<B, Par, Tr, Alloc> Rtree; diff --git a/doc/html/index.html b/doc/html/index.html index 422519f60..cb1905219 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
    - +

    Last revised: February 19, 2013 at 19:29:30 GMT

    Last revised: February 22, 2013 at 03:18:40 GMT


    diff --git a/doc/make_qbk.py b/doc/make_qbk.py index f737f85b7..1bcd4077e 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -27,11 +27,13 @@ os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1linear", "rtree_ os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic", "rtree_runtime_quadratic")) os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1rstar", "rtree_runtime_rstar")) +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator", "translator")) +#os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_3_01std_1_1pair_3_01_indexable_00_01_second_01_4_01_4", "translator_pair")) +#os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_3_01boost_1_1tuple_3_01_indexable_00_01_t1_00_01_1c55aa63046ee2c1171cfc2033fb0edd", "translator_tuple")) + os.system(cmd % ("group__predicates", "predicates")) os.system(cmd % ("group__nearest__relations", "nearest_relations")) os.system(cmd % ("group__adaptors", "adaptors")) -os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_1_1def", "translator_def")) -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1translator_1_1index", "translator_index")) os.system(cmd % ("group__inserters", "inserters")) os.system("b2") diff --git a/doc/rtree/reference.qbk b/doc/rtree/reference.qbk index ff6ddd73d..734cd4370 100644 --- a/doc/rtree/reference.qbk +++ b/doc/rtree/reference.qbk @@ -24,17 +24,18 @@ [endsect] +[section:translator Translator (boost::geometry::index::translator)] + +[include ../generated/translator.qbk] +[/include ../generated/translator_pair.qbk/] +[/include ../generated/translator_tuple.qbk/] + +[endsect] + [include ../generated/predicates.qbk] [include ../generated/nearest_relations.qbk] [include ../generated/adaptors.qbk] -[section:translators Translators (boost::geometry::index::translators::)] - -[include ../generated/translator_def.qbk] -[include ../generated/translator_index.qbk] - -[endsect] - [include ../generated/inserters.qbk] [endsect] \ No newline at end of file diff --git a/doc/src/examples/rtree/interprocess.cpp b/doc/src/examples/rtree/interprocess.cpp index 612d8c88f..e160d6ea6 100644 --- a/doc/src/examples/rtree/interprocess.cpp +++ b/doc/src/examples/rtree/interprocess.cpp @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) typedef bgm::box

    B; typedef bgi::linear<32, 8> Par; - typedef bgi::translator::def Tr; + typedef bgi::translator Tr; typedef allocator Alloc; typedef bgi::rtree Rtree; diff --git a/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp index 90eba7c18..93726063b 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/children_box.hpp @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_CHILDREN_BOX_HPP -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp index 8a084d479..8fc25ac80 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/copy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/copy.hpp @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COPY_HPP -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/count.hpp b/include/boost/geometry/index/detail/rtree/visitors/count.hpp index 1c37dcf52..203422f33 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/count.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/count.hpp @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_COUNT_HPP -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp index 7c5129c31..62722b97a 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/destroy.hpp @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DELETE_HPP -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp index d872a14da..0ba54d675 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/insert.hpp @@ -13,8 +13,6 @@ #include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { diff --git a/include/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp b/include/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp index ce8608f22..6d21afd99 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_IS_LEAF_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_IS_LEAF_HPP -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp index 4284f5724..ef54d995f 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp @@ -11,11 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_NEAREST_QUERY_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_NEAREST_QUERY_HPP -#include - -#include -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp index 33cca203c..a827db088 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/remove.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/remove.hpp @@ -11,8 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP -#include - #include #include diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index 9fd7f0e04..17244e30f 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -11,10 +11,6 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP -#include - -#include - namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace visitors { diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index c57830576..beaeb14c2 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -23,9 +23,10 @@ #include -#include #include +#include + #include #include #include @@ -96,7 +97,7 @@ container, the default translator translates from std::pair const& template < typename Value, typename Parameters, - typename Translator = translator::def, + typename Translator = index::translator, typename Allocator = std::allocator > class rtree @@ -116,7 +117,7 @@ public: typedef typename allocator_type::size_type size_type; /*! \brief The Indexable type to which Value is translated. */ - typedef typename translator::indexable_type::type indexable_type; + typedef typename index::detail::translator::indexable_type::type indexable_type; /*! \brief The Box type used by the R-tree. */ typedef typename index::detail::default_box_type::type bounds_type; diff --git a/include/boost/geometry/index/translator/def.hpp b/include/boost/geometry/index/translator.hpp similarity index 57% rename from include/boost/geometry/index/translator/def.hpp rename to include/boost/geometry/index/translator.hpp index 1ff01b4eb..d3ebc469e 100644 --- a/include/boost/geometry/index/translator/def.hpp +++ b/include/boost/geometry/index/translator.hpp @@ -1,19 +1,61 @@ // Boost.Geometry Index // -// Default translator -// // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP -#define BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP +#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP +#define BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP -#include +// move index::translator::def<> to index::translator<> +// make all index::translator<> methods static +// remove translator::index +// move helpers to index::default::translator -namespace boost { namespace geometry { namespace index { namespace translator { +//#include +//#include + +#include + +#include +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { namespace translator { + +template +struct indexable_not_found_error +{ + static const bool value = false; +}; +template <> +struct indexable_not_found_error +{ + static const bool value = true; +}; + +template +struct equals +{ + static bool apply(Geometry const& g1, Geometry const& g2) + { + return geometry::equals(g1, g2); + } +}; + +template +struct equals +{ + static bool apply(T const& v1, T const& v2) + { + return v1 == v2; + } +}; + +}} // namespace detail::translator /*! \brief The default translator. @@ -24,11 +66,11 @@ This translator is also specialized for std::pair and boost:: \tparam Value The Value type which may be translated directly to the Indexable. */ template -struct def +struct translator { BOOST_MPL_ASSERT_MSG( - (!detail::indexable_not_found_error< - typename geometry::index::detail::traits::indexable_type::type + (!detail::translator::indexable_not_found_error< + typename detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Value) @@ -56,11 +98,11 @@ This specialization translates from std::pair. \tparam Second The second type. */ template -struct def< std::pair > +struct translator< std::pair > { BOOST_MPL_ASSERT_MSG( - (!detail::indexable_not_found_error< - typename geometry::index::detail::traits::indexable_type::type + (!detail::translator::indexable_not_found_error< + typename detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Indexable) @@ -77,15 +119,14 @@ struct def< std::pair > { return geometry::equals(v1.first, v2.first) && - dispatch::equals< + detail::translator::equals< Second, typename geometry::traits::tag::type >::apply(v1.second, v2.second); } }; -namespace detail -{ +namespace detail { namespace translator { template struct compare_tuples @@ -93,7 +134,7 @@ struct compare_tuples inline static bool apply(Tuple const& t1, Tuple const& t2) { typedef typename boost::tuples::element::type T; - return dispatch::equals< + return detail::translator::equals< T, typename geometry::traits::tag::type >::apply(boost::get(t1), boost::get(t2)) @@ -111,7 +152,7 @@ struct compare_tuples } }; -} // namespace detail +}} // namespace detail::translator /*! \brief The default translator. @@ -122,13 +163,13 @@ This specialization translates from boost::tuple. */ template -struct def< boost::tuple > +struct translator< boost::tuple > { typedef boost::tuple value_type; BOOST_MPL_ASSERT_MSG( - (!detail::indexable_not_found_error< - typename geometry::index::detail::traits::indexable_type::type + (!detail::translator::indexable_not_found_error< + typename detail::traits::indexable_type::type >::value), NOT_VALID_INDEXABLE_TYPE, (Indexable) @@ -143,11 +184,25 @@ struct def< boost::tuple > bool equals(value_type const& v1, value_type const& v2) const { - return detail::compare_tuples::value> + return detail::translator::compare_tuples::value> ::apply(v1, v2); } }; -}}}} // namespace boost::geometry::index::translator +namespace detail { namespace translator { -#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_DEF_HPP +template +struct indexable_type +{ + typedef typename boost::remove_const< + typename boost::remove_reference< + typename Translator::result_type + >::type + >::type type; +}; + +}} // namespace detail::translator + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP diff --git a/include/boost/geometry/index/translator/helpers.hpp b/include/boost/geometry/index/translator/helpers.hpp deleted file mode 100644 index 494cfe02e..000000000 --- a/include/boost/geometry/index/translator/helpers.hpp +++ /dev/null @@ -1,194 +0,0 @@ -// Boost.Geometry Index -// -// Translators helper functions -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP -#define BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP - -#include - -#include - -#include -#include -#include - -#include - -#include - -namespace boost { namespace geometry { namespace index { namespace translator { - -namespace dispatch { - -// Extract object from std::pair by non-void tag - -template -struct choose_pair_element -{ - typedef typename Pair::first_type type; - static type const& get(Pair const& p) { return p.first; } -}; - -template -struct choose_pair_element -{ - typedef typename Pair::first_type type; - static type const& get(Pair const& p) { return p.first; } -}; - -template -struct choose_pair_element -{ - typedef typename Pair::second_type type; - static type const& get(Pair const& p) { return p.second; } -}; - -template -struct choose_pair_element -{ - typedef void type; -}; - -} // namespace dispatch - -namespace detail { - -template -struct indexable_not_found_error -{ - static const bool value = false; -}; -template <> -struct indexable_not_found_error -{ - static const bool value = true; -}; - -// Extract indexable - -template -struct extract_indexable -{ - typedef Value type; - - BOOST_STATIC_ASSERT(!indexable_not_found_error::value); - - static type const& get(Value const& v) { return v; } -}; - -template -struct extract_indexable< std::pair > -{ - typedef typename dispatch::choose_pair_element< - std::pair, - typename index::detail::traits::indexable_type::type, - typename index::detail::traits::indexable_type::type - > cp; - - typedef typename cp::type type; - - BOOST_STATIC_ASSERT(!indexable_not_found_error::value); - - static type const& get(std::pair const& v) - { - return cp::get(v); - } -}; - -// Recognize iterators and smart pointers - -BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category) -BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) -BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type) -BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer) -BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) - -BOOST_MPL_HAS_XXX_TRAIT_DEF(element_type) - -// TODO -// use has_operator_xxx in the future - -template -struct is_iterator -{ - static const bool value = boost::mpl::and_ - < - has_iterator_category, - has_value_type, - has_difference_type, - has_pointer, - has_reference - >::value; -}; - -template -struct is_smart_ptr -{ - static const bool value = has_element_type::value; -}; - -} // namespace detail - -namespace dispatch { - -template -struct equals -{ - static bool apply(Geometry const& g1, Geometry const& g2) - { - return geometry::equals(g1, g2); - } -}; - -template -struct equals -{ - static bool apply(T const& v1, T const& v2) - { - return v1 == v2; - } -}; - -} // namespace dispatch - -namespace detail { - -template -struct equals -{ - static bool apply(Geometry const& g1, Geometry const& g2) - { - return geometry::equals(g1, g2); - } -}; - -template -struct equals< std::pair > -{ - static bool apply(std::pair const& p1, std::pair const& p2) - { - return - dispatch::equals< - First, - typename traits::tag::type - >::apply(p1.first, p2.first) - && - dispatch::equals< - Second, - typename traits::tag::type - >::apply(p1.second, p2.second); - } -}; - -} // namespace detail - -}}}} // namespace boost::geometry::index::translator - -#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_HELPERS_HPP diff --git a/include/boost/geometry/index/translator/index.hpp b/include/boost/geometry/index/translator/index.hpp deleted file mode 100644 index e20d90ee6..000000000 --- a/include/boost/geometry/index/translator/index.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Boost.Geometry Index -// -// Translator translating random-access container index value to Indexable object -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP -#define BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP - -#include - -namespace boost { namespace geometry { namespace index { namespace translator { - -/*! -\brief The index translator. - -This translator translates from index of an element in an external Container to the Indexable. -The container should have operator[](size_type) defined. -Index translator uses translator::def<...> to translate from Container::value_type to the Indexable which -means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container. - -\tparam Container The Container type. -*/ -template -class index -{ - typedef typename Container::value_type value_type; - typedef typename Container::size_type size_type; - -public: - typedef typename translator::def::result_type result_type; - - /*! - \brief The constructor. - - \param c The container which stores indexed values. - */ - explicit index(Container const& c) - : m_c(c) - {} - - result_type operator()(size_type i) const - { - return m_tr(m_c[i]); - } - - bool equals(size_type i1, size_type i2) const - { - return m_tr.equals(m_c[i1], m_c[i2]); - } - -private: - Container const& m_c; - translator::def m_tr; -}; - -}}}} // namespace boost::geometry::index::translator - -#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_INDEX_HPP diff --git a/include/boost/geometry/index/translator/translator.hpp b/include/boost/geometry/index/translator/translator.hpp deleted file mode 100644 index 07aa78241..000000000 --- a/include/boost/geometry/index/translator/translator.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Boost.Geometry Index -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP -#define BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP - -#include -#include - -namespace boost { namespace geometry { namespace index { namespace translator { - -template -struct indexable_type -{ - typedef typename boost::remove_const< - typename boost::remove_reference< - typename Translator::result_type - >::type - >::type type; -}; - -}}}} // namespace boost::geometry::index::translator - -#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 8075a44f0..2b1062391 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -205,10 +205,10 @@ struct test_object Indexable indexable; }; -namespace boost { namespace geometry { namespace index { namespace translator { +namespace boost { namespace geometry { namespace index { template -struct def< boost::shared_ptr< test_object > > +struct translator< boost::shared_ptr< test_object > > { typedef boost::shared_ptr< test_object > value_type; typedef Indexable const& result_type; @@ -224,7 +224,7 @@ struct def< boost::shared_ptr< test_object > > } }; -}}}} +}}} template struct generate_value< boost::shared_ptr > > > @@ -266,10 +266,10 @@ struct counting_value Indexable indexable; }; -namespace boost { namespace geometry { namespace index { namespace translator { +namespace boost { namespace geometry { namespace index { template -struct def< counting_value > +struct translator< counting_value > { typedef counting_value value_type; typedef Indexable const& result_type; @@ -285,7 +285,7 @@ struct def< counting_value > } }; -}}}} +}}} template struct generate_value< counting_value > > @@ -330,26 +330,26 @@ struct value_no_dctor Indexable indexable; }; -namespace boost { namespace geometry { namespace index { namespace translator { +namespace boost { namespace geometry { namespace index { - template - struct def< value_no_dctor > +template +struct translator< value_no_dctor > +{ + typedef value_no_dctor value_type; + typedef Indexable const& result_type; + + result_type operator()(value_type const& value) const { - typedef value_no_dctor value_type; - typedef Indexable const& result_type; + return value.indexable; + } - result_type operator()(value_type const& value) const - { - return value.indexable; - } + bool equals(value_type const& v1, value_type const& v2) const + { + return boost::geometry::equals(v1.indexable, v2.indexable); + } +}; - bool equals(value_type const& v1, value_type const& v2) const - { - return boost::geometry::equals(v1.indexable, v2.indexable); - } - }; - -}}}} +}}} template struct generate_value_default< value_no_dctor > @@ -1109,7 +1109,7 @@ void test_clear(Rtree & tree, std::vector const& input, Box const& qbox) template void test_rtree_by_value(Parameters const& parameters, Allocator const& allocator) { - typedef bgi::translator::def T; + typedef bgi::translator T; typedef typename Allocator::template rebind::other A; typedef bgi::rtree Tree; typedef typename Tree::box_type B; @@ -1165,7 +1165,7 @@ void test_count_rtree_values(Parameters const& parameters, Allocator const& allo { typedef counting_value Value; - typedef bgi::translator::def T; + typedef bgi::translator T; typedef typename Allocator::template rebind::other A; typedef bgi::rtree Tree; typedef typename Tree::box_type B; @@ -1207,7 +1207,7 @@ void test_rtree_count(Parameters const& parameters, Allocator const& allocator) { typedef std::pair Value; - typedef bgi::translator::def T; + typedef bgi::translator T; typedef typename Allocator::template rebind::other A; typedef bgi::rtree Tree; typedef typename Tree::box_type B; @@ -1237,7 +1237,7 @@ void test_rtree_count(Parameters const& parameters, Allocator const& allocator) template void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator) { - typedef bgi::translator::def T; + typedef bgi::translator T; typedef typename Allocator::template rebind::other A; typedef bgi::rtree Tree; typedef typename Tree::box_type B; From f7849be05df01e2e45262d7ab702a7c4682b58a3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 22 Feb 2013 13:53:19 +0000 Subject: [PATCH 339/366] doxygen_xml2qbk: fixed alt. class output for class specialization. quickbook_output_indexterm() call removed from alt. class output. docs updated [SVN r83082] --- doc/generated/rtree.qbk | 3 +- doc/generated/rtree_linear.qbk | 3 +- doc/generated/rtree_quadratic.qbk | 3 +- doc/generated/rtree_rstar.qbk | 3 +- doc/generated/rtree_runtime_linear.qbk | 3 +- doc/generated/rtree_runtime_quadratic.qbk | 3 +- doc/generated/rtree_runtime_rstar.qbk | 3 +- doc/generated/translator.qbk | 3 +- doc/html/geometry_index/r_tree.html | 5 +- doc/html/geometry_index/r_tree/reference.html | 747 +++++++++--------- doc/html/index.html | 2 +- doc/rtree/reference.qbk | 4 +- .../doxygen_xml2qbk/quickbook_output.hpp | 20 +- include/boost/geometry/index/rtree.hpp | 2 +- 14 files changed, 394 insertions(+), 410 deletions(-) diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index bda3bd984..392035a08 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/classboost_1_1geometry_1_1index_1_1rtree.xml] [#classboost_1_1geometry_1_1index_1_1rtree] -[section:boost_geometry_index_rtree boost::geometry::index::rtree] +[section boost::geometry::index::rtree] -'''boostgeometryindexrtree''' The R-tree spatial index. [heading Description] diff --git a/doc/generated/rtree_linear.qbk b/doc/generated/rtree_linear.qbk index 6e90a4a2d..63848bb8d 100644 --- a/doc/generated/rtree_linear.qbk +++ b/doc/generated/rtree_linear.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/structboost_1_1geometry_1_1index_1_1linear.xml] [#structboost_1_1geometry_1_1index_1_1linear] -[section:boost_geometry_index_linear boost::geometry::index::linear] +[section boost::geometry::index::linear] -'''boostgeometryindexlinear''' Linear r-tree creation algorithm parameters. [heading Header] diff --git a/doc/generated/rtree_quadratic.qbk b/doc/generated/rtree_quadratic.qbk index 54880ba50..58ee72e28 100644 --- a/doc/generated/rtree_quadratic.qbk +++ b/doc/generated/rtree_quadratic.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/structboost_1_1geometry_1_1index_1_1quadratic.xml] [#structboost_1_1geometry_1_1index_1_1quadratic] -[section:boost_geometry_index_quadratic boost::geometry::index::quadratic] +[section boost::geometry::index::quadratic] -'''boostgeometryindexquadratic''' Quadratic r-tree creation algorithm parameters. [heading Header] diff --git a/doc/generated/rtree_rstar.qbk b/doc/generated/rtree_rstar.qbk index 1d434696e..70d6a94ad 100644 --- a/doc/generated/rtree_rstar.qbk +++ b/doc/generated/rtree_rstar.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/structboost_1_1geometry_1_1index_1_1rstar.xml] [#structboost_1_1geometry_1_1index_1_1rstar] -[section:boost_geometry_index_rstar boost::geometry::index::rstar] +[section boost::geometry::index::rstar] -'''boostgeometryindexrstar''' R*-tree creation algorithm parameters. [heading Header] diff --git a/doc/generated/rtree_runtime_linear.qbk b/doc/generated/rtree_runtime_linear.qbk index b6dc0a110..352662c5c 100644 --- a/doc/generated/rtree_runtime_linear.qbk +++ b/doc/generated/rtree_runtime_linear.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1linear.xml] [#classboost_1_1geometry_1_1index_1_1runtime_1_1linear] -[section:boost_geometry_index_runtime_linear boost::geometry::index::runtime::linear] +[section boost::geometry::index::runtime::linear] -'''boostgeometryindexruntimelinear''' Linear r-tree creation algorithm parameters. [heading Header] diff --git a/doc/generated/rtree_runtime_quadratic.qbk b/doc/generated/rtree_runtime_quadratic.qbk index 2a5102750..90c6c095e 100644 --- a/doc/generated/rtree_runtime_quadratic.qbk +++ b/doc/generated/rtree_runtime_quadratic.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic.xml] [#classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic] -[section:boost_geometry_index_runtime_quadratic boost::geometry::index::runtime::quadratic] +[section boost::geometry::index::runtime::quadratic] -'''boostgeometryindexruntimequadratic''' Quadratic r-tree creation algorithm parameters. [heading Header] diff --git a/doc/generated/rtree_runtime_rstar.qbk b/doc/generated/rtree_runtime_rstar.qbk index 491ce09cc..e0d506dcb 100644 --- a/doc/generated/rtree_runtime_rstar.qbk +++ b/doc/generated/rtree_runtime_rstar.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1rstar.xml] [#classboost_1_1geometry_1_1index_1_1runtime_1_1rstar] -[section:boost_geometry_index_runtime_rstar boost::geometry::index::runtime::rstar] +[section boost::geometry::index::runtime::rstar] -'''boostgeometryindexruntimerstar''' R*-tree creation algorithm parameters. [heading Header] diff --git a/doc/generated/translator.qbk b/doc/generated/translator.qbk index d01eaf0ab..333d7123e 100644 --- a/doc/generated/translator.qbk +++ b/doc/generated/translator.qbk @@ -1,9 +1,8 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] [/ Generated from xml/structboost_1_1geometry_1_1index_1_1translator.xml] [#structboost_1_1geometry_1_1index_1_1translator] -[section:boost_geometry_index_translator boost::geometry::index::translator] +[section boost::geometry::index::translator] -'''boostgeometryindextranslator''' The default translator. [heading Description] diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index dc6a7e6de..91109edb9 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -72,13 +72,12 @@

    Reference
    -
    boost::geometry::index::rtree
    +
    boost::geometry::index::rtree
    Functions related to the rtree
    R-tree parameters (boost::geometry::index::)
    -
    Translator - (boost::geometry::index::translator)
    +
    boost::geometry::index::translator
    Predicates (boost::geometry::index::)
    Nearest diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 742a3136f..2f080695e 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -26,13 +26,12 @@ Reference

    - -The R-tree spatial index. + The R-tree spatial index.

    - - Description + + Description

    This is self-balancing spatial index capable to store various types of Values and balancing algorithms.

    - - Parameters + + Parameters

    The user must pass a type defining the Parameters which will be used in @@ -96,8 +94,8 @@ The R-tree spatial index.

  • - - Translator + + Translator

    The Translator translates from Value to Indexable each time r-tree requires @@ -113,15 +111,15 @@ The R-tree spatial index. to Box const&.

    - - Header + + Header

    #include <boost/geometry/index/rtree.hpp>

    - - Synopsis + + Synopsis
    template<typename Value,
              typename Parameters,
    @@ -133,8 +131,8 @@ The R-tree spatial index.
     };
     
    - - Template + + Template parameter(s)
    @@ -207,8 +205,8 @@ The R-tree spatial index.
    - - Typedef(s) + + Typedef(s)
    @@ -315,8 +313,8 @@ The R-tree spatial index.
    - - Constructor(s) + + Constructor(s) and destructor
    @@ -457,8 +455,8 @@ The R-tree spatial index.
    - - Member(s) + + Member(s)
    @@ -774,20 +772,20 @@ The R-tree spatial index.

    The constructor.

    - - Synopsis + + Synopsis
    rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
     
    - - Modifier(s) + + Modifier(s)

    @@ -795,8 +793,8 @@ The R-tree spatial index.

    - - Parameter(s) + + Parameter(s)
    @@ -860,8 +858,8 @@ The R-tree spatial index.
    - - Throws + + Throws

    If allocator default constructor throws. @@ -869,23 +867,23 @@ The R-tree spatial index.

    The constructor.

    - - Synopsis + + Synopsis
    rtree(parameters_type parameters,
           translator_type const & translator,
           allocator_type allocator)
     
    - - Parameter(s) + + Parameter(s)
    @@ -966,8 +964,8 @@ The R-tree spatial index.
    - - Throws + + Throws

    If allocator copy constructor throws. @@ -975,15 +973,15 @@ The R-tree spatial index.

    The constructor.

    - - Synopsis + + Synopsis
    template<typename Iterator>
     rtree(Iterator first,
    @@ -993,8 +991,8 @@ The R-tree spatial index.
           allocator_type allocator = allocator_type())
     
    - - Parameter(s) + + Parameter(s)
    @@ -1109,8 +1107,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -1129,15 +1127,15 @@ The R-tree spatial index.

    The constructor.

    - - Synopsis + + Synopsis
    template<typename Range>
     rtree(Range const & rng,
    @@ -1146,8 +1144,8 @@ The R-tree spatial index.
           allocator_type allocator = allocator_type())
     
    - - Modifier(s) + + Modifier(s)

    @@ -1155,8 +1153,8 @@ The R-tree spatial index.

    - - Parameter(s) + + Parameter(s)
    @@ -1255,8 +1253,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -1275,20 +1273,20 @@ The R-tree spatial index.

    The destructor.

    - - Synopsis + + Synopsis
    ~rtree()
     
    - - Throws + + Throws

    Nothing. @@ -1296,28 +1294,28 @@ The R-tree spatial index.

    The copy constructor.

    - - Description + + Description

    It uses parameters, translator and allocator from the source tree.

    - - Synopsis + + Synopsis
    rtree(rtree const & src)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1362,8 +1360,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -1382,28 +1380,28 @@ The R-tree spatial index.

    The copy constructor.

    - - Description + + Description

    It uses Parameters and translator from the source tree.

    - - Synopsis + + Synopsis
    rtree(rtree const & src, allocator_type const & allocator)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1468,8 +1466,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -1488,28 +1486,28 @@ The R-tree spatial index.

    The moving constructor.

    - - Description + + Description

    It uses parameters, translator and allocator from the source tree.

    - - Synopsis + + Synopsis
    rtree(rtree && src)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1554,8 +1552,8 @@ The R-tree spatial index.
    - - Throws + + Throws

    Nothing. @@ -1563,28 +1561,28 @@ The R-tree spatial index.

    The moving constructor.

    - - Description + + Description

    It uses parameters and translator from the source tree.

    - - Synopsis + + Synopsis
    rtree(rtree && src, allocator_type const & allocator)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1649,8 +1647,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -1670,28 +1668,28 @@ The R-tree spatial index.

    The assignment operator.

    - - Description + + Description

    It uses parameters and translator from the source tree.

    - - Synopsis + + Synopsis
    rtree & operator=(const rtree & src)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1736,8 +1734,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -1753,28 +1751,28 @@ The R-tree spatial index.

    The moving assignment.

    - - Description + + Description

    It uses parameters and translator from the source tree.

    - - Synopsis + + Synopsis
    rtree & operator=(rtree && src)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1819,8 +1817,8 @@ The R-tree spatial index.
    - - Throws + + Throws

    Only if allocators aren't equal. @@ -1839,28 +1837,28 @@ The R-tree spatial index.

    Swaps contents of two rtrees.

    - - Description + + Description

    Parameters, translator and allocators are swapped as well.

    - - Synopsis + + Synopsis
    void swap(rtree & other)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1905,8 +1903,8 @@ The R-tree spatial index.
    - - Throws + + Throws

    If allocators swap throws. @@ -1914,21 +1912,21 @@ The R-tree spatial index.

    Insert a value to the index.

    - - Synopsis + + Synopsis
    void insert(value_type const & value)
     
    - - Parameter(s) + + Parameter(s)
    @@ -1973,8 +1971,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -2001,22 +1999,22 @@ The R-tree spatial index.

    Insert a range of values to the index.

    - - Synopsis + + Synopsis
    template<typename Iterator>
     void insert(Iterator first, Iterator last)
     
    - - Parameter(s) + + Parameter(s)
    @@ -2079,8 +2077,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -2107,22 +2105,22 @@ The R-tree spatial index.

    Insert a range of values to the index.

    - - Synopsis + + Synopsis
    template<typename Range>
     void insert(Range const & rng)
     
    - - Parameter(s) + + Parameter(s)
    @@ -2167,8 +2165,8 @@ The R-tree spatial index.
    - - Throws + + Throws
    • @@ -2195,15 +2193,15 @@ The R-tree spatial index.

    Remove a value from the container.

    - - Description + + Description

    In contrast to the std::set @@ -2211,14 +2209,14 @@ The R-tree spatial index. only one value from the container.

    - - Synopsis + + Synopsis
    size_type remove(value_type const & value)
     
    - - Parameter(s) + + Parameter(s)
    @@ -2263,15 +2261,15 @@ The R-tree spatial index.
    - - Returns + + Returns

    1 if the value was removed, 0 otherwise.

    - - Throws + + Throws
    • @@ -2298,15 +2296,15 @@ The R-tree spatial index.

    Remove a range of values from the container.

    - - Description + + Description

    In contrast to the std::set @@ -2316,15 +2314,15 @@ The R-tree spatial index. value for each one passed in the range, not all equal values.

    - - Synopsis + + Synopsis
    template<typename Iterator>
     size_type remove(Iterator first, Iterator last)
     
    - - Parameter(s) + + Parameter(s)
    @@ -2387,15 +2385,15 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of removed values.

    - - Throws + + Throws
    • @@ -2422,15 +2420,15 @@ The R-tree spatial index.

    Remove a range of values from the container.

    - - Description + + Description

    In contrast to the std::set @@ -2439,15 +2437,15 @@ The R-tree spatial index. one value for each one passed in the range, not all equal values.

    - - Synopsis + + Synopsis
    template<typename Range>
     size_type remove(Range const & rng)
     
    - - Parameter(s) + + Parameter(s)
    @@ -2492,15 +2490,15 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of removed values.

    - - Throws + + Throws
    • @@ -2527,7 +2525,7 @@ The R-tree spatial index.

    @@ -2535,8 +2533,8 @@ The R-tree spatial index. intersecting some Box.

    - - Description + + Description

    This query function performs spatial and k-nearest neighbor searches. @@ -2620,15 +2618,15 @@ The R-tree spatial index. Predicates may be passed together connected with operator&&().

    - - Synopsis + + Synopsis
    template<typename Predicates, typename OutIter>
     size_type query(Predicates const & predicates, OutIter out_it)
     
    - - Modifier(s) + + Modifier(s)

    @@ -2636,8 +2634,8 @@ The R-tree spatial index.

    - - Parameter(s) + + Parameter(s)
    @@ -2700,15 +2698,15 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found.

    - - Example + + Example

    @@ -2726,8 +2724,8 @@ The R-tree spatial index.

    - - Throws + + Throws

    If Value copy constructor or copy assignment throws. @@ -2745,20 +2743,20 @@ The R-tree spatial index.

    Returns the number of stored values.

    - - Synopsis + + Synopsis
    size_type size()
     
    - - Modifier(s) + + Modifier(s)

    @@ -2766,15 +2764,15 @@ The R-tree spatial index.

    - - Returns + + Returns

    The number of stored values.

    - - Throws + + Throws

    Nothing. @@ -2782,20 +2780,20 @@ The R-tree spatial index.

    Query if the container is empty.

    - - Synopsis + + Synopsis
    bool empty()
     
    - - Modifier(s) + + Modifier(s)

    @@ -2803,15 +2801,15 @@ The R-tree spatial index.

    - - Returns + + Returns

    true if the container is empty.

    - - Throws + + Throws

    Nothing. @@ -2819,20 +2817,20 @@ The R-tree spatial index.

    Removes all values stored in the container.

    - - Synopsis + + Synopsis
    void clear()
     
    - - Throws + + Throws

    Nothing. @@ -2840,28 +2838,28 @@ The R-tree spatial index.

    Returns the box able to contain all values stored in the container.

    - - Description + + Description

    Returns the box able to contain all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.

    - - Synopsis + + Synopsis
    bounds_type bounds()
     
    - - Modifier(s) + + Modifier(s)

    @@ -2869,16 +2867,16 @@ The R-tree spatial index.

    - - Returns + + Returns

    The box able to contain all values stored in the container or an invalid box if there are no values in the container.

    - - Throws + + Throws

    Nothing. @@ -2886,15 +2884,15 @@ The R-tree spatial index.

    Count Values or Indexables stored in the container.

    - - Description + + Description

    For indexable_type it returns the number of values which indexables equals @@ -2902,15 +2900,15 @@ The R-tree spatial index. the parameter.

    - - Synopsis + + Synopsis
    template<typename ValueOrIndexable>
     size_type count(ValueOrIndexable const & vori)
     
    - - Modifier(s) + + Modifier(s)

    @@ -2918,8 +2916,8 @@ The R-tree spatial index.

    - - Parameter(s) + + Parameter(s)
    @@ -2964,15 +2962,15 @@ The R-tree spatial index.
    - - Returns + + Returns

    The number of values found.

    - - Throws + + Throws

    Nothing. @@ -2980,20 +2978,20 @@ The R-tree spatial index.

    Returns parameters.

    - - Synopsis + + Synopsis
    parameters_type const & parameters()
     
    - - Modifier(s) + + Modifier(s)

    @@ -3001,15 +2999,15 @@ The R-tree spatial index.

    - - Returns + + Returns

    The parameters object.

    - - Throws + + Throws

    Nothing. @@ -3017,20 +3015,20 @@ The R-tree spatial index.

    Returns the translator object.

    - - Synopsis + + Synopsis
    translator_type const & translator()
     
    - - Modifier(s) + + Modifier(s)

    @@ -3038,15 +3036,15 @@ The R-tree spatial index.

    - - Returns + + Returns

    The translator object.

    - - Throws + + Throws

    Nothing. @@ -3054,20 +3052,20 @@ The R-tree spatial index.

    Returns allocator used by the rtree.

    - - Synopsis + + Synopsis
    allocator_type get_allocator()
     
    - - Modifier(s) + + Modifier(s)

    @@ -3075,15 +3073,15 @@ The R-tree spatial index.

    - - Returns + + Returns

    The allocator.

    - - Throws + + Throws

    If allocator copy constructor throws. @@ -4613,22 +4611,21 @@ The R-tree spatial index.

    - -Linear r-tree creation algorithm parameters. + Linear r-tree creation algorithm parameters.

    - - Header + + Header

    #include <boost/geometry/index/parameters.hpp>

    - - Synopsis + + Synopsis
    template<size_t MaxElements, size_t MinElements>
     struct linear
    @@ -4637,8 +4634,8 @@ Linear r-tree creation algorithm parameters.
     };
     
    - - Template + + Template parameter(s)
    @@ -4688,22 +4685,21 @@ Linear r-tree creation algorithm parameters.

    - -Quadratic r-tree creation algorithm parameters. + Quadratic r-tree creation algorithm parameters.

    - - Header + + Header

    #include <boost/geometry/index/parameters.hpp>

    - - Synopsis + + Synopsis
    template<size_t MaxElements, size_t MinElements>
     struct quadratic
    @@ -4712,8 +4708,8 @@ Quadratic r-tree creation algorithm parameters.
     };
     
    - - Template + + Template parameter(s)
    @@ -4763,22 +4759,21 @@ Quadratic r-tree creation algorithm parameters.

    - -R*-tree creation algorithm parameters. + R*-tree creation algorithm parameters.

    - - Header + + Header

    #include <boost/geometry/index/parameters.hpp>

    - - Synopsis + + Synopsis
    template<size_t MaxElements,
              size_t MinElements,
    @@ -4790,8 +4785,8 @@ R*-tree creation algorithm parameters.
     };
     
    - - Template + + Template parameter(s)
    @@ -4867,22 +4862,21 @@ R*-tree creation algorithm parameters.

    - -Linear r-tree creation algorithm parameters. + Linear r-tree creation algorithm parameters.

    - - Header + + Header

    #include <boost/geometry/index/parameters.hpp>

    - - Synopsis + + Synopsis
    class linear
     {
    @@ -4890,8 +4884,8 @@ Linear r-tree creation algorithm parameters.
     };
     
    - - Constructor(s) + + Constructor(s) and destructor
    @@ -4927,18 +4921,18 @@ Linear r-tree creation algorithm parameters.

    The constructor.

    - - Synopsis + + Synopsis
    linear(size_t max_elements, size_t min_elements)
     
    - - Parameter(s) + + Parameter(s)
    @@ -5003,22 +4997,21 @@ Linear r-tree creation algorithm parameters.

    - -Quadratic r-tree creation algorithm parameters. + Quadratic r-tree creation algorithm parameters.

    - - Header + + Header

    #include <boost/geometry/index/parameters.hpp>

    - - Synopsis + + Synopsis
    class quadratic
     {
    @@ -5026,8 +5019,8 @@ Quadratic r-tree creation algorithm parameters.
     };
     
    - - Constructor(s) + + Constructor(s) and destructor
    @@ -5063,18 +5056,18 @@ Quadratic r-tree creation algorithm parameters.

    The constructor.

    - - Synopsis + + Synopsis
    quadratic(size_t max_elements, size_t min_elements)
     
    - - Parameter(s) + + Parameter(s)
    @@ -5139,22 +5132,21 @@ Quadratic r-tree creation algorithm parameters.

    - -R*-tree creation algorithm parameters. + R*-tree creation algorithm parameters.

    - - Header + + Header

    #include <boost/geometry/index/parameters.hpp>

    - - Synopsis + + Synopsis
    class rstar
     {
    @@ -5162,8 +5154,8 @@ R*-tree creation algorithm parameters.
     };
     
    - - Constructor(s) + + Constructor(s) and destructor
    @@ -5199,21 +5191,21 @@ R*-tree creation algorithm parameters.

    The constructor.

    - - Synopsis + + Synopsis
    rstar(size_t max_elements,
           size_t min_elements,
           size_t overlap_cost_threshold = 0,
           size_t reinserted_elements = detail::default_rstar_reinserted_elements_d())
     
    - - Parameter(s) + + Parameter(s)
    @@ -5315,37 +5307,31 @@ R*-tree creation algorithm parameters.
    -
    -

    - -The default translator. -

    + The default translator. +

    - - Description -
    + + Description +

    - It translates Value object to Indexable object. The default version handles - Values which are Indexables. This translator is also specialized for - std::pair<Indexable, Second> and boost::tuple<Indexable, ...>. -

    + It translates Value object to Indexable object. The default version handles + Values which are Indexables. This translator is also specialized for std::pair<Indexable, + Second> and boost::tuple<Indexable, ...>. +

    - - Header -
    + + Header +

    - #include <boost/geometry/index/translator.hpp> -

    + #include <boost/geometry/index/translator.hpp> +

    - - Synopsis -
    + + Synopsis +
    template<typename Value>
     struct translator
     {
    @@ -5353,10 +5339,10 @@ The default translator.
     };
     
    - - Template - parameter(s) -
    + + Template + parameter(s) +
    @@ -5364,31 +5350,30 @@ The default translator. +

    + Parameter +

    + +

    + Description +

    + +

    + Value +

    + +

    + The Value type which may be translated directly to the Indexable. +

    +
    -

    - Parameter -

    -
    -

    - Description -

    -
    -

    - Value -

    -
    -

    - The Value type which may be translated directly to the Indexable. -

    -
    -
    - +

    Last revised: February 22, 2013 at 03:18:40 GMT

    Last revised: February 22, 2013 at 13:50:49 GMT


    diff --git a/doc/rtree/reference.qbk b/doc/rtree/reference.qbk index 734cd4370..b3258ff81 100644 --- a/doc/rtree/reference.qbk +++ b/doc/rtree/reference.qbk @@ -24,13 +24,13 @@ [endsect] -[section:translator Translator (boost::geometry::index::translator)] +[/section:translator Translator (boost::geometry::index::translator)/] [include ../generated/translator.qbk] [/include ../generated/translator_pair.qbk/] [/include ../generated/translator_tuple.qbk/] -[endsect] +[/endsect/] [include ../generated/predicates.qbk] [include ../generated/nearest_relations.qbk] diff --git a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp index 737ff8f44..d14f8423c 100644 --- a/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp +++ b/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp @@ -619,7 +619,6 @@ void quickbook_output(class_or_struct const& cos, configuration const& config, s // ALT // ----------------------------------------------------------------------------------------------- // - std::string remove_template_parameters(std::string const& name) { std::string res; @@ -944,8 +943,17 @@ void quickbook_synopsis_alt(class_or_struct const& cos, configuration const& con out << "\n"; out << (cos.is_class ? "`class " : "`struct "); - out << short_name.substr(short_name.find_last_of("::") + 1) << "`" << std::endl; - + { + std::string::size_type last_scope = std::string::npos; + std::string::size_type i = short_name.find("<"); + for(std::string::size_type j = short_name.find("::") ; j < i ; j = short_name.find("::", j+1)) + last_scope = j; + if ( last_scope == std::string::npos ) + out << short_name << "`" << std::endl; + else + out << short_name.substr(last_scope + 2) << "`" << std::endl; + } + if (! cos.base_classes.empty()) { out << "` : "; @@ -1235,13 +1243,13 @@ void quickbook_output_alt(class_or_struct const& cos, configuration const& confi { // Skip namespace std::string short_name = namespace_skipped(cos.fullname, config); - std::string section_name = to_section_name(short_name); if ( config.output_style == "alt" && !cos.id.empty() ) out << "[#" << cos.id << "]" << std::endl; - out << "[section:" << section_name << " " << short_name << "]" << std::endl << std::endl; + out << "[section " << short_name << "]" << std::endl << std::endl; - quickbook_output_indexterm(short_name, out); + // Can't be used in the case of specializations and probably isn't needed in alt output + //quickbook_output_indexterm(short_name, out); // Brief diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index beaeb14c2..0338725a6 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -1010,7 +1010,7 @@ private: /*! \brief Perform nearest neighbour search. - . + \par Exception-safety strong */ From e7211f7b09076dcf305bf6583dad196ae51b49ad Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 23 Feb 2013 04:30:29 +0000 Subject: [PATCH 340/366] rtree docs updated: introduction fixed, translator::def<> changed to translator<>. [SVN r83094] --- .../geometry_index/r_tree/creation_and_modification.html | 4 ++-- doc/html/geometry_index/r_tree/introduction.html | 7 +++---- doc/html/index.html | 2 +- doc/rtree/creation.qbk | 4 ++-- doc/rtree/introduction.qbk | 6 +++--- 5 files changed, 11 insertions(+), 12 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 7909b5d67..096b84562 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -53,7 +53,7 @@

    R-tree has 4 parameters:

    -
    rtree<Value, Parameters, Translator = translator::def<Value>, Allocator> = std::allocator<Value> >
    +
    rtree<Value, Parameters, Translator = index::translator<Value>, Allocator> = std::allocator<Value> >
     
    • @@ -87,7 +87,7 @@ in this documentation. Each type adapted to Point or Box concept is an Indexable. Values types which can - be handled by the default Translator - index::translator::def<Value> + be handled by the default Translator - index::translator<Value> are defined as follows:

        diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 00e5b8943..74f9022ec 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -223,7 +223,7 @@

        The spatial index was originally started by Federico J. Fernandez during - the Google-Of-Summer project 2008, mentored by Hartmut Kaiser. + the Google Summer of Code 2008 program, mentored by Hartmut Kaiser.

        @@ -231,9 +231,8 @@ thanks

        - I'd like to thank Barend Gehrels, Bruno Lalande, Lucanus J. Simonson for - their support and ideas, as well as the members of the Boost.Geometry mailing - list for their help. + I'd like to thank Barend Gehrels, Bruno Lalande, Mateusz Łoskot, Lucanus + J. Simonson for their support and ideas.



        diff --git a/doc/html/index.html b/doc/html/index.html index 2c2551f7e..30f0631c9 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
      - +

      Last revised: February 22, 2013 at 13:50:49 GMT

      Last revised: February 23, 2013 at 04:28:38 GMT


      diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 100204841..9d0cfba8b 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -14,7 +14,7 @@ __rtree__ has 4 parameters: - rtree, Allocator> = std::allocator > + rtree, Allocator> = std::allocator > * `__value__` - type of object which will be stored in the container, * `Parameters` - parameters type, inserting/splitting algorithm, @@ -29,7 +29,7 @@ __rtree__ has 4 parameters: __rtree__ may store `__value__`s of any type as long the `__translator__` knows how to interpret those `__value__`s and extract an object that the __rtree__ can handle. Those objects are called `__indexable__`s in this documentation. Each type adapted to `__point__` or `__box__` concept is an `__indexable__`. -`__value__`s types which can be handled by the default `__translator__` - `index::translator::def<__value__>` +`__value__`s types which can be handled by the default `__translator__` - `index::translator<__value__>` are defined as follows: * `__indexable__ = __point__ | __box__` diff --git a/doc/rtree/introduction.qbk b/doc/rtree/introduction.qbk index d309dc6f4..852a7b62e 100644 --- a/doc/rtree/introduction.qbk +++ b/doc/rtree/introduction.qbk @@ -1,4 +1,4 @@ -[/============================================================================ +[/============================================================================ Boost.Geometry Index Copyright (c) 2011-2012 Adam Wulkiewicz. @@ -61,11 +61,11 @@ R-tree depends on *Boost.Move*, *Boost.Container*, *Boost.Tuple*, *Boost.Utility [heading Contributors] -The spatial index was originally started by Federico J. Fernandez during the Google-Of-Summer project 2008, mentored by Hartmut Kaiser. +The spatial index was originally started by Federico J. Fernandez during the Google Summer of Code 2008 program, mentored by Hartmut Kaiser. [heading Spatial thanks] -I'd like to thank Barend Gehrels, Bruno Lalande, Lucanus J. Simonson for their support and ideas, as well as the members of the Boost.Geometry mailing list for their help. +I'd like to thank Barend Gehrels, Bruno Lalande, Mateusz Łoskot, Lucanus J. Simonson for their support and ideas. [endsect] From e1a4660d47477e76952aad4bd56d20b178a2cd4e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 23 Feb 2013 23:47:19 +0000 Subject: [PATCH 341/366] Added examples of indexing polygons. Fixed c++11 compilation error caused by use of deleted Allocators copy ctor in rstar insert visitor. [SVN r83110] --- doc/html/geometry_index/r_tree.html | 4 + .../geometry_index/r_tree/rtree_examples.html | 192 +++++++++++++++++- .../r_tree/rtree_quickstart.html | 12 +- doc/html/index.html | 2 +- doc/imports.qbk | 2 + doc/rtree/examples.qbk | 8 + doc/src/examples/rtree/Jamfile.v2 | 6 +- doc/src/examples/rtree/interprocess.cpp | 10 +- .../examples/rtree/polygons_shared_ptr.cpp | 88 ++++++++ doc/src/examples/rtree/polygons_vector.cpp | 96 +++++++++ doc/src/examples/rtree/quick_start.cpp | 12 +- .../index/detail/rtree/rstar/insert.hpp | 2 +- 12 files changed, 419 insertions(+), 15 deletions(-) create mode 100644 doc/src/examples/rtree/polygons_shared_ptr.cpp create mode 100644 doc/src/examples/rtree/polygons_vector.cpp diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index 91109edb9..e4e8c3cec 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -68,6 +68,10 @@
      Quick start
      +
      Index + of polygons stored in vector
      +
      Index + of shared pointers to polygons
      Interprocess
      Reference
      diff --git a/doc/html/geometry_index/r_tree/rtree_examples.html b/doc/html/geometry_index/r_tree/rtree_examples.html index 7642a31b2..056fb38a4 100644 --- a/doc/html/geometry_index/r_tree/rtree_examples.html +++ b/doc/html/geometry_index/r_tree/rtree_examples.html @@ -29,6 +29,10 @@
      @@ -39,7 +43,7 @@

      #include <boost/geometry.hpp>
      -#include <boost/geometry/geometries/point_xy.hpp>
      +#include <boost/geometry/geometries/point.hpp>
       #include <boost/geometry/geometries/box.hpp>
       
       #include <boost/geometry/index/rtree.hpp>
      @@ -61,7 +65,7 @@
           typedef std::pair<box, unsigned> value;
       
           // create the rtree using default constructor
      -    bgi::rtree< value, bgi::quadratic<32, 8> > rtree;
      +    bgi::rtree< value, bgi::quadratic<16, 4> > rtree;
       
           // create some values
           for ( unsigned i = 0 ; i < 10 ; ++i )
      @@ -81,9 +85,15 @@
           std::vector<value> result_n;
           rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
       
      +    // display results
      +    std::cout << "spatial query box:" << std::endl;
      +    std::cout << bg::wkt<box>(query_box) << std::endl;
           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 point:" << std::endl;
      +    std::cout << bg::wkt<point>(point(0, 0)) << 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;
      @@ -96,6 +106,184 @@
       
      +

      +

      +
      #include <boost/geometry.hpp>
      +#include <boost/geometry/geometries/point.hpp>
      +#include <boost/geometry/geometries/box.hpp>
      +#include <boost/geometry/geometries/polygon.hpp>
      +
      +#include <boost/geometry/index/rtree.hpp>
      +
      +#include <cmath>
      +#include <vector>
      +#include <iostream>
      +#include <boost/foreach.hpp>
      +
      +namespace bg = boost::geometry;
      +namespace bgi = boost::geometry::index;
      +
      +int main(void)
      +{
      +    typedef bg::model::point<float, 2, bg::cs::cartesian> point;
      +    typedef bg::model::box<point> box;
      +    typedef bg::model::polygon<point, false, false> polygon; // ccw, open polygon
      +    typedef std::pair<box, unsigned> value;
      +
      +    // polygons
      +    std::vector<polygon> polygons;
      +
      +    // create some polygons
      +    for ( unsigned i = 0 ; i < 10 ; ++i )
      +    {
      +        // create a polygon
      +        polygon p;
      +        for ( float a = 0 ; a < 6.28316f ; a += 1.04720f )
      +        {
      +            float x = i + int(10*::cos(a))*0.1f;
      +            float y = i + int(10*::sin(a))*0.1f;
      +            p.outer().push_back(point(x, y));
      +        }
      +
      +        // add polygon
      +        polygons.push_back(p);
      +    }
      +
      +    // display polygons
      +    std::cout << "generated polygons:" << std::endl;
      +    BOOST_FOREACH(polygon const& p, polygons)
      +        std::cout << bg::wkt<polygon>(p) << std::endl;
      +
      +    // create the rtree using default constructor
      +    bgi::rtree< value, bgi::rstar<16, 4> > rtree;
      +
      +    // fill the spatial index
      +    for ( size_t i = 0 ; i < polygons.size() ; ++i )
      +    {
      +        // calculate polygon bounding box
      +        box b = bg::return_envelope<box>(polygons[i]);
      +        // insert new value
      +        rtree.insert(std::make_pair(b, i));
      +    }
      +
      +    // find values intersecting some area defined by a box
      +    box query_box(point(0, 0), point(5, 5));
      +    std::vector<value> result_s;
      +    rtree.query(query_box, std::back_inserter(result_s));
      +
      +    // find 5 nearest values to a point
      +    std::vector<value> result_n;
      +    rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
      +
      +    // display results
      +    std::cout << "spatial query box:" << std::endl;
      +    std::cout << bg::wkt<box>(query_box) << std::endl;
      +    std::cout << "spatial query result:" << std::endl;
      +    BOOST_FOREACH(value const& v, result_s)
      +        std::cout << bg::wkt<polygon>(polygons[v.second]) << std::endl;
      +
      +    std::cout << "knn query point:" << std::endl;
      +    std::cout << bg::wkt<point>(point(0, 0)) << std::endl;
      +    std::cout << "knn query result:" << std::endl;
      +    BOOST_FOREACH(value const& v, result_n)
      +        std::cout << bg::wkt<polygon>(polygons[v.second]) << std::endl;
      +
      +    return 0;
      +}
      +
      +

      +

      +
      +
      + +

      +

      +
      #include <boost/geometry.hpp>
      +#include <boost/geometry/geometries/point.hpp>
      +#include <boost/geometry/geometries/box.hpp>
      +#include <boost/geometry/geometries/polygon.hpp>
      +
      +#include <boost/geometry/index/rtree.hpp>
      +
      +#include <cmath>
      +#include <vector>
      +#include <iostream>
      +#include <boost/foreach.hpp>
      +#include <boost/shared_ptr.hpp>
      +
      +namespace bg = boost::geometry;
      +namespace bgi = boost::geometry::index;
      +
      +int main(void)
      +{
      +    typedef bg::model::point<float, 2, bg::cs::cartesian> point;
      +    typedef bg::model::box<point> box;
      +    typedef bg::model::polygon<point, false, false> polygon; // ccw, open polygon
      +    typedef boost::shared_ptr<polygon> shp;
      +    typedef std::pair<box, shp> value;
      +
      +    // create the rtree using default constructor
      +    bgi::rtree< value, bgi::linear<16, 4> > rtree;
      +
      +    std::cout << "filling index with polygons shared pointers:" << std::endl;
      +
      +    // create some polygons and fill the spatial index
      +    for ( unsigned i = 0 ; i < 10 ; ++i )
      +    {
      +        // create a polygon
      +        shp p(new polygon());
      +        for ( float a = 0 ; a < 6.28316f ; a += 1.04720f )
      +        {
      +            float x = i + int(10*::cos(a))*0.1f;
      +            float y = i + int(10*::sin(a))*0.1f;
      +            p->outer().push_back(point(x, y));
      +        }
      +
      +        // display new polygon
      +        std::cout << bg::wkt<polygon>(*p) << std::endl;
      +
      +        // calculate polygon bounding box
      +        box b = bg::return_envelope<box>(*p);
      +        // insert new value
      +        rtree.insert(std::make_pair(b, p));
      +    }
      +
      +    // find values intersecting some area defined by a box
      +    box query_box(point(0, 0), point(5, 5));
      +    std::vector<value> result_s;
      +    rtree.query(query_box, std::back_inserter(result_s));
      +
      +    // find 5 nearest values to a point
      +    std::vector<value> result_n;
      +    rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
      +
      +    // display results
      +    std::cout << "spatial query box:" << std::endl;
      +    std::cout << bg::wkt<box>(query_box) << std::endl;
      +    std::cout << "spatial query result:" << std::endl;
      +    BOOST_FOREACH(value const& v, result_s)
      +        std::cout << bg::wkt<polygon>(*v.second) << std::endl;
      +
      +    std::cout << "knn query point:" << std::endl;
      +    std::cout << bg::wkt<point>(point(0, 0)) << std::endl;
      +    std::cout << "knn query result:" << std::endl;
      +    BOOST_FOREACH(value const& v, result_n)
      +        std::cout << bg::wkt<polygon>(*v.second) << std::endl;
      +
      +    return 0;
      +}
      +
      +

      +

      +
      +
      +

      diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index e0430d0a4..84f002c80 100644 --- a/doc/html/geometry_index/r_tree/rtree_quickstart.html +++ b/doc/html/geometry_index/r_tree/rtree_quickstart.html @@ -36,7 +36,7 @@

      #include <boost/geometry.hpp>
      -#include <boost/geometry/geometries/point_xy.hpp>
      +#include <boost/geometry/geometries/point.hpp>
       #include <boost/geometry/geometries/box.hpp>
       
       #include <boost/geometry/index/rtree.hpp>
      @@ -79,7 +79,7 @@
       

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

      @@ -139,9 +139,15 @@

      -
      std::cout << "spatial query result:" << std::endl;
      +
      // display results
      +std::cout << "spatial query box:" << std::endl;
      +std::cout << bg::wkt<box>(query_box) << std::endl;
      +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 point:" << std::endl;
      +std::cout << bg::wkt<point>(point(0, 0)) << 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;
      diff --git a/doc/html/index.html b/doc/html/index.html
      index 30f0631c9..e1c19784f 100644
      --- a/doc/html/index.html
      +++ b/doc/html/index.html
      @@ -51,7 +51,7 @@
       
    - +

    Last revised: February 23, 2013 at 04:28:38 GMT

    Last revised: February 23, 2013 at 23:45:13 GMT


    diff --git a/doc/imports.qbk b/doc/imports.qbk index 79c49edbd..68c57c29a 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -9,4 +9,6 @@ =============================================================================/] [import src/examples/rtree/quick_start.cpp] +[import src/examples/rtree/polygons_vector.cpp] +[import src/examples/rtree/polygons_shared_ptr.cpp] [import src/examples/rtree/interprocess.cpp] diff --git a/doc/rtree/examples.qbk b/doc/rtree/examples.qbk index 5691be531..917de425a 100644 --- a/doc/rtree/examples.qbk +++ b/doc/rtree/examples.qbk @@ -14,6 +14,14 @@ [rtree_quickstart] [endsect] +[section Index of polygons stored in vector] +[rtree_polygons_vector] +[endsect] + +[section Index of shared pointers to polygons] +[rtree_polygons_shared_ptr] +[endsect] + [section Interprocess] [rtree_interprocess] [endsect] diff --git a/doc/src/examples/rtree/Jamfile.v2 b/doc/src/examples/rtree/Jamfile.v2 index 57422ddc1..dcf90b575 100644 --- a/doc/src/examples/rtree/Jamfile.v2 +++ b/doc/src/examples/rtree/Jamfile.v2 @@ -1,6 +1,6 @@ # Boost.Geometry Index # -# Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +# Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -8,6 +8,10 @@ exe quick_start : quick_start.cpp ; +exe polygons_vector : polygons_vector.cpp + ; +exe polygons_shared_ptr : polygons_shared_ptr.cpp + ; exe interprocess : interprocess.cpp /boost/thread//boost_thread : diff --git a/doc/src/examples/rtree/interprocess.cpp b/doc/src/examples/rtree/interprocess.cpp index e160d6ea6..1b59451b9 100644 --- a/doc/src/examples/rtree/interprocess.cpp +++ b/doc/src/examples/rtree/interprocess.cpp @@ -1,7 +1,9 @@ -// Boost.Geometry.Index Rtree interprocess example - -// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. - +// Boost.Geometry Index +// +// Quickbook Examples +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/doc/src/examples/rtree/polygons_shared_ptr.cpp b/doc/src/examples/rtree/polygons_shared_ptr.cpp new file mode 100644 index 000000000..210fb27ad --- /dev/null +++ b/doc/src/examples/rtree/polygons_shared_ptr.cpp @@ -0,0 +1,88 @@ +// Boost.Geometry Index +// +// Quickbook Examples +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +//[rtree_polygons_shared_ptr + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace bg = boost::geometry; +namespace bgi = boost::geometry::index; + +int main(void) +{ + typedef bg::model::point point; + typedef bg::model::box box; + typedef bg::model::polygon polygon; // ccw, open polygon + typedef boost::shared_ptr shp; + typedef std::pair value; + + // create the rtree using default constructor + bgi::rtree< value, bgi::linear<16, 4> > rtree; + + std::cout << "filling index with polygons shared pointers:" << std::endl; + + // create some polygons and fill the spatial index + for ( unsigned i = 0 ; i < 10 ; ++i ) + { + // create a polygon + shp p(new polygon()); + for ( float a = 0 ; a < 6.28316f ; a += 1.04720f ) + { + float x = i + int(10*::cos(a))*0.1f; + float y = i + int(10*::sin(a))*0.1f; + p->outer().push_back(point(x, y)); + } + + // display new polygon + std::cout << bg::wkt(*p) << std::endl; + + // calculate polygon bounding box + box b = bg::return_envelope(*p); + // insert new value + rtree.insert(std::make_pair(b, p)); + } + + // find values intersecting some area defined by a box + box query_box(point(0, 0), point(5, 5)); + std::vector result_s; + rtree.query(query_box, std::back_inserter(result_s)); + + // find 5 nearest values to a point + std::vector result_n; + rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n)); + + // display results + std::cout << "spatial query box:" << std::endl; + std::cout << bg::wkt(query_box) << std::endl; + std::cout << "spatial query result:" << std::endl; + BOOST_FOREACH(value const& v, result_s) + std::cout << bg::wkt(*v.second) << std::endl; + + std::cout << "knn query point:" << std::endl; + std::cout << bg::wkt(point(0, 0)) << std::endl; + std::cout << "knn query result:" << std::endl; + BOOST_FOREACH(value const& v, result_n) + std::cout << bg::wkt(*v.second) << std::endl; + + return 0; +} + +//] \ No newline at end of file diff --git a/doc/src/examples/rtree/polygons_vector.cpp b/doc/src/examples/rtree/polygons_vector.cpp new file mode 100644 index 000000000..3fa6cb51f --- /dev/null +++ b/doc/src/examples/rtree/polygons_vector.cpp @@ -0,0 +1,96 @@ +// Boost.Geometry Index +// +// Quickbook Examples +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +//[rtree_polygons_vector + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +namespace bg = boost::geometry; +namespace bgi = boost::geometry::index; + +int main(void) +{ + typedef bg::model::point point; + typedef bg::model::box box; + typedef bg::model::polygon polygon; // ccw, open polygon + typedef std::pair value; + + // polygons + std::vector polygons; + + // create some polygons + for ( unsigned i = 0 ; i < 10 ; ++i ) + { + // create a polygon + polygon p; + for ( float a = 0 ; a < 6.28316f ; a += 1.04720f ) + { + float x = i + int(10*::cos(a))*0.1f; + float y = i + int(10*::sin(a))*0.1f; + p.outer().push_back(point(x, y)); + } + + // add polygon + polygons.push_back(p); + } + + // display polygons + std::cout << "generated polygons:" << std::endl; + BOOST_FOREACH(polygon const& p, polygons) + std::cout << bg::wkt(p) << std::endl; + + // create the rtree using default constructor + bgi::rtree< value, bgi::rstar<16, 4> > rtree; + + // fill the spatial index + for ( size_t i = 0 ; i < polygons.size() ; ++i ) + { + // calculate polygon bounding box + box b = bg::return_envelope(polygons[i]); + // insert new value + rtree.insert(std::make_pair(b, i)); + } + + // find values intersecting some area defined by a box + box query_box(point(0, 0), point(5, 5)); + std::vector result_s; + rtree.query(query_box, std::back_inserter(result_s)); + + // find 5 nearest values to a point + std::vector result_n; + rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n)); + + // display results + std::cout << "spatial query box:" << std::endl; + std::cout << bg::wkt(query_box) << std::endl; + std::cout << "spatial query result:" << std::endl; + BOOST_FOREACH(value const& v, result_s) + std::cout << bg::wkt(polygons[v.second]) << std::endl; + + std::cout << "knn query point:" << std::endl; + std::cout << bg::wkt(point(0, 0)) << std::endl; + std::cout << "knn query result:" << std::endl; + BOOST_FOREACH(value const& v, result_n) + std::cout << bg::wkt(polygons[v.second]) << std::endl; + + return 0; +} + +//] \ No newline at end of file diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index d64d38a29..f25b2383c 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -2,7 +2,7 @@ // // Quickbook Examples // -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -13,7 +13,7 @@ //[rtree_quickstart_include #include -#include +#include #include #include @@ -39,7 +39,7 @@ int main(void) //[rtree_quickstart_create // create the rtree using default constructor - bgi::rtree< value, bgi::quadratic<32, 8> > rtree; + bgi::rtree< value, bgi::quadratic<16, 4> > rtree; //] //[rtree_quickstart_insert @@ -67,9 +67,15 @@ int main(void) //] //[rtree_quickstart_output + // display results + std::cout << "spatial query box:" << std::endl; + std::cout << bg::wkt(query_box) << std::endl; 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 point:" << std::endl; + std::cout << bg::wkt(point(0, 0)) << 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; diff --git a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp index 58aba4038..896286be0 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/insert.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/insert.hpp @@ -532,7 +532,7 @@ private: size_t m_relative_level; - Allocators m_allocators; + Allocators & m_allocators; }; }}} // namespace detail::rtree::visitors From 30d54874ae2bf665c05d85e9fc60625fdfdec604 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 24 Feb 2013 00:10:10 +0000 Subject: [PATCH 342/366] rtree: test generator newline added [SVN r83111] --- test/rtree/rtree_test_generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rtree/rtree_test_generator.cpp b/test/rtree/rtree_test_generator.cpp index f5e861277..fabc634f4 100644 --- a/test/rtree/rtree_test_generator.cpp +++ b/test/rtree/rtree_test_generator.cpp @@ -119,4 +119,4 @@ int main() "\n"; return 0; -} \ No newline at end of file +} From 67edc979a1439c3b9f162e79751d2f2c4e9d2122 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 24 Feb 2013 03:29:11 +0000 Subject: [PATCH 343/366] Added example: index of iterators of a map storing variant geometries, Interprocess example name changed. [SVN r83112] --- doc/html/geometry_index/r_tree.html | 5 +- .../geometry_index/r_tree/rtree_examples.html | 148 +++++++++++++++++- doc/html/index.html | 2 +- doc/imports.qbk | 1 + doc/rtree/examples.qbk | 6 +- doc/src/examples/rtree/Jamfile.v2 | 2 + doc/src/examples/rtree/variants_map.cpp | 143 +++++++++++++++++ 7 files changed, 302 insertions(+), 5 deletions(-) create mode 100644 doc/src/examples/rtree/variants_map.cpp diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index e4e8c3cec..54adadc83 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -72,7 +72,10 @@ of polygons stored in vector
    Index of shared pointers to polygons
    -
    Interprocess
    +
    Index + of iterators of a map storing variant geometries
    +
    Index + stored in shared memory using Boost.Interprocess
    Reference
    diff --git a/doc/html/geometry_index/r_tree/rtree_examples.html b/doc/html/geometry_index/r_tree/rtree_examples.html index 056fb38a4..1e565f1b6 100644 --- a/doc/html/geometry_index/r_tree/rtree_examples.html +++ b/doc/html/geometry_index/r_tree/rtree_examples.html @@ -33,7 +33,10 @@ of polygons stored in vector
    Index of shared pointers to polygons
    -
    Interprocess
    +
    Index + of iterators of a map storing variant geometries
    +
    Index + stored in shared memory using Boost.Interprocess

    @@ -284,7 +287,148 @@

    +

    +

    +
    #include <boost/geometry.hpp>
    +#include <boost/geometry/geometries/point.hpp>
    +#include <boost/geometry/geometries/box.hpp>
    +#include <boost/geometry/geometries/polygon.hpp>
    +#include <boost/geometry/geometries/ring.hpp>
    +#include <boost/geometry/geometries/linestring.hpp>
    +
    +#include <boost/geometry/index/rtree.hpp>
    +
    +#include <cmath>
    +#include <vector>
    +#include <map>
    +#include <iostream>
    +#include <boost/foreach.hpp>
    +#include <boost/variant.hpp>
    +
    +namespace bg = boost::geometry;
    +namespace bgi = boost::geometry::index;
    +
    +typedef bg::model::point<float, 2, bg::cs::cartesian> point;
    +typedef bg::model::box<point> box;
    +typedef bg::model::polygon<point, false, false> polygon; // ccw, open polygon
    +typedef bg::model::ring<point, false, false> ring; // ccw, open ring
    +typedef bg::model::linestring<point> linestring;
    +typedef boost::variant<polygon, ring, linestring> geometry;
    +
    +typedef std::map<unsigned, geometry> map;
    +typedef std::pair<box, map::iterator> value;
    +
    +template <class Container>
    +void fill(unsigned i, Container & container)
    +{
    +    for ( float a = 0 ; a < 6.28316f ; a += 1.04720f )
    +    {
    +        float x = i + int(10*::cos(a))*0.1f;
    +        float y = i + int(10*::sin(a))*0.1f;
    +        container.push_back(point(x, y));
    +    }
    +}
    +
    +struct print_visitor : public boost::static_visitor<>
    +{
    +    void operator()(polygon const& g) const { std::cout << bg::wkt<polygon>(g) << std::endl; }
    +    void operator()(ring const& g) const { std::cout << bg::wkt<ring>(g) << std::endl; }
    +    void operator()(linestring const& g) const { std::cout << bg::wkt<linestring>(g) << std::endl; }
    +};
    +
    +struct envelope_visitor : public boost::static_visitor<box>
    +{
    +    box operator()(polygon const& g) const { return bg::return_envelope<box>(g); }
    +    box operator()(ring const& g) const { return bg::return_envelope<box>(g); }
    +    box operator()(linestring const& g) const { return bg::return_envelope<box>(g); }
    +};
    +
    +
    +int main(void)
    +{
    +    // geometries container
    +    map geometries;
    +
    +    // create some geometries
    +    for ( unsigned i = 0 ; i < 10 ; ++i )
    +    {
    +        unsigned c = rand() % 3;
    +
    +        if ( 0 == c )
    +        {
    +            // create polygon
    +            polygon p;
    +            fill(i, p.outer());
    +            geometries.insert(std::make_pair(i, geometry(p)));
    +        }
    +        else if ( 1 == c )
    +        {
    +            // create ring
    +            ring r;
    +            fill(i, r);
    +            geometries.insert(std::make_pair(i, geometry(r)));
    +        }
    +        else if ( 2 == c )
    +        {
    +            // create linestring
    +            linestring l;
    +            fill(i, l);
    +            geometries.insert(std::make_pair(i, geometry(l)));
    +        }
    +    }
    +
    +    // display geometries
    +    std::cout << "generated geometries:" << std::endl;
    +    BOOST_FOREACH(map::value_type const& p, geometries)
    +        boost::apply_visitor(print_visitor(), p.second);
    +
    +    // create the rtree using default constructor
    +    bgi::rtree< value, bgi::quadratic<16, 4> > rtree;
    +
    +    // fill the spatial index
    +    for ( map::iterator it = geometries.begin() ; it != geometries.end() ; ++it )
    +    {
    +        // calculate polygon bounding box
    +        box b = boost::apply_visitor(envelope_visitor(), it->second);
    +        // insert new value
    +        rtree.insert(std::make_pair(b, it));
    +    }
    +
    +    // find values intersecting some area defined by a box
    +    box query_box(point(0, 0), point(5, 5));
    +    std::vector<value> result_s;
    +    rtree.query(query_box, std::back_inserter(result_s));
    +
    +    // find 5 nearest values to a point
    +    std::vector<value> result_n;
    +    rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
    +
    +    // display results
    +    std::cout << "spatial query box:" << std::endl;
    +    std::cout << bg::wkt<box>(query_box) << std::endl;
    +    std::cout << "spatial query result:" << std::endl;
    +    BOOST_FOREACH(value const& v, result_s)
    +        boost::apply_visitor(print_visitor(), v.second->second);
    +
    +    std::cout << "knn query point:" << std::endl;
    +    std::cout << bg::wkt<point>(point(0, 0)) << std::endl;
    +    std::cout << "knn query result:" << std::endl;
    +    BOOST_FOREACH(value const& v, result_n)
    +        boost::apply_visitor(print_visitor(), v.second->second);
    +
    +    return 0;
    +}
    +
    +

    +

    +
    +
    +

    diff --git a/doc/html/index.html b/doc/html/index.html index e1c19784f..dff9d3363 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
    - +

    Last revised: February 23, 2013 at 23:45:13 GMT

    Last revised: February 24, 2013 at 03:27:27 GMT


    diff --git a/doc/imports.qbk b/doc/imports.qbk index 68c57c29a..5e384dba0 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -11,4 +11,5 @@ [import src/examples/rtree/quick_start.cpp] [import src/examples/rtree/polygons_vector.cpp] [import src/examples/rtree/polygons_shared_ptr.cpp] +[import src/examples/rtree/variants_map.cpp] [import src/examples/rtree/interprocess.cpp] diff --git a/doc/rtree/examples.qbk b/doc/rtree/examples.qbk index 917de425a..f796da212 100644 --- a/doc/rtree/examples.qbk +++ b/doc/rtree/examples.qbk @@ -22,7 +22,11 @@ [rtree_polygons_shared_ptr] [endsect] -[section Interprocess] +[section Index of iterators of a map storing variant geometries] +[rtree_variants_map] +[endsect] + +[section Index stored in shared memory using Boost.Interprocess] [rtree_interprocess] [endsect] diff --git a/doc/src/examples/rtree/Jamfile.v2 b/doc/src/examples/rtree/Jamfile.v2 index dcf90b575..528972cdb 100644 --- a/doc/src/examples/rtree/Jamfile.v2 +++ b/doc/src/examples/rtree/Jamfile.v2 @@ -12,6 +12,8 @@ exe polygons_vector : polygons_vector.cpp ; exe polygons_shared_ptr : polygons_shared_ptr.cpp ; +exe variants_map : variants_map.cpp + ; exe interprocess : interprocess.cpp /boost/thread//boost_thread : diff --git a/doc/src/examples/rtree/variants_map.cpp b/doc/src/examples/rtree/variants_map.cpp new file mode 100644 index 000000000..38fd9aafc --- /dev/null +++ b/doc/src/examples/rtree/variants_map.cpp @@ -0,0 +1,143 @@ +// Boost.Geometry Index +// +// Quickbook Examples +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +//[rtree_variants_map + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace bg = boost::geometry; +namespace bgi = boost::geometry::index; + +typedef bg::model::point point; +typedef bg::model::box box; +typedef bg::model::polygon polygon; // ccw, open polygon +typedef bg::model::ring ring; // ccw, open ring +typedef bg::model::linestring linestring; +typedef boost::variant geometry; + +typedef std::map map; +typedef std::pair value; + +template +void fill(unsigned i, Container & container) +{ + for ( float a = 0 ; a < 6.28316f ; a += 1.04720f ) + { + float x = i + int(10*::cos(a))*0.1f; + float y = i + int(10*::sin(a))*0.1f; + container.push_back(point(x, y)); + } +} + +struct print_visitor : public boost::static_visitor<> +{ + void operator()(polygon const& g) const { std::cout << bg::wkt(g) << std::endl; } + void operator()(ring const& g) const { std::cout << bg::wkt(g) << std::endl; } + void operator()(linestring const& g) const { std::cout << bg::wkt(g) << std::endl; } +}; + +struct envelope_visitor : public boost::static_visitor +{ + box operator()(polygon const& g) const { return bg::return_envelope(g); } + box operator()(ring const& g) const { return bg::return_envelope(g); } + box operator()(linestring const& g) const { return bg::return_envelope(g); } +}; + + +int main(void) +{ + // geometries container + map geometries; + + // create some geometries + for ( unsigned i = 0 ; i < 10 ; ++i ) + { + unsigned c = rand() % 3; + + if ( 0 == c ) + { + // create polygon + polygon p; + fill(i, p.outer()); + geometries.insert(std::make_pair(i, geometry(p))); + } + else if ( 1 == c ) + { + // create ring + ring r; + fill(i, r); + geometries.insert(std::make_pair(i, geometry(r))); + } + else if ( 2 == c ) + { + // create linestring + linestring l; + fill(i, l); + geometries.insert(std::make_pair(i, geometry(l))); + } + } + + // display geometries + std::cout << "generated geometries:" << std::endl; + BOOST_FOREACH(map::value_type const& p, geometries) + boost::apply_visitor(print_visitor(), p.second); + + // create the rtree using default constructor + bgi::rtree< value, bgi::quadratic<16, 4> > rtree; + + // fill the spatial index + for ( map::iterator it = geometries.begin() ; it != geometries.end() ; ++it ) + { + // calculate polygon bounding box + box b = boost::apply_visitor(envelope_visitor(), it->second); + // insert new value + rtree.insert(std::make_pair(b, it)); + } + + // find values intersecting some area defined by a box + box query_box(point(0, 0), point(5, 5)); + std::vector result_s; + rtree.query(query_box, std::back_inserter(result_s)); + + // find 5 nearest values to a point + std::vector result_n; + rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n)); + + // display results + std::cout << "spatial query box:" << std::endl; + std::cout << bg::wkt(query_box) << std::endl; + std::cout << "spatial query result:" << std::endl; + BOOST_FOREACH(value const& v, result_s) + boost::apply_visitor(print_visitor(), v.second->second); + + std::cout << "knn query point:" << std::endl; + std::cout << bg::wkt(point(0, 0)) << std::endl; + std::cout << "knn query result:" << std::endl; + BOOST_FOREACH(value const& v, result_n) + boost::apply_visitor(print_visitor(), v.second->second); + + return 0; +} + +//] \ No newline at end of file From 12bb15d27ed809f96f4888291ef8dc77f5a9f714 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 24 Feb 2013 16:42:39 +0000 Subject: [PATCH 344/366] Added translator examples. rtree: parameters passed in the constructor by const& instead of a copy. [SVN r83135] --- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 6 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 28 +- doc/html/geometry_index/r_tree/queries.html | 6 +- doc/html/geometry_index/r_tree/reference.html | 532 +++++++++--------- .../geometry_index/r_tree/rtree_examples.html | 190 ++++++- .../r_tree/rtree_quickstart.html | 4 +- doc/html/index.html | 4 +- doc/imports.qbk | 2 + doc/rtree/examples.qbk | 8 + doc/src/examples/rtree/Jamfile.v2 | 14 +- doc/src/examples/rtree/translator_index.cpp | 98 ++++ .../examples/rtree/translator_shared_ptr.cpp | 92 +++ .../detail/rtree/node/node_d_mem_dynamic.hpp | 2 +- include/boost/geometry/index/rtree.hpp | 8 +- include/boost/geometry/index/translator.hpp | 8 +- 17 files changed, 705 insertions(+), 309 deletions(-) create mode 100644 doc/src/examples/rtree/translator_index.cpp create mode 100644 doc/src/examples/rtree/translator_shared_ptr.cpp diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index c00e43835..dd5718dbb 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 54adadc83..c34629cbf 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -74,6 +74,10 @@ of shared pointers to polygons
    Index of iterators of a map storing variant geometries
    +
    Specializing + Translator - storing shared pointers in the rtree
    +
    Using + Translator object - storing indexes of external container's elements
    Index stored in shared memory using Boost.Interprocess
    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 096b84562..7af45c47f 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 - + @@ -55,7 +55,7 @@

    rtree<Value, Parameters, Translator = index::translator<Value>, Allocator> = std::allocator<Value> >
     
    -
      +
      • Value - type of object which will be stored in the container,
      • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator<Value> are defined as follows:

        -
          +
          • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

            -
              +
              • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                If comparison of two Values is required, the default translator:

                -
                  +
                  • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 74f9022ec..8dc523bbc 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

              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 + 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 [2]. + close to some point in space [2].

              The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

              The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -181,13 +181,13 @@

            - Implementation + Implementation details

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

            -
              +
              • capable to store arbitrary Value type,
              • @@ -211,7 +211,7 @@
              - Dependencies + Dependencies

              R-tree depends on Boost.Move, Boost.Container, Boost.Tuple, @@ -219,7 +219,7 @@

              - Contributors + Contributors

              The spatial index was originally started by Federico J. Fernandez during @@ -227,7 +227,7 @@

              - Spatial + Spatial thanks

              @@ -235,20 +235,20 @@ J. Simonson for their support and ideas.

              -

              -

              [1] +


              +

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

              -

              [2] +

              [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

              -

              [3] +

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

              -

              [4] +

              [4] 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/queries.html b/doc/html/geometry_index/r_tree/queries.html index e32d7352f..7a2a90633 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -44,7 +44,7 @@ Queries returns Values which meets some predicates. Currently supported are three types of predicates:

              -
                +
                • spatial predicates - defining relationship between stored Values and some Geometry, @@ -60,7 +60,7 @@

                  For example queries may be used to retrieve Values:

                  -
                    +
                    • intersecting some area but not within other area,
                    • diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 2f080695e..05b14d11f 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -50,7 +50,7 @@

                      - Description + Description

                      This is self-balancing spatial index capable to store various types of @@ -58,7 +58,7 @@

                      - Parameters + Parameters

                      The user must pass a type defining the Parameters which will be used in @@ -68,7 +68,7 @@

                      Predefined algorithms with compile-time parameters are:

                      -
                        +
                        • boost::geometry::index::linear,
                        • @@ -82,7 +82,7 @@

                          Predefined algorithms with run-time parameters are:

                          -
                            +
                            - Translator + Translator

                            The Translator translates from Value to Indexable each time r-tree requires @@ -112,14 +112,14 @@

                            - Header + Header

                            #include <boost/geometry/index/rtree.hpp>

                            - Synopsis + Synopsis
                            template<typename Value,
                                      typename Parameters,
                            @@ -132,7 +132,7 @@
                             
                            - Template + Template parameter(s)
                            @@ -206,7 +206,7 @@
                            - Typedef(s) + Typedef(s)
                            @@ -314,7 +314,7 @@
                            - Constructor(s) + Constructor(s) and destructor
                            @@ -456,7 +456,7 @@
                            - Member(s) + Member(s)
                            @@ -779,13 +779,13 @@

                            - Synopsis + Synopsis
                            rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                             
                            - Modifier(s) + Modifier(s)

                            @@ -794,7 +794,7 @@

                            - Parameter(s) + Parameter(s)
                            @@ -859,7 +859,7 @@
                            - Throws + Throws

                            If allocator default constructor throws. @@ -875,7 +875,7 @@

                            - Synopsis + Synopsis
                            rtree(parameters_type parameters,
                                   translator_type const & translator,
                            @@ -883,7 +883,7 @@
                             
                            - Parameter(s) + Parameter(s)
                            @@ -965,7 +965,7 @@
                            - Throws + Throws

                            If allocator copy constructor throws. @@ -981,7 +981,7 @@

                            - Synopsis + Synopsis
                            template<typename Iterator>
                             rtree(Iterator first,
                            @@ -992,7 +992,7 @@
                             
                            - Parameter(s) + Parameter(s)
                            @@ -1108,9 +1108,9 @@
                            - Throws + Throws
                            -
                              +
                              • If allocator copy constructor throws.
                              • @@ -1135,7 +1135,7 @@

                                - Synopsis + Synopsis
                                template<typename Range>
                                 rtree(Range const & rng,
                                @@ -1145,7 +1145,7 @@
                                 
                                - Modifier(s) + Modifier(s)

                                @@ -1154,7 +1154,7 @@

                                - Parameter(s) + Parameter(s)
                                @@ -1254,9 +1254,9 @@
                                - Throws + Throws
                                -
                                  +
                                  • If allocator copy constructor throws.
                                  • @@ -1280,13 +1280,13 @@

                                    - Synopsis + Synopsis
                                    ~rtree()
                                     
                                    - Throws + Throws

                                    Nothing. @@ -1302,20 +1302,20 @@

                                    - Description + Description

                                    It uses parameters, translator and allocator from the source tree.

                                    - Synopsis + Synopsis
                                    rtree(rtree const & src)
                                     
                                    - Parameter(s) + Parameter(s)
                                    @@ -1361,9 +1361,9 @@
                                    - Throws + Throws
                                    -
                                      +
                                      • If allocator copy constructor throws.
                                      • @@ -1388,20 +1388,20 @@

                                        - Description + Description

                                        It uses Parameters and translator from the source tree.

                                        - Synopsis + Synopsis
                                        rtree(rtree const & src, allocator_type const & allocator)
                                         
                                        - Parameter(s) + Parameter(s)
                                        @@ -1467,9 +1467,9 @@
                                        - Throws + Throws
                                        -
                                          +
                                          • If allocator copy constructor throws.
                                          • @@ -1494,20 +1494,20 @@

                                            - Description + Description

                                            It uses parameters, translator and allocator from the source tree.

                                            - Synopsis + Synopsis
                                            rtree(rtree && src)
                                             
                                            - Parameter(s) + Parameter(s)
                                            @@ -1553,7 +1553,7 @@
                                            - Throws + Throws

                                            Nothing. @@ -1569,20 +1569,20 @@

                                            - Description + Description

                                            It uses parameters and translator from the source tree.

                                            - Synopsis + Synopsis
                                            rtree(rtree && src, allocator_type const & allocator)
                                             
                                            - Parameter(s) + Parameter(s)
                                            @@ -1648,9 +1648,9 @@
                                            - Throws + Throws
                                            -
                                              +
                                              • If allocator copy constructor throws.
                                              • @@ -1676,20 +1676,20 @@

                                                - Description + Description

                                                It uses parameters and translator from the source tree.

                                                - Synopsis + Synopsis
                                                rtree & operator=(const rtree & src)
                                                 
                                                - Parameter(s) + Parameter(s)
                                                @@ -1735,9 +1735,9 @@
                                                - Throws + Throws
                                                -
                                                  +
                                                  • If Value copy constructor throws.
                                                  • @@ -1759,20 +1759,20 @@

                                                    - Description + Description

                                                    It uses parameters and translator from the source tree.

                                                    - Synopsis + Synopsis
                                                    rtree & operator=(rtree && src)
                                                     
                                                    - Parameter(s) + Parameter(s)
                                                    @@ -1818,12 +1818,12 @@
                                                    - Throws + Throws

                                                    Only if allocators aren't equal.

                                                    -
                                                      +
                                                      • If Value copy constructor throws.
                                                      • @@ -1845,20 +1845,20 @@

                                                        - Description + Description

                                                        Parameters, translator and allocators are swapped as well.

                                                        - Synopsis + Synopsis
                                                        void swap(rtree & other)
                                                         
                                                        - Parameter(s) + Parameter(s)
                                                        @@ -1904,7 +1904,7 @@
                                                        - Throws + Throws

                                                        If allocators swap throws. @@ -1920,13 +1920,13 @@

                                                        - Synopsis + Synopsis
                                                        void insert(value_type const & value)
                                                         
                                                        - Parameter(s) + Parameter(s)
                                                        @@ -1972,9 +1972,9 @@
                                                        - Throws + Throws
                                                        -
                                                          +
                                                          • If Value copy constructor or copy assignment throws.
                                                          • @@ -2007,14 +2007,14 @@

                                                            - Synopsis + Synopsis
                                                            template<typename Iterator>
                                                             void insert(Iterator first, Iterator last)
                                                             
                                                            - Parameter(s) + Parameter(s)
                                                            @@ -2078,9 +2078,9 @@
                                                            - Throws + Throws
                                                            -
                                                              +
                                                              • If Value copy constructor or copy assignment throws.
                                                              • @@ -2113,14 +2113,14 @@

                                                                - Synopsis + Synopsis
                                                                template<typename Range>
                                                                 void insert(Range const & rng)
                                                                 
                                                                - Parameter(s) + Parameter(s)
                                                                @@ -2166,9 +2166,9 @@
                                                                - Throws + Throws
                                                                -
                                                                  +
                                                                  • If Value copy constructor or copy assignment throws.
                                                                  • @@ -2201,7 +2201,7 @@

                                                                    - Description + Description

                                                                    In contrast to the std::set @@ -2210,13 +2210,13 @@

                                                                    - Synopsis + Synopsis
                                                                    size_type remove(value_type const & value)
                                                                     
                                                                    - Parameter(s) + Parameter(s)
                                                                    @@ -2262,16 +2262,16 @@
                                                                    - Returns + Returns

                                                                    1 if the value was removed, 0 otherwise.

                                                                    - Throws + Throws
                                                                    -
                                                                      +
                                                                      • If Value copy constructor or copy assignment throws.
                                                                      • @@ -2304,7 +2304,7 @@

                                                                        - Description + Description

                                                                        In contrast to the std::set @@ -2315,14 +2315,14 @@

                                                                        - Synopsis + Synopsis
                                                                        template<typename Iterator>
                                                                         size_type remove(Iterator first, Iterator last)
                                                                         
                                                                        - Parameter(s) + Parameter(s)
                                                                        @@ -2386,16 +2386,16 @@
                                                                        - Returns + Returns

                                                                        The number of removed values.

                                                                        - Throws + Throws
                                                                        -
                                                                          +
                                                                          • If Value copy constructor or copy assignment throws.
                                                                          • @@ -2428,7 +2428,7 @@

                                                                            - Description + Description

                                                                            In contrast to the std::set @@ -2438,14 +2438,14 @@

                                                                            - Synopsis + Synopsis
                                                                            template<typename Range>
                                                                             size_type remove(Range const & rng)
                                                                             
                                                                            - Parameter(s) + Parameter(s)
                                                                            @@ -2491,16 +2491,16 @@
                                                                            - Returns + Returns

                                                                            The number of removed values.

                                                                            - Throws + Throws
                                                                            -
                                                                              +
                                                                              • If Value copy constructor or copy assignment throws.
                                                                              • @@ -2534,7 +2534,7 @@

                                                                                - Description + Description

                                                                                This query function performs spatial and k-nearest neighbor searches. @@ -2550,7 +2550,7 @@ are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                                -
                                                                                  +
                                                                                  • boost::geometry::index::covered_by(),
                                                                                  • @@ -2571,7 +2571,7 @@

                                                                                    It is possible to negate spatial predicates:

                                                                                    -
                                                                                      +
                                                                                      - Functions + Functions
                                                                                      @@ -3291,7 +3291,7 @@

                                                                                      - Description + Description

                                                                                      It calls rtree::insert(value_type @@ -3299,7 +3299,7 @@

                                                                                      - Synopsis + Synopsis
                                                                                      template<typename Value,
                                                                                                typename Options,
                                                                                      @@ -3309,7 +3309,7 @@
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -3388,7 +3388,7 @@

                                                                                      - Description + Description

                                                                                      It calls rtree::insert(Iterator, @@ -3396,7 +3396,7 @@

                                                                                      - Synopsis + Synopsis
                                                                                      template<typename Value,
                                                                                                typename Options,
                                                                                      @@ -3409,7 +3409,7 @@
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -3504,7 +3504,7 @@

                                                                                      - Description + Description

                                                                                      It calls rtree::insert(Range @@ -3512,7 +3512,7 @@

                                                                                      - Synopsis + Synopsis
                                                                                      template<typename Value,
                                                                                                typename Options,
                                                                                      @@ -3523,7 +3523,7 @@
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -3602,7 +3602,7 @@

                                                                                      - Description + Description

                                                                                      Remove a value from the container. In contrast to the std::set or std::map erase() method this function removes @@ -3614,7 +3614,7 @@

                                                                                      - Synopsis + Synopsis
                                                                                      template<typename Value,
                                                                                                typename Options,
                                                                                      @@ -3624,7 +3624,7 @@
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -3694,7 +3694,7 @@
                                                                                      - Returns + Returns

                                                                                      1 if value was removed, 0 otherwise. @@ -3710,7 +3710,7 @@

                                                                                      - Description + Description

                                                                                      Remove a range of values from the container. In contrast to the std::set or std::map erase() method it doesn't take iterators @@ -3724,7 +3724,7 @@

                                                                                      - Synopsis + Synopsis
                                                                                      template<typename Value,
                                                                                                typename Options,
                                                                                      @@ -3737,7 +3737,7 @@
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -3823,7 +3823,7 @@
                                                                                      - Returns + Returns

                                                                                      The number of removed values. @@ -3839,7 +3839,7 @@

                                                                                      - Description + Description

                                                                                      Remove a range of values from the container. In contrast to the std::set or std::map erase() method it removes values @@ -3852,7 +3852,7 @@

                                                                                      - Synopsis + Synopsis
                                                                                      template<typename Value,
                                                                                                typename Options,
                                                                                      @@ -3863,7 +3863,7 @@
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -3933,7 +3933,7 @@
                                                                                      - Returns + Returns

                                                                                      The number of removed values. @@ -3950,7 +3950,7 @@

                                                                                      - Description + Description

                                                                                      This query function performs spatial and k-nearest neighbor searches. @@ -3966,7 +3966,7 @@ are returned. More spatial predicates may be generated by one of the functions listed below:

                                                                                      -
                                                                                        +
                                                                                        +

                                                                                        +

                                                                                        +
                                                                                        #include <boost/geometry.hpp>
                                                                                        +#include <boost/geometry/geometries/point.hpp>
                                                                                        +#include <boost/geometry/geometries/box.hpp>
                                                                                        +
                                                                                        +#include <boost/geometry/index/rtree.hpp>
                                                                                        +
                                                                                        +#include <cmath>
                                                                                        +#include <vector>
                                                                                        +#include <iostream>
                                                                                        +#include <boost/foreach.hpp>
                                                                                        +#include <boost/shared_ptr.hpp>
                                                                                        +
                                                                                        +namespace bg = boost::geometry;
                                                                                        +namespace bgi = boost::geometry::index;
                                                                                        +
                                                                                        +namespace boost { namespace geometry { namespace index {
                                                                                        +
                                                                                        +template <typename Box>
                                                                                        +struct translator< boost::shared_ptr<Box> >
                                                                                        +{
                                                                                        +    typedef boost::shared_ptr<Box> V;
                                                                                        +
                                                                                        +    typedef Box const& result_type;
                                                                                        +    result_type operator()(V const& v) const { return *v; }
                                                                                        +    bool equals(V const& v1, V const& v2) const { return v1 == v2; }
                                                                                        +};
                                                                                        +
                                                                                        +}}} // namespace boost::geometry::index
                                                                                        +
                                                                                        +int main(void)
                                                                                        +{
                                                                                        +    typedef bg::model::point<float, 2, bg::cs::cartesian> point;
                                                                                        +    typedef bg::model::box<point> box;
                                                                                        +    typedef boost::shared_ptr<box> shp;
                                                                                        +    typedef shp value;
                                                                                        +
                                                                                        +    // create the rtree using default constructor
                                                                                        +    bgi::rtree< value, bgi::linear<16, 4> > rtree;
                                                                                        +
                                                                                        +    std::cout << "filling index with boxes shared pointers:" << std::endl;
                                                                                        +
                                                                                        +    // create some polygons and fill the spatial index
                                                                                        +    for ( unsigned i = 0 ; i < 10 ; ++i )
                                                                                        +    {
                                                                                        +        // create a box
                                                                                        +        shp b(new box(point(i, i), point(i+0.5f, i+0.5f)));
                                                                                        +
                                                                                        +        // display new box
                                                                                        +        std::cout << bg::wkt<box>(*b) << std::endl;
                                                                                        +
                                                                                        +        // insert new value
                                                                                        +        rtree.insert(b);
                                                                                        +    }
                                                                                        +
                                                                                        +    // find values intersecting some area defined by a box
                                                                                        +    box query_box(point(0, 0), point(5, 5));
                                                                                        +    std::vector<value> result_s;
                                                                                        +    rtree.query(query_box, std::back_inserter(result_s));
                                                                                        +
                                                                                        +    // find 5 nearest values to a point
                                                                                        +    std::vector<value> result_n;
                                                                                        +    rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
                                                                                        +
                                                                                        +    // display results
                                                                                        +    std::cout << "spatial query box:" << std::endl;
                                                                                        +    std::cout << bg::wkt<box>(query_box) << std::endl;
                                                                                        +    std::cout << "spatial query result:" << std::endl;
                                                                                        +    BOOST_FOREACH(value const& v, result_s)
                                                                                        +        std::cout << bg::wkt<box>(*v) << std::endl;
                                                                                        +
                                                                                        +    std::cout << "knn query point:" << std::endl;
                                                                                        +    std::cout << bg::wkt<point>(point(0, 0)) << std::endl;
                                                                                        +    std::cout << "knn query result:" << std::endl;
                                                                                        +    BOOST_FOREACH(value const& v, result_n)
                                                                                        +        std::cout << bg::wkt<box>(*v) << std::endl;
                                                                                        +
                                                                                        +    return 0;
                                                                                        +}
                                                                                        +
                                                                                        +

                                                                                        +

                                                                                        +
                                                                                        +
                                                                                        + +

                                                                                        +

                                                                                        +
                                                                                        #include <boost/geometry.hpp>
                                                                                        +#include <boost/geometry/geometries/point.hpp>
                                                                                        +#include <boost/geometry/geometries/box.hpp>
                                                                                        +
                                                                                        +#include <boost/geometry/index/rtree.hpp>
                                                                                        +
                                                                                        +#include <cmath>
                                                                                        +#include <vector>
                                                                                        +#include <iostream>
                                                                                        +#include <boost/foreach.hpp>
                                                                                        +
                                                                                        +namespace bg = boost::geometry;
                                                                                        +namespace bgi = boost::geometry::index;
                                                                                        +
                                                                                        +template <typename Container>
                                                                                        +class index_translator
                                                                                        +{
                                                                                        +    typedef typename Container::size_type size_t;
                                                                                        +    typedef typename Container::const_reference cref;
                                                                                        +    Container const& container;
                                                                                        +
                                                                                        +public:
                                                                                        +    typedef cref result_type;
                                                                                        +    explicit index_translator(Container const& c) : container(c) {}
                                                                                        +    result_type operator()(size_t i) const { return container[i]; }
                                                                                        +    bool equals(size_t i1, size_t i2) const { return i1 == i2; }
                                                                                        +};
                                                                                        +
                                                                                        +int main(void)
                                                                                        +{
                                                                                        +    typedef bg::model::point<float, 2, bg::cs::cartesian> point;
                                                                                        +    typedef bg::model::box<point> box;
                                                                                        +    typedef std::vector<box>::size_type value;
                                                                                        +    typedef bgi::rstar<16, 4> parameters;
                                                                                        +    typedef index_translator< std::vector<box> > translator;
                                                                                        +
                                                                                        +    // boxes
                                                                                        +    std::vector<box> boxes;
                                                                                        +
                                                                                        +    // create some boxes
                                                                                        +    for ( unsigned i = 0 ; i < 10 ; ++i )
                                                                                        +    {
                                                                                        +        // add a box
                                                                                        +        boxes.push_back(box(point(i, i), point(i+0.5f, i+0.5f)));
                                                                                        +    }
                                                                                        +
                                                                                        +    // display boxes
                                                                                        +    std::cout << "generated boxes:" << std::endl;
                                                                                        +    BOOST_FOREACH(box const& b, boxes)
                                                                                        +        std::cout << bg::wkt<box>(b) << std::endl;
                                                                                        +
                                                                                        +    // create the rtree
                                                                                        +    parameters params;
                                                                                        +    translator tr(boxes);
                                                                                        +    bgi::rtree<value, parameters, translator> rtree(params, tr);
                                                                                        +
                                                                                        +    // fill the spatial index
                                                                                        +    for ( size_t i = 0 ; i < boxes.size() ; ++i )
                                                                                        +        rtree.insert(i);
                                                                                        +
                                                                                        +    // find values intersecting some area defined by a box
                                                                                        +    box query_box(point(0, 0), point(5, 5));
                                                                                        +    std::vector<value> result_s;
                                                                                        +    rtree.query(query_box, std::back_inserter(result_s));
                                                                                        +
                                                                                        +    // find 5 nearest values to a point
                                                                                        +    std::vector<value> result_n;
                                                                                        +    rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
                                                                                        +
                                                                                        +    // display results
                                                                                        +    std::cout << "spatial query box:" << std::endl;
                                                                                        +    std::cout << bg::wkt<box>(query_box) << std::endl;
                                                                                        +    std::cout << "spatial query result:" << std::endl;
                                                                                        +    BOOST_FOREACH(value i, result_s)
                                                                                        +        std::cout << bg::wkt<box>(boxes[i]) << std::endl;
                                                                                        +
                                                                                        +    std::cout << "knn query point:" << std::endl;
                                                                                        +    std::cout << bg::wkt<point>(point(0, 0)) << std::endl;
                                                                                        +    std::cout << "knn query result:" << std::endl;
                                                                                        +    BOOST_FOREACH(value i, result_n)
                                                                                        +        std::cout << bg::wkt<box>(boxes[i]) << std::endl;
                                                                                        +
                                                                                        +    return 0;
                                                                                        +}
                                                                                        +
                                                                                        +

                                                                                        +

                                                                                        +
                                                                                        +
                                                                                        + diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 84f002c80..22a62ca05 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 - + @@ -156,7 +156,7 @@

                                                                                        - More + More

                                                                                        More information about the R-tree implementation, other algorithms and queries diff --git a/doc/html/index.html b/doc/html/index.html index dff9d3363..42d405d7b 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -51,7 +51,7 @@

                                                                                      - +

                                                                                      Last revised: February 24, 2013 at 03:27:27 GMT

                                                                                      Last revised: February 24, 2013 at 16:39:24 GMT


                                                                                      diff --git a/doc/imports.qbk b/doc/imports.qbk index 5e384dba0..8072b3859 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -12,4 +12,6 @@ [import src/examples/rtree/polygons_vector.cpp] [import src/examples/rtree/polygons_shared_ptr.cpp] [import src/examples/rtree/variants_map.cpp] +[import src/examples/rtree/translator_shared_ptr.cpp] +[import src/examples/rtree/translator_index.cpp] [import src/examples/rtree/interprocess.cpp] diff --git a/doc/rtree/examples.qbk b/doc/rtree/examples.qbk index f796da212..a8ce7ac94 100644 --- a/doc/rtree/examples.qbk +++ b/doc/rtree/examples.qbk @@ -26,6 +26,14 @@ [rtree_variants_map] [endsect] +[section Specializing Translator - storing shared pointers in the rtree] +[rtree_translator_shared_ptr] +[endsect] + +[section Using Translator object - storing indexes of external container's elements] +[rtree_translator_index] +[endsect] + [section Index stored in shared memory using Boost.Interprocess] [rtree_interprocess] [endsect] diff --git a/doc/src/examples/rtree/Jamfile.v2 b/doc/src/examples/rtree/Jamfile.v2 index 528972cdb..381fc1e52 100644 --- a/doc/src/examples/rtree/Jamfile.v2 +++ b/doc/src/examples/rtree/Jamfile.v2 @@ -6,14 +6,12 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -exe quick_start : quick_start.cpp - ; -exe polygons_vector : polygons_vector.cpp - ; -exe polygons_shared_ptr : polygons_shared_ptr.cpp - ; -exe variants_map : variants_map.cpp - ; +exe quick_start : quick_start.cpp ; +exe polygons_vector : polygons_vector.cpp ; +exe polygons_shared_ptr : polygons_shared_ptr.cpp ; +exe variants_map : variants_map.cpp ; +exe translator_shared_ptr : translator_shared_ptr.cpp ; +exe translator_index : translator_index.cpp ; exe interprocess : interprocess.cpp /boost/thread//boost_thread : diff --git a/doc/src/examples/rtree/translator_index.cpp b/doc/src/examples/rtree/translator_index.cpp new file mode 100644 index 000000000..ea629f6c2 --- /dev/null +++ b/doc/src/examples/rtree/translator_index.cpp @@ -0,0 +1,98 @@ +// Boost.Geometry Index +// +// Quickbook Examples +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +//[rtree_translator_index + +#include +#include +#include + +#include + +#include +#include +#include +#include + +namespace bg = boost::geometry; +namespace bgi = boost::geometry::index; + +template +class index_translator +{ + typedef typename Container::size_type size_t; + typedef typename Container::const_reference cref; + Container const& container; + +public: + typedef cref result_type; + explicit index_translator(Container const& c) : container(c) {} + result_type operator()(size_t i) const { return container[i]; } + bool equals(size_t i1, size_t i2) const { return i1 == i2; } +}; + +int main(void) +{ + typedef bg::model::point point; + typedef bg::model::box box; + typedef std::vector::size_type value; + typedef bgi::rstar<16, 4> parameters; + typedef index_translator< std::vector > translator; + + // boxes + std::vector boxes; + + // create some boxes + for ( unsigned i = 0 ; i < 10 ; ++i ) + { + // add a box + boxes.push_back(box(point(i, i), point(i+0.5f, i+0.5f))); + } + + // display boxes + std::cout << "generated boxes:" << std::endl; + BOOST_FOREACH(box const& b, boxes) + std::cout << bg::wkt(b) << std::endl; + + // create the rtree + parameters params; + translator tr(boxes); + bgi::rtree rtree(params, tr); + + // fill the spatial index + for ( size_t i = 0 ; i < boxes.size() ; ++i ) + rtree.insert(i); + + // find values intersecting some area defined by a box + box query_box(point(0, 0), point(5, 5)); + std::vector result_s; + rtree.query(query_box, std::back_inserter(result_s)); + + // find 5 nearest values to a point + std::vector result_n; + rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n)); + + // display results + std::cout << "spatial query box:" << std::endl; + std::cout << bg::wkt(query_box) << std::endl; + std::cout << "spatial query result:" << std::endl; + BOOST_FOREACH(value i, result_s) + std::cout << bg::wkt(boxes[i]) << std::endl; + + std::cout << "knn query point:" << std::endl; + std::cout << bg::wkt(point(0, 0)) << std::endl; + std::cout << "knn query result:" << std::endl; + BOOST_FOREACH(value i, result_n) + std::cout << bg::wkt(boxes[i]) << std::endl; + + return 0; +} + +//] diff --git a/doc/src/examples/rtree/translator_shared_ptr.cpp b/doc/src/examples/rtree/translator_shared_ptr.cpp new file mode 100644 index 000000000..a1f43d1a4 --- /dev/null +++ b/doc/src/examples/rtree/translator_shared_ptr.cpp @@ -0,0 +1,92 @@ +// Boost.Geometry Index +// +// Quickbook Examples +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +//[rtree_translator_shared_ptr + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace bg = boost::geometry; +namespace bgi = boost::geometry::index; + +namespace boost { namespace geometry { namespace index { + +template +struct translator< boost::shared_ptr > +{ + typedef boost::shared_ptr V; + + typedef Box const& result_type; + result_type operator()(V const& v) const { return *v; } + bool equals(V const& v1, V const& v2) const { return v1 == v2; } +}; + +}}} // namespace boost::geometry::index + +int main(void) +{ + typedef bg::model::point point; + typedef bg::model::box box; + typedef boost::shared_ptr shp; + typedef shp value; + + // create the rtree using default constructor + bgi::rtree< value, bgi::linear<16, 4> > rtree; + + std::cout << "filling index with boxes shared pointers:" << std::endl; + + // create some polygons and fill the spatial index + for ( unsigned i = 0 ; i < 10 ; ++i ) + { + // create a box + shp b(new box(point(i, i), point(i+0.5f, i+0.5f))); + + // display new box + std::cout << bg::wkt(*b) << std::endl; + + // insert new value + rtree.insert(b); + } + + // find values intersecting some area defined by a box + box query_box(point(0, 0), point(5, 5)); + std::vector result_s; + rtree.query(query_box, std::back_inserter(result_s)); + + // find 5 nearest values to a point + std::vector result_n; + rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n)); + + // display results + std::cout << "spatial query box:" << std::endl; + std::cout << bg::wkt(query_box) << std::endl; + std::cout << "spatial query result:" << std::endl; + BOOST_FOREACH(value const& v, result_s) + std::cout << bg::wkt(*v) << std::endl; + + std::cout << "knn query point:" << std::endl; + std::cout << bg::wkt(point(0, 0)) << std::endl; + std::cout << "knn query result:" << std::endl; + BOOST_FOREACH(value const& v, result_n) + std::cout << bg::wkt(*v) << std::endl; + + return 0; +} + +//] diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 0c3e89a11..5a39b3e87 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -111,7 +111,7 @@ struct element_indexable_type< // element's indexable getter template -typename Translator::result_type +typename translator::result_type::type element_indexable(Element const& el, Translator const& tr) { return tr(el); diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 0338725a6..1eb4c7334 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -147,7 +147,7 @@ public: \par Throws If allocator default constructor throws. */ - inline explicit rtree(parameters_type parameters = parameters_type(), + inline explicit rtree(parameters_type const& parameters = parameters_type(), translator_type const& translator = translator_type()) : m_members(translator, parameters) {} @@ -162,7 +162,7 @@ public: \par Throws If allocator copy constructor throws. */ - inline rtree(parameters_type parameters, + inline rtree(parameters_type const& parameters, translator_type const& translator, allocator_type allocator) : m_members(translator, parameters, allocator) @@ -185,7 +185,7 @@ public: */ template inline rtree(Iterator first, Iterator last, - parameters_type parameters = parameters_type(), + parameters_type const& parameters = parameters_type(), translator_type const& translator = translator_type(), allocator_type allocator = allocator_type()) : m_members(translator, parameters, allocator) @@ -217,7 +217,7 @@ public: */ template inline explicit rtree(Range const& rng, - parameters_type parameters = parameters_type(), + parameters_type const& parameters = parameters_type(), translator_type const& translator = translator_type(), allocator_type allocator = allocator_type()) : m_members(translator, parameters, allocator) diff --git a/include/boost/geometry/index/translator.hpp b/include/boost/geometry/index/translator.hpp index d3ebc469e..39ab56bba 100644 --- a/include/boost/geometry/index/translator.hpp +++ b/include/boost/geometry/index/translator.hpp @@ -191,12 +191,18 @@ struct translator< boost::tuple > namespace detail { namespace translator { +template +struct result_type +{ + typedef typename Translator::result_type type; +}; + template struct indexable_type { typedef typename boost::remove_const< typename boost::remove_reference< - typename Translator::result_type + typename result_type::type >::type >::type type; }; From 2fc5f4464d5dc3eeea58eda59300f32325c496d6 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 24 Feb 2013 16:45:59 +0000 Subject: [PATCH 345/366] Fixed comment in the example [SVN r83136] --- doc/html/geometry_index/r_tree/rtree_examples.html | 2 +- doc/html/index.html | 2 +- doc/src/examples/rtree/translator_shared_ptr.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/html/geometry_index/r_tree/rtree_examples.html b/doc/html/geometry_index/r_tree/rtree_examples.html index e7e4a077e..03a8c2071 100644 --- a/doc/html/geometry_index/r_tree/rtree_examples.html +++ b/doc/html/geometry_index/r_tree/rtree_examples.html @@ -477,7 +477,7 @@ std::cout << "filling index with boxes shared pointers:" << std::endl; - // create some polygons and fill the spatial index + // fill the spatial index for ( unsigned i = 0 ; i < 10 ; ++i ) { // create a box diff --git a/doc/html/index.html b/doc/html/index.html index 42d405d7b..5e566e778 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
                                                                                  - +

                                                                                  Last revised: February 24, 2013 at 16:39:24 GMT

                                                                                  Last revised: February 24, 2013 at 16:45:22 GMT


                                                                                  diff --git a/doc/src/examples/rtree/translator_shared_ptr.cpp b/doc/src/examples/rtree/translator_shared_ptr.cpp index a1f43d1a4..b40e561b5 100644 --- a/doc/src/examples/rtree/translator_shared_ptr.cpp +++ b/doc/src/examples/rtree/translator_shared_ptr.cpp @@ -51,7 +51,7 @@ int main(void) std::cout << "filling index with boxes shared pointers:" << std::endl; - // create some polygons and fill the spatial index + // fill the spatial index for ( unsigned i = 0 ; i < 10 ; ++i ) { // create a box From 2a62a3ed21508e3c04c6e069cdf71b2e7ebd7eb0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 25 Feb 2013 20:47:19 +0000 Subject: [PATCH 346/366] rtree: added value predicate test. [SVN r83157] --- test/rtree/test_rtree.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 2b1062391..62877cb2d 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -837,6 +837,31 @@ void test_nearest_query_not_found(Rtree const& rtree, Point const& pt) BOOST_CHECK(n_res < 5); } +template +bool test_value_fun(Value const& v) { return true; } + +struct test_value_obj +{ + template + bool operator()(Value const& v) const { return true; } +}; + +template +void test_value_predicate(Rtree const& rtree, std::vector const& input) +{ + std::vector result; + rtree.query(bgi::value(test_value_obj()), std::back_inserter(result)); + BOOST_CHECK(result.size() == input.size()); + result.clear(); + rtree.query(bgi::value(test_value_fun), std::back_inserter(result)); + BOOST_CHECK(result.size() == input.size()); +#ifndef BOOST_NO_CXX11_LAMBDAS + result.clear(); + rtree.query(bgi::value([](Value const& v){ return true; }), std::back_inserter(result)); + BOOST_CHECK(result.size() == input.size()); +#endif +} + // rtree copying and moving template @@ -1136,6 +1161,8 @@ void test_rtree_by_value(Parameters const& parameters, Allocator const& allocato test_nearest_query_k(tree, input, pt, 10); test_nearest_query_not_found(tree, generate_outside_point

                                                                                  ::apply()); + test_value_predicate(tree, input); + test_copy_assignment_swap_move(tree, qbox); test_create_insert(tree, input, qbox); From e6216086672e76aacf8f3b3cabbfea81146a8679 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 27 Feb 2013 13:30:14 +0000 Subject: [PATCH 347/366] index::runtime::XXX parameters moved and renamed to index::dynamic_XXX [SVN r83188] --- doc/generated/rtree.qbk | 40 ++--- doc/generated/rtree_dynamic_linear.qbk | 45 +++++ doc/generated/rtree_dynamic_quadratic.qbk | 45 +++++ ...time_rstar.qbk => rtree_dynamic_rstar.qbk} | 24 +-- doc/generated/rtree_runtime_linear.qbk | 45 ----- doc/generated/rtree_runtime_quadratic.qbk | 45 ----- .../r_tree/creation_and_modification.html | 22 +-- doc/html/geometry_index/r_tree/reference.html | 163 +++++++++--------- doc/html/index.html | 2 +- doc/make_qbk.py | 6 +- doc/rtree/creation.qbk | 22 +-- doc/rtree/reference.qbk | 8 +- .../geometry/index/detail/rtree/options.hpp | 12 +- include/boost/geometry/index/parameters.hpp | 28 ++- include/boost/geometry/index/rtree.hpp | 6 +- test/rtree/exceptions/rtree_exceptions.cpp | 6 +- test/rtree/generated/Jamfile.v2 | 111 ++++++++++-- test/rtree/generated/rtree_b2d_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_b2d_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2d_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_b2d_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2d_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_b2d_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2f_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_b2f_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2f_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_b2f_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2f_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_b2f_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2i_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_b2i_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2i_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_b2i_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2i_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_b2i_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2tt_linear.cpp | 4 +- ...rstar_rt.cpp => rtree_b2tt_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2tt_quadratic.cpp | 4 +- ...ic_rt.cpp => rtree_b2tt_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b2tt_rstar.cpp | 4 +- ...linear_rt.cpp => rtree_b2tt_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3d_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_b3d_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3d_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_b3d_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3d_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_b3d_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3f_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_b3f_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3f_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_b3f_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3f_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_b3f_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3i_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_b3i_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3i_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_b3i_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3i_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_b3i_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3tt_linear.cpp | 4 +- ...rstar_rt.cpp => rtree_b3tt_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3tt_quadratic.cpp | 4 +- ...ic_rt.cpp => rtree_b3tt_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_b3tt_rstar.cpp | 4 +- ...linear_rt.cpp => rtree_b3tt_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2d_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_p2d_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2d_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_p2d_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2d_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_p2d_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2f_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_p2f_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2f_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_p2f_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2f_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_p2f_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2i_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_p2i_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2i_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_p2i_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2i_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_p2i_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2tt_linear.cpp | 4 +- ...rstar_rt.cpp => rtree_p2tt_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2tt_quadratic.cpp | 4 +- ...ic_rt.cpp => rtree_p2tt_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p2tt_rstar.cpp | 4 +- ...linear_rt.cpp => rtree_p2tt_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3d_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_p3d_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3d_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_p3d_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3d_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_p3d_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3f_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_p3f_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3f_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_p3f_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3f_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_p3f_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3i_linear.cpp | 4 +- ..._rstar_rt.cpp => rtree_p3i_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3i_quadratic.cpp | 4 +- ...tic_rt.cpp => rtree_p3i_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3i_rstar.cpp | 4 +- ..._linear_rt.cpp => rtree_p3i_rstar_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3tt_linear.cpp | 4 +- ...rstar_rt.cpp => rtree_p3tt_linear_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3tt_quadratic.cpp | 4 +- ...ic_rt.cpp => rtree_p3tt_quadratic_dyn.cpp} | 4 +- test/rtree/generated/rtree_p3tt_rstar.cpp | 4 +- ...linear_rt.cpp => rtree_p3tt_rstar_dyn.cpp} | 4 +- ... => rtree_interprocess_b2f_linear_dyn.cpp} | 2 +- ... rtree_interprocess_b2f_quadratic_dyn.cpp} | 2 +- ...p => rtree_interprocess_b2f_rstar_dyn.cpp} | 2 +- test/rtree/rtree_test_generator.cpp | 12 +- 117 files changed, 560 insertions(+), 472 deletions(-) create mode 100644 doc/generated/rtree_dynamic_linear.qbk create mode 100644 doc/generated/rtree_dynamic_quadratic.qbk rename doc/generated/{rtree_runtime_rstar.qbk => rtree_dynamic_rstar.qbk} (52%) delete mode 100644 doc/generated/rtree_runtime_linear.qbk delete mode 100644 doc/generated/rtree_runtime_quadratic.qbk rename test/rtree/generated/{rtree_b2d_rstar_rt.cpp => rtree_b2d_linear_dyn.cpp} (80%) rename test/rtree/generated/{rtree_b2d_quadratic_rt.cpp => rtree_b2d_quadratic_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b2d_linear_rt.cpp => rtree_b2d_rstar_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b2f_rstar_rt.cpp => rtree_b2f_linear_dyn.cpp} (80%) rename test/rtree/generated/{rtree_b2f_quadratic_rt.cpp => rtree_b2f_quadratic_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b2f_linear_rt.cpp => rtree_b2f_rstar_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b2i_rstar_rt.cpp => rtree_b2i_linear_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b2i_quadratic_rt.cpp => rtree_b2i_quadratic_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b2i_linear_rt.cpp => rtree_b2i_rstar_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b2tt_rstar_rt.cpp => rtree_b2tt_linear_dyn.cpp} (81%) rename test/rtree/generated/{rtree_b2tt_quadratic_rt.cpp => rtree_b2tt_quadratic_dyn.cpp} (80%) rename test/rtree/generated/{rtree_b2tt_linear_rt.cpp => rtree_b2tt_rstar_dyn.cpp} (80%) rename test/rtree/generated/{rtree_b3d_rstar_rt.cpp => rtree_b3d_linear_dyn.cpp} (80%) rename test/rtree/generated/{rtree_b3d_quadratic_rt.cpp => rtree_b3d_quadratic_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b3d_linear_rt.cpp => rtree_b3d_rstar_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b3f_rstar_rt.cpp => rtree_b3f_linear_dyn.cpp} (80%) rename test/rtree/generated/{rtree_b3f_quadratic_rt.cpp => rtree_b3f_quadratic_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b3f_linear_rt.cpp => rtree_b3f_rstar_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b3i_rstar_rt.cpp => rtree_b3i_linear_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b3i_quadratic_rt.cpp => rtree_b3i_quadratic_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b3i_linear_rt.cpp => rtree_b3i_rstar_dyn.cpp} (79%) rename test/rtree/generated/{rtree_b3tt_rstar_rt.cpp => rtree_b3tt_linear_dyn.cpp} (81%) rename test/rtree/generated/{rtree_b3tt_quadratic_rt.cpp => rtree_b3tt_quadratic_dyn.cpp} (80%) rename test/rtree/generated/{rtree_b3tt_linear_rt.cpp => rtree_b3tt_rstar_dyn.cpp} (80%) rename test/rtree/generated/{rtree_p2d_rstar_rt.cpp => rtree_p2d_linear_dyn.cpp} (78%) rename test/rtree/generated/{rtree_p2d_quadratic_rt.cpp => rtree_p2d_quadratic_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p2d_linear_rt.cpp => rtree_p2d_rstar_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p2f_rstar_rt.cpp => rtree_p2f_linear_dyn.cpp} (78%) rename test/rtree/generated/{rtree_p2f_quadratic_rt.cpp => rtree_p2f_quadratic_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p2f_linear_rt.cpp => rtree_p2f_rstar_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p2i_rstar_rt.cpp => rtree_p2i_linear_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p2i_quadratic_rt.cpp => rtree_p2i_quadratic_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p2i_linear_rt.cpp => rtree_p2i_rstar_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p2tt_rstar_rt.cpp => rtree_p2tt_linear_dyn.cpp} (79%) rename test/rtree/generated/{rtree_p2tt_quadratic_rt.cpp => rtree_p2tt_quadratic_dyn.cpp} (78%) rename test/rtree/generated/{rtree_p2tt_linear_rt.cpp => rtree_p2tt_rstar_dyn.cpp} (79%) rename test/rtree/generated/{rtree_p3d_rstar_rt.cpp => rtree_p3d_linear_dyn.cpp} (78%) rename test/rtree/generated/{rtree_p3d_quadratic_rt.cpp => rtree_p3d_quadratic_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p3d_linear_rt.cpp => rtree_p3d_rstar_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p3f_rstar_rt.cpp => rtree_p3f_linear_dyn.cpp} (78%) rename test/rtree/generated/{rtree_p3f_quadratic_rt.cpp => rtree_p3f_quadratic_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p3f_linear_rt.cpp => rtree_p3f_rstar_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p3i_rstar_rt.cpp => rtree_p3i_linear_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p3i_quadratic_rt.cpp => rtree_p3i_quadratic_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p3i_linear_rt.cpp => rtree_p3i_rstar_dyn.cpp} (77%) rename test/rtree/generated/{rtree_p3tt_rstar_rt.cpp => rtree_p3tt_linear_dyn.cpp} (79%) rename test/rtree/generated/{rtree_p3tt_quadratic_rt.cpp => rtree_p3tt_quadratic_dyn.cpp} (78%) rename test/rtree/generated/{rtree_p3tt_linear_rt.cpp => rtree_p3tt_rstar_dyn.cpp} (79%) rename test/rtree/interprocess/{rtree_interprocess_b2f_rstar_rt.cpp => rtree_interprocess_b2f_linear_dyn.cpp} (87%) rename test/rtree/interprocess/{rtree_interprocess_b2f_quadratic_rt.cpp => rtree_interprocess_b2f_quadratic_dyn.cpp} (87%) rename test/rtree/interprocess/{rtree_interprocess_b2f_linear_rt.cpp => rtree_interprocess_b2f_rstar_dyn.cpp} (87%) diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 392035a08..0194acf34 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -27,9 +27,9 @@ Predefined algorithms with compile-time parameters are: Predefined algorithms with run-time parameters are: -* [^[link classboost_1_1geometry_1_1index_1_1runtime_1_1linear boost::geometry::index::runtime::linear]], -* [^[link classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic boost::geometry::index::runtime::quadratic]], -* [^[link classboost_1_1geometry_1_1index_1_1runtime_1_1rstar boost::geometry::index::runtime::rstar]]. +* [^[link classboost_1_1geometry_1_1index_1_1dynamic__linear boost::geometry::index::dynamic_linear]], +* [^[link classboost_1_1geometry_1_1index_1_1dynamic__quadratic boost::geometry::index::dynamic_quadratic]], +* [^[link classboost_1_1geometry_1_1index_1_1dynamic__rstar boost::geometry::index::dynamic_rstar]]. @@ -75,10 +75,10 @@ The Translator translates from Value to Indexable each time r-tree requires it. [heading Constructor(s) and destructor] [table [[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b `rtree()`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a2cadbaa3a7157f7503eef3f2f6b889aa `rtree(parameters_type, translator_type const &, allocator_type)`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a64c67e0dec7ccce2dc52d918436c62e5 `rtree(Iterator, Iterator)`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a0d15842e8bb86a87f073ffabb7cabd21 `rtree(Range const &)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a393bb202f84b6fe5613df02d1ba2a092 `rtree()`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a434839ea5dd2e57f9491d18520621c4b `rtree(parameters_type const &, translator_type const &, allocator_type)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1ace0b58f496b7eb00c518b4fc2794f4bc `rtree(Iterator, Iterator)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a513f271626372c6dad5488f64db6d1d4 `rtree(Range const &)`]][The constructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1ae8b10914ec434d1ee6877f5e1000b674 `~rtree()`]][The destructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1a006904b4e7dcef1fd1efcb70a010964f `rtree(rtree const &)`]][The copy constructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1ac59521aa9a9b69104fa25c0f7b705354 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] @@ -109,21 +109,21 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] ] -[#classboost_1_1geometry_1_1index_1_1rtree_1afa64d1b825b06d196b1164aec27c2d7b] +[#classboost_1_1geometry_1_1index_1_1rtree_1a393bb202f84b6fe5613df02d1ba2a092] [section rtree()] The constructor. [heading Synopsis] [pre -`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` ] [heading Modifier(s)] ``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object.]] ] [heading Throws] @@ -131,14 +131,14 @@ If allocator default constructor throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a2cadbaa3a7157f7503eef3f2f6b889aa] -[section rtree(parameters_type, translator_type const &, allocator_type)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a434839ea5dd2e57f9491d18520621c4b] +[section rtree(parameters_type const &, translator_type const &, allocator_type)] The constructor. [heading Synopsis] [pre -`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters``,` +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator``)` ] @@ -146,7 +146,7 @@ The constructor. [heading Parameter(s)] [table [[Type][Name][Description]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] ] @@ -155,7 +155,7 @@ If allocator copy constructor throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a64c67e0dec7ccce2dc52d918436c62e5] +[#classboost_1_1geometry_1_1index_1_1rtree_1ace0b58f496b7eb00c518b4fc2794f4bc] [section rtree(Iterator, Iterator)] The constructor. @@ -164,7 +164,7 @@ The constructor. `template<``typename Iterator``>` `rtree``(``Iterator` `first``,` `Iterator` `last``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` ] @@ -174,7 +174,7 @@ The constructor. [[Type][Name][Description]] [[`Iterator`][ `first` ][The beginning of the range of Values. ]] [[`Iterator`][ `last` ][The end of the range of Values. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] ] @@ -190,7 +190,7 @@ The constructor. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a0d15842e8bb86a87f073ffabb7cabd21] +[#classboost_1_1geometry_1_1index_1_1rtree_1a513f271626372c6dad5488f64db6d1d4] [section rtree(Range const &)] The constructor. @@ -198,7 +198,7 @@ The constructor. [pre `template<``typename Range``>` `rtree``(``Range const &` `rng``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]] `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` ] @@ -208,7 +208,7 @@ The constructor. [table [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]][ `parameters` ][The parameters object. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] ] diff --git a/doc/generated/rtree_dynamic_linear.qbk b/doc/generated/rtree_dynamic_linear.qbk new file mode 100644 index 000000000..19e697a2a --- /dev/null +++ b/doc/generated/rtree_dynamic_linear.qbk @@ -0,0 +1,45 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1dynamic__linear.xml] +[#classboost_1_1geometry_1_1index_1_1dynamic__linear] +[section boost::geometry::index::dynamic_linear] + +Linear r-tree creation algorithm parameters - run-time version. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre + +`class dynamic_linear` +`{` +` // ...` +`};` +] + +[heading Constructor(s) and destructor] +[table +[[Function][Description]] +[[[link classboost_1_1geometry_1_1index_1_1dynamic__linear_1afd6fdb6746cc4b3331b7058e9819d037 `dynamic_linear(size_t, size_t)`]][The constructor. ]] +] + +[#classboost_1_1geometry_1_1index_1_1dynamic__linear_1afd6fdb6746cc4b3331b7058e9819d037] +[section dynamic_linear(size_t, size_t)] +The constructor. + +[heading Synopsis] +[pre + +`dynamic_linear``(``size_t` `max_elements``,` `size_t` `min_elements``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`size_t`][ `max_elements` ][Maximum number of elements in nodes. ]] +[[`size_t`][ `min_elements` ][Minimum number of elements in nodes. ]] +] +[endsect] + +[endsect] + diff --git a/doc/generated/rtree_dynamic_quadratic.qbk b/doc/generated/rtree_dynamic_quadratic.qbk new file mode 100644 index 000000000..3c28e915f --- /dev/null +++ b/doc/generated/rtree_dynamic_quadratic.qbk @@ -0,0 +1,45 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1dynamic__quadratic.xml] +[#classboost_1_1geometry_1_1index_1_1dynamic__quadratic] +[section boost::geometry::index::dynamic_quadratic] + +Quadratic r-tree creation algorithm parameters - run-time version. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre + +`class dynamic_quadratic` +`{` +` // ...` +`};` +] + +[heading Constructor(s) and destructor] +[table +[[Function][Description]] +[[[link classboost_1_1geometry_1_1index_1_1dynamic__quadratic_1a19f526af4c76e09402164f966fdfca91 `dynamic_quadratic(size_t, size_t)`]][The constructor. ]] +] + +[#classboost_1_1geometry_1_1index_1_1dynamic__quadratic_1a19f526af4c76e09402164f966fdfca91] +[section dynamic_quadratic(size_t, size_t)] +The constructor. + +[heading Synopsis] +[pre + +`dynamic_quadratic``(``size_t` `max_elements``,` `size_t` `min_elements``)` +] + +[heading Parameter(s)] +[table +[[Type][Name][Description]] +[[`size_t`][ `max_elements` ][Maximum number of elements in nodes. ]] +[[`size_t`][ `min_elements` ][Minimum number of elements in nodes. ]] +] +[endsect] + +[endsect] + diff --git a/doc/generated/rtree_runtime_rstar.qbk b/doc/generated/rtree_dynamic_rstar.qbk similarity index 52% rename from doc/generated/rtree_runtime_rstar.qbk rename to doc/generated/rtree_dynamic_rstar.qbk index e0d506dcb..288cf78ff 100644 --- a/doc/generated/rtree_runtime_rstar.qbk +++ b/doc/generated/rtree_dynamic_rstar.qbk @@ -1,9 +1,9 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] -[/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1rstar.xml] -[#classboost_1_1geometry_1_1index_1_1runtime_1_1rstar] -[section boost::geometry::index::runtime::rstar] +[/ Generated from xml/classboost_1_1geometry_1_1index_1_1dynamic__rstar.xml] +[#classboost_1_1geometry_1_1index_1_1dynamic__rstar] +[section boost::geometry::index::dynamic_rstar] -R*-tree creation algorithm parameters. +R*-tree creation algorithm parameters - run-time version. [heading Header] `#include ` @@ -11,7 +11,7 @@ R*-tree creation algorithm parameters. [heading Synopsis] [pre -`class rstar` +`class dynamic_rstar` `{` ` // ...` `};` @@ -20,20 +20,20 @@ R*-tree creation algorithm parameters. [heading Constructor(s) and destructor] [table [[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1a44d70eb723daa4fca13a1cfa20bf346f `rstar(size_t, size_t)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1dynamic__rstar_1af825a8e4652b3ca3f2487fe7fdd403be `dynamic_rstar(size_t, size_t)`]][The constructor. ]] ] -[#classboost_1_1geometry_1_1index_1_1runtime_1_1rstar_1a44d70eb723daa4fca13a1cfa20bf346f] -[section rstar(size_t, size_t)] +[#classboost_1_1geometry_1_1index_1_1dynamic__rstar_1af825a8e4652b3ca3f2487fe7fdd403be] +[section dynamic_rstar(size_t, size_t)] The constructor. [heading Synopsis] [pre -`rstar``(``size_t` `max_elements``,` - `size_t` `min_elements``,` - `size_t` `overlap_cost_threshold` = `0``,` - `size_t` `reinserted_elements` = `detail::default_rstar_reinserted_elements_d()``)` +`dynamic_rstar``(``size_t` `max_elements``,` + `size_t` `min_elements``,` + `size_t` `overlap_cost_threshold` = `0``,` + `size_t` `reinserted_elements` = `detail::default_rstar_reinserted_elements_d()``)` ] [heading Parameter(s)] diff --git a/doc/generated/rtree_runtime_linear.qbk b/doc/generated/rtree_runtime_linear.qbk deleted file mode 100644 index 352662c5c..000000000 --- a/doc/generated/rtree_runtime_linear.qbk +++ /dev/null @@ -1,45 +0,0 @@ -[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] -[/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1linear.xml] -[#classboost_1_1geometry_1_1index_1_1runtime_1_1linear] -[section boost::geometry::index::runtime::linear] - -Linear r-tree creation algorithm parameters. - -[heading Header] -`#include ` - -[heading Synopsis] -[pre - -`class linear` -`{` -` // ...` -`};` -] - -[heading Constructor(s) and destructor] -[table -[[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1linear_1a31efc1a8faba0fd037066bc1bc72b6fd `linear(size_t, size_t)`]][The constructor. ]] -] - -[#classboost_1_1geometry_1_1index_1_1runtime_1_1linear_1a31efc1a8faba0fd037066bc1bc72b6fd] -[section linear(size_t, size_t)] -The constructor. - -[heading Synopsis] -[pre - -`linear``(``size_t` `max_elements``,` `size_t` `min_elements``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`size_t`][ `max_elements` ][Maximum number of elements in nodes. ]] -[[`size_t`][ `min_elements` ][Minimum number of elements in nodes. ]] -] -[endsect] - -[endsect] - diff --git a/doc/generated/rtree_runtime_quadratic.qbk b/doc/generated/rtree_runtime_quadratic.qbk deleted file mode 100644 index 90c6c095e..000000000 --- a/doc/generated/rtree_runtime_quadratic.qbk +++ /dev/null @@ -1,45 +0,0 @@ -[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] -[/ Generated from xml/classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic.xml] -[#classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic] -[section boost::geometry::index::runtime::quadratic] - -Quadratic r-tree creation algorithm parameters. - -[heading Header] -`#include ` - -[heading Synopsis] -[pre - -`class quadratic` -`{` -` // ...` -`};` -] - -[heading Constructor(s) and destructor] -[table -[[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic_1ae14911a22f8f91807254c58744b81563 `quadratic(size_t, size_t)`]][The constructor. ]] -] - -[#classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic_1ae14911a22f8f91807254c58744b81563] -[section quadratic(size_t, size_t)] -The constructor. - -[heading Synopsis] -[pre - -`quadratic``(``size_t` `max_elements``,` `size_t` `min_elements``)` -] - -[heading Parameter(s)] -[table -[[Type][Name][Description]] -[[`size_t`][ `max_elements` ][Maximum number of elements in nodes. ]] -[[`size_t`][ `min_elements` ][Minimum number of elements in nodes. ]] -] -[endsect] - -[endsect] - 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 7af45c47f..582f76640 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -168,17 +168,17 @@

                                                                                  Linear - classic R-tree using balancing algorithm of linear complexity

                                                                                  -
                                                                                  index::rtree< Value, index::linear<32, 8> > rt;
                                                                                  +
                                                                                  index::rtree< Value, index::linear<16, 4> > rt;
                                                                                   

                                                                                  Quadratic - classic R-tree using balancing algorithm of quadratic complexity

                                                                                  -
                                                                                  index::rtree< Value, index::quadratic<32, 8> > rt;
                                                                                  +
                                                                                  index::rtree< Value, index::quadratic<16, 4> > rt;
                                                                                   

                                                                                  R*-tree - balancing algorithm minimizing nodes' overlap with forced reinsertions

                                                                                  -
                                                                                  index::rtree< Value, index::rstar<32, 8> > rt;
                                                                                  +
                                                                                  index::rtree< Value, index::rstar<16, 4> > rt;
                                                                                   
                                                                                @@ -188,17 +188,17 @@

                                                                            Balancing algorithm parameters may be passed to the R-tree in run time. - To use run-time versions of the R-tree one may pass parameters defined - in index::runtime namespace. + To use run-time versions of the R-tree one may pass parameters which names + start with dynamic_.

                                                                            // linear
                                                                            -index::rtree<Value, index::runtime::linear> rt(index::runtime::linear(32, 8));
                                                                            +index::rtree<Value, index::dynamic_linear> rt(index::dynamic_linear(16, 4));
                                                                             
                                                                             // quadratic
                                                                            -index::rtree<Value, index::runtime::quadratic> rt(index::runtime::quadratic(32, 8));
                                                                            +index::rtree<Value, index::dynamic_quadratic> rt(index::dynamic_quadratic(16, 4));
                                                                             
                                                                             // rstar
                                                                            -index::rtree<Value, index::runtime::rstar> rt(index::runtime::rstar(32, 8));
                                                                            +index::rtree<Value, index::dynamic_rstar> rt(index::dynamic_rstar(16, 4));
                                                                             

                                                                            The obvious drawback is a slightly slower R-tree. @@ -215,16 +215,16 @@ references.

                                                                            // default constructor
                                                                            -index::rtree< Value, index::quadratic<32, 8> > rt1;
                                                                            +index::rtree< Value, index::linear<32, 8> > rt1;
                                                                             
                                                                             // copy constructor
                                                                            -index::rtree< Value, index::quadratic<32, 8> > rt2(r1);
                                                                            +index::rtree< Value, index::quadratic<16, 4> > rt2(r1);
                                                                             
                                                                             // copy assignment
                                                                             rt2 = r1;
                                                                             
                                                                             // move constructor
                                                                            -index::rtree< Value, index::quadratic<32, 8> > rt3(boost::move(rt1));
                                                                            +index::rtree< Value, index::quadratic<8, 3> > rt3(boost::move(rt1));
                                                                             
                                                                             // move assignment
                                                                             rt3 = boost::move(rt2);
                                                                            diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html
                                                                            index 05b14d11f..68418307a 100644
                                                                            --- a/doc/html/geometry_index/r_tree/reference.html
                                                                            +++ b/doc/html/geometry_index/r_tree/reference.html
                                                                            @@ -84,13 +84,13 @@
                                                                                     

                                                                            @@ -338,7 +338,7 @@

                                                                            - rtree() + rtree()

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

                                                                            - rtree(parameters_type, - translator_type const - &, allocator_type) + rtree(parameters_type const + &, translator_type + const &, + allocator_type)

                                                                            @@ -364,7 +365,7 @@

                                                                            - rtree(Iterator, + rtree(Iterator, Iterator)

                                                                            @@ -377,7 +378,7 @@

                                                                            - rtree(Range const + rtree(Range const &)

                                                                            @@ -772,7 +773,7 @@

                                                                          The constructor. @@ -781,7 +782,7 @@ Synopsis -

                                                                          rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())
                                                                          +
                                                                          rtree(parameters_type const & parameters = parameters_type(), translator_type const & translator = translator_type())
                                                                           
                                                                          @@ -823,7 +824,8 @@

                                                                          - parameters_type + parameters_type + const &

                                                                          @@ -867,23 +869,23 @@

                                                                          The constructor.

                                                                          - - Synopsis + + Synopsis
                                                                          -
                                                                          rtree(parameters_type parameters,
                                                                          +
                                                                          rtree(parameters_type const & parameters,
                                                                                 translator_type const & translator,
                                                                                 allocator_type allocator)
                                                                           
                                                                          - - Parameter(s) + + Parameter(s)
                                                                          @@ -912,7 +914,8 @@

                                                                          - parameters_type + parameters_type + const &

                                                                          @@ -964,8 +967,8 @@
                                                                          - - Throws + + Throws

                                                                          If allocator copy constructor throws. @@ -973,7 +976,7 @@

                                                                          @@ -986,7 +989,7 @@

                                                                          template<typename Iterator>
                                                                           rtree(Iterator first,
                                                                                 Iterator last,
                                                                          -      parameters_type parameters = parameters_type(),
                                                                          +      parameters_type const & parameters = parameters_type(),
                                                                                 translator_type const & translator = translator_type(),
                                                                                 allocator_type allocator = allocator_type())
                                                                           
                                                                          @@ -1055,7 +1058,8 @@

                                                                          - parameters_type + parameters_type + const &

                                                                          @@ -1127,7 +1131,7 @@

                                                                          @@ -1139,7 +1143,7 @@

                                                                          template<typename Range>
                                                                           rtree(Range const & rng,
                                                                          -      parameters_type parameters = parameters_type(),
                                                                          +      parameters_type const & parameters = parameters_type(),
                                                                                 translator_type const & translator = translator_type(),
                                                                                 allocator_type allocator = allocator_type())
                                                                           
                                                                          @@ -1201,7 +1205,8 @@

                                                                          - parameters_type + parameters_type + const &

                                                                          @@ -4862,30 +4867,30 @@

                                                                          - Linear r-tree creation algorithm parameters. + Linear r-tree creation algorithm parameters - run-time version.

                                                                          - - Header + + Header

                                                                          #include <boost/geometry/index/parameters.hpp>

                                                                          - - Synopsis + + Synopsis
                                                                          -
                                                                          class linear
                                                                          +
                                                                          class dynamic_linear
                                                                           {
                                                                             // ...
                                                                           };
                                                                           
                                                                          - - Constructor(s) + + Constructor(s) and destructor
                                                                          @@ -4908,7 +4913,7 @@ @@ -4921,18 +4926,18 @@

                                                                          - linear(size_t, + dynamic_linear(size_t, size_t)

                                                                          The constructor.

                                                                          - - Synopsis -
                                                                          linear(size_t max_elements, size_t min_elements)
                                                                          +
                                                                          +              Synopsis
                                                                          +            
                                                                          dynamic_linear(size_t max_elements, size_t min_elements)
                                                                           
                                                                          - - Parameter(s) + + Parameter(s)
                                                                          @@ -4997,30 +5002,30 @@

                                                                          - Quadratic r-tree creation algorithm parameters. + Quadratic r-tree creation algorithm parameters - run-time version.

                                                                          - - Header + + Header

                                                                          #include <boost/geometry/index/parameters.hpp>

                                                                          - - Synopsis + + Synopsis
                                                                          -
                                                                          class quadratic
                                                                          +
                                                                          class dynamic_quadratic
                                                                           {
                                                                             // ...
                                                                           };
                                                                           
                                                                          - - Constructor(s) + + Constructor(s) and destructor
                                                                          @@ -5043,7 +5048,7 @@ @@ -5056,18 +5061,18 @@

                                                                          - quadratic(size_t, + dynamic_quadratic(size_t, size_t)

                                                                          The constructor.

                                                                          - - Synopsis -
                                                                          quadratic(size_t max_elements, size_t min_elements)
                                                                          +
                                                                          +              Synopsis
                                                                          +            
                                                                          dynamic_quadratic(size_t max_elements, size_t min_elements)
                                                                           
                                                                          - - Parameter(s) + + Parameter(s)
                                                                          @@ -5132,30 +5137,30 @@

                                                                          - R*-tree creation algorithm parameters. + R*-tree creation algorithm parameters - run-time version.

                                                                          - - Header + + Header

                                                                          #include <boost/geometry/index/parameters.hpp>

                                                                          - - Synopsis + + Synopsis
                                                                          -
                                                                          class rstar
                                                                          +
                                                                          class dynamic_rstar
                                                                           {
                                                                             // ...
                                                                           };
                                                                           
                                                                          - - Constructor(s) + + Constructor(s) and destructor
                                                                          @@ -5178,7 +5183,7 @@ @@ -5191,21 +5196,21 @@

                                                                          - rstar(size_t, + dynamic_rstar(size_t, size_t)

                                                                          The constructor.

                                                                          - - Synopsis -
                                                                          rstar(size_t max_elements,
                                                                          -      size_t min_elements,
                                                                          -      size_t overlap_cost_threshold = 0,
                                                                          -      size_t reinserted_elements = detail::default_rstar_reinserted_elements_d())
                                                                          +
                                                                          +              Synopsis
                                                                          +            
                                                                          dynamic_rstar(size_t max_elements,
                                                                          +              size_t min_elements,
                                                                          +              size_t overlap_cost_threshold = 0,
                                                                          +              size_t reinserted_elements = detail::default_rstar_reinserted_elements_d())
                                                                           
                                                                          - - Parameter(s) + + Parameter(s)
                                                                          diff --git a/doc/html/index.html b/doc/html/index.html index 5e566e778..22b189b70 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
                                                                          - +

                                                                          Last revised: February 24, 2013 at 16:45:22 GMT

                                                                          Last revised: February 27, 2013 at 11:59:54 GMT


                                                                          diff --git a/doc/make_qbk.py b/doc/make_qbk.py index 1bcd4077e..8bc316a60 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -23,9 +23,9 @@ os.system(cmd % ("group__rtree__functions", "rtree_functions")) os.system(cmd % ("structboost_1_1geometry_1_1index_1_1linear", "rtree_linear")) os.system(cmd % ("structboost_1_1geometry_1_1index_1_1quadratic", "rtree_quadratic")) os.system(cmd % ("structboost_1_1geometry_1_1index_1_1rstar", "rtree_rstar")) -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1linear", "rtree_runtime_linear")) -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1quadratic", "rtree_runtime_quadratic")) -os.system(cmd % ("classboost_1_1geometry_1_1index_1_1runtime_1_1rstar", "rtree_runtime_rstar")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1dynamic__linear", "rtree_dynamic_linear")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1dynamic__quadratic", "rtree_dynamic_quadratic")) +os.system(cmd % ("classboost_1_1geometry_1_1index_1_1dynamic__rstar", "rtree_dynamic_rstar")) os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator", "translator")) #os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_3_01std_1_1pair_3_01_indexable_00_01_second_01_4_01_4", "translator_pair")) diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 9d0cfba8b..853f00fc6 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -69,32 +69,32 @@ nodes' balancing algorithm. Currently, three well-known types of R-trees may be Linear - classic __rtree__ using balancing algorithm of linear complexity - index::rtree< __value__, index::linear<32, 8> > rt; + index::rtree< __value__, index::linear<16, 4> > rt; Quadratic - classic __rtree__ using balancing algorithm of quadratic complexity - index::rtree< __value__, index::quadratic<32, 8> > rt; + index::rtree< __value__, index::quadratic<16, 4> > rt; R*-tree - balancing algorithm minimizing nodes' overlap with forced reinsertions - index::rtree< __value__, index::rstar<32, 8> > rt; + index::rtree< __value__, index::rstar<16, 4> > rt; [endsect] [section Balancing algorithms (run-time)] Balancing algorithm parameters may be passed to the __rtree__ in run time. -To use run-time versions of the __rtree__ one may pass parameters defined in index::runtime -namespace. +To use run-time versions of the __rtree__ one may pass parameters which +names start with `dynamic_`. // linear - index::rtree<__value__, index::runtime::linear> rt(index::runtime::linear(32, 8)); + index::rtree<__value__, index::dynamic_linear> rt(index::dynamic_linear(16, 4)); // quadratic - index::rtree<__value__, index::runtime::quadratic> rt(index::runtime::quadratic(32, 8)); + index::rtree<__value__, index::dynamic_quadratic> rt(index::dynamic_quadratic(16, 4)); // rstar - index::rtree<__value__, index::runtime::rstar> rt(index::runtime::rstar(32, 8)); + index::rtree<__value__, index::dynamic_rstar> rt(index::dynamic_rstar(16, 4)); The obvious drawback is a slightly slower __rtree__. @@ -106,16 +106,16 @@ The __rtree__ is copyable and movable container. Move semantics is implemented u which also supports compilers not supporting rvalue references. // default constructor - index::rtree< __value__, index::quadratic<32, 8> > rt1; + index::rtree< __value__, index::linear<32, 8> > rt1; // copy constructor - index::rtree< __value__, index::quadratic<32, 8> > rt2(r1); + index::rtree< __value__, index::quadratic<16, 4> > rt2(r1); // copy assignment rt2 = r1; // move constructor - index::rtree< __value__, index::quadratic<32, 8> > rt3(boost::move(rt1)); + index::rtree< __value__, index::quadratic<8, 3> > rt3(boost::move(rt1)); // move assignment rt3 = boost::move(rt2); diff --git a/doc/rtree/reference.qbk b/doc/rtree/reference.qbk index b3258ff81..a9665ff1f 100644 --- a/doc/rtree/reference.qbk +++ b/doc/rtree/reference.qbk @@ -18,9 +18,9 @@ [include ../generated/rtree_linear.qbk] [include ../generated/rtree_quadratic.qbk] [include ../generated/rtree_rstar.qbk] -[include ../generated/rtree_runtime_linear.qbk] -[include ../generated/rtree_runtime_quadratic.qbk] -[include ../generated/rtree_runtime_rstar.qbk] +[include ../generated/rtree_dynamic_linear.qbk] +[include ../generated/rtree_dynamic_quadratic.qbk] +[include ../generated/rtree_dynamic_rstar.qbk] [endsect] @@ -38,4 +38,4 @@ [include ../generated/inserters.qbk] -[endsect] \ No newline at end of file +[endsect] diff --git a/include/boost/geometry/index/detail/rtree/options.hpp b/include/boost/geometry/index/detail/rtree/options.hpp index 061bbfb8a..b1bb60df1 100644 --- a/include/boost/geometry/index/detail/rtree/options.hpp +++ b/include/boost/geometry/index/detail/rtree/options.hpp @@ -110,10 +110,10 @@ struct options_type< index::rstar -struct options_type< index::runtime::linear > +struct options_type< index::dynamic_linear > { typedef options< - index::runtime::linear, + index::dynamic_linear, insert_default_tag, choose_by_content_diff_tag, split_default_tag, @@ -123,10 +123,10 @@ struct options_type< index::runtime::linear > }; template <> -struct options_type< index::runtime::quadratic > +struct options_type< index::dynamic_quadratic > { typedef options< - index::runtime::quadratic, + index::dynamic_quadratic, insert_default_tag, choose_by_content_diff_tag, split_default_tag, @@ -136,10 +136,10 @@ struct options_type< index::runtime::quadratic > }; template <> -struct options_type< index::runtime::rstar > +struct options_type< index::dynamic_rstar > { typedef options< - index::runtime::rstar, + index::dynamic_rstar, insert_reinsert_tag, choose_by_overlap_diff_tag, split_default_tag, diff --git a/include/boost/geometry/index/parameters.hpp b/include/boost/geometry/index/parameters.hpp index 60d7d33cc..9af868428 100644 --- a/include/boost/geometry/index/parameters.hpp +++ b/include/boost/geometry/index/parameters.hpp @@ -98,12 +98,10 @@ struct rstar // static const size_t min_elements = MinElements; //}; -namespace runtime { - /*! -\brief Linear r-tree creation algorithm parameters. +\brief Linear r-tree creation algorithm parameters - run-time version. */ -class linear +class dynamic_linear { public: /*! @@ -112,7 +110,7 @@ public: \param max_elements Maximum number of elements in nodes. \param min_elements Minimum number of elements in nodes. */ - linear(size_t max_elements, size_t min_elements) + dynamic_linear(size_t max_elements, size_t min_elements) : m_max_elements(max_elements) , m_min_elements(min_elements) {} @@ -126,9 +124,9 @@ private: }; /*! -\brief Quadratic r-tree creation algorithm parameters. +\brief Quadratic r-tree creation algorithm parameters - run-time version. */ -class quadratic +class dynamic_quadratic { public: /*! @@ -137,7 +135,7 @@ public: \param max_elements Maximum number of elements in nodes. \param min_elements Minimum number of elements in nodes. */ - quadratic(size_t max_elements, size_t min_elements) + dynamic_quadratic(size_t max_elements, size_t min_elements) : m_max_elements(max_elements) , m_min_elements(min_elements) {} @@ -160,9 +158,9 @@ inline size_t default_rstar_reinserted_elements_d() } // namespace detail /*! -\brief R*-tree creation algorithm parameters. +\brief R*-tree creation algorithm parameters - run-time version. */ -class rstar +class dynamic_rstar { public: /*! @@ -175,10 +173,10 @@ public: overlap cost. If 0 minimum overlap cost is always calculated. \param reinserted_elements Number of elements reinserted by forced reinsertions algorithm. */ - rstar(size_t max_elements, - size_t min_elements, - size_t overlap_cost_threshold = 0, - size_t reinserted_elements = detail::default_rstar_reinserted_elements_d()) + dynamic_rstar(size_t max_elements, + size_t min_elements, + size_t overlap_cost_threshold = 0, + size_t reinserted_elements = detail::default_rstar_reinserted_elements_d()) : m_max_elements(max_elements) , m_min_elements(min_elements) , m_overlap_cost_threshold(overlap_cost_threshold) @@ -201,8 +199,6 @@ private: size_t m_reinserted_elements; }; -} // namespace runtime - }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_INDEX_PARAMETERS_HPP diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 1eb4c7334..537344fe0 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -77,9 +77,9 @@ Predefined algorithms with compile-time parameters are: \par Predefined algorithms with run-time parameters are: - \li \c boost::geometry::index::runtime::linear, - \li \c boost::geometry::index::runtime::quadratic, - \li \c boost::geometry::index::runtime::rstar. + \li \c boost::geometry::index::dynamic_linear, + \li \c boost::geometry::index::dynamic_quadratic, + \li \c boost::geometry::index::dynamic_rstar. \par Translator The Translator translates from Value to Indexable each time r-tree requires it. Which means that this diff --git a/test/rtree/exceptions/rtree_exceptions.cpp b/test/rtree/exceptions/rtree_exceptions.cpp index b28c7974b..94c528acf 100644 --- a/test/rtree/exceptions/rtree_exceptions.cpp +++ b/test/rtree/exceptions/rtree_exceptions.cpp @@ -165,11 +165,11 @@ void test_rtree_elements_exceptions(Parameters const& parameters = Parameters()) int test_main(int, char* []) { test_rtree_value_exceptions< bgi::linear<4, 2> >(); - test_rtree_value_exceptions(bgi::runtime::linear(4, 2)); + test_rtree_value_exceptions(bgi::dynamic_linear(4, 2)); test_rtree_value_exceptions< bgi::quadratic<4, 2> >(); - test_rtree_value_exceptions(bgi::runtime::quadratic(4, 2)); + test_rtree_value_exceptions(bgi::dynamic_quadratic(4, 2)); test_rtree_value_exceptions< bgi::rstar<4, 2, 0, 2> >(); - test_rtree_value_exceptions(bgi::runtime::rstar(4, 2, 0, 2)); + test_rtree_value_exceptions(bgi::dynamic_rstar(4, 2, 0, 2)); test_rtree_elements_exceptions< bgi::linear_throwing<4, 2> >(); test_rtree_elements_exceptions< bgi::quadratic_throwing<4, 2> >(); diff --git a/test/rtree/generated/Jamfile.v2 b/test/rtree/generated/Jamfile.v2 index 7d1cb2cfa..adcc56a86 100644 --- a/test/rtree/generated/Jamfile.v2 +++ b/test/rtree/generated/Jamfile.v2 @@ -6,16 +6,103 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -rule test_all -{ - local all_rules = ; +test-suite boost-geometry-index-rtree-generated + : + [ run rtree_p2d_linear.cpp ] + [ run rtree_b2d_linear.cpp ] + [ run rtree_p2d_quadratic.cpp ] + [ run rtree_b2d_quadratic.cpp ] + [ run rtree_p2d_rstar.cpp ] + [ run rtree_b2d_rstar.cpp ] + [ run rtree_p2d_linear_dyn.cpp ] + [ run rtree_b2d_linear_dyn.cpp ] + [ run rtree_p2d_quadratic_dyn.cpp ] + [ run rtree_b2d_quadratic_dyn.cpp ] + [ run rtree_p2d_rstar_dyn.cpp ] + [ run rtree_b2d_rstar_dyn.cpp ] + [ run rtree_p2f_linear.cpp ] + [ run rtree_b2f_linear.cpp ] + [ run rtree_p2f_quadratic.cpp ] + [ run rtree_b2f_quadratic.cpp ] + [ run rtree_p2f_rstar.cpp ] + [ run rtree_b2f_rstar.cpp ] + [ run rtree_p2f_linear_dyn.cpp ] + [ run rtree_b2f_linear_dyn.cpp ] + [ run rtree_p2f_quadratic_dyn.cpp ] + [ run rtree_b2f_quadratic_dyn.cpp ] + [ run rtree_p2f_rstar_dyn.cpp ] + [ run rtree_b2f_rstar_dyn.cpp ] + [ run rtree_p2i_linear.cpp ] + [ run rtree_b2i_linear.cpp ] + [ run rtree_p2i_quadratic.cpp ] + [ run rtree_b2i_quadratic.cpp ] + [ run rtree_p2i_rstar.cpp ] + [ run rtree_b2i_rstar.cpp ] + [ run rtree_p2i_linear_dyn.cpp ] + [ run rtree_b2i_linear_dyn.cpp ] + [ run rtree_p2i_quadratic_dyn.cpp ] + [ run rtree_b2i_quadratic_dyn.cpp ] + [ run rtree_p2i_rstar_dyn.cpp ] + [ run rtree_b2i_rstar_dyn.cpp ] + [ run rtree_p2tt_linear.cpp ] + [ run rtree_b2tt_linear.cpp ] + [ run rtree_p2tt_quadratic.cpp ] + [ run rtree_b2tt_quadratic.cpp ] + [ run rtree_p2tt_rstar.cpp ] + [ run rtree_b2tt_rstar.cpp ] + [ run rtree_p2tt_linear_dyn.cpp ] + [ run rtree_b2tt_linear_dyn.cpp ] + [ run rtree_p2tt_quadratic_dyn.cpp ] + [ run rtree_b2tt_quadratic_dyn.cpp ] + [ run rtree_p2tt_rstar_dyn.cpp ] + [ run rtree_b2tt_rstar_dyn.cpp ] + [ run rtree_p3d_linear.cpp ] + [ run rtree_b3d_linear.cpp ] + [ run rtree_p3d_quadratic.cpp ] + [ run rtree_b3d_quadratic.cpp ] + [ run rtree_p3d_rstar.cpp ] + [ run rtree_b3d_rstar.cpp ] + [ run rtree_p3d_linear_dyn.cpp ] + [ run rtree_b3d_linear_dyn.cpp ] + [ run rtree_p3d_quadratic_dyn.cpp ] + [ run rtree_b3d_quadratic_dyn.cpp ] + [ run rtree_p3d_rstar_dyn.cpp ] + [ run rtree_b3d_rstar_dyn.cpp ] + [ run rtree_p3f_linear.cpp ] + [ run rtree_b3f_linear.cpp ] + [ run rtree_p3f_quadratic.cpp ] + [ run rtree_b3f_quadratic.cpp ] + [ run rtree_p3f_rstar.cpp ] + [ run rtree_b3f_rstar.cpp ] + [ run rtree_p3f_linear_dyn.cpp ] + [ run rtree_b3f_linear_dyn.cpp ] + [ run rtree_p3f_quadratic_dyn.cpp ] + [ run rtree_b3f_quadratic_dyn.cpp ] + [ run rtree_p3f_rstar_dyn.cpp ] + [ run rtree_b3f_rstar_dyn.cpp ] + [ run rtree_p3i_linear.cpp ] + [ run rtree_b3i_linear.cpp ] + [ run rtree_p3i_quadratic.cpp ] + [ run rtree_b3i_quadratic.cpp ] + [ run rtree_p3i_rstar.cpp ] + [ run rtree_b3i_rstar.cpp ] + [ run rtree_p3i_linear_dyn.cpp ] + [ run rtree_b3i_linear_dyn.cpp ] + [ run rtree_p3i_quadratic_dyn.cpp ] + [ run rtree_b3i_quadratic_dyn.cpp ] + [ run rtree_p3i_rstar_dyn.cpp ] + [ run rtree_b3i_rstar_dyn.cpp ] + [ run rtree_p3tt_linear.cpp ] + [ run rtree_b3tt_linear.cpp ] + [ run rtree_p3tt_quadratic.cpp ] + [ run rtree_b3tt_quadratic.cpp ] + [ run rtree_p3tt_rstar.cpp ] + [ run rtree_b3tt_rstar.cpp ] + [ run rtree_p3tt_linear_dyn.cpp ] + [ run rtree_b3tt_linear_dyn.cpp ] + [ run rtree_p3tt_quadratic_dyn.cpp ] + [ run rtree_b3tt_quadratic_dyn.cpp ] + [ run rtree_p3tt_rstar_dyn.cpp ] + [ run rtree_b3tt_rstar_dyn.cpp ] + ; - for local fileb in [ glob *.cpp ] - { - all_rules += [ run $(fileb) ] ; - } - - return $(all_rules) ; -} - -test-suite boost-geometry-index-rtree-generated : [ test_all r ] ; diff --git a/test/rtree/generated/rtree_b2d_linear.cpp b/test/rtree/generated/rtree_b2d_linear.cpp index 30c9f7186..349507628 100644 --- a/test/rtree/generated/rtree_b2d_linear.cpp +++ b/test/rtree/generated/rtree_b2d_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2d_rstar_rt.cpp b/test/rtree/generated/rtree_b2d_linear_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b2d_rstar_rt.cpp rename to test/rtree/generated/rtree_b2d_linear_dyn.cpp index 2f2deb99b..1b67a0128 100644 --- a/test/rtree/generated/rtree_b2d_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b2d_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2d_quadratic.cpp b/test/rtree/generated/rtree_b2d_quadratic.cpp index e403991d6..99a3b36a6 100644 --- a/test/rtree/generated/rtree_b2d_quadratic.cpp +++ b/test/rtree/generated/rtree_b2d_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2d_quadratic_rt.cpp b/test/rtree/generated/rtree_b2d_quadratic_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b2d_quadratic_rt.cpp rename to test/rtree/generated/rtree_b2d_quadratic_dyn.cpp index ed9ef4531..fa085618c 100644 --- a/test/rtree/generated/rtree_b2d_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b2d_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2d_rstar.cpp b/test/rtree/generated/rtree_b2d_rstar.cpp index 44e249dec..e120e63ce 100644 --- a/test/rtree/generated/rtree_b2d_rstar.cpp +++ b/test/rtree/generated/rtree_b2d_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2d_linear_rt.cpp b/test/rtree/generated/rtree_b2d_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b2d_linear_rt.cpp rename to test/rtree/generated/rtree_b2d_rstar_dyn.cpp index 06299af28..71d12bc2c 100644 --- a/test/rtree/generated/rtree_b2d_linear_rt.cpp +++ b/test/rtree/generated/rtree_b2d_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2f_linear.cpp b/test/rtree/generated/rtree_b2f_linear.cpp index cfee39bbb..ff122ef06 100644 --- a/test/rtree/generated/rtree_b2f_linear.cpp +++ b/test/rtree/generated/rtree_b2f_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2f_rstar_rt.cpp b/test/rtree/generated/rtree_b2f_linear_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b2f_rstar_rt.cpp rename to test/rtree/generated/rtree_b2f_linear_dyn.cpp index 7c1f9dc61..0b3e48701 100644 --- a/test/rtree/generated/rtree_b2f_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b2f_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2f_quadratic.cpp b/test/rtree/generated/rtree_b2f_quadratic.cpp index 84a4ecbdc..7c72afc59 100644 --- a/test/rtree/generated/rtree_b2f_quadratic.cpp +++ b/test/rtree/generated/rtree_b2f_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2f_quadratic_rt.cpp b/test/rtree/generated/rtree_b2f_quadratic_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b2f_quadratic_rt.cpp rename to test/rtree/generated/rtree_b2f_quadratic_dyn.cpp index c20fcee60..277bc59a8 100644 --- a/test/rtree/generated/rtree_b2f_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b2f_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2f_rstar.cpp b/test/rtree/generated/rtree_b2f_rstar.cpp index 5c9ffe78c..10e1af46c 100644 --- a/test/rtree/generated/rtree_b2f_rstar.cpp +++ b/test/rtree/generated/rtree_b2f_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2f_linear_rt.cpp b/test/rtree/generated/rtree_b2f_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b2f_linear_rt.cpp rename to test/rtree/generated/rtree_b2f_rstar_dyn.cpp index 5ee826746..7c0b7a855 100644 --- a/test/rtree/generated/rtree_b2f_linear_rt.cpp +++ b/test/rtree/generated/rtree_b2f_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2i_linear.cpp b/test/rtree/generated/rtree_b2i_linear.cpp index b46e391c5..4ff293ede 100644 --- a/test/rtree/generated/rtree_b2i_linear.cpp +++ b/test/rtree/generated/rtree_b2i_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2i_rstar_rt.cpp b/test/rtree/generated/rtree_b2i_linear_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b2i_rstar_rt.cpp rename to test/rtree/generated/rtree_b2i_linear_dyn.cpp index ed4601a05..2be4c4102 100644 --- a/test/rtree/generated/rtree_b2i_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b2i_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2i_quadratic.cpp b/test/rtree/generated/rtree_b2i_quadratic.cpp index ebf03ea64..cec32d1d3 100644 --- a/test/rtree/generated/rtree_b2i_quadratic.cpp +++ b/test/rtree/generated/rtree_b2i_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2i_quadratic_rt.cpp b/test/rtree/generated/rtree_b2i_quadratic_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b2i_quadratic_rt.cpp rename to test/rtree/generated/rtree_b2i_quadratic_dyn.cpp index 9c4e46e75..4c3a5c313 100644 --- a/test/rtree/generated/rtree_b2i_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b2i_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2i_rstar.cpp b/test/rtree/generated/rtree_b2i_rstar.cpp index c7767e513..5c3daefe5 100644 --- a/test/rtree/generated/rtree_b2i_rstar.cpp +++ b/test/rtree/generated/rtree_b2i_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b2i_linear_rt.cpp b/test/rtree/generated/rtree_b2i_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b2i_linear_rt.cpp rename to test/rtree/generated/rtree_b2i_rstar_dyn.cpp index f29d856be..05c5e8464 100644 --- a/test/rtree/generated/rtree_b2i_linear_rt.cpp +++ b/test/rtree/generated/rtree_b2i_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b2tt_linear.cpp b/test/rtree/generated/rtree_b2tt_linear.cpp index 5e258da29..8a83352ed 100644 --- a/test/rtree/generated/rtree_b2tt_linear.cpp +++ b/test/rtree/generated/rtree_b2tt_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_b2tt_rstar_rt.cpp b/test/rtree/generated/rtree_b2tt_linear_dyn.cpp similarity index 81% rename from test/rtree/generated/rtree_b2tt_rstar_rt.cpp rename to test/rtree/generated/rtree_b2tt_linear_dyn.cpp index 7a5d85204..c2ceedbdb 100644 --- a/test/rtree/generated/rtree_b2tt_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b2tt_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_b2tt_quadratic.cpp b/test/rtree/generated/rtree_b2tt_quadratic.cpp index 78174b822..4d2884a03 100644 --- a/test/rtree/generated/rtree_b2tt_quadratic.cpp +++ b/test/rtree/generated/rtree_b2tt_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_b2tt_quadratic_rt.cpp b/test/rtree/generated/rtree_b2tt_quadratic_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b2tt_quadratic_rt.cpp rename to test/rtree/generated/rtree_b2tt_quadratic_dyn.cpp index 994a354f9..8bd029035 100644 --- a/test/rtree/generated/rtree_b2tt_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b2tt_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_b2tt_rstar.cpp b/test/rtree/generated/rtree_b2tt_rstar.cpp index 594946963..fb66a0439 100644 --- a/test/rtree/generated/rtree_b2tt_rstar.cpp +++ b/test/rtree/generated/rtree_b2tt_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_b2tt_linear_rt.cpp b/test/rtree/generated/rtree_b2tt_rstar_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b2tt_linear_rt.cpp rename to test/rtree/generated/rtree_b2tt_rstar_dyn.cpp index db89744fc..6bb760fcd 100644 --- a/test/rtree/generated/rtree_b2tt_linear_rt.cpp +++ b/test/rtree/generated/rtree_b2tt_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_b3d_linear.cpp b/test/rtree/generated/rtree_b3d_linear.cpp index a846fa70f..db8f37387 100644 --- a/test/rtree/generated/rtree_b3d_linear.cpp +++ b/test/rtree/generated/rtree_b3d_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3d_rstar_rt.cpp b/test/rtree/generated/rtree_b3d_linear_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b3d_rstar_rt.cpp rename to test/rtree/generated/rtree_b3d_linear_dyn.cpp index 2be2b343f..556a5bde4 100644 --- a/test/rtree/generated/rtree_b3d_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b3d_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3d_quadratic.cpp b/test/rtree/generated/rtree_b3d_quadratic.cpp index f01a96ea9..fb1a7b42f 100644 --- a/test/rtree/generated/rtree_b3d_quadratic.cpp +++ b/test/rtree/generated/rtree_b3d_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3d_quadratic_rt.cpp b/test/rtree/generated/rtree_b3d_quadratic_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b3d_quadratic_rt.cpp rename to test/rtree/generated/rtree_b3d_quadratic_dyn.cpp index 4a8304f06..bb0eb63ca 100644 --- a/test/rtree/generated/rtree_b3d_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b3d_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3d_rstar.cpp b/test/rtree/generated/rtree_b3d_rstar.cpp index 00cbbff8e..47e9b1dba 100644 --- a/test/rtree/generated/rtree_b3d_rstar.cpp +++ b/test/rtree/generated/rtree_b3d_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3d_linear_rt.cpp b/test/rtree/generated/rtree_b3d_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b3d_linear_rt.cpp rename to test/rtree/generated/rtree_b3d_rstar_dyn.cpp index fa17aba0c..ba3b2baa7 100644 --- a/test/rtree/generated/rtree_b3d_linear_rt.cpp +++ b/test/rtree/generated/rtree_b3d_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3f_linear.cpp b/test/rtree/generated/rtree_b3f_linear.cpp index d624f338d..20aff0d22 100644 --- a/test/rtree/generated/rtree_b3f_linear.cpp +++ b/test/rtree/generated/rtree_b3f_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3f_rstar_rt.cpp b/test/rtree/generated/rtree_b3f_linear_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b3f_rstar_rt.cpp rename to test/rtree/generated/rtree_b3f_linear_dyn.cpp index d6c3e4b9c..e74c9979c 100644 --- a/test/rtree/generated/rtree_b3f_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b3f_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3f_quadratic.cpp b/test/rtree/generated/rtree_b3f_quadratic.cpp index 01481d0fa..1a0ac4fb1 100644 --- a/test/rtree/generated/rtree_b3f_quadratic.cpp +++ b/test/rtree/generated/rtree_b3f_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3f_quadratic_rt.cpp b/test/rtree/generated/rtree_b3f_quadratic_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b3f_quadratic_rt.cpp rename to test/rtree/generated/rtree_b3f_quadratic_dyn.cpp index ff46cb91c..3ab424540 100644 --- a/test/rtree/generated/rtree_b3f_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b3f_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3f_rstar.cpp b/test/rtree/generated/rtree_b3f_rstar.cpp index 445d030a6..8c52a946d 100644 --- a/test/rtree/generated/rtree_b3f_rstar.cpp +++ b/test/rtree/generated/rtree_b3f_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3f_linear_rt.cpp b/test/rtree/generated/rtree_b3f_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b3f_linear_rt.cpp rename to test/rtree/generated/rtree_b3f_rstar_dyn.cpp index 360bcd554..3640772e9 100644 --- a/test/rtree/generated/rtree_b3f_linear_rt.cpp +++ b/test/rtree/generated/rtree_b3f_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3i_linear.cpp b/test/rtree/generated/rtree_b3i_linear.cpp index 3cde64aa4..eb41aa60c 100644 --- a/test/rtree/generated/rtree_b3i_linear.cpp +++ b/test/rtree/generated/rtree_b3i_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3i_rstar_rt.cpp b/test/rtree/generated/rtree_b3i_linear_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b3i_rstar_rt.cpp rename to test/rtree/generated/rtree_b3i_linear_dyn.cpp index 4372f8821..d0d232ad3 100644 --- a/test/rtree/generated/rtree_b3i_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b3i_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3i_quadratic.cpp b/test/rtree/generated/rtree_b3i_quadratic.cpp index 8e2620be0..622a5f1b3 100644 --- a/test/rtree/generated/rtree_b3i_quadratic.cpp +++ b/test/rtree/generated/rtree_b3i_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3i_quadratic_rt.cpp b/test/rtree/generated/rtree_b3i_quadratic_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b3i_quadratic_rt.cpp rename to test/rtree/generated/rtree_b3i_quadratic_dyn.cpp index b115b6b50..19e963ae8 100644 --- a/test/rtree/generated/rtree_b3i_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b3i_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3i_rstar.cpp b/test/rtree/generated/rtree_b3i_rstar.cpp index 5a9162e2b..4dc4bde9d 100644 --- a/test/rtree/generated/rtree_b3i_rstar.cpp +++ b/test/rtree/generated/rtree_b3i_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_b3i_linear_rt.cpp b/test/rtree/generated/rtree_b3i_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_b3i_linear_rt.cpp rename to test/rtree/generated/rtree_b3i_rstar_dyn.cpp index 5dd58494e..5da45e88b 100644 --- a/test/rtree/generated/rtree_b3i_linear_rt.cpp +++ b/test/rtree/generated/rtree_b3i_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,6 +15,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_b3tt_linear.cpp b/test/rtree/generated/rtree_b3tt_linear.cpp index ac00d5cc2..01df37cbc 100644 --- a/test/rtree/generated/rtree_b3tt_linear.cpp +++ b/test/rtree/generated/rtree_b3tt_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::linear<4, 2>()); + test_rtree_for_box(bgi::linear<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_b3tt_rstar_rt.cpp b/test/rtree/generated/rtree_b3tt_linear_dyn.cpp similarity index 81% rename from test/rtree/generated/rtree_b3tt_rstar_rt.cpp rename to test/rtree/generated/rtree_b3tt_linear_dyn.cpp index a352816b1..8084caa7a 100644 --- a/test/rtree/generated/rtree_b3tt_rstar_rt.cpp +++ b/test/rtree/generated/rtree_b3tt_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::rstar(4, 2)); + test_rtree_for_box(bgi::dynamic_linear(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_b3tt_quadratic.cpp b/test/rtree/generated/rtree_b3tt_quadratic.cpp index e73ed1996..68016508b 100644 --- a/test/rtree/generated/rtree_b3tt_quadratic.cpp +++ b/test/rtree/generated/rtree_b3tt_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::quadratic<4, 2>()); + test_rtree_for_box(bgi::quadratic<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_b3tt_quadratic_rt.cpp b/test/rtree/generated/rtree_b3tt_quadratic_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b3tt_quadratic_rt.cpp rename to test/rtree/generated/rtree_b3tt_quadratic_dyn.cpp index f91e35431..b277b2222 100644 --- a/test/rtree/generated/rtree_b3tt_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_b3tt_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::quadratic(4, 2)); + test_rtree_for_box(bgi::dynamic_quadratic(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_b3tt_rstar.cpp b/test/rtree/generated/rtree_b3tt_rstar.cpp index 3b2dec2f8..027e4a3ee 100644 --- a/test/rtree/generated/rtree_b3tt_rstar.cpp +++ b/test/rtree/generated/rtree_b3tt_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::rstar<4, 2>()); + test_rtree_for_box(bgi::rstar<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_b3tt_linear_rt.cpp b/test/rtree/generated/rtree_b3tt_rstar_dyn.cpp similarity index 80% rename from test/rtree/generated/rtree_b3tt_linear_rt.cpp rename to test/rtree/generated/rtree_b3tt_rstar_dyn.cpp index 0446c802c..e673826a9 100644 --- a/test/rtree/generated/rtree_b3tt_linear_rt.cpp +++ b/test/rtree/generated/rtree_b3tt_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -16,7 +16,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_box(bgi::runtime::linear(4, 2)); + test_rtree_for_box(bgi::dynamic_rstar(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_p2d_linear.cpp b/test/rtree/generated/rtree_p2d_linear.cpp index 9e140d87d..2baac1ed0 100644 --- a/test/rtree/generated/rtree_p2d_linear.cpp +++ b/test/rtree/generated/rtree_p2d_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2d_rstar_rt.cpp b/test/rtree/generated/rtree_p2d_linear_dyn.cpp similarity index 78% rename from test/rtree/generated/rtree_p2d_rstar_rt.cpp rename to test/rtree/generated/rtree_p2d_linear_dyn.cpp index d4a570cf0..8dd4a9a0a 100644 --- a/test/rtree/generated/rtree_p2d_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p2d_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2d_quadratic.cpp b/test/rtree/generated/rtree_p2d_quadratic.cpp index 12b482b28..638eced1e 100644 --- a/test/rtree/generated/rtree_p2d_quadratic.cpp +++ b/test/rtree/generated/rtree_p2d_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2d_quadratic_rt.cpp b/test/rtree/generated/rtree_p2d_quadratic_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p2d_quadratic_rt.cpp rename to test/rtree/generated/rtree_p2d_quadratic_dyn.cpp index f5fff67dc..1f634cb2e 100644 --- a/test/rtree/generated/rtree_p2d_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p2d_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2d_rstar.cpp b/test/rtree/generated/rtree_p2d_rstar.cpp index 33abbe06e..a66de065f 100644 --- a/test/rtree/generated/rtree_p2d_rstar.cpp +++ b/test/rtree/generated/rtree_p2d_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2d_linear_rt.cpp b/test/rtree/generated/rtree_p2d_rstar_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p2d_linear_rt.cpp rename to test/rtree/generated/rtree_p2d_rstar_dyn.cpp index fa0987d8d..08a6332c2 100644 --- a/test/rtree/generated/rtree_p2d_linear_rt.cpp +++ b/test/rtree/generated/rtree_p2d_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2f_linear.cpp b/test/rtree/generated/rtree_p2f_linear.cpp index 365b7a30c..d8fc01866 100644 --- a/test/rtree/generated/rtree_p2f_linear.cpp +++ b/test/rtree/generated/rtree_p2f_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2f_rstar_rt.cpp b/test/rtree/generated/rtree_p2f_linear_dyn.cpp similarity index 78% rename from test/rtree/generated/rtree_p2f_rstar_rt.cpp rename to test/rtree/generated/rtree_p2f_linear_dyn.cpp index 481f72fd6..cea61cd84 100644 --- a/test/rtree/generated/rtree_p2f_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p2f_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2f_quadratic.cpp b/test/rtree/generated/rtree_p2f_quadratic.cpp index 43e6dbe42..2865c34a6 100644 --- a/test/rtree/generated/rtree_p2f_quadratic.cpp +++ b/test/rtree/generated/rtree_p2f_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2f_quadratic_rt.cpp b/test/rtree/generated/rtree_p2f_quadratic_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p2f_quadratic_rt.cpp rename to test/rtree/generated/rtree_p2f_quadratic_dyn.cpp index 5a7c7df12..5418bdf7d 100644 --- a/test/rtree/generated/rtree_p2f_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p2f_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2f_rstar.cpp b/test/rtree/generated/rtree_p2f_rstar.cpp index 607369cae..14ebaec2c 100644 --- a/test/rtree/generated/rtree_p2f_rstar.cpp +++ b/test/rtree/generated/rtree_p2f_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2f_linear_rt.cpp b/test/rtree/generated/rtree_p2f_rstar_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p2f_linear_rt.cpp rename to test/rtree/generated/rtree_p2f_rstar_dyn.cpp index 73f2800a8..987714647 100644 --- a/test/rtree/generated/rtree_p2f_linear_rt.cpp +++ b/test/rtree/generated/rtree_p2f_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2i_linear.cpp b/test/rtree/generated/rtree_p2i_linear.cpp index 3fdfe97fa..a039da2d3 100644 --- a/test/rtree/generated/rtree_p2i_linear.cpp +++ b/test/rtree/generated/rtree_p2i_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2i_rstar_rt.cpp b/test/rtree/generated/rtree_p2i_linear_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p2i_rstar_rt.cpp rename to test/rtree/generated/rtree_p2i_linear_dyn.cpp index ad55f2397..2c1a2a3db 100644 --- a/test/rtree/generated/rtree_p2i_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p2i_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2i_quadratic.cpp b/test/rtree/generated/rtree_p2i_quadratic.cpp index be431bdc4..314a36f13 100644 --- a/test/rtree/generated/rtree_p2i_quadratic.cpp +++ b/test/rtree/generated/rtree_p2i_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2i_quadratic_rt.cpp b/test/rtree/generated/rtree_p2i_quadratic_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p2i_quadratic_rt.cpp rename to test/rtree/generated/rtree_p2i_quadratic_dyn.cpp index feab0546e..2dcde7d3f 100644 --- a/test/rtree/generated/rtree_p2i_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p2i_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2i_rstar.cpp b/test/rtree/generated/rtree_p2i_rstar.cpp index 40fe0d148..896b4d1c8 100644 --- a/test/rtree/generated/rtree_p2i_rstar.cpp +++ b/test/rtree/generated/rtree_p2i_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p2i_linear_rt.cpp b/test/rtree/generated/rtree_p2i_rstar_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p2i_linear_rt.cpp rename to test/rtree/generated/rtree_p2i_rstar_dyn.cpp index f97caa12c..972f8a28c 100644 --- a/test/rtree/generated/rtree_p2i_linear_rt.cpp +++ b/test/rtree/generated/rtree_p2i_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p2tt_linear.cpp b/test/rtree/generated/rtree_p2tt_linear.cpp index 7f1069109..d2d6389f2 100644 --- a/test/rtree/generated/rtree_p2tt_linear.cpp +++ b/test/rtree/generated/rtree_p2tt_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_p2tt_rstar_rt.cpp b/test/rtree/generated/rtree_p2tt_linear_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_p2tt_rstar_rt.cpp rename to test/rtree/generated/rtree_p2tt_linear_dyn.cpp index 5464a8f1a..542f7288e 100644 --- a/test/rtree/generated/rtree_p2tt_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p2tt_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_p2tt_quadratic.cpp b/test/rtree/generated/rtree_p2tt_quadratic.cpp index b1502cf7c..7d72d3920 100644 --- a/test/rtree/generated/rtree_p2tt_quadratic.cpp +++ b/test/rtree/generated/rtree_p2tt_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_p2tt_quadratic_rt.cpp b/test/rtree/generated/rtree_p2tt_quadratic_dyn.cpp similarity index 78% rename from test/rtree/generated/rtree_p2tt_quadratic_rt.cpp rename to test/rtree/generated/rtree_p2tt_quadratic_dyn.cpp index 631a7f112..8808d17f5 100644 --- a/test/rtree/generated/rtree_p2tt_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p2tt_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_p2tt_rstar.cpp b/test/rtree/generated/rtree_p2tt_rstar.cpp index a92617bf2..cd0ce4463 100644 --- a/test/rtree/generated/rtree_p2tt_rstar.cpp +++ b/test/rtree/generated/rtree_p2tt_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_p2tt_linear_rt.cpp b/test/rtree/generated/rtree_p2tt_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_p2tt_linear_rt.cpp rename to test/rtree/generated/rtree_p2tt_rstar_dyn.cpp index 1520a3f20..68c19615c 100644 --- a/test/rtree/generated/rtree_p2tt_linear_rt.cpp +++ b/test/rtree/generated/rtree_p2tt_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_p3d_linear.cpp b/test/rtree/generated/rtree_p3d_linear.cpp index f7d143a1a..c75060b8e 100644 --- a/test/rtree/generated/rtree_p3d_linear.cpp +++ b/test/rtree/generated/rtree_p3d_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3d_rstar_rt.cpp b/test/rtree/generated/rtree_p3d_linear_dyn.cpp similarity index 78% rename from test/rtree/generated/rtree_p3d_rstar_rt.cpp rename to test/rtree/generated/rtree_p3d_linear_dyn.cpp index bea115c70..04d4d22d2 100644 --- a/test/rtree/generated/rtree_p3d_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p3d_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3d_quadratic.cpp b/test/rtree/generated/rtree_p3d_quadratic.cpp index 2d92eef5d..be83b580c 100644 --- a/test/rtree/generated/rtree_p3d_quadratic.cpp +++ b/test/rtree/generated/rtree_p3d_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3d_quadratic_rt.cpp b/test/rtree/generated/rtree_p3d_quadratic_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p3d_quadratic_rt.cpp rename to test/rtree/generated/rtree_p3d_quadratic_dyn.cpp index 553dea5cc..d4f188fea 100644 --- a/test/rtree/generated/rtree_p3d_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p3d_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3d_rstar.cpp b/test/rtree/generated/rtree_p3d_rstar.cpp index b1e00bd33..fa4aabbe2 100644 --- a/test/rtree/generated/rtree_p3d_rstar.cpp +++ b/test/rtree/generated/rtree_p3d_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3d_linear_rt.cpp b/test/rtree/generated/rtree_p3d_rstar_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p3d_linear_rt.cpp rename to test/rtree/generated/rtree_p3d_rstar_dyn.cpp index e413d09c5..068d17f9c 100644 --- a/test/rtree/generated/rtree_p3d_linear_rt.cpp +++ b/test/rtree/generated/rtree_p3d_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3f_linear.cpp b/test/rtree/generated/rtree_p3f_linear.cpp index 9cc816df5..b2ec1809f 100644 --- a/test/rtree/generated/rtree_p3f_linear.cpp +++ b/test/rtree/generated/rtree_p3f_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3f_rstar_rt.cpp b/test/rtree/generated/rtree_p3f_linear_dyn.cpp similarity index 78% rename from test/rtree/generated/rtree_p3f_rstar_rt.cpp rename to test/rtree/generated/rtree_p3f_linear_dyn.cpp index c07a1ea30..4c066ed02 100644 --- a/test/rtree/generated/rtree_p3f_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p3f_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3f_quadratic.cpp b/test/rtree/generated/rtree_p3f_quadratic.cpp index 060a49795..2dc5b9257 100644 --- a/test/rtree/generated/rtree_p3f_quadratic.cpp +++ b/test/rtree/generated/rtree_p3f_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3f_quadratic_rt.cpp b/test/rtree/generated/rtree_p3f_quadratic_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p3f_quadratic_rt.cpp rename to test/rtree/generated/rtree_p3f_quadratic_dyn.cpp index 8ed2a9dcc..de4e1d940 100644 --- a/test/rtree/generated/rtree_p3f_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p3f_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3f_rstar.cpp b/test/rtree/generated/rtree_p3f_rstar.cpp index d0b0b5e2f..ac62ff650 100644 --- a/test/rtree/generated/rtree_p3f_rstar.cpp +++ b/test/rtree/generated/rtree_p3f_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3f_linear_rt.cpp b/test/rtree/generated/rtree_p3f_rstar_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p3f_linear_rt.cpp rename to test/rtree/generated/rtree_p3f_rstar_dyn.cpp index 1dc3bc40f..a6776e1c5 100644 --- a/test/rtree/generated/rtree_p3f_linear_rt.cpp +++ b/test/rtree/generated/rtree_p3f_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3i_linear.cpp b/test/rtree/generated/rtree_p3i_linear.cpp index 5db6a7926..082f2ae55 100644 --- a/test/rtree/generated/rtree_p3i_linear.cpp +++ b/test/rtree/generated/rtree_p3i_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3i_rstar_rt.cpp b/test/rtree/generated/rtree_p3i_linear_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p3i_rstar_rt.cpp rename to test/rtree/generated/rtree_p3i_linear_dyn.cpp index c13c3f673..c23d66f47 100644 --- a/test/rtree/generated/rtree_p3i_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p3i_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3i_quadratic.cpp b/test/rtree/generated/rtree_p3i_quadratic.cpp index ebbe705ec..65e66af48 100644 --- a/test/rtree/generated/rtree_p3i_quadratic.cpp +++ b/test/rtree/generated/rtree_p3i_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3i_quadratic_rt.cpp b/test/rtree/generated/rtree_p3i_quadratic_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p3i_quadratic_rt.cpp rename to test/rtree/generated/rtree_p3i_quadratic_dyn.cpp index 4a3aab46a..0590eef25 100644 --- a/test/rtree/generated/rtree_p3i_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p3i_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3i_rstar.cpp b/test/rtree/generated/rtree_p3i_rstar.cpp index c33e48617..2e2407f66 100644 --- a/test/rtree/generated/rtree_p3i_rstar.cpp +++ b/test/rtree/generated/rtree_p3i_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); return 0; } diff --git a/test/rtree/generated/rtree_p3i_linear_rt.cpp b/test/rtree/generated/rtree_p3i_rstar_dyn.cpp similarity index 77% rename from test/rtree/generated/rtree_p3i_linear_rt.cpp rename to test/rtree/generated/rtree_p3i_rstar_dyn.cpp index 19fb4a70a..d97b0e07d 100644 --- a/test/rtree/generated/rtree_p3i_linear_rt.cpp +++ b/test/rtree/generated/rtree_p3i_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +14,6 @@ int test_main(int, char* []) { typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); return 0; } diff --git a/test/rtree/generated/rtree_p3tt_linear.cpp b/test/rtree/generated/rtree_p3tt_linear.cpp index d5d10511c..2bf383ad8 100644 --- a/test/rtree/generated/rtree_p3tt_linear.cpp +++ b/test/rtree/generated/rtree_p3tt_linear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::linear<4, 2>()); + test_rtree_for_point(bgi::linear<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_p3tt_rstar_rt.cpp b/test/rtree/generated/rtree_p3tt_linear_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_p3tt_rstar_rt.cpp rename to test/rtree/generated/rtree_p3tt_linear_dyn.cpp index d07498686..d939880c6 100644 --- a/test/rtree/generated/rtree_p3tt_rstar_rt.cpp +++ b/test/rtree/generated/rtree_p3tt_linear_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::rstar(4, 2)); + test_rtree_for_point(bgi::dynamic_linear(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_p3tt_quadratic.cpp b/test/rtree/generated/rtree_p3tt_quadratic.cpp index 687868a19..74faf4548 100644 --- a/test/rtree/generated/rtree_p3tt_quadratic.cpp +++ b/test/rtree/generated/rtree_p3tt_quadratic.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::quadratic<4, 2>()); + test_rtree_for_point(bgi::quadratic<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_p3tt_quadratic_rt.cpp b/test/rtree/generated/rtree_p3tt_quadratic_dyn.cpp similarity index 78% rename from test/rtree/generated/rtree_p3tt_quadratic_rt.cpp rename to test/rtree/generated/rtree_p3tt_quadratic_dyn.cpp index c23896e92..f6dd08433 100644 --- a/test/rtree/generated/rtree_p3tt_quadratic_rt.cpp +++ b/test/rtree/generated/rtree_p3tt_quadratic_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::quadratic(4, 2)); + test_rtree_for_point(bgi::dynamic_quadratic(8, 3)); #endif return 0; } diff --git a/test/rtree/generated/rtree_p3tt_rstar.cpp b/test/rtree/generated/rtree_p3tt_rstar.cpp index 4205017eb..8b5bc8c1e 100644 --- a/test/rtree/generated/rtree_p3tt_rstar.cpp +++ b/test/rtree/generated/rtree_p3tt_rstar.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::rstar<4, 2>()); + test_rtree_for_point(bgi::rstar<8, 3>()); #endif return 0; } diff --git a/test/rtree/generated/rtree_p3tt_linear_rt.cpp b/test/rtree/generated/rtree_p3tt_rstar_dyn.cpp similarity index 79% rename from test/rtree/generated/rtree_p3tt_linear_rt.cpp rename to test/rtree/generated/rtree_p3tt_rstar_dyn.cpp index b4e8ac342..637087f0d 100644 --- a/test/rtree/generated/rtree_p3tt_linear_rt.cpp +++ b/test/rtree/generated/rtree_p3tt_rstar_dyn.cpp @@ -1,7 +1,7 @@ // Boost.Geometry Index // Unit Test -// Copyright (c) 2011-2012 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ int test_main(int, char* []) { #ifdef HAVE_TTMATH typedef bg::model::point Point; - test_rtree_for_point(bgi::runtime::linear(4, 2)); + test_rtree_for_point(bgi::dynamic_rstar(8, 3)); #endif return 0; } diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_rstar_rt.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_linear_dyn.cpp similarity index 87% rename from test/rtree/interprocess/rtree_interprocess_b2f_rstar_rt.cpp rename to test/rtree/interprocess/rtree_interprocess_b2f_linear_dyn.cpp index 4a4504f15..94a6e00ed 100644 --- a/test/rtree/interprocess/rtree_interprocess_b2f_rstar_rt.cpp +++ b/test/rtree/interprocess/rtree_interprocess_b2f_linear_dyn.cpp @@ -13,7 +13,7 @@ int test_main(int, char* []) { typedef bg::model::point P2f; - test_rtree_interprocess(bgi::runtime::rstar(32, 8)); + test_rtree_interprocess(bgi::dynamic_linear(32, 8)); return 0; } diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_quadratic_rt.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_quadratic_dyn.cpp similarity index 87% rename from test/rtree/interprocess/rtree_interprocess_b2f_quadratic_rt.cpp rename to test/rtree/interprocess/rtree_interprocess_b2f_quadratic_dyn.cpp index 1bc58b2e7..29a962666 100644 --- a/test/rtree/interprocess/rtree_interprocess_b2f_quadratic_rt.cpp +++ b/test/rtree/interprocess/rtree_interprocess_b2f_quadratic_dyn.cpp @@ -13,7 +13,7 @@ int test_main(int, char* []) { typedef bg::model::point P2f; - test_rtree_interprocess(bgi::runtime::quadratic(32, 8)); + test_rtree_interprocess(bgi::dynamic_quadratic(32, 8)); return 0; } diff --git a/test/rtree/interprocess/rtree_interprocess_b2f_linear_rt.cpp b/test/rtree/interprocess/rtree_interprocess_b2f_rstar_dyn.cpp similarity index 87% rename from test/rtree/interprocess/rtree_interprocess_b2f_linear_rt.cpp rename to test/rtree/interprocess/rtree_interprocess_b2f_rstar_dyn.cpp index 44c15b52d..15d58698c 100644 --- a/test/rtree/interprocess/rtree_interprocess_b2f_linear_rt.cpp +++ b/test/rtree/interprocess/rtree_interprocess_b2f_rstar_dyn.cpp @@ -13,7 +13,7 @@ int test_main(int, char* []) { typedef bg::model::point P2f; - test_rtree_interprocess(bgi::runtime::linear(32, 8)); + test_rtree_interprocess(bgi::dynamic_rstar(32, 8)); return 0; } diff --git a/test/rtree/rtree_test_generator.cpp b/test/rtree/rtree_test_generator.cpp index fabc634f4..676a99d16 100644 --- a/test/rtree/rtree_test_generator.cpp +++ b/test/rtree/rtree_test_generator.cpp @@ -30,12 +30,12 @@ int main() typedef boost::tuple P; std::vector

                                                                          parameters; - parameters.push_back(boost::make_tuple("bgi::linear<4, 2>()", "linear")); - parameters.push_back(boost::make_tuple("bgi::quadratic<4, 2>()", "quadratic")); - parameters.push_back(boost::make_tuple("bgi::rstar<4, 2>()", "rstar")); - parameters.push_back(boost::make_tuple("bgi::runtime::linear(4, 2)", "linear_rt")); - parameters.push_back(boost::make_tuple("bgi::runtime::quadratic(4, 2)", "quadratic_rt")); - parameters.push_back(boost::make_tuple("bgi::runtime::rstar(4, 2)","rstar_rt")); + parameters.push_back(boost::make_tuple("bgi::linear<8, 3>()", "linear")); + parameters.push_back(boost::make_tuple("bgi::quadratic<8, 3>()", "quadratic")); + parameters.push_back(boost::make_tuple("bgi::rstar<8, 3>()", "rstar")); + parameters.push_back(boost::make_tuple("bgi::dynamic_linear(8, 3)", "linear_dyn")); + parameters.push_back(boost::make_tuple("bgi::dynamic_quadratic(8, 3)", "quadratic_dyn")); + parameters.push_back(boost::make_tuple("bgi::dynamic_rstar(8, 3)","rstar_dyn")); std::vector indexables; indexables.push_back("p"); From 0afdadc5c4f15536258d587dbf5153c648f1ab88 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 1 Mar 2013 02:59:39 +0000 Subject: [PATCH 348/366] value() predicate renamed to satisfies() [SVN r83224] --- doc/generated/predicates.qbk | 74 ++++++++-- doc/generated/rtree.qbk | 6 +- doc/generated/rtree_functions.qbk | 4 +- doc/html/geometry_index/r_tree.html | 2 +- doc/html/geometry_index/r_tree/queries.html | 15 +- doc/html/geometry_index/r_tree/reference.html | 131 +++++++++++++----- doc/html/index.html | 2 +- doc/rtree/query.qbk | 8 +- .../geometry/index/detail/predicates.hpp | 14 +- include/boost/geometry/index/predicates.hpp | 57 ++++++-- include/boost/geometry/index/rtree.hpp | 6 +- test/rtree/test_rtree.hpp | 14 +- 12 files changed, 241 insertions(+), 92 deletions(-) diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 6129af70b..558e8654e 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -9,8 +9,8 @@ [[[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 `intersects(Geometry const &)`]][Generate [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 intersects()]] predicate. ]] [[[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 `overlaps(Geometry const &)`]][Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. ]] [[[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d `within(Geometry const &)`]][Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. ]] -[[[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce `value(Fun const &)`]][Generate value predicate. ]] -[[[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 `nearest(PointOrRelation const &, unsigned)`]][Generate nearest predicate. ]] +[[[link group__predicates_1gae7e9291c5b99041fb155d29de0860bab `satisfies(UnaryPredicate const &)`]][Generate [link group__predicates_1gae7e9291c5b99041fb155d29de0860bab satisfies()] predicate. ]] +[[[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 `nearest(PointOrRelation const &, unsigned)`]][Generate [link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()] predicate. ]] ] [#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61] @@ -35,6 +35,13 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret [[Type][Name][Description]] [[`Geometry const &`][ `g` ][The Geometry object. ]] ] +[heading Example] + +`` +bgi::query(spatial_index, bgi::covered_by(box), std::back_inserter(result)); +`` + + [endsect] [#group__predicates_1ga351bb3b82e019ff45adf789385b8007d] @@ -59,6 +66,13 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret [[Type][Name][Description]] [[`Geometry const &`][ `g` ][The Geometry object. ]] ] +[heading Example] + +`` +bgi::query(spatial_index, bgi::disjoint(box), std::back_inserter(result)); +`` + + [endsect] [#group__predicates_1ga7301c50e0272976b9f1434536383e6d0] @@ -83,6 +97,15 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret [[Type][Name][Description]] [[`Geometry const &`][ `g` ][The Geometry object. ]] ] +[heading Example] + +`` +bgi::query(spatial_index, bgi::intersects(box), std::back_inserter(result)); +bgi::query(spatial_index, bgi::intersects(ring), std::back_inserter(result)); +bgi::query(spatial_index, bgi::intersects(polygon), std::back_inserter(result)); +`` + + [endsect] [#group__predicates_1ga5511236f56be1defcccbf11e742ccd88] @@ -107,6 +130,13 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret [[Type][Name][Description]] [[`Geometry const &`][ `g` ][The Geometry object. ]] ] +[heading Example] + +`` +bgi::query(spatial_index, bgi::overlaps(box), std::back_inserter(result)); +`` + + [endsect] [#group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d] @@ -131,35 +161,51 @@ Generate a predicate defining Value and Geometry relationship. Value will be ret [[Type][Name][Description]] [[`Geometry const &`][ `g` ][The Geometry object. ]] ] +[heading Example] + +`` +bgi::query(spatial_index, bgi::within(box), std::back_inserter(result)); +`` + + [endsect] -[#group__predicates_1ga8acb81106fce01da72f310184ab4d9ce] -[section value(Fun const &)] -Generate value predicate. +[#group__predicates_1gae7e9291c5b99041fb155d29de0860bab] +[section satisfies(UnaryPredicate const &)] +Generate [link group__predicates_1gae7e9291c5b99041fb155d29de0860bab satisfies()] predicate. [heading Description] -A wrapper around user-defined functor describing if Value should be returned by spatial query.[heading Synopsis] +A wrapper around user-defined UnaryPredicate checking if Value should be returned by spatial query.[heading Synopsis] [pre -`template<``typename Fun``>` -`detail::value boost::geometry::index::value``(``Fun const &` `fun``)` +`template<``typename UnaryPredicate``>` +`detail::satisfies boost::geometry::index::satisfies``(``UnaryPredicate const &` `pred``)` ] [heading Template parameter(s)] [table [[Parameter] [Description]] -[[`Fun`][Functor type.]] +[[`UnaryPredicate`][A type of unary predicate function or function object.]] ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`Fun const &`][ `fun` ][The functor. ]] +[[`UnaryPredicate const &`][ `pred` ][The unary predicate function or function object. ]] ] +[heading Example] + +`` +bool is_red(Value const& v) { ... } +... +bgi::query(spatial_index, bgi::intersects(box) && bgi::satisfies(is_red), std::back_inserter(result)); +`` + + [endsect] [#group__predicates_1gae80a2c204673a8b11c4fc137cfff6556] [section nearest(PointOrRelation const &, unsigned)] -Generate nearest predicate. +Generate [link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()] predicate. [heading Description] When nearest predicate is passed to the query, k-nearest neighbour search will be performed. @@ -187,9 +233,9 @@ It is possible to define how distance between values and query Point is calculat [heading Example] `` -tree.query(bgi::nearest(pt, 5), std::back_inserter(result)); -tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); -tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); +bgi::query(spatial_index, bgi::nearest(pt, 5), std::back_inserter(result)); +bgi::query(spatial_index, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +bgi::query(spatial_index, bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); `` diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 0194acf34..08affd337 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -630,7 +630,7 @@ It is possible to negate spatial predicates: This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: -* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. +* [^`boost::geometry::index::value()`]. [*Nearest predicate] @@ -662,8 +662,8 @@ The number of values found. tree.query(box, std::back_inserter(result)); // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); -// return elements overlapping box and meeting my_fun value predicate -tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +// return elements overlapping box and meeting my_fun unary predicate +tree.query(bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result)); // return 5 elements nearest to pt and elements are intersecting box tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); // return 5 elements which centroids are nearest to pt and elements aren't within box diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index f91bfe149..60110d045 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -202,7 +202,7 @@ It is possible to negate spatial predicates: This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: -* [^[link group__predicates_1ga8acb81106fce01da72f310184ab4d9ce boost::geometry::index::value()]]. +* [^`boost::geometry::index::value()`]. [*Nearest predicate] @@ -242,7 +242,7 @@ bgi::query(tree, box, std::back_inserter(result)); // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate -bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +bgi::query(tree, bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result)); // return 5 elements nearest to pt and elements are intersecting box bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); // return 5 elements which centroids are nearest to pt and elements aren't within box diff --git a/doc/html/geometry_index/r_tree.html b/doc/html/geometry_index/r_tree.html index c34629cbf..3b11e3a94 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -57,7 +57,7 @@ queries

                                                                          Nearest neighbours queries
                                                                          -
                                                                          Value +
                                                                          Satisfies predicate
                                                                          Passing a set of predicates
                                                                          diff --git a/doc/html/geometry_index/r_tree/queries.html b/doc/html/geometry_index/r_tree/queries.html index 7a2a90633..304a999e6 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -33,7 +33,7 @@ queries
                                                                          Nearest neighbours queries
                                                                          -
                                                                          Value +
                                                                          Satisfies predicate
                                                                          Passing a set of predicates
                                                                          @@ -54,7 +54,8 @@ some Point,
                                                                        • - value predicate - passing user-defined functor to the query. + satisfies predicate - allows to pass user-defined UnaryPredicate (function + or function object) to the query.

                                                                        @@ -313,13 +314,13 @@

                                                                      - There is a unique predicate index::value(...) taking user-defined function/functor - which checks if Value should be returned by the query. It - may be used to check some specific conditions for user-defined Values. + There is a unique predicate index::satisfies(...) taking user-defined function or function + object which checks if Value should be returned by the query. + It may be used to check some specific conditions for user-defined Values.

                                                                      bool fun(Value const& v)
                                                                       {
                                                                      @@ -328,7 +329,7 @@
                                                                       
                                                                       // ...
                                                                       
                                                                      -rt.query(index::intersects(box) && index::value(fun),
                                                                      +rt.query(index::intersects(box) && index::satisfies(fun),
                                                                                std::back_inserter(result));
                                                                       
                                                                      diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 68418307a..783af34a2 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -2602,7 +2602,7 @@ by:

                                                                      Nearest predicate @@ -2719,8 +2719,8 @@ tree.query(box, std::back_inserter(result)); // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); -// return elements overlapping box and meeting my_fun value predicate -tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +// return elements overlapping box and meeting my_fun unary predicate +tree.query(bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result)); // return 5 elements nearest to pt and elements are intersecting box tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); // return 5 elements which centroids are nearest to pt and elements aren't within box @@ -4018,7 +4018,7 @@ by:

                                                                      Nearest predicate @@ -4156,7 +4156,7 @@ // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate -bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +bgi::query(tree, bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result)); // return 5 elements nearest to pt and elements are intersecting box bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); // return 5 elements which centroids are nearest to pt and elements aren't within box @@ -5479,13 +5479,14 @@

                                                                      - value(Fun const + satisfies(UnaryPredicate const &)

                                                                      - Generate value predicate. + Generate satisfies() + predicate.

                                                                      @@ -5498,7 +5499,8 @@

                                                                      - Generate nearest predicate. + Generate nearest() + predicate.

                                                                      @@ -5609,6 +5611,16 @@
                                                                    +
                                                                    + + Example +
                                                                    +

                                                                    +

                                                                    +
                                                                    bgi::query(spatial_index, bgi::covered_by(box), std::back_inserter(result));
                                                                    +
                                                                    +

                                                                    +

                                                                  @@ -5715,6 +5727,16 @@
                                                                  +
                                                                  + + Example +
                                                                  +

                                                                  +

                                                                  +
                                                                  bgi::query(spatial_index, bgi::disjoint(box), std::back_inserter(result));
                                                                  +
                                                                  +

                                                                  +

                                                                  @@ -5821,6 +5843,18 @@
                                                                  +
                                                                  + + Example +
                                                                  +

                                                                  +

                                                                  +
                                                                  bgi::query(spatial_index, bgi::intersects(box), std::back_inserter(result));
                                                                  +bgi::query(spatial_index, bgi::intersects(ring), std::back_inserter(result));
                                                                  +bgi::query(spatial_index, bgi::intersects(polygon), std::back_inserter(result));
                                                                  +
                                                                  +

                                                                  +

                                                                  @@ -5927,6 +5961,16 @@
                                                                  +
                                                                  + + Example +
                                                                  +

                                                                  +

                                                                  +
                                                                  bgi::query(spatial_index, bgi::overlaps(box), std::back_inserter(result));
                                                                  +
                                                                  +

                                                                  +

                                                                  @@ -6033,33 +6077,44 @@
                                                                  +
                                                                  + + Example +
                                                                  +

                                                                  +

                                                                  +
                                                                  bgi::query(spatial_index, bgi::within(box), std::back_inserter(result));
                                                                  +
                                                                  +

                                                                  +

                                                                  - Generate value predicate. + Generate satisfies() + predicate.

                                                                  - - Description + + Description

                                                                  - A wrapper around user-defined functor describing if Value should be returned - by spatial query. + A wrapper around user-defined UnaryPredicate checking if Value should + be returned by spatial query.

                                                                  - - Synopsis + + Synopsis
                                                                  -
                                                                  template<typename Fun>
                                                                  -detail::value<Fun> boost::geometry::index::value(Fun const & fun)
                                                                  +
                                                                  template<typename UnaryPredicate>
                                                                  +detail::satisfies<UnaryPredicate> boost::geometry::index::satisfies(UnaryPredicate const & pred)
                                                                   
                                                                  - - Template + + Template parameter(s)
                                                                  @@ -6082,19 +6137,19 @@

                                                                  - Fun + UnaryPredicate

                                                                  - Functor type. + A type of unary predicate function or function object.

                                                                  - - Parameter(s) + + Parameter(s)
                                                                  @@ -6122,22 +6177,33 @@

                                                                  - Fun const - & + UnaryPredicate const &

                                                                  - fun + pred

                                                                  - The functor. + The unary predicate function or function object.

                                                                  +
                                                                  + + Example +
                                                                  +

                                                                  +

                                                                  +
                                                                  bool is_red(Value const& v) { ... }
                                                                  +...
                                                                  +bgi::query(spatial_index, bgi::intersects(box) && bgi::satisfies(is_red), std::back_inserter(result));
                                                                  +
                                                                  +

                                                                  +

                                                                  @@ -6145,7 +6211,8 @@ const &, unsigned)

                                                                  - Generate nearest predicate. + Generate nearest() + predicate.

                                                                  @@ -6252,9 +6319,9 @@

                                                                  -
                                                                  tree.query(bgi::nearest(pt, 5), std::back_inserter(result));
                                                                  -tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result));
                                                                  -tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result));
                                                                  +
                                                                  bgi::query(spatial_index, bgi::nearest(pt, 5), std::back_inserter(result));
                                                                  +bgi::query(spatial_index, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result));
                                                                  +bgi::query(spatial_index, bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result));
                                                                   

                                                                  diff --git a/doc/html/index.html b/doc/html/index.html index 22b189b70..7a78e45d9 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
                                                                  - +

                                                                  Last revised: February 27, 2013 at 11:59:54 GMT

                                                                  Last revised: March 01, 2013 at 02:58:06 GMT


                                                                  diff --git a/doc/rtree/query.qbk b/doc/rtree/query.qbk index cbbebb92d..e905180d6 100644 --- a/doc/rtree/query.qbk +++ b/doc/rtree/query.qbk @@ -14,7 +14,7 @@ Queries returns `__value__`s which meets some predicates. Currently supported ar * spatial predicates - defining relationship between stored Values and some Geometry, * nearest predicates - defining relationship between stored Values and some Point, -* value predicate - passing user-defined functor to the query. +* satisfies predicate - allows to pass user-defined UnaryPredicate (function or function object) to the query. For example queries may be used to retrieve Values: @@ -134,9 +134,9 @@ a relation object generated as follows: [endsect] -[section Value predicate] +[section Satisfies predicate] -There is a unique predicate `index::value(...)` taking user-defined function/functor +There is a unique predicate `index::satisfies(...)` taking user-defined function or function object which checks if `__value__` should be returned by the query. It may be used to check some specific conditions for user-defined Values. @@ -147,7 +147,7 @@ some specific conditions for user-defined Values. // ... - rt.query(index::intersects(box) && index::value(fun), + rt.query(index::intersects(box) && index::satisfies(fun), std::back_inserter(result)); [endsect] diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index fa5067a31..e58aa511b 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -20,12 +20,13 @@ namespace boost { namespace geometry { namespace index { namespace detail { // predicates // ------------------------------------------------------------------ // +// not needed? struct empty {}; template -struct value +struct satisfies { - value(Fun const& f) : fun(f) {} + satisfies(Fun const& f) : fun(f) {} Fun const& fun; }; @@ -151,6 +152,7 @@ struct predicate_check } }; +// not needed? template <> struct predicate_check { @@ -162,10 +164,10 @@ struct predicate_check }; template -struct predicate_check, value_tag> +struct predicate_check, value_tag> { template - static inline bool apply(value const& p, Value const& v, Indexable const&) + static inline bool apply(satisfies const& p, Value const& v, Indexable const&) { return p.fun(v); } @@ -326,10 +328,10 @@ struct predicate_check }; template -struct predicate_check, bounds_tag> +struct predicate_check, bounds_tag> { template - static bool apply(value const&, Value const&, Box const&) + static bool apply(satisfies const&, Value const&, Box const&) { return true; } diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index baba6f890..a7cd3c318 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -34,6 +34,11 @@ Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::covered_by(Indexable, Geometry) returns true. +\par Example +\verbatim +bgi::query(spatial_index, bgi::covered_by(box), std::back_inserter(result)); +\endverbatim + \ingroup predicates \tparam Geometry The Geometry type. @@ -53,6 +58,11 @@ Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::disjoint(Indexable, Geometry) returns true. +\par Example +\verbatim +bgi::query(spatial_index, bgi::disjoint(box), std::back_inserter(result)); +\endverbatim + \ingroup predicates \tparam Geometry The Geometry type. @@ -72,6 +82,13 @@ Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::intersects(Indexable, Geometry) returns true. +\par Example +\verbatim +bgi::query(spatial_index, bgi::intersects(box), std::back_inserter(result)); +bgi::query(spatial_index, bgi::intersects(ring), std::back_inserter(result)); +bgi::query(spatial_index, bgi::intersects(polygon), std::back_inserter(result)); +\endverbatim + \ingroup predicates \tparam Geometry The Geometry type. @@ -91,6 +108,11 @@ Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::overlaps(Indexable, Geometry) returns true. +\par Example +\verbatim +bgi::query(spatial_index, bgi::overlaps(box), std::back_inserter(result)); +\endverbatim + \ingroup predicates \tparam Geometry The Geometry type. @@ -129,6 +151,11 @@ Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if bg::within(Indexable, Geometry) returns true. +\par Example +\verbatim +bgi::query(spatial_index, bgi::within(box), std::back_inserter(result)); +\endverbatim + \ingroup predicates \tparam Geometry The Geometry type. @@ -142,25 +169,31 @@ inline detail::within within(Geometry const& g) } /*! -\brief Generate value predicate. +\brief Generate satisfies() predicate. -A wrapper around user-defined functor -describing if Value should be returned by spatial query. +A wrapper around user-defined UnaryPredicate checking if Value should be returned by spatial query. + +\par Example +\verbatim +bool is_red(Value const& v) { ... } +... +bgi::query(spatial_index, bgi::intersects(box) && bgi::satisfies(is_red), std::back_inserter(result)); +\endverbatim \ingroup predicates -\tparam Fun Functor type. +\tparam UnaryPredicate A type of unary predicate function or function object. -\param fun The functor. +\param pred The unary predicate function or function object. */ -template -inline detail::value value(Fun const& fun) +template +inline detail::satisfies satisfies(UnaryPredicate const& pred) { - return detail::value(fun); + return detail::satisfies(pred); } /*! -\brief Generate nearest predicate. +\brief Generate nearest() predicate. When nearest predicate is passed to the query, k-nearest neighbour search will be performed. @@ -174,9 +207,9 @@ It can be generated by following functions: \par Example \verbatim -tree.query(bgi::nearest(pt, 5), std::back_inserter(result)); -tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); -tree.query(bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); +bgi::query(spatial_index, bgi::nearest(pt, 5), std::back_inserter(result)); +bgi::query(spatial_index, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); +bgi::query(spatial_index, bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result)); \endverbatim \warning diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 537344fe0..c6ac359a2 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -634,8 +634,8 @@ public: tree.query(box, std::back_inserter(result)); // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); - // return elements overlapping box and meeting my_fun value predicate - tree.query(bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); + // return elements overlapping box and meeting my_fun unary predicate + tree.query(bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result)); // return 5 elements nearest to pt and elements are intersecting box tree.query(bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); // return 5 elements which centroids are nearest to pt and elements aren't within box @@ -1286,7 +1286,7 @@ bgi::query(tree, box, std::back_inserter(result)); // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate -bgi::query(tree, bgi::overlaps(box) && bgi::value(my_fun), std::back_inserter(result)); +bgi::query(tree, bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result)); // return 5 elements nearest to pt and elements are intersecting box bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); // return 5 elements which centroids are nearest to pt and elements aren't within box diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 62877cb2d..09555e38a 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -832,32 +832,32 @@ void test_nearest_query_not_found(Rtree const& rtree, Point const& pt) typedef typename Rtree::value_type Value; std::vector output_v; - size_t n_res = rtree.query(bgi::nearest(pt, 5) && bgi::value(AlwaysFalse()), std::back_inserter(output_v)); + size_t n_res = rtree.query(bgi::nearest(pt, 5) && bgi::satisfies(AlwaysFalse()), std::back_inserter(output_v)); BOOST_CHECK(output_v.size() == n_res); BOOST_CHECK(n_res < 5); } template -bool test_value_fun(Value const& v) { return true; } +bool test_satisfies_fun(Value const& ) { return true; } -struct test_value_obj +struct test_satisfies_obj { template - bool operator()(Value const& v) const { return true; } + bool operator()(Value const& ) const { return true; } }; template void test_value_predicate(Rtree const& rtree, std::vector const& input) { std::vector result; - rtree.query(bgi::value(test_value_obj()), std::back_inserter(result)); + rtree.query(bgi::satisfies(test_satisfies_obj()), std::back_inserter(result)); BOOST_CHECK(result.size() == input.size()); result.clear(); - rtree.query(bgi::value(test_value_fun), std::back_inserter(result)); + rtree.query(bgi::satisfies(test_satisfies_fun), std::back_inserter(result)); BOOST_CHECK(result.size() == input.size()); #ifndef BOOST_NO_CXX11_LAMBDAS result.clear(); - rtree.query(bgi::value([](Value const& v){ return true; }), std::back_inserter(result)); + rtree.query(bgi::satisfies([](Value const& v){ return true; }), std::back_inserter(result)); BOOST_CHECK(result.size() == input.size()); #endif } From 0bc541d1e9c4b0e82ee7c6d9d3607cb3a5f231f0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 1 Mar 2013 18:14:46 +0000 Subject: [PATCH 349/366] rtree query default spatial predicate removed. Explicit call of intersects() is expected. Predicates and DistancePredicates are stored by value in visitors. Each predicate is stored by value in expression tuple. Examples and docs updated. [SVN r83232] --- doc/generated/predicates.qbk | 21 +- doc/generated/rtree.qbk | 12 +- doc/generated/rtree_functions.qbk | 12 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 6 +- .../r_tree/creation_and_modification.html | 10 +- .../geometry_index/r_tree/introduction.html | 28 +- doc/html/geometry_index/r_tree/queries.html | 88 +-- doc/html/geometry_index/r_tree/reference.html | 601 +++++++++--------- .../geometry_index/r_tree/rtree_examples.html | 16 +- .../r_tree/rtree_quickstart.html | 6 +- doc/html/index.html | 4 +- doc/rtree/query.qbk | 63 +- doc/src/examples/rtree/interprocess.cpp | 2 +- .../examples/rtree/polygons_shared_ptr.cpp | 2 +- doc/src/examples/rtree/polygons_vector.cpp | 2 +- doc/src/examples/rtree/quick_start.cpp | 2 +- doc/src/examples/rtree/translator_index.cpp | 2 +- .../examples/rtree/translator_shared_ptr.cpp | 2 +- doc/src/examples/rtree/variants_map.cpp | 2 +- example/benchmark.cpp | 2 +- .../geometry/index/detail/predicates.hpp | 452 +++++++------ .../detail/rtree/visitors/nearest_query.hpp | 89 +-- .../detail/rtree/visitors/spatial_query.hpp | 4 +- include/boost/geometry/index/predicates.hpp | 42 +- include/boost/geometry/index/rtree.hpp | 28 +- test/rtree/test_rtree.hpp | 44 +- 27 files changed, 846 insertions(+), 698 deletions(-) diff --git a/doc/generated/predicates.qbk b/doc/generated/predicates.qbk index 558e8654e..7b2858581 100644 --- a/doc/generated/predicates.qbk +++ b/doc/generated/predicates.qbk @@ -195,9 +195,24 @@ A wrapper around user-defined UnaryPredicate checking if Value should be returne [heading Example] `` -bool is_red(Value const& v) { ... } -... -bgi::query(spatial_index, bgi::intersects(box) && bgi::satisfies(is_red), std::back_inserter(result)); +bool is_red(__value__ const& v) { return v.is_red(); } + +struct is_red_o { +template bool operator()(__value__ const& v) { return v.is_red(); } +} + +// ... + +rt.query(index::intersects(box) && index::satisfies(is_red), +std::back_inserter(result)); + +rt.query(index::intersects(box) && index::satisfies(is_red_o()), +std::back_inserter(result)); + +#ifndef BOOST_NO_CXX11_LAMBDAS +rt.query(index::intersects(box) && index::satisfies([](__value__ const& v) { return v.is_red(); }), +std::back_inserter(result)); +#endif `` diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 08affd337..cc9b648d1 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -609,11 +609,11 @@ This query function performs spatial and k-nearest neighbor searches. It allows [*Spatial predicates] -The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: +Spatial predicates may be generated by one of the functions listed below: * [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], * [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], * [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], @@ -626,11 +626,11 @@ It is possible to negate spatial predicates: * [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -[*Value predicate] +[*Satisfies predicate] -This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: +This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: -* [^`boost::geometry::index::value()`]. +* [^[link group__predicates_1gae7e9291c5b99041fb155d29de0860bab boost::geometry::index::satisfies()]]. [*Nearest predicate] @@ -659,7 +659,7 @@ The number of values found. `` // return elements intersecting box -tree.query(box, std::back_inserter(result)); +tree.query(bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun unary predicate diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 60110d045..466b7146f 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -181,11 +181,11 @@ This query function performs spatial and k-nearest neighbor searches. It allows [*Spatial predicates] -The simplest form of spatial predicate is a [^`Geometry`]. In this case Values intersecting the [^`Geometry`] are returned. More spatial predicates may be generated by one of the functions listed below: +Spatial predicates may be generated by one of the functions listed below: * [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 boost::geometry::index::covered_by()]], * [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d boost::geometry::index::disjoint()]], -* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]] - default, +* [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 boost::geometry::index::intersects()]], * [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]], @@ -198,11 +198,11 @@ It is possible to negate spatial predicates: * [^`! `[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 boost::geometry::index::overlaps()]], * [^`! `[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d boost::geometry::index::within()]] -[*Value predicate] +[*Satisfies predicate] -This is a special kind of predicate which allows to pass a user-defined functor which checks if Value should be returned by the query. It's generated by: +This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: -* [^`boost::geometry::index::value()`]. +* [^[link group__predicates_1gae7e9291c5b99041fb155d29de0860bab boost::geometry::index::satisfies()]]. [*Nearest predicate] @@ -238,7 +238,7 @@ The number of values found. `` // return elements intersecting box -bgi::query(tree, box, std::back_inserter(result)); +bgi::query(tree, bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd5718dbb..c00e43835 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 3b11e3a94..4bf610979 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -57,8 +57,8 @@ queries
                                                                  Nearest neighbours queries
                                                                  -
                                                                  Satisfies - predicate
                                                                  +
                                                                  user-defined + unary predicate
                                                                  Passing a set of predicates
                                                                  Inserting 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 582f76640..5a53f97f9 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 - + @@ -55,7 +55,7 @@

                                                                  rtree<Value, Parameters, Translator = index::translator<Value>, Allocator> = std::allocator<Value> >
                                                                   
                                                                  -
                                                                    +
                                                                    • Value - type of object which will be stored in the container,
                                                                    • @@ -90,7 +90,7 @@ be handled by the default Translator - index::translator<Value> are defined as follows:

                                                                      -
                                                                        +
                                                                        • Indexable = Point | Box @@ -116,7 +116,7 @@ A Translator is a type which knows how to handle Values. It has two purposes:

                                                                          -
                                                                            +
                                                                            • it translates Value to a more suitable Indexable type which is needed by most of operations, @@ -134,7 +134,7 @@

                                                                              If comparison of two Values is required, the default translator:

                                                                              -
                                                                                +
                                                                                • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 8dc523bbc..74f9022ec 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                                                                            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 + 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 [2]. + close to some point in space [2].

                                                                            The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                                                                            The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -181,13 +181,13 @@

                                                                          - Implementation + Implementation details

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

                                                                          -
                                                                            +
                                                                            • capable to store arbitrary Value type,
                                                                            • @@ -211,7 +211,7 @@
                                                                            - Dependencies + Dependencies

                                                                            R-tree depends on Boost.Move, Boost.Container, Boost.Tuple, @@ -219,7 +219,7 @@

                                                                            - Contributors + Contributors

                                                                            The spatial index was originally started by Federico J. Fernandez during @@ -227,7 +227,7 @@

                                                                            - Spatial + Spatial thanks

                                                                            @@ -235,20 +235,20 @@ J. Simonson for their support and ideas.

                                                                            -

                                                                            -

                                                                            [1] +


                                                                            +

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

                                                                            -

                                                                            [2] +

                                                                            [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                                                                            -

                                                                            [3] +

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

                                                                            -

                                                                            [4] +

                                                                            [4] 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/queries.html b/doc/html/geometry_index/r_tree/queries.html index 304a999e6..2429cdc5f 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -33,8 +33,8 @@ queries
                                                                  Nearest neighbours queries
                                                                  -
                                                                  Satisfies - predicate
                                                                  +
                                                                  user-defined + unary predicate
                                                                  Passing a set of predicates
                                                                  Inserting @@ -44,24 +44,24 @@ Queries returns Values which meets some predicates. Currently supported are three types of predicates:

                                                                  -

                                                                  - There are three ways to perform a query. In the following example Box - is used as the predicate, this is a default spatial predicate described - in the following section. Following queries returns Values - intersecting some region defined as a Box. - These three ways are: + There are three ways to perform a query presented below. All of them returns + Values intersecting some region defined as a Box.

                                                                  Method call

                                                                  std::vector<Value> returned_values;
                                                                   Box box_region(...);
                                                                  -rt.query(box_region, std::back_inserter(returned_values));
                                                                  +rt.query(bgi::intersects(box_region), std::back_inserter(returned_values));
                                                                   

                                                                  Function call

                                                                  std::vector<Value> returned_values;
                                                                   Box box_region(...);
                                                                  -index::query(rt, box_region, std::back_inserter(returned_values));
                                                                  +index::query(rt, bgi::intersects(box_region), std::back_inserter(returned_values));
                                                                   

                                                                  Use of pipe operator generating a range

                                                                  Box box_region(...);
                                                                  -BOOST_FOREACH(Value & v, rt | index::adaptors::queried(box_region))
                                                                  +BOOST_FOREACH(Value & v, rt | index::adaptors::queried(bgi::intersects(box_region)))
                                                                     ; // do something with v
                                                                   
                                                                  @@ -113,7 +110,7 @@

                                                                  Spatial query returns Values which are related somehow to - a geometry or some number of geometries. Names of spatial predicates corresponds + some Geometry - box, polygon, etc. Names of spatial predicates corresponds to names of Boost.Geometry algorithms. Examples of some basic queries may be found in tables below. The query region and result Values @@ -224,12 +221,10 @@

                                                                  - To use a spatial predicate one may pass a geometry (which is a default - case) or use one of the functions defined in boost::geometry::index - namespace to define it explicitly. + To use a spatial predicate one may use one of the functions defined in + boost::geometry::index namespace.

                                                                  -
                                                                  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::intersects(box), std::back_inserter(result));
                                                                   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));
                                                                  @@ -250,10 +245,10 @@
                                                                   

                                                                Nearest neighbours queries returns Values which are closest - to some point in space. Additionally it is possible to pass define how - the distance to the Value - should be calculated. The examples of some knn queries may be found in - the table below. All queries returns 5 closest Values. + to some point in space. Additionally it is possible to define how the distance + to the Value should be + calculated. The examples of some knn queries may be found in the table + below. All queries return 5 closest Values. The query point and Values are orange.

                                                                @@ -314,23 +309,42 @@

                                                              - There is a unique predicate index::satisfies(...) taking user-defined function or function - object which checks if Value should be returned by the query. - It may be used to check some specific conditions for user-defined Values. + The user may pass a UnaryPredicate + - function, function object or lambda expression taking const reference + to Value and returning bool. This object may be passed to the query in + order to check if Value should be returned by the query. To + do it one may use index::satisfies() function like on the example below:

                                                              -
                                                              bool fun(Value const& v)
                                                              +
                                                              bool is_red(Value const& v)
                                                               {
                                                                 return v.is_red();
                                                               }
                                                               
                                                              +struct is_red_o
                                                              +{
                                                              +  template <typename Value>
                                                              +  bool operator()(Value const& v)
                                                              +  {
                                                              +    return v.is_red();
                                                              +  }
                                                              +}
                                                              +
                                                               // ...
                                                               
                                                              -rt.query(index::intersects(box) && index::satisfies(fun),
                                                              +rt.query(index::intersects(box) && index::satisfies(is_red),
                                                                        std::back_inserter(result));
                                                              +
                                                              +rt.query(index::intersects(box) && index::satisfies(is_red_o()),
                                                              +         std::back_inserter(result));
                                                              +
                                                              +#ifndef BOOST_NO_CXX11_LAMBDAS
                                                              +rt.query(index::intersects(box) && index::satisfies([](Value const& v) { return v.is_red(); }),
                                                              +         std::back_inserter(result));
                                                              +#endif
                                                               
                                                              @@ -387,7 +401,7 @@ /* some inserting into the tree */ std::vector<Value> result; -rt1.query(Box(/*...*/), std::back_inserter(result)); +rt1.query(bgi::intersects(Box(/*...*/)), std::back_inserter(result)); RTree rt2(result.begin(), result.end());

                                                              @@ -397,14 +411,14 @@ query results because temporary container won't be used.

                                                              RTree rt3;
                                                              -rt1.query(Box(/*...*/), bgi::inserter(rt3));
                                                              +rt1.query(bgi::intersects(Box(/*...*/))), bgi::inserter(rt3));
                                                               

                                                              If you like Boost.Range you'll appreciate the third option. You may pass the result Range directly to the constructor. However in this case the temporary container is created.

                                                              -
                                                              RTree rt4(rt1 | bgi::adaptors::queried(Box(/*...*/)));
                                                              +
                                                              RTree rt4(rt1 | bgi::adaptors::queried(bgi::intersects(Box(/*...*/)))));
                                                               
                                                            diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 783af34a2..520b75acd 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -50,7 +50,7 @@

                                                            - Description + Description

                                                            This is self-balancing spatial index capable to store various types of @@ -58,7 +58,7 @@

                                                            - Parameters + Parameters

                                                            The user must pass a type defining the Parameters which will be used in @@ -68,7 +68,7 @@

                                                            Predefined algorithms with compile-time parameters are:

                                                            -
                                                              +
                                                              • boost::geometry::index::linear,
                                                              • @@ -82,7 +82,7 @@

                                                                Predefined algorithms with run-time parameters are:

                                                                -
                                                                  +
                                                                  - Translator + Translator

                                                                  The Translator translates from Value to Indexable each time r-tree requires @@ -112,14 +112,14 @@

                                                                  - Header + Header

                                                                  #include <boost/geometry/index/rtree.hpp>

                                                                  - Synopsis + Synopsis
                                                                  template<typename Value,
                                                                            typename Parameters,
                                                                  @@ -132,7 +132,7 @@
                                                                   
                                                                  - Template + Template parameter(s)
                                                                  @@ -206,7 +206,7 @@
                                                                  - Typedef(s) + Typedef(s)
                                                                  @@ -314,7 +314,7 @@
                                                                  - Constructor(s) + Constructor(s) and destructor
                                                                  @@ -457,7 +457,7 @@
                                                                  - Member(s) + Member(s)
                                                                  @@ -780,13 +780,13 @@

                                                                  - Synopsis + Synopsis
                                                                  rtree(parameters_type const & parameters = parameters_type(), translator_type const & translator = translator_type())
                                                                   
                                                                  - Modifier(s) + Modifier(s)

                                                                  @@ -795,7 +795,7 @@

                                                                  - Parameter(s) + Parameter(s)
                                                                  @@ -861,7 +861,7 @@
                                                                  - Throws + Throws

                                                                  If allocator default constructor throws. @@ -877,7 +877,7 @@

                                                                  - Synopsis + Synopsis
                                                                  rtree(parameters_type const & parameters,
                                                                         translator_type const & translator,
                                                                  @@ -885,7 +885,7 @@
                                                                   
                                                                  - Parameter(s) + Parameter(s)
                                                                  @@ -968,7 +968,7 @@
                                                                  - Throws + Throws

                                                                  If allocator copy constructor throws. @@ -984,7 +984,7 @@

                                                                  - Synopsis + Synopsis
                                                                  template<typename Iterator>
                                                                   rtree(Iterator first,
                                                                  @@ -995,7 +995,7 @@
                                                                   
                                                                  - Parameter(s) + Parameter(s)
                                                                  @@ -1112,9 +1112,9 @@
                                                                  - Throws + Throws
                                                                  -
                                                                    +
                                                                    • If allocator copy constructor throws.
                                                                    • @@ -1139,7 +1139,7 @@

                                                                      - Synopsis + Synopsis
                                                                      template<typename Range>
                                                                       rtree(Range const & rng,
                                                                      @@ -1149,7 +1149,7 @@
                                                                       
                                                                      - Modifier(s) + Modifier(s)

                                                                      @@ -1158,7 +1158,7 @@

                                                                      - Parameter(s) + Parameter(s)
                                                                      @@ -1259,9 +1259,9 @@
                                                                      - Throws + Throws
                                                                      -
                                                                        +
                                                                        • If allocator copy constructor throws.
                                                                        • @@ -1285,13 +1285,13 @@

                                                                          - Synopsis + Synopsis
                                                                          ~rtree()
                                                                           
                                                                          - Throws + Throws

                                                                          Nothing. @@ -1307,20 +1307,20 @@

                                                                          - Description + Description

                                                                          It uses parameters, translator and allocator from the source tree.

                                                                          - Synopsis + Synopsis
                                                                          rtree(rtree const & src)
                                                                           
                                                                          - Parameter(s) + Parameter(s)
                                                                          @@ -1366,9 +1366,9 @@
                                                                          - Throws + Throws
                                                                          -
                                                                            +
                                                                            • If allocator copy constructor throws.
                                                                            • @@ -1393,20 +1393,20 @@

                                                                              - Description + Description

                                                                              It uses Parameters and translator from the source tree.

                                                                              - Synopsis + Synopsis
                                                                              rtree(rtree const & src, allocator_type const & allocator)
                                                                               
                                                                              - Parameter(s) + Parameter(s)
                                                                              @@ -1472,9 +1472,9 @@
                                                                              - Throws + Throws
                                                                              -
                                                                                +
                                                                                • If allocator copy constructor throws.
                                                                                • @@ -1499,20 +1499,20 @@

                                                                                  - Description + Description

                                                                                  It uses parameters, translator and allocator from the source tree.

                                                                                  - Synopsis + Synopsis
                                                                                  rtree(rtree && src)
                                                                                   
                                                                                  - Parameter(s) + Parameter(s)
                                                                                  @@ -1558,7 +1558,7 @@
                                                                                  - Throws + Throws

                                                                                  Nothing. @@ -1574,20 +1574,20 @@

                                                                                  - Description + Description

                                                                                  It uses parameters and translator from the source tree.

                                                                                  - Synopsis + Synopsis
                                                                                  rtree(rtree && src, allocator_type const & allocator)
                                                                                   
                                                                                  - Parameter(s) + Parameter(s)
                                                                                  @@ -1653,9 +1653,9 @@
                                                                                  - Throws + Throws
                                                                                  -
                                                                                    +
                                                                                    • If allocator copy constructor throws.
                                                                                    • @@ -1681,20 +1681,20 @@

                                                                                      - Description + Description

                                                                                      It uses parameters and translator from the source tree.

                                                                                      - Synopsis + Synopsis
                                                                                      rtree & operator=(const rtree & src)
                                                                                       
                                                                                      - Parameter(s) + Parameter(s)
                                                                                      @@ -1740,9 +1740,9 @@
                                                                                      - Throws + Throws
                                                                                      -
                                                                                        +
                                                                                        • If Value copy constructor throws.
                                                                                        • @@ -1764,20 +1764,20 @@

                                                                                          - Description + Description

                                                                                          It uses parameters and translator from the source tree.

                                                                                          - Synopsis + Synopsis
                                                                                          rtree & operator=(rtree && src)
                                                                                           
                                                                                          - Parameter(s) + Parameter(s)
                                                                                          @@ -1823,12 +1823,12 @@
                                                                                          - Throws + Throws

                                                                                          Only if allocators aren't equal.

                                                                                          -
                                                                                            +
                                                                                            • If Value copy constructor throws.
                                                                                            • @@ -1850,20 +1850,20 @@

                                                                                              - Description + Description

                                                                                              Parameters, translator and allocators are swapped as well.

                                                                                              - Synopsis + Synopsis
                                                                                              void swap(rtree & other)
                                                                                               
                                                                                              - Parameter(s) + Parameter(s)
                                                                                              @@ -1909,7 +1909,7 @@
                                                                                              - Throws + Throws

                                                                                              If allocators swap throws. @@ -1925,13 +1925,13 @@

                                                                                              - Synopsis + Synopsis
                                                                                              void insert(value_type const & value)
                                                                                               
                                                                                              - Parameter(s) + Parameter(s)
                                                                                              @@ -1977,9 +1977,9 @@
                                                                                              - Throws + Throws
                                                                                              -
                                                                                                +
                                                                                                • If Value copy constructor or copy assignment throws.
                                                                                                • @@ -2012,14 +2012,14 @@

                                                                                                  - Synopsis + Synopsis
                                                                                                  template<typename Iterator>
                                                                                                   void insert(Iterator first, Iterator last)
                                                                                                   
                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                  @@ -2083,9 +2083,9 @@
                                                                                                  - Throws + Throws
                                                                                                  -
                                                                                                    +
                                                                                                    • If Value copy constructor or copy assignment throws.
                                                                                                    • @@ -2118,14 +2118,14 @@

                                                                                                      - Synopsis + Synopsis
                                                                                                      template<typename Range>
                                                                                                       void insert(Range const & rng)
                                                                                                       
                                                                                                      - Parameter(s) + Parameter(s)
                                                                                                      @@ -2171,9 +2171,9 @@
                                                                                                      - Throws + Throws
                                                                                                      -
                                                                                                        +
                                                                                                        • If Value copy constructor or copy assignment throws.
                                                                                                        • @@ -2206,7 +2206,7 @@

                                                                                                          - Description + Description

                                                                                                          In contrast to the std::set @@ -2215,13 +2215,13 @@

                                                                                                          - Synopsis + Synopsis
                                                                                                          size_type remove(value_type const & value)
                                                                                                           
                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                          @@ -2267,16 +2267,16 @@
                                                                                                          - Returns + Returns

                                                                                                          1 if the value was removed, 0 otherwise.

                                                                                                          - Throws + Throws
                                                                                                          -
                                                                                                            +
                                                                                                            • If Value copy constructor or copy assignment throws.
                                                                                                            • @@ -2309,7 +2309,7 @@

                                                                                                              - Description + Description

                                                                                                              In contrast to the std::set @@ -2320,14 +2320,14 @@

                                                                                                              - Synopsis + Synopsis
                                                                                                              template<typename Iterator>
                                                                                                               size_type remove(Iterator first, Iterator last)
                                                                                                               
                                                                                                              - Parameter(s) + Parameter(s)
                                                                                                              @@ -2391,16 +2391,16 @@
                                                                                                              - Returns + Returns

                                                                                                              The number of removed values.

                                                                                                              - Throws + Throws
                                                                                                              -
                                                                                                                +
                                                                                                                • If Value copy constructor or copy assignment throws.
                                                                                                                • @@ -2433,7 +2433,7 @@

                                                                                                                  - Description + Description

                                                                                                                  In contrast to the std::set @@ -2443,14 +2443,14 @@

                                                                                                                  - Synopsis + Synopsis
                                                                                                                  template<typename Range>
                                                                                                                   size_type remove(Range const & rng)
                                                                                                                   
                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                  @@ -2496,16 +2496,16 @@
                                                                                                                  - Returns + Returns

                                                                                                                  The number of removed values.

                                                                                                                  - Throws + Throws
                                                                                                                  -
                                                                                                                    +
                                                                                                                    • If Value copy constructor or copy assignment throws.
                                                                                                                    • @@ -2539,7 +2539,7 @@

                                                                                                                      - Description + Description

                                                                                                                      This query function performs spatial and k-nearest neighbor searches. @@ -2550,12 +2550,9 @@ Spatial predicates

                                                                                                                      - The simplest form of spatial predicate is a Geometry. - In this case Values intersecting the Geometry - are returned. More spatial predicates may be generated by one of the - functions listed below: + Spatial predicates may be generated by one of the functions listed below:

                                                                                                                      -
                                                                                                                        +
                                                                                                                        • boost::geometry::index::covered_by(),
                                                                                                                        • @@ -2563,8 +2560,7 @@ boost::geometry::index::disjoint(),
                                                                                                                        • - boost::geometry::index::intersects() - - default, + boost::geometry::index::intersects(),
                                                                                                                        • boost::geometry::index::overlaps(), @@ -2576,7 +2572,7 @@

                                                                                                                          It is possible to negate spatial predicates:

                                                                                                                          -
                                                                                                                          - Functions + Functions
                                                                                                                          @@ -3296,7 +3292,7 @@

                                                                                                                          - Description + Description

                                                                                                                          It calls rtree::insert(value_type @@ -3304,7 +3300,7 @@

                                                                                                                          - Synopsis + Synopsis
                                                                                                                          template<typename Value,
                                                                                                                                    typename Options,
                                                                                                                          @@ -3314,7 +3310,7 @@
                                                                                                                           
                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                          @@ -3393,7 +3389,7 @@

                                                                                                                          - Description + Description

                                                                                                                          It calls rtree::insert(Iterator, @@ -3401,7 +3397,7 @@

                                                                                                                          - Synopsis + Synopsis
                                                                                                                          template<typename Value,
                                                                                                                                    typename Options,
                                                                                                                          @@ -3414,7 +3410,7 @@
                                                                                                                           
                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                          @@ -3509,7 +3505,7 @@

                                                                                                                          - Description + Description

                                                                                                                          It calls rtree::insert(Range @@ -3517,7 +3513,7 @@

                                                                                                                          - Synopsis + Synopsis
                                                                                                                          template<typename Value,
                                                                                                                                    typename Options,
                                                                                                                          @@ -3528,7 +3524,7 @@
                                                                                                                           
                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                          @@ -3607,7 +3603,7 @@

                                                                                                                          - Description + Description

                                                                                                                          Remove a value from the container. In contrast to the std::set or std::map erase() method this function removes @@ -3619,7 +3615,7 @@

                                                                                                                          - Synopsis + Synopsis
                                                                                                                          template<typename Value,
                                                                                                                                    typename Options,
                                                                                                                          @@ -3629,7 +3625,7 @@
                                                                                                                           
                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                          @@ -3699,7 +3695,7 @@
                                                                                                                          - Returns + Returns

                                                                                                                          1 if value was removed, 0 otherwise. @@ -3715,7 +3711,7 @@

                                                                                                                          - Description + Description

                                                                                                                          Remove a range of values from the container. In contrast to the std::set or std::map erase() method it doesn't take iterators @@ -3729,7 +3725,7 @@

                                                                                                                          - Synopsis + Synopsis
                                                                                                                          template<typename Value,
                                                                                                                                    typename Options,
                                                                                                                          @@ -3742,7 +3738,7 @@
                                                                                                                           
                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                          @@ -3828,7 +3824,7 @@
                                                                                                                          - Returns + Returns

                                                                                                                          The number of removed values. @@ -3844,7 +3840,7 @@

                                                                                                                          - Description + Description

                                                                                                                          Remove a range of values from the container. In contrast to the std::set or std::map erase() method it removes values @@ -3857,7 +3853,7 @@

                                                                                                                          - Synopsis + Synopsis
                                                                                                                          template<typename Value,
                                                                                                                                    typename Options,
                                                                                                                          @@ -3868,7 +3864,7 @@
                                                                                                                           
                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                          @@ -3938,7 +3934,7 @@
                                                                                                                          - Returns + Returns

                                                                                                                          The number of removed values. @@ -3955,7 +3951,7 @@

                                                                                                                          - Description + Description

                                                                                                                          This query function performs spatial and k-nearest neighbor searches. @@ -3966,12 +3962,9 @@ Spatial predicates

                                                                                                                          - The simplest form of spatial predicate is a Geometry. - In this case Values intersecting the Geometry - are returned. More spatial predicates may be generated by one of the - functions listed below: + Spatial predicates may be generated by one of the functions listed below:

                                                                                                                          -
                                                                                                                            +
                                                                                                                            • boost::geometry::index::covered_by(),
                                                                                                                            • @@ -3979,8 +3972,7 @@ boost::geometry::index::disjoint(),
                                                                                                                            • - boost::geometry::index::intersects() - - default, + boost::geometry::index::intersects(),
                                                                                                                            • boost::geometry::index::overlaps(), @@ -3992,7 +3984,7 @@

                                                                                                                              It is possible to negate spatial predicates:

                                                                                                                              -
                                                                                                                                +

                                                                                                                                - Value predicate + Satisfies predicate

                                                                                                                                This is a special kind of predicate which allows to pass a user-defined - functor which checks if Value should be returned by the query. It's generated - by: + function or function object which checks if Value should be returned + by the query. It's generated by:

                                                                                                                                -
                                                                                                                                - Functions + Functions
                                                                                                                                @@ -6419,7 +6426,7 @@

                                                                                                                                - Description + Description

                                                                                                                                Generate a nearest query Point and Value's Indexable relationship while @@ -6432,14 +6439,14 @@

                                                                                                                                - Synopsis + Synopsis
                                                                                                                                template<typename T>
                                                                                                                                 detail::to_nearest<T> boost::geometry::index::to_nearest(T const & v)
                                                                                                                                 
                                                                                                                                - Template + Template parameter(s)
                                                                                                                                @@ -6475,7 +6482,7 @@
                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                @@ -6531,7 +6538,7 @@

                                                                                                                                - Description + Description

                                                                                                                                Generate a nearest query Point and Value's Indexable relationship while @@ -6542,14 +6549,14 @@

                                                                                                                                - Synopsis + Synopsis
                                                                                                                                template<typename T>
                                                                                                                                 detail::to_centroid<T> boost::geometry::index::to_centroid(T const & v)
                                                                                                                                 
                                                                                                                                - Template + Template parameter(s)
                                                                                                                                @@ -6585,7 +6592,7 @@
                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                @@ -6641,7 +6648,7 @@

                                                                                                                                - Description + Description

                                                                                                                                Generate a nearest query Point and Value's Indexable relationship while @@ -6654,14 +6661,14 @@

                                                                                                                                - Synopsis + Synopsis
                                                                                                                                template<typename T>
                                                                                                                                 detail::to_furthest<T> boost::geometry::index::to_furthest(T const & v)
                                                                                                                                 
                                                                                                                                - Template + Template parameter(s)
                                                                                                                                @@ -6697,7 +6704,7 @@
                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                @@ -6750,7 +6757,7 @@
                                                                                                                                - Functions + Functions
                                                                                                                                @@ -6793,14 +6800,14 @@

                                                                                                                                - Synopsis + Synopsis
                                                                                                                                template<typename Predicates>
                                                                                                                                 detail::query<Predicates> boost::geometry::index::adaptors::queried(Predicates const & pred)
                                                                                                                                 
                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                @@ -6852,7 +6859,7 @@
                                                                                                                                - Functions + Functions
                                                                                                                                @@ -6894,7 +6901,7 @@

                                                                                                                                - Description + Description

                                                                                                                                Returns insert iterator capable to insert values to the container (spatial @@ -6902,14 +6909,14 @@

                                                                                                                                - Synopsis + Synopsis
                                                                                                                                template<typename Container>
                                                                                                                                 insert_iterator<Container> boost::geometry::index::inserter(Container & c)
                                                                                                                                 
                                                                                                                                - Parameter(s) + Parameter(s)
                                                                                                                                @@ -6955,7 +6962,7 @@
                                                                                                                                - Returns + Returns

                                                                                                                                The insert iterator inserting values to the container. diff --git a/doc/html/geometry_index/r_tree/rtree_examples.html b/doc/html/geometry_index/r_tree/rtree_examples.html index 03a8c2071..b803abc4e 100644 --- a/doc/html/geometry_index/r_tree/rtree_examples.html +++ b/doc/html/geometry_index/r_tree/rtree_examples.html @@ -3,7 +3,7 @@ Examples - + @@ -86,7 +86,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -179,7 +179,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -264,7 +264,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -404,7 +404,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -493,7 +493,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -588,7 +588,7 @@ // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector<value> result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector<value> result_n; @@ -699,7 +699,7 @@ std::cout << "Child: Querying for objects intersecting box = [(45, 45)(55, 55)]\n"; std::vector<B> result; - unsigned k = tree->query(B(P(45, 45), P(55, 55)), std::back_inserter(result)); + unsigned k = tree->query(bgi::intersects(B(P(45, 45), P(55, 55))), std::back_inserter(result)); std::cout << "Child: Found objects:\n"; std::cout << k << "\n"; diff --git a/doc/html/geometry_index/r_tree/rtree_quickstart.html b/doc/html/geometry_index/r_tree/rtree_quickstart.html index 22a62ca05..d0516c114 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 - + @@ -116,7 +116,7 @@

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

                                                                                                                                @@ -156,7 +156,7 @@

                                                                                                                                - More + More

                                                                                                                                More information about the R-tree implementation, other algorithms and queries diff --git a/doc/html/index.html b/doc/html/index.html index 7a78e45d9..478437542 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Geometry Index - + @@ -51,7 +51,7 @@

                                                                                                                            - +

                                                                                                                            Last revised: March 01, 2013 at 02:58:06 GMT

                                                                                                                            Last revised: March 01, 2013 at 18:11:11 GMT


                                                                                                                            diff --git a/doc/rtree/query.qbk b/doc/rtree/query.qbk index e905180d6..f13e87393 100644 --- a/doc/rtree/query.qbk +++ b/doc/rtree/query.qbk @@ -13,8 +13,8 @@ Queries returns `__value__`s which meets some predicates. Currently supported are three types of predicates: * spatial predicates - defining relationship between stored Values and some Geometry, -* nearest predicates - defining relationship between stored Values and some Point, -* satisfies predicate - allows to pass user-defined UnaryPredicate (function or function object) to the query. +* nearest predicate - defining relationship between stored Values and some Point, +* user-defined unary predicate - function, function object or lambda expression checking user-defined condition. For example queries may be used to retrieve Values: @@ -24,34 +24,32 @@ For example queries may be used to retrieve Values: [section Performing a query] -There are three ways to perform a query. In the following example `__box__` is used as -the predicate, this is a default spatial predicate described in the following section. -Following queries returns `__value__`s intersecting some region defined as a `__box__`. -These three ways are: +There are three ways to perform a query presented below. All of them returns `__value__`s intersecting some +region defined as a `__box__`. Method call std::vector<__value__> returned_values; __box__ box_region(...); - rt.query(box_region, std::back_inserter(returned_values)); + rt.query(bgi::intersects(box_region), std::back_inserter(returned_values)); Function call std::vector<__value__> returned_values; __box__ box_region(...); - index::query(rt, box_region, std::back_inserter(returned_values)); + index::query(rt, bgi::intersects(box_region), std::back_inserter(returned_values)); Use of pipe operator generating a range __box__ box_region(...); - BOOST_FOREACH(__value__ & v, rt | index::adaptors::queried(box_region)) + BOOST_FOREACH(__value__ & v, rt | index::adaptors::queried(bgi::intersects(box_region))) ; // do something with v [endsect] [section Spatial queries] -Spatial query returns `__value__`s which are related somehow to a geometry or some number of geometries. +Spatial query returns `__value__`s which are related somehow to some Geometry - box, polygon, etc. Names of spatial predicates corresponds to names of __boost_geometry__ algorithms. Examples of some basic queries may be found in tables below. The query region and result `Value`s are orange. @@ -65,11 +63,9 @@ basic queries may be found in tables below. The query region and result `Value`s [[[$../images/intersects_ring.png]] [[$../images/intersects_poly.png]] [[$../images/intersects_mpoly.png]]] ] -To use a spatial predicate one may pass a geometry (which is a default case) or use one of the functions defined in -`boost::geometry::index` namespace to define it explicitly. +To use a spatial predicate one may use one of the functions defined in `boost::geometry::index` namespace. - 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::intersects(box), std::back_inserter(result)); 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)); @@ -86,8 +82,8 @@ All predicates may be negated, e.g.: [section Nearest neighbours queries] Nearest neighbours queries returns `__value__`s which are closest to some point in space. -Additionally it is possible to pass define how the distance to the `Value` should be calculated. -The examples of some knn queries may be found in the table below. All queries returns 5 closest `Values`. +Additionally it is possible to define how the distance to the `Value` should be calculated. +The examples of some knn queries may be found in the table below. All queries return 5 closest `Values`. The query point and Values are orange. [$../images/knn.png] @@ -134,22 +130,39 @@ a relation object generated as follows: [endsect] -[section Satisfies predicate] +[section user-defined unary predicate] -There is a unique predicate `index::satisfies(...)` taking user-defined function or function object -which checks if `__value__` should be returned by the query. It may be used to check -some specific conditions for user-defined Values. +The user may pass a `UnaryPredicate` - function, function object or lambda expression taking const reference to Value and returning bool. +This object may be passed to the query in order to check if `__value__` should be returned by the query. To do it one +may use `index::satisfies()` function like on the example below: - bool fun(__value__ const& v) + bool is_red(__value__ const& v) { return v.is_red(); } + struct is_red_o + { + template + bool operator()(__value__ const& v) + { + return v.is_red(); + } + } + // ... - rt.query(index::intersects(box) && index::satisfies(fun), + rt.query(index::intersects(box) && index::satisfies(is_red), std::back_inserter(result)); + rt.query(index::intersects(box) && index::satisfies(is_red_o()), + std::back_inserter(result)); + + #ifndef BOOST_NO_CXX11_LAMBDAS + rt.query(index::intersects(box) && index::satisfies([](__value__ const& v) { return v.is_red(); }), + std::back_inserter(result)); + #endif + [endsect] [section Passing a set of predicates] @@ -189,7 +202,7 @@ The most basic way is creating a temporary container for Values and insert them /* some inserting into the tree */ std::vector result; - rt1.query(Box(/*...*/), std::back_inserter(result)); + rt1.query(bgi::intersects(Box(/*...*/)), std::back_inserter(result)); RTree rt2(result.begin(), result.end()); However there are better ways. One of these methods is mentioned in the "Creation and modification" section. @@ -197,12 +210,12 @@ The insert iterator may be passed directly to the query, which will be the faste query results because temporary container won't be used. RTree rt3; - rt1.query(Box(/*...*/), bgi::inserter(rt3)); + rt1.query(bgi::intersects(Box(/*...*/))), bgi::inserter(rt3)); If you like Boost.Range you'll appreciate the third option. You may pass the result Range directly to the constructor. However in this case the temporary container is created. - RTree rt4(rt1 | bgi::adaptors::queried(Box(/*...*/))); + RTree rt4(rt1 | bgi::adaptors::queried(bgi::intersects(Box(/*...*/))))); [endsect] diff --git a/doc/src/examples/rtree/interprocess.cpp b/doc/src/examples/rtree/interprocess.cpp index 1b59451b9..4260ffdf1 100644 --- a/doc/src/examples/rtree/interprocess.cpp +++ b/doc/src/examples/rtree/interprocess.cpp @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) std::cout << "Child: Querying for objects intersecting box = [(45, 45)(55, 55)]\n"; std::vector result; - unsigned k = tree->query(B(P(45, 45), P(55, 55)), std::back_inserter(result)); + unsigned k = tree->query(bgi::intersects(B(P(45, 45), P(55, 55))), std::back_inserter(result)); std::cout << "Child: Found objects:\n"; std::cout << k << "\n"; diff --git a/doc/src/examples/rtree/polygons_shared_ptr.cpp b/doc/src/examples/rtree/polygons_shared_ptr.cpp index 210fb27ad..5886fbf04 100644 --- a/doc/src/examples/rtree/polygons_shared_ptr.cpp +++ b/doc/src/examples/rtree/polygons_shared_ptr.cpp @@ -63,7 +63,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/polygons_vector.cpp b/doc/src/examples/rtree/polygons_vector.cpp index 3fa6cb51f..e64e574a1 100644 --- a/doc/src/examples/rtree/polygons_vector.cpp +++ b/doc/src/examples/rtree/polygons_vector.cpp @@ -71,7 +71,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/quick_start.cpp b/doc/src/examples/rtree/quick_start.cpp index f25b2383c..efa4b3584 100644 --- a/doc/src/examples/rtree/quick_start.cpp +++ b/doc/src/examples/rtree/quick_start.cpp @@ -57,7 +57,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); //] //[rtree_quickstart_nearest_query diff --git a/doc/src/examples/rtree/translator_index.cpp b/doc/src/examples/rtree/translator_index.cpp index ea629f6c2..978b7dbae 100644 --- a/doc/src/examples/rtree/translator_index.cpp +++ b/doc/src/examples/rtree/translator_index.cpp @@ -73,7 +73,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/translator_shared_ptr.cpp b/doc/src/examples/rtree/translator_shared_ptr.cpp index b40e561b5..52e26a280 100644 --- a/doc/src/examples/rtree/translator_shared_ptr.cpp +++ b/doc/src/examples/rtree/translator_shared_ptr.cpp @@ -67,7 +67,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/doc/src/examples/rtree/variants_map.cpp b/doc/src/examples/rtree/variants_map.cpp index 38fd9aafc..427c5567c 100644 --- a/doc/src/examples/rtree/variants_map.cpp +++ b/doc/src/examples/rtree/variants_map.cpp @@ -118,7 +118,7 @@ int main(void) // find values intersecting some area defined by a box box query_box(point(0, 0), point(5, 5)); std::vector result_s; - rtree.query(query_box, std::back_inserter(result_s)); + rtree.query(bgi::intersects(query_box), std::back_inserter(result_s)); // find 5 nearest values to a point std::vector result_n; diff --git a/example/benchmark.cpp b/example/benchmark.cpp index fad858aa4..12a38ff3c 100644 --- a/example/benchmark.cpp +++ b/example/benchmark.cpp @@ -91,7 +91,7 @@ int main() float x = coords[i].first; float y = coords[i].second; result.clear(); - t.query(B(P(x - 10, y - 10), P(x + 10, y + 10)), std::back_inserter(result)); + t.query(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))), std::back_inserter(result)); temp += result.size(); } dur_t time = clock_t::now() - start; diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index e58aa511b..93874aa40 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -20,8 +20,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { // predicates // ------------------------------------------------------------------ // -// not needed? -struct empty {}; +//struct empty {}; template struct satisfies @@ -125,43 +124,102 @@ struct nearest unsigned count; }; +// ------------------------------------------------------------------ // +// is_predicate +// ------------------------------------------------------------------ // + +//template struct is_predicate { static const bool value = false; }; +////template <> struct is_predicate< empty > { static const bool value = true; }; +//template struct is_predicate< satisfies > { static const bool value = true; }; +//template struct is_predicate< covered_by > { static const bool value = true; }; +//template struct is_predicate< disjoint > { static const bool value = true; }; +//template struct is_predicate< intersects > { static const bool value = true; }; +//template struct is_predicate< overlaps > { static const bool value = true; }; +////template struct is_predicate< touches > { static const bool value = true; }; +//template struct is_predicate< within > { static const bool value = true; }; +//template struct is_predicate< not_covered_by > { static const bool value = true; }; +//template struct is_predicate< not_disjoint > { static const bool value = true; }; +//template struct is_predicate< not_intersects > { static const bool value = true; }; +//template struct is_predicate< not_overlaps > { static const bool value = true; }; +////template struct is_predicate< not_touches > { static const bool value = true; }; +//template struct is_predicate< not_within > { static const bool value = true; }; +//template struct is_predicate< nearest

                                                                                                                            > { static const bool value = true; }; + +// ------------------------------------------------------------------ // +// predicate_check_default +// ------------------------------------------------------------------ // + +//template +//struct predicate_check_default +//{ +// BOOST_MPL_ASSERT_MSG( +// (false), +// NOT_IMPLEMENTED_FOR_THESE_TAGS, +// (predicate_check_default)); +//}; + // ------------------------------------------------------------------ // // predicate_check // ------------------------------------------------------------------ // -template +template struct predicate_check { BOOST_MPL_ASSERT_MSG( (false), - NOT_IMPLEMENTED_FOR_THIS_TAG, + NOT_IMPLEMENTED_FOR_THIS_PREDICATE_OR_TAG, (predicate_check)); }; +// ------------------------------------------------------------------ // +// predicate_check_default for value +// ------------------------------------------------------------------ // + +//template +//struct predicate_check_default +//{ +// template +// static inline bool apply(Geometry const& g, Value const&, Indexable const& i) +// { +// return geometry::intersects(i, g); +// } +//}; +// +//template +//struct predicate_check_default +//{ +// template +// static inline bool apply(Unary const& u, Value const& v, Indexable const&) +// { +// return u(v); +// } +//}; + // ------------------------------------------------------------------ // // predicate_check for value // ------------------------------------------------------------------ // -template -struct predicate_check -{ - template - static inline bool apply(Geometry const& g, Value const&, Indexable const& i) - { - return geometry::intersects(i, g); - } -}; +//template +//struct predicate_check +//{ +// template +// static inline bool apply(GeometryOrUnary const& g, Value const& v, Indexable const& i) +// { +// return predicate_check_default< +// GeometryOrUnary, typename geometry::traits::tag::type, bounds_tag +// >::apply(g, v, i); +// } +//}; -// not needed? -template <> -struct predicate_check -{ - template - static inline bool apply(empty const&, Value const&, Indexable const&) - { - return true; - } -}; +//template <> +//struct predicate_check +//{ +// template +// static inline bool apply(empty const&, Value const&, Indexable const&) +// { +// return true; +// } +//}; template struct predicate_check, value_tag> @@ -304,28 +362,54 @@ struct predicate_check, value_tag> }; // ------------------------------------------------------------------ // -// predicates_chec for envelope +// predicate_check_default for bounds // ------------------------------------------------------------------ // -template -struct predicate_check -{ - template - static inline bool apply(Geometry const& g, Value const&, Indexable const& i) - { - return geometry::intersects(i, g); - } -}; +//template +//struct predicate_check_default +//{ +// template +// static inline bool apply(Geometry const& g, Value const&, Indexable const& i) +// { +// return geometry::intersects(i, g); +// } +//}; +// +//template +//struct predicate_check_default +//{ +// template +// static inline bool apply(Unary const&, Value const&, Indexable const&) +// { +// return true; +// } +//}; -template <> -struct predicate_check -{ - template - static inline bool apply(Geometry const&, Value const&, Indexable const&) - { - return true; - } -}; +// ------------------------------------------------------------------ // +// predicates_chec for bounds +// ------------------------------------------------------------------ // + +//template +//struct predicate_check +//{ +// template +// static inline bool apply(GeometryOrUnary const& g, Value const& v, Indexable const& i) +// { +// return predicate_check_default< +// GeometryOrUnary, typename geometry::traits::tag::type, bounds_tag +// >::apply(g, v, i); +// } +//}; + +//template <> +//struct predicate_check +//{ +// template +// static inline bool apply(Geometry const&, Value const&, Indexable const&) +// { +// return true; +// } +//}; template struct predicate_check, bounds_tag> @@ -481,17 +565,17 @@ struct predicates_length static const unsigned value = 1; }; -template -struct predicates_length< std::pair > -{ - static const unsigned value = 2; -}; +//template +//struct predicates_length< std::pair > +//{ +// static const unsigned value = 2; +//}; -template -struct predicates_length< boost::tuple > -{ - static const unsigned value = boost::tuples::length< boost::tuple >::value; -}; +//template +//struct predicates_length< boost::tuple > +//{ +// static const unsigned value = boost::tuples::length< boost::tuple >::value; +//}; template struct predicates_length< boost::tuples::cons > @@ -511,30 +595,30 @@ struct predicates_element static type const& get(T const& p) { return p; } }; -template -struct predicates_element< I, std::pair > -{ - BOOST_MPL_ASSERT_MSG((I < 2), INVALID_INDEX, (predicates_element)); - - typedef F type; - static type const& get(std::pair const& p) { return p.first; } -}; - -template -struct predicates_element< 1, std::pair > -{ - typedef S type; - static type const& get(std::pair const& p) { return p.second; } -}; - -template -struct predicates_element< I, boost::tuple > -{ - typedef boost::tuple predicate_type; - - typedef typename boost::tuples::element::type type; - static type const& get(predicate_type const& p) { return boost::get(p); } -}; +//template +//struct predicates_element< I, std::pair > +//{ +// BOOST_MPL_ASSERT_MSG((I < 2), INVALID_INDEX, (predicates_element)); +// +// typedef F type; +// static type const& get(std::pair const& p) { return p.first; } +//}; +// +//template +//struct predicates_element< 1, std::pair > +//{ +// typedef S type; +// static type const& get(std::pair const& p) { return p.second; } +//}; +// +//template +//struct predicates_element< I, boost::tuple > +//{ +// typedef boost::tuple predicate_type; +// +// typedef typename boost::tuples::element::type type; +// static type const& get(predicate_type const& p) { return boost::get(p); } +//}; template struct predicates_element< I, boost::tuples::cons > @@ -549,49 +633,49 @@ struct predicates_element< I, boost::tuples::cons > // predicates_check // ------------------------------------------------------------------ // -template -struct predicates_check_pair {}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& , Value const& , Indexable const& ) - { - return true; - } -}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.first, v, i); - } -}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.second, v, i); - } -}; - -template -struct predicates_check_pair -{ - template - static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.first, v, i) - && predicate_check::apply(p.second, v, i); - } -}; +//template +//struct predicates_check_pair {}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& , Value const& , Indexable const& ) +// { +// return true; +// } +//}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) +// { +// return predicate_check::apply(p.first, v, i); +// } +//}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) +// { +// return predicate_check::apply(p.second, v, i); +// } +//}; +// +//template +//struct predicates_check_pair +//{ +// template +// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) +// { +// return predicate_check::apply(p.first, v, i) +// && predicate_check::apply(p.second, v, i); +// } +//}; template struct predicates_check_tuple @@ -630,43 +714,43 @@ struct predicates_check_impl } }; -template -struct predicates_check_impl, Tag, First, Last> -{ - BOOST_MPL_ASSERT_MSG((First < 2 && Last <= 2 && First <= Last), INVALID_INDEXES, (predicates_check_impl)); - - template - static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) - { - return predicate_check::apply(p.first, v, i) - && predicate_check::apply(p.second, v, i); - } -}; - -template < - typename T0, typename T1, typename T2, typename T3, typename T4, - typename T5, typename T6, typename T7, typename T8, typename T9, - typename Tag, unsigned First, unsigned Last -> -struct predicates_check_impl< - boost::tuple, - Tag, First, Last -> -{ - typedef boost::tuple predicates_type; - - static const unsigned pred_len = boost::tuples::length::value; - BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl)); - - template - static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) - { - return predicates_check_tuple< - predicates_type, - Tag, First, Last - >::apply(p, v, i); - } -}; +//template +//struct predicates_check_impl, Tag, First, Last> +//{ +// BOOST_MPL_ASSERT_MSG((First < 2 && Last <= 2 && First <= Last), INVALID_INDEXES, (predicates_check_impl)); +// +// template +// static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) +// { +// return predicate_check::apply(p.first, v, i) +// && predicate_check::apply(p.second, v, i); +// } +//}; +// +//template < +// typename T0, typename T1, typename T2, typename T3, typename T4, +// typename T5, typename T6, typename T7, typename T8, typename T9, +// typename Tag, unsigned First, unsigned Last +//> +//struct predicates_check_impl< +// boost::tuple, +// Tag, First, Last +//> +//{ +// typedef boost::tuple predicates_type; +// +// static const unsigned pred_len = boost::tuples::length::value; +// BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl)); +// +// template +// static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) +// { +// return predicates_check_tuple< +// predicates_type, +// Tag, First, Last +// >::apply(p, v, i); +// } +//}; template struct predicates_check_impl< @@ -722,12 +806,12 @@ struct predicates_count_nearest static const unsigned value = predicates_is_nearest::value; }; -template -struct predicates_count_nearest< std::pair > -{ - static const unsigned value = predicates_is_nearest::value - + predicates_is_nearest::value; -}; +//template +//struct predicates_count_nearest< std::pair > +//{ +// static const unsigned value = predicates_is_nearest::value +// + predicates_is_nearest::value; +//}; template struct predicates_count_nearest_tuple @@ -744,14 +828,14 @@ struct predicates_count_nearest_tuple predicates_is_nearest::type>::value; }; -template -struct predicates_count_nearest< boost::tuple > -{ - static const unsigned value = predicates_count_nearest_tuple< - boost::tuple, - boost::tuples::length< boost::tuple >::value - >::value; -}; +//template +//struct predicates_count_nearest< boost::tuple > +//{ +// static const unsigned value = predicates_count_nearest_tuple< +// boost::tuple, +// boost::tuples::length< boost::tuple >::value +// >::value; +//}; template struct predicates_count_nearest< boost::tuples::cons > @@ -770,12 +854,12 @@ struct predicates_find_nearest static const unsigned value = predicates_is_nearest::value ? 0 : 1; }; -template -struct predicates_find_nearest< std::pair > -{ - static const unsigned value = predicates_is_nearest::value ? 0 : - (predicates_is_nearest::value ? 1 : 2); -}; +//template +//struct predicates_find_nearest< std::pair > +//{ +// static const unsigned value = predicates_is_nearest::value ? 0 : +// (predicates_is_nearest::value ? 1 : 2); +//}; template struct predicates_find_nearest_tuple @@ -796,14 +880,14 @@ struct predicates_find_nearest_tuple static const unsigned value = is_found ? 0 : boost::tuples::length::value; }; -template -struct predicates_find_nearest< boost::tuple > -{ - static const unsigned value = predicates_find_nearest_tuple< - boost::tuple, - boost::tuples::length< boost::tuple >::value - >::value; -}; +//template +//struct predicates_find_nearest< boost::tuple > +//{ +// static const unsigned value = predicates_find_nearest_tuple< +// boost::tuple, +// boost::tuples::length< boost::tuple >::value +// >::value; +//}; template struct predicates_find_nearest< boost::tuples::cons > diff --git a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp index ef54d995f..0019a4d81 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp @@ -19,48 +19,48 @@ namespace detail { namespace rtree { namespace visitors { // in store() or break store to 2 functions e.g. should_store() and store() // - well not with this algorithm of storing k-th neighbor -template -struct nearest_query_result_one -{ -public: - typedef typename geometry::default_distance_result< - Point, - typename translator::indexable_type::type - >::type distance_type; - - inline nearest_query_result_one(Value & value) - : m_value(value) - , m_comp_dist((std::numeric_limits::max)()) - {} - - inline void store(Value const& val, distance_type const& curr_comp_dist) - { - if ( curr_comp_dist < m_comp_dist ) - { - m_comp_dist = curr_comp_dist; - m_value = val; - } - } - - inline bool is_comparable_distance_valid() const - { - return m_comp_dist < (std::numeric_limits::max)(); - } - - inline distance_type comparable_distance() const - { - return m_comp_dist; - } - - inline size_t finish() - { - return is_comparable_distance_valid() ? 1 : 0; - } - -private: - Value & m_value; - distance_type m_comp_dist; -}; +//template +//struct nearest_query_result_one +//{ +//public: +// typedef typename geometry::default_distance_result< +// Point, +// typename translator::indexable_type::type +// >::type distance_type; +// +// inline nearest_query_result_one(Value & value) +// : m_value(value) +// , m_comp_dist((std::numeric_limits::max)()) +// {} +// +// inline void store(Value const& val, distance_type const& curr_comp_dist) +// { +// if ( curr_comp_dist < m_comp_dist ) +// { +// m_comp_dist = curr_comp_dist; +// m_value = val; +// } +// } +// +// inline bool is_comparable_distance_valid() const +// { +// return m_comp_dist < (std::numeric_limits::max)(); +// } +// +// inline distance_type comparable_distance() const +// { +// return m_comp_dist; +// } +// +// inline size_t finish() +// { +// return is_comparable_distance_valid() ? 1 : 0; +// } +// +//private: +// Value & m_value; +// distance_type m_comp_dist; +//}; template struct nearest_query_result_k @@ -324,8 +324,9 @@ private: parameters_type const& m_parameters; Translator const& m_translator; - DistancesPredicates const& m_dist_pred; - Predicates const& m_pred; + + DistancesPredicates m_dist_pred; + Predicates m_pred; Result & m_result; }; diff --git a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp index 17244e30f..3a15f04bd 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp @@ -66,7 +66,9 @@ struct spatial_query } Translator const& tr; - Predicates const& pred; + + Predicates pred; + OutIter out_iter; size_t found_count; }; diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index a7cd3c318..4b111201c 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -175,9 +175,24 @@ A wrapper around user-defined UnaryPredicate checking if Value should be returne \par Example \verbatim -bool is_red(Value const& v) { ... } -... -bgi::query(spatial_index, bgi::intersects(box) && bgi::satisfies(is_red), std::back_inserter(result)); +bool is_red(__value__ const& v) { return v.is_red(); } + +struct is_red_o { +template bool operator()(__value__ const& v) { return v.is_red(); } +} + +// ... + +rt.query(index::intersects(box) && index::satisfies(is_red), +std::back_inserter(result)); + +rt.query(index::intersects(box) && index::satisfies(is_red_o()), +std::back_inserter(result)); + +#ifndef BOOST_NO_CXX11_LAMBDAS +rt.query(index::intersects(box) && index::satisfies([](__value__ const& v) { return v.is_red(); }), +std::back_inserter(result)); +#endif \endverbatim \ingroup predicates @@ -324,14 +339,13 @@ boost::tuples::cons< > operator&&(Pred1 const& p1, Pred2 const& p2) { + /*typedef typename boost::mpl::if_c::value, Pred1, Pred1 const&>::type stored1; + typedef typename boost::mpl::if_c::value, Pred2, Pred2 const&>::type stored2;*/ + namespace bt = boost::tuples; + return - boost::tuples::cons< - Pred1, - boost::tuples::cons - >( - p1, - boost::tuples::cons(p2, boost::tuples::null_type()) - ); + bt::cons< Pred1, bt::cons > + ( p1, bt::cons(p2, bt::null_type()) ); } template inline @@ -343,12 +357,12 @@ typename tuples::push_back_impl< >::type operator&&(boost::tuples::cons const& t, Pred const& p) { + //typedef typename boost::mpl::if_c::value, Pred, Pred const&>::type stored; + namespace bt = boost::tuples; + return tuples::push_back_impl< - boost::tuples::cons, - Pred, - 0, - boost::tuples::length >::value + bt::cons, Pred, 0, bt::length< bt::cons >::value >::apply(t, p); } diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index c6ac359a2..e95037f7e 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -596,11 +596,10 @@ public: Spatial predicates - The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. - More spatial predicates may be generated by one of the functions listed below: + Spatial predicates may be generated by one of the functions listed below: \li \c boost::geometry::index::covered_by(), \li \c boost::geometry::index::disjoint(), - \li \c boost::geometry::index::intersects() - default, + \li \c boost::geometry::index::intersects(), \li \c boost::geometry::index::overlaps(), \li \c boost::geometry::index::within(), @@ -611,11 +610,11 @@ public: \li ! boost::geometry::index::overlaps(), \li ! boost::geometry::index::within() - Value predicate + Satisfies predicate - This is a special kind of predicate which allows to pass a user-defined functor which checks + This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: - \li \c boost::geometry::index::value(). + \li \c boost::geometry::index::satisfies(). Nearest predicate @@ -631,7 +630,7 @@ public: \par Example \verbatim // return elements intersecting box - tree.query(box, std::back_inserter(result)); + tree.query(bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box tree.query(bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun unary predicate @@ -1247,11 +1246,10 @@ Values will be returned only if all predicates are met. Spatial predicates -The simplest form of spatial predicate is a \c Geometry. In this case Values intersecting the \c Geometry are returned. -More spatial predicates may be generated by one of the functions listed below: +Spatial predicates may be generated by one of the functions listed below: \li \c boost::geometry::index::covered_by(), \li \c boost::geometry::index::disjoint(), -\li \c boost::geometry::index::intersects() - default, +\li \c boost::geometry::index::intersects(), \li \c boost::geometry::index::overlaps(), \li \c boost::geometry::index::within(), @@ -1262,11 +1260,11 @@ It is possible to negate spatial predicates: \li ! boost::geometry::index::overlaps(), \li ! boost::geometry::index::within() -Value predicate - -This is a special kind of predicate which allows to pass a user-defined functor which checks +Satisfies predicate + +This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by: -\li \c boost::geometry::index::value(). +\li \c boost::geometry::index::satisfies(). Nearest predicate @@ -1282,7 +1280,7 @@ Predicates may be passed together connected with \c operator&&(). \par Example \verbatim // return elements intersecting box -bgi::query(tree, box, std::back_inserter(result)); +bgi::query(tree, bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 09555e38a..78dd7be99 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -574,7 +574,7 @@ void test_intersects(Rtree const& tree, std::vector const& input, Box con if ( bg::intersects(tree.translator()(v), qbox) ) expected_output.push_back(v); - test_spatial_query(tree, qbox, expected_output); + //test_spatial_query(tree, qbox, expected_output); test_spatial_query(tree, bgi::intersects(qbox), expected_output); test_spatial_query(tree, !bgi::disjoint(qbox), expected_output); @@ -857,7 +857,7 @@ void test_value_predicate(Rtree const& rtree, std::vector const& input) BOOST_CHECK(result.size() == input.size()); #ifndef BOOST_NO_CXX11_LAMBDAS result.clear(); - rtree.query(bgi::satisfies([](Value const& v){ return true; }), std::back_inserter(result)); + rtree.query(bgi::satisfies([](Value const&){ return true; }), std::back_inserter(result)); BOOST_CHECK(result.size() == input.size()); #endif } @@ -872,7 +872,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) size_t s = tree.size(); std::vector expected_output; - tree.query(qbox, std::back_inserter(expected_output)); + tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); // copy constructor Rtree t1(tree); @@ -881,7 +881,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(tree.size() == t1.size()); std::vector output; - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); // copying assignment operator @@ -891,7 +891,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(tree.size() == t1.size()); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); Rtree t2(tree.parameters(), tree.translator(), tree.get_allocator()); @@ -902,11 +902,11 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(0 == t1.size()); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); BOOST_CHECK(output.empty()); output.clear(); - t2.query(qbox, std::back_inserter(output)); + t2.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t2, output, expected_output); t2.swap(t1); @@ -917,7 +917,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(t1.size() == 0); output.clear(); - t3.query(qbox, std::back_inserter(output)); + t3.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t3, output, expected_output); // moving assignment operator @@ -927,7 +927,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) BOOST_CHECK(t3.size() == 0); output.clear(); - t1.query(qbox, std::back_inserter(output)); + t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); //TODO - test SWAP @@ -939,7 +939,7 @@ template void test_create_insert(Rtree & tree, std::vector const& input, Box const& qbox) { std::vector expected_output; - tree.query(qbox, std::back_inserter(expected_output)); + tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); { Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); @@ -947,7 +947,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const t.insert(v); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -955,21 +955,21 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const std::copy(input.begin(), input.end(), bgi::inserter(t)); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { Rtree t(input.begin(), input.end(), tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { Rtree t(input, tree.parameters(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -977,7 +977,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const t.insert(input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -985,7 +985,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const t.insert(input); BOOST_CHECK(tree.size() == t.size()); std::vector output; - t.query(qbox, std::back_inserter(output)); + t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } @@ -995,7 +995,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const bgi::insert(t, v); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::query(t, qbox, std::back_inserter(output)); + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1003,7 +1003,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const bgi::insert(t, input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::query(t, qbox, std::back_inserter(output)); + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { @@ -1011,7 +1011,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const bgi::insert(t, input); BOOST_CHECK(tree.size() == t.size()); std::vector output; - bgi::query(t, qbox, std::back_inserter(output)); + bgi::query(t, bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } } @@ -1024,7 +1024,7 @@ void test_remove(Rtree & tree, Box const& qbox) typedef typename Rtree::value_type Value; std::vector values_to_remove; - tree.query(qbox, std::back_inserter(values_to_remove)); + tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); BOOST_CHECK(0 < values_to_remove.size()); std::vector expected_output; @@ -1107,7 +1107,7 @@ template void test_clear(Rtree & tree, std::vector const& input, Box const& qbox) { std::vector values_to_remove; - tree.query(qbox, std::back_inserter(values_to_remove)); + tree.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); BOOST_CHECK(0 < values_to_remove.size()); //clear @@ -1208,7 +1208,7 @@ void test_count_rtree_values(Parameters const& parameters, Allocator const& allo BOOST_CHECK(t.size() + rest_count == Value::counter()); std::vector values_to_remove; - t.query(qbox, std::back_inserter(values_to_remove)); + t.query(bgi::intersects(qbox), std::back_inserter(values_to_remove)); rest_count += values_to_remove.size(); From f5362259182da47314190681861a184a668d578c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 1 Mar 2013 21:57:29 +0000 Subject: [PATCH 350/366] added functors index::equal_to and index::indexable, not used yet [SVN r83235] --- include/boost/geometry/index/translator.hpp | 99 +++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/include/boost/geometry/index/translator.hpp b/include/boost/geometry/index/translator.hpp index 39ab56bba..828f2069c 100644 --- a/include/boost/geometry/index/translator.hpp +++ b/include/boost/geometry/index/translator.hpp @@ -209,6 +209,105 @@ struct indexable_type }} // namespace detail::translator +// indexable + +template +struct indexable +{ + BOOST_MPL_ASSERT_MSG( + (!detail::translator::indexable_not_found_error< + typename detail::traits::indexable_type::type + >::value), + NOT_VALID_INDEXABLE_TYPE, + (Value) + ); + + typedef Value const& result_type; + result_type operator()(Value const& v) + { + return v; + } +}; + +template +struct indexable< std::pair > +{ + BOOST_MPL_ASSERT_MSG( + (!detail::translator::indexable_not_found_error< + typename detail::traits::indexable_type::type + >::value), + NOT_VALID_INDEXABLE_TYPE, + (Indexable) + ); + + typedef Indexable const& result_type; + result_type operator()(std::pair const& v) + { + return v.first; + } +}; + +template +struct indexable< boost::tuple > +{ + typedef boost::tuple value_type; + + BOOST_MPL_ASSERT_MSG( + (!detail::translator::indexable_not_found_error< + typename detail::traits::indexable_type::type + >::value), + NOT_VALID_INDEXABLE_TYPE, + (Indexable) + ); + + typedef Indexable const& result_type; + result_type operator()(value_type const& v) const + { + return boost::get<0>(v); + } +}; + +// equal_to + +template +struct equal_to +{ + typedef bool result_type; + bool operator()(Value const& l, Value const& r) + { + return detail::translator::equals::type>::apply(l ,r); + } +}; + +template +struct equal_to< std::pair > +{ + typedef bool result_type; + bool operator()(std::pair const& l, std::pair const& r) const + { + typedef detail::translator::equals::type> equals1; + typedef detail::translator::equals::type> equals2; + + return equals1::apply(l.first, r.first) && equals2::apply(l.second, r.second); + } +}; + +template +struct equal_to< boost::tuple > +{ + typedef boost::tuple value_type; + + typedef bool result_type; + bool operator()(value_type const& l, value_type const& r) const + { + return detail::translator::compare_tuples< + value_type, 0, boost::tuples::length::value + >::apply(l ,r); + } +}; + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP From d04778f99ef0f56ab38a0066811344656dda8188 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 2 Mar 2013 02:20:40 +0000 Subject: [PATCH 351/366] rtree parameter Translator replaced by two IndexableGetter and EqualTo [SVN r83238] --- doc/generated/equal_to.qbk | 30 + .../{translator.qbk => indexable.qbk} | 12 +- doc/generated/rtree.qbk | 227 ++- doc/generated/rtree_functions.qbk | 186 +-- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 18 +- .../r_tree/creation_and_modification.html | 71 +- .../geometry_index/r_tree/introduction.html | 28 +- doc/html/geometry_index/r_tree/queries.html | 6 +- doc/html/geometry_index/r_tree/reference.html | 1225 +++++++++-------- .../geometry_index/r_tree/rtree_examples.html | 41 +- .../r_tree/rtree_quickstart.html | 4 +- doc/html/index.html | 4 +- doc/imports.qbk | 4 +- doc/index.qbk | 1 - doc/make_qbk.py | 5 +- doc/rtree/creation.qbk | 33 +- doc/rtree/examples.qbk | 8 +- doc/rtree/reference.qbk | 7 +- doc/src/examples/rtree/Jamfile.v2 | 4 +- doc/src/examples/rtree/interprocess.cpp | 9 +- .../{translator_index.cpp => value_index.cpp} | 13 +- ...or_shared_ptr.cpp => value_shared_ptr.cpp} | 5 +- .../geometry/index/detail/rtree/adaptors.hpp | 8 +- .../detail/rtree/visitors/are_boxes_ok.hpp | 6 +- .../detail/rtree/visitors/are_levels_ok.hpp | 6 +- .../index/detail/rtree/visitors/gl_draw.hpp | 8 +- .../index/detail/rtree/visitors/print.hpp | 6 +- include/boost/geometry/index/rtree.hpp | 161 ++- include/boost/geometry/index/translator.hpp | 219 ++- test/rtree/test_rtree.hpp | 89 +- 31 files changed, 1285 insertions(+), 1161 deletions(-) create mode 100644 doc/generated/equal_to.qbk rename doc/generated/{translator.qbk => indexable.qbk} (55%) rename doc/src/examples/rtree/{translator_index.cpp => value_index.cpp} (88%) rename doc/src/examples/rtree/{translator_shared_ptr.cpp => value_shared_ptr.cpp} (94%) diff --git a/doc/generated/equal_to.qbk b/doc/generated/equal_to.qbk new file mode 100644 index 000000000..58f0fb670 --- /dev/null +++ b/doc/generated/equal_to.qbk @@ -0,0 +1,30 @@ +[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] +[/ Generated from xml/structboost_1_1geometry_1_1index_1_1equal__to.xml] +[#structboost_1_1geometry_1_1index_1_1equal__to] +[section boost::geometry::index::equal_to] + +The function object comparing Values. + +[heading Description] +It compares Geometries using geometry::equals() function. Other types are compared using operator==. The default version handles Values which are Indexables. This template is also specialized for std::pair and boost::tuple<...>. + +[heading Header] +`#include ` + +[heading Synopsis] +[pre +`template<``typename Value``>` +`struct equal_to` +`{` +` // ...` +`};` +] + +[heading Template parameter(s)] +[table +[[Parameter] [Description]] +[[`Value`][The type of objects which are compared by this function object. ]] +] + +[endsect] + diff --git a/doc/generated/translator.qbk b/doc/generated/indexable.qbk similarity index 55% rename from doc/generated/translator.qbk rename to doc/generated/indexable.qbk index 333d7123e..0d70a9e74 100644 --- a/doc/generated/translator.qbk +++ b/doc/generated/indexable.qbk @@ -1,12 +1,12 @@ [/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically] -[/ Generated from xml/structboost_1_1geometry_1_1index_1_1translator.xml] -[#structboost_1_1geometry_1_1index_1_1translator] -[section boost::geometry::index::translator] +[/ Generated from xml/structboost_1_1geometry_1_1index_1_1indexable.xml] +[#structboost_1_1geometry_1_1index_1_1indexable] +[section boost::geometry::index::indexable] -The default translator. +The function object extracting Indexable from Value. [heading Description] -It translates Value object to Indexable object. The default version handles Values which are Indexables. This translator is also specialized for std::pair and boost::tuple. +It translates Value object to Indexable object. The default version handles Values which are Indexables. This template is also specialized for std::pair and boost::tuple. [heading Header] `#include ` @@ -14,7 +14,7 @@ It translates Value object to Indexable object. The default version handles Valu [heading Synopsis] [pre `template<``typename Value``>` -`struct translator` +`struct indexable` `{` ` // ...` `};` diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index cc9b648d1..8e1d7c433 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -43,7 +43,8 @@ The Translator translates from Value to Indexable each time r-tree requires it. [pre `template<``typename Value``,` `typename Parameters``,` - `typename Translator` = [^[link structboost_1_1geometry_1_1index_1_1translator index::translator]]```,` + `typename IndexableGetter` = [^[link structboost_1_1geometry_1_1index_1_1indexable index::indexable]]```,` + `typename EqualTo` = [^[link structboost_1_1geometry_1_1index_1_1equal__to index::equal_to]]```,` `typename Allocator` = `std::allocator``>` `class rtree` `{` @@ -56,106 +57,110 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[Parameter] [Description]] [[`Value`][The type of objects stored in the container. ]] [[`Parameters`][Compile-time parameters. ]] -[[`Translator`][The type of the translator which translates from Value to Indexable. ]] +[[`IndexableGetter`][The function object extracting Indexable from Value. ]] +[[`EqualTo`][The function object comparing objects of type Value. ]] [[`Allocator`][The allocator used to allocate/deallocate memory, construct/destroy nodes and Values. ]] ] [heading Typedef(s)] [table [[Type] [Description]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb] `value_type`][The type of Value stored in the container. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a] `parameters_type`][R-tree parameters type. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91] `translator_type`][Value to Indexable Translator type. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d] `allocator_type`][The type of allocator used by the container. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6] `size_type`][Unsigned integral type used by the container. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a6533b05d4a2eea9d4a0033e192add466] `indexable_type`][The Indexable type to which Value is translated. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f] `bounds_type`][The Box type used by the R-tree. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a5761a41d87b93d4fd548ecb6600ae757] `value_type`][The type of Value stored in the container. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17] `parameters_type`][R-tree parameters type. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e] `allocator_type`][The type of allocator used by the container. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4] `size_type`][Unsigned integral type used by the container. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1ac6b09c3c32ec7ed2dee19459fdee92a2] `indexable_type`][The Indexable type to which Value is translated. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a89a6fd9a7c24f9d30422ef81ce2b959f] `bounds_type`][The Box type used by the R-tree. ]] ] [heading Constructor(s) and destructor] [table [[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a393bb202f84b6fe5613df02d1ba2a092 `rtree()`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a434839ea5dd2e57f9491d18520621c4b `rtree(parameters_type const &, translator_type const &, allocator_type)`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ace0b58f496b7eb00c518b4fc2794f4bc `rtree(Iterator, Iterator)`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a513f271626372c6dad5488f64db6d1d4 `rtree(Range const &)`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae8b10914ec434d1ee6877f5e1000b674 `~rtree()`]][The destructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a006904b4e7dcef1fd1efcb70a010964f `rtree(rtree const &)`]][The copy constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ac59521aa9a9b69104fa25c0f7b705354 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a050fca8af38fe25548d4c22830b55bf2 `rtree(rtree &&)`]][The moving constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1ae0b4e031554daa6e6e8d3a0f95630260 `rtree(rtree &&, allocator_type const &)`]][The moving constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a55da92f65c8718efd65ef520ad058b28 `rtree()`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1afb26a28fd2309fd70e5f84ea20dc899d `rtree(parameters_type const &, IndexableGetter const &, EqualTo const &, allocator_type)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a07c03c285279cc976cc045f80265ee39 `rtree(Iterator, Iterator)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1adc4c1b5fce889a3755eb916fdd021bf1 `rtree(Range const &)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1af8db72811d2be53c409240204e63fb5a `~rtree()`]][The destructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a826fc3236e181ad718d5283e95d7866f `rtree(rtree const &)`]][The copy constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a72b6b75e083eea2ed26f54d4a2265375 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1aa8b27db8cb783282ab5274e6769da26a `rtree(rtree &&)`]][The moving constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a8508c4236d17ff39a1caef058aac8486 `rtree(rtree &&, allocator_type const &)`]][The moving constructor. ]] ] [heading Member(s)] [table [[Modifier][Function][Description]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179 `operator=(const rtree &)`]][The assignment operator. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be `operator=(rtree &&)`]][The moving assignment. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 `swap(rtree &)`]][Swaps contents of two rtrees. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c `insert(value_type const &)`]][Insert a value to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 `insert(Range const &)`]][Insert a range of values to the index. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a `remove(value_type const &)`]][Remove a value from the container. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c `remove(Range const &)`]][Remove a range of values from the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949 `query(Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd `size()`]][Returns the number of stored values. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c `empty()`]][Query if the container is empty. ]] -[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 `clear()`]][Removes all values stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1aeba4f1afee40262204dd074a93536ebf `bounds()`]][Returns the box able to contain all values stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606 `parameters()`]][Returns parameters. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258 `translator()`]][Returns the translator object. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff `get_allocator()`]][Returns allocator used by the rtree. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a278cfc791ab6c5ebc2f70aeb5b3428a1 `operator=(const rtree &)`]][The assignment operator. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1af0bf9622ed3e901580b73ed39b746fb7 `operator=(rtree &&)`]][The moving assignment. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aedb719dfece91d298e9ee56878524c9b `swap(rtree &)`]][Swaps contents of two rtrees. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1ad47980467e66b8644df18a480dbf9d86 `insert(value_type const &)`]][Insert a value to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a60d4c8790fd8810ff8b57f049e6bed8d `insert(Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a39be117f85cc9ebc508d8ecf77578329 `insert(Range const &)`]][Insert a range of values to the index. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a1ce933b0b833faec5349bfc27bde15d4 `remove(value_type const &)`]][Remove a value from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1aa97084231d17564a94f0142d095cecaa `remove(Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a8a6460c186f595e91be69b1062ecae8b `remove(Range const &)`]][Remove a range of values from the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a7baa88eb4e7a5c640ab847513de45b3e `query(Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1ac9f152c8c96525e3735b81635d8171b1 `size()`]][Returns the number of stored values. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1aa5302ce1c26105d722aac20793e83f0e `empty()`]][Query if the container is empty. ]] +[[][[link classboost_1_1geometry_1_1index_1_1rtree_1a1bec40977c175983f585c4488cf8fe3c `clear()`]][Removes all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a0dad06d0f117f45ed54b5c123cb41d6e `bounds()`]][Returns the box able to contain all values stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1aaa834c241c191ac9de67f134564f36fa `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afef125f04ba51b50370fadc9c1b1e8bf `parameters()`]][Returns parameters. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17d9cef211feb7f674a5b4602f4cc81e `get_allocator()`]][Returns allocator used by the rtree. ]] ] -[#classboost_1_1geometry_1_1index_1_1rtree_1a393bb202f84b6fe5613df02d1ba2a092] +[#classboost_1_1geometry_1_1index_1_1rtree_1a55da92f65c8718efd65ef520ad058b28] [section rtree()] The constructor. [heading Synopsis] [pre -`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``)` +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]`()``,` + `IndexableGetter const &` `indexable_getter` = `IndexableGetter()``,` + `EqualTo const &` `equal_to` = `EqualTo()``)` ] [heading Modifier(s)] ``explicit ``[heading Parameter(s)] [table [[Type][Name][Description]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] +[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] +[[`EqualTo const &`][ `equal_to` ][]] ] [heading Throws] If allocator default constructor throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a434839ea5dd2e57f9491d18520621c4b] -[section rtree(parameters_type const &, translator_type const &, allocator_type)] +[#classboost_1_1geometry_1_1index_1_1rtree_1afb26a28fd2309fd70e5f84ea20dc899d] +[section rtree(parameters_type const &, IndexableGetter const &, EqualTo const &, allocator_type)] The constructor. [heading Synopsis] [pre -`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator``)` +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters``,` + `IndexableGetter const &` `indexable_getter``,` + `EqualTo const &` `equal_to``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]] `allocator``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] +[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] +[[`EqualTo const &`][ `equal_to` ][]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]][ `allocator` ][The allocator object.]] ] [heading Throws] If allocator copy constructor throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ace0b58f496b7eb00c518b4fc2794f4bc] +[#classboost_1_1geometry_1_1index_1_1rtree_1a07c03c285279cc976cc045f80265ee39] [section rtree(Iterator, Iterator)] The constructor. @@ -164,9 +169,10 @@ The constructor. `template<``typename Iterator``>` `rtree``(``Iterator` `first``,` `Iterator` `last``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]`()``,` + `IndexableGetter const &` `indexable_getter` = `IndexableGetter()``,` + `EqualTo const &` `equal_to` = `EqualTo()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]`()``)` ] [heading Parameter(s)] @@ -174,9 +180,10 @@ The constructor. [[Type][Name][Description]] [[`Iterator`][ `first` ][The beginning of the range of Values. ]] [[`Iterator`][ `last` ][The end of the range of Values. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] +[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] +[[`EqualTo const &`][ `equal_to` ][]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]][ `allocator` ][The allocator object.]] ] [heading Throws] @@ -190,7 +197,7 @@ The constructor. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a513f271626372c6dad5488f64db6d1d4] +[#classboost_1_1geometry_1_1index_1_1rtree_1adc4c1b5fce889a3755eb916fdd021bf1] [section rtree(Range const &)] The constructor. @@ -198,9 +205,10 @@ The constructor. [pre `template<``typename Range``>` `rtree``(``Range const &` `rng``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]`()``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]`()``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]`()``)` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]`()``,` + `IndexableGetter const &` `indexable_getter` = `IndexableGetter()``,` + `EqualTo const &` `equal_to` = `EqualTo()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]`()``)` ] [heading Modifier(s)] @@ -208,9 +216,10 @@ The constructor. [table [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &`][ `translator` ][The translator object. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]][ `allocator` ][The allocator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] +[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] +[[`EqualTo const &`][ `equal_to` ][]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]][ `allocator` ][The allocator object.]] ] [heading Throws] @@ -224,7 +233,7 @@ The constructor. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ae8b10914ec434d1ee6877f5e1000b674] +[#classboost_1_1geometry_1_1index_1_1rtree_1af8db72811d2be53c409240204e63fb5a] [section ~rtree()] The destructor. @@ -239,7 +248,7 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a006904b4e7dcef1fd1efcb70a010964f] +[#classboost_1_1geometry_1_1index_1_1rtree_1a826fc3236e181ad718d5283e95d7866f] [section rtree(rtree const &)] The copy constructor. @@ -267,7 +276,7 @@ It uses parameters, translator and allocator from the source tree.[heading Synop [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ac59521aa9a9b69104fa25c0f7b705354] +[#classboost_1_1geometry_1_1index_1_1rtree_1a72b6b75e083eea2ed26f54d4a2265375] [section rtree(rtree const &, allocator_type const &)] The copy constructor. @@ -275,14 +284,14 @@ The copy constructor. It uses Parameters and translator from the source tree.[heading Synopsis] [pre -`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` const &` `src``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &` `allocator``)` +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` const &` `src``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &` `allocator``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` const &`][ `src` ][The rtree which content will be copied. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &`][ `allocator` ][The allocator which will be used.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &`][ `allocator` ][The allocator which will be used.]] ] [heading Throws] @@ -296,7 +305,7 @@ It uses Parameters and translator from the source tree.[heading Synopsis] [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a050fca8af38fe25548d4c22830b55bf2] +[#classboost_1_1geometry_1_1index_1_1rtree_1aa8b27db8cb783282ab5274e6769da26a] [section rtree(rtree &&)] The moving constructor. @@ -317,7 +326,7 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ae0b4e031554daa6e6e8d3a0f95630260] +[#classboost_1_1geometry_1_1index_1_1rtree_1a8508c4236d17ff39a1caef058aac8486] [section rtree(rtree &&, allocator_type const &)] The moving constructor. @@ -325,14 +334,14 @@ The moving constructor. It uses parameters and translator from the source tree.[heading Synopsis] [pre -`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&` `src``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &` `allocator``)` +`rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&` `src``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &` `allocator``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree rtree]]` &&`][ `src` ][The rtree which content will be moved. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]]` const &`][ `allocator` ][The allocator.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &`][ `allocator` ][The allocator.]] ] [heading Throws] @@ -346,7 +355,7 @@ It uses parameters and translator from the source tree.[heading Synopsis] [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ab823a214501cb0f9fd00ba12a1ade179] +[#classboost_1_1geometry_1_1index_1_1rtree_1a278cfc791ab6c5ebc2f70aeb5b3428a1] [section operator=(const rtree &)] The assignment operator. @@ -373,7 +382,7 @@ It uses parameters and translator from the source tree.[heading Synopsis] [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a44bd4edee49db92c18b6bbbba77b42be] +[#classboost_1_1geometry_1_1index_1_1rtree_1af0bf9622ed3e901580b73ed39b746fb7] [section operator=(rtree &&)] The moving assignment. @@ -400,7 +409,7 @@ Only if allocators aren't equal. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73] +[#classboost_1_1geometry_1_1index_1_1rtree_1aedb719dfece91d298e9ee56878524c9b] [section swap(rtree &)] Swaps contents of two rtrees. @@ -421,20 +430,20 @@ If allocators swap throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c] +[#classboost_1_1geometry_1_1index_1_1rtree_1ad47980467e66b8644df18a480dbf9d86] [section insert(value_type const &)] Insert a value to the index. [heading Synopsis] [pre -`void` `insert``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &` `value``)` +`void` `insert``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5761a41d87b93d4fd548ecb6600ae757 value_type]]` const &` `value``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &`][ `value` ][The value which will be stored in the container.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5761a41d87b93d4fd548ecb6600ae757 value_type]]` const &`][ `value` ][The value which will be stored in the container.]] ] [heading Throws] @@ -449,7 +458,7 @@ Insert a value to the index. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d] +[#classboost_1_1geometry_1_1index_1_1rtree_1a60d4c8790fd8810ff8b57f049e6bed8d] [section insert(Iterator, Iterator)] Insert a range of values to the index. @@ -478,7 +487,7 @@ Insert a range of values to the index. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2] +[#classboost_1_1geometry_1_1index_1_1rtree_1a39be117f85cc9ebc508d8ecf77578329] [section insert(Range const &)] Insert a range of values to the index. @@ -506,7 +515,7 @@ Insert a range of values to the index. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a] +[#classboost_1_1geometry_1_1index_1_1rtree_1a1ce933b0b833faec5349bfc27bde15d4] [section remove(value_type const &)] Remove a value from the container. @@ -514,13 +523,13 @@ Remove a value from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method this method removes only one value from the container.[heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &` `value``)` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4 size_type]] `remove``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5761a41d87b93d4fd548ecb6600ae757 value_type]]` const &` `value``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9979db9ef37591985256cb8ad31862bb value_type]]` const &`][ `value` ][The value which will be removed from the container.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5761a41d87b93d4fd548ecb6600ae757 value_type]]` const &`][ `value` ][The value which will be removed from the container.]] ] [heading Returns] 1 if the value was removed, 0 otherwise. @@ -537,7 +546,7 @@ In contrast to the [^`std::set`] or [^`std::map erase()`] method this method rem [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd] +[#classboost_1_1geometry_1_1index_1_1rtree_1aa97084231d17564a94f0142d095cecaa] [section remove(Iterator, Iterator)] Remove a range of values from the container. @@ -545,7 +554,7 @@ Remove a range of values from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] [pre `template<``typename Iterator``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(``Iterator` `first``,` `Iterator` `last``)` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4 size_type]] `remove``(``Iterator` `first``,` `Iterator` `last``)` ] [heading Parameter(s)] @@ -569,7 +578,7 @@ The number of removed values. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c] +[#classboost_1_1geometry_1_1index_1_1rtree_1a8a6460c186f595e91be69b1062ecae8b] [section remove(Range const &)] Remove a range of values from the container. @@ -577,7 +586,7 @@ Remove a range of values from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.[heading Synopsis] [pre `template<``typename Range``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `remove``(``Range const &` `rng``)` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4 size_type]] `remove``(``Range const &` `rng``)` ] [heading Parameter(s)] @@ -600,7 +609,7 @@ The number of removed values. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a25ce2ead0e8a2d270105f4958237e949] +[#classboost_1_1geometry_1_1index_1_1rtree_1a7baa88eb4e7a5c640ab847513de45b3e] [section query(Predicates const &, OutIter)] Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. @@ -643,7 +652,7 @@ If the nearest predicate is passed a k-nearest neighbor search will be performed Predicates may be passed together connected with [^`operator&&()`].[heading Synopsis] [pre `template<``typename Predicates``,` `typename OutIter``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `query``(``Predicates const &` `predicates``,` `OutIter` `out_it``)` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4 size_type]] `query``(``Predicates const &` `predicates``,` `OutIter` `out_it``)` ] [heading Modifier(s)] @@ -678,14 +687,14 @@ If Value copy constructor or copy assignment throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd] +[#classboost_1_1geometry_1_1index_1_1rtree_1ac9f152c8c96525e3735b81635d8171b1] [section size()] Returns the number of stored values. [heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `size``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4 size_type]] `size``()` ] [heading Modifier(s)] @@ -696,7 +705,7 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c] +[#classboost_1_1geometry_1_1index_1_1rtree_1aa5302ce1c26105d722aac20793e83f0e] [section empty()] Query if the container is empty. @@ -714,7 +723,7 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09] +[#classboost_1_1geometry_1_1index_1_1rtree_1a1bec40977c175983f585c4488cf8fe3c] [section clear()] Removes all values stored in the container. @@ -729,7 +738,7 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1aeba4f1afee40262204dd074a93536ebf] +[#classboost_1_1geometry_1_1index_1_1rtree_1a0dad06d0f117f45ed54b5c123cb41d6e] [section bounds()] Returns the box able to contain all values stored in the container. @@ -737,7 +746,7 @@ Returns the box able to contain all values stored in the container. Returns the box able to contain all values stored in the container. If the container is empty the result of [^`geometry::assign_inverse()`] is returned.[heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a653555282525601512c3b1bed1e9590f bounds_type]] `bounds``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a89a6fd9a7c24f9d30422ef81ce2b959f bounds_type]] `bounds``()` ] [heading Modifier(s)] @@ -748,7 +757,7 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a17fce1fac81f6460d2c3a5744f4963ee] +[#classboost_1_1geometry_1_1index_1_1rtree_1aaa834c241c191ac9de67f134564f36fa] [section count(ValueOrIndexable const &)] Count Values or Indexables stored in the container. @@ -756,7 +765,7 @@ Count Values or Indexables stored in the container. For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter.[heading Synopsis] [pre `template<``typename ValueOrIndexable``>` -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a5c1a657074c527ed65f858c1ab6b36e6 size_type]] `count``(``ValueOrIndexable const &` `vori``)` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4 size_type]] `count``(``ValueOrIndexable const &` `vori``)` ] [heading Modifier(s)] @@ -772,14 +781,14 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a18910715f67608ff010556ac41f51606] +[#classboost_1_1geometry_1_1index_1_1rtree_1afef125f04ba51b50370fadc9c1b1e8bf] [section parameters()] Returns parameters. [heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1af85d4e399a807b3e4e46d38a0b4ffc5a parameters_type]]` const &` `parameters``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters``()` ] [heading Modifier(s)] @@ -790,32 +799,14 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1afc7e9a4bd53a58552c17c1e7cb997258] -[section translator()] -Returns the translator object. - -[heading Synopsis] -[pre - -[^[link classboost_1_1geometry_1_1index_1_1rtree_1adbc30a1fa986e2e856e0662111ac2d91 translator_type]]` const &` `translator``()` -] - -[heading Modifier(s)] -``const ``[heading Returns] -The translator object. -[heading Throws] -Nothing. - -[endsect] - -[#classboost_1_1geometry_1_1index_1_1rtree_1a1eeb303253f4cabe3a89a82ed41247ff] +[#classboost_1_1geometry_1_1index_1_1rtree_1a17d9cef211feb7f674a5b4602f4cc81e] [section get_allocator()] Returns allocator used by the rtree. [heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a9d35bc38fa697c6f600548fb5b38807d allocator_type]] `get_allocator``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]] `get_allocator``()` ] [heading Modifier(s)] diff --git a/doc/generated/rtree_functions.qbk b/doc/generated/rtree_functions.qbk index 466b7146f..5c553c15e 100644 --- a/doc/generated/rtree_functions.qbk +++ b/doc/generated/rtree_functions.qbk @@ -4,55 +4,57 @@ [heading Functions] [table [[Function][Description]] -[[[link group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] -[[[link group__rtree__functions_1gaf8f4fa09c12b96ace3bbb38823a9191b `insert(rtree<...> &, Iterator, Iterator)`]][Insert a range of values to the index. ]] -[[[link group__rtree__functions_1ga97ec330c1c021a1ac2d896a488c2eb9c `insert(rtree<...> &, Range const &)`]][Insert a range of values to the index. ]] -[[[link group__rtree__functions_1gad40492a5b99c3eebbd51901574762527 `remove(rtree<...> &, Value const &)`]][Remove a value from the container. ]] -[[[link group__rtree__functions_1ga0219361de8b15c539af3f9bd027938ce `remove(rtree<...> &, Iterator, Iterator)`]][Remove a range of values from the container. ]] -[[[link group__rtree__functions_1ga5885d6c90a91f238f72ab9b5ef24daf9 `remove(rtree<...> &, Range const &)`]][Remove a range of values from the container. ]] -[[[link group__rtree__functions_1ga86e0808522ef6682b72b310a3891b276 `query(rtree<...> const &, Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] -[[[link group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c `clear(rtree<...> &)`]][Remove all values from the index. ]] -[[[link group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] -[[[link group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] -[[[link group__rtree__functions_1gadb11fdb8e75ba7652286ec6750b49c4f `bounds(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] -[[[link group__rtree__functions_1ga043d21dc24c57fcabc5ee85093eb8b15 `swap(rtree<...> &, rtree<...> &)`]][Exchanges the contents of the container with those of other. ]] +[[[link group__rtree__functions_1gada4f62111ed22eb2860ea30995c1ce60 `insert(rtree<...> &, Value const &)`]][Insert a value to the index. ]] +[[[link group__rtree__functions_1ga056469ea699e609e67762fe1b789997f `insert(rtree<...> &, Iterator, Iterator)`]][Insert a range of values to the index. ]] +[[[link group__rtree__functions_1ga524e332717347c3ffb54d2497047215b `insert(rtree<...> &, Range const &)`]][Insert a range of values to the index. ]] +[[[link group__rtree__functions_1gaf353d90fd933e6110b031f63166fb45a `remove(rtree<...> &, Value const &)`]][Remove a value from the container. ]] +[[[link group__rtree__functions_1gaa460a8985496cf133f63f245527ac6e7 `remove(rtree<...> &, Iterator, Iterator)`]][Remove a range of values from the container. ]] +[[[link group__rtree__functions_1ga421f4fe0554d1b436b9e7e64794e6349 `remove(rtree<...> &, Range const &)`]][Remove a range of values from the container. ]] +[[[link group__rtree__functions_1gadb43b211d5d743ebe2ef256328286e95 `query(rtree<...> const &, Predicates const &, OutIter)`]][Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. ]] +[[[link group__rtree__functions_1gabaca6c24c3838a8164aa3700c459e7a4 `clear(rtree<...> &)`]][Remove all values from the index. ]] +[[[link group__rtree__functions_1gaa19a09e7b5f0a86a4b74ef2342de1d68 `size(rtree<...> const &)`]][Get the number of values stored in the index. ]] +[[[link group__rtree__functions_1gaba44e2fb12fdc7b528bfee56a88e0844 `empty(rtree<...> const &)`]][Query if there are no values stored in the index. ]] +[[[link group__rtree__functions_1ga4e43e7720c66e88959ff511a7462a3ff `bounds(rtree<...> const &)`]][Get the box containing all stored values or an invalid box if the index has no values. ]] +[[[link group__rtree__functions_1gaa1250318a78d7e27ba8f3537eb0ddb3f `swap(rtree<...> &, rtree<...> &)`]][Exchanges the contents of the container with those of other. ]] ] -[#group__rtree__functions_1gac0ac9ed0e01f7494a5a3059e75d3c5cc] +[#group__rtree__functions_1gada4f62111ed22eb2860ea30995c1ce60] [section insert(rtree<...> &, Value const &)] Insert a value to the index. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1af6d5bd81e46cb4ff89277c753133664c rtree::insert(value_type const&)]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad47980467e66b8644df18a480dbf9d86 rtree::insert(value_type const&)]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``>` -`void boost::geometry::index::insert``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Value const &` `v``)` +`void boost::geometry::index::insert``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `tree``,` `Value const &` `v``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `tree` ][The spatial index. ]] [[`Value const &`][ `v` ][The value which will be stored in the index. ]] ] [endsect] -[#group__rtree__functions_1gaf8f4fa09c12b96ace3bbb38823a9191b] +[#group__rtree__functions_1ga056469ea699e609e67762fe1b789997f] [section insert(rtree<...> &, Iterator, Iterator)] Insert a range of values to the index. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4ad1d44cc540d rtree::insert(Iterator, Iterator)]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a60d4c8790fd8810ff8b57f049e6bed8d rtree::insert(Iterator, Iterator)]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``,` `typename Iterator``>` -`void boost::geometry::index::insert``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` +`void boost::geometry::index::insert``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `tree``,` `Iterator` `first``,` `Iterator` `last``)` ] @@ -60,84 +62,87 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5263a3faac7b4f0090d4 [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `tree` ][The spatial index. ]] [[`Iterator`][ `first` ][The beginning of the range of values. ]] [[`Iterator`][ `last` ][The end of the range of values. ]] ] [endsect] -[#group__rtree__functions_1ga97ec330c1c021a1ac2d896a488c2eb9c] +[#group__rtree__functions_1ga524e332717347c3ffb54d2497047215b] [section insert(rtree<...> &, Range const &)] Insert a range of values to the index. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1abb624abd9268b41e815d40342b2634c2 rtree::insert(Range const&)]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a39be117f85cc9ebc508d8ecf77578329 rtree::insert(Range const&)]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``,` `typename Range``>` -`void boost::geometry::index::insert``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Range const &` `rng``)` +`void boost::geometry::index::insert``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `tree``,` `Range const &` `rng``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `tree` ][The spatial index. ]] [[`Range const &`][ `rng` ][The range of values. ]] ] [endsect] -[#group__rtree__functions_1gad40492a5b99c3eebbd51901574762527] +[#group__rtree__functions_1gaf353d90fd933e6110b031f63166fb45a] [section remove(rtree<...> &, Value const &)] Remove a value from the container. [heading Description] Remove a value from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method this function removes only one value from the container. -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1af6ca6909354a997f89411ef40ea5688a rtree::remove(value_type const&)]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a1ce933b0b833faec5349bfc27bde15d4 rtree::remove(value_type const&)]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``>` -`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Value const &` `v``)` +`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `tree``,` `Value const &` `v``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `tree` ][The spatial index. ]] [[`Value const &`][ `v` ][The value which will be removed from the index.]] ] [heading Returns] 1 if value was removed, 0 otherwise. [endsect] -[#group__rtree__functions_1ga0219361de8b15c539af3f9bd027938ce] +[#group__rtree__functions_1gaa460a8985496cf133f63f245527ac6e7] [section remove(rtree<...> &, Iterator, Iterator)] Remove a range of values from the container. [heading Description] Remove a range of values from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values. -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16ebc49cd5371fbd rtree::remove(Iterator, Iterator)]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1aa97084231d17564a94f0142d095cecaa rtree::remove(Iterator, Iterator)]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``,` `typename Iterator``>` -`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` - `Iterator` `first``,` - `Iterator` `last``)` +`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `tree``,` + `Iterator` `first``,` + `Iterator` `last``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `tree` ][The spatial index. ]] [[`Iterator`][ `first` ][The beginning of the range of values. ]] [[`Iterator`][ `last` ][The end of the range of values.]] ] @@ -145,34 +150,35 @@ It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a6e9123114697d65b16eb The number of removed values. [endsect] -[#group__rtree__functions_1ga5885d6c90a91f238f72ab9b5ef24daf9] +[#group__rtree__functions_1ga421f4fe0554d1b436b9e7e64794e6349] [section remove(rtree<...> &, Range const &)] Remove a range of values from the container. [heading Description] Remove a range of values from the container. In contrast to the [^`std::set`] or [^`std::map erase()`] method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values. -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a5a57bb93b0b2d7ea1c659e925f918e9c rtree::remove(Range const&)]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a8a6460c186f595e91be69b1062ecae8b rtree::remove(Range const&)]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``,` `typename Range``>` -`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Options, Translator, Allocator > &` `tree``,` `Range const &` `rng``)` +`rtree::size_type boost::geometry::index::remove``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `tree``,` `Range const &` `rng``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `tree` ][The spatial index. ]] [[`Range const &`][ `rng` ][The range of values.]] ] [heading Returns] The number of removed values. [endsect] -[#group__rtree__functions_1ga86e0808522ef6682b72b310a3891b276] +[#group__rtree__functions_1gadb43b211d5d743ebe2ef256328286e95] [section query(rtree<...> const &, Predicates const &, OutIter)] Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. @@ -215,20 +221,21 @@ If the nearest predicate is passed a k-nearest neighbor search will be performed Predicates may be passed together connected with [^`operator&&()`].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``,` `typename Predicates``,` `typename OutIter``>` -`rtree::size_type boost::geometry::index::query``(``rtree< Value, Options, Translator, Allocator > const &` `tree``,` - `Predicates const &` `predicates``,` - `OutIter` `out_it``)` +`rtree::size_type boost::geometry::index::query``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &` `tree``,` + `Predicates const &` `predicates``,` + `OutIter` `out_it``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The rtree. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &`][ `tree` ][The rtree. ]] [[`Predicates const &`][ `predicates` ][Predicates. ]] [[`OutIter`][ `out_it` ][The output iterator, e.g. generated by std::back_inserter().]] ] @@ -257,74 +264,77 @@ If Value copy constructor or copy assignment throws. [endsect] -[#group__rtree__functions_1ga0c65d7b29b1edf72f1d236ccf211f63c] +[#group__rtree__functions_1gabaca6c24c3838a8164aa3700c459e7a4] [section clear(rtree<...> &)] Remove all values from the index. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ae6027e42d28a4bf93e74b055c79e6b09 rtree::clear()]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a1bec40977c175983f585c4488cf8fe3c rtree::clear()]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``>` -`void boost::geometry::index::clear``(``rtree< Value, Options, Translator, Allocator > &` `tree``)` +`void boost::geometry::index::clear``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `tree``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `tree` ][The spatial index. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `tree` ][The spatial index. ]] ] [endsect] -[#group__rtree__functions_1gaec0b88a9d8b408753e3069134f1598c7] +[#group__rtree__functions_1gaa19a09e7b5f0a86a4b74ef2342de1d68] [section size(rtree<...> const &)] Get the number of values stored in the index. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1a89561a834563f2ed6fc782bad16143fd rtree::size()]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ac9f152c8c96525e3735b81635d8171b1 rtree::size()]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``>` -`size_t boost::geometry::index::size``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +`size_t boost::geometry::index::size``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &` `tree``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index.]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &`][ `tree` ][The spatial index.]] ] [heading Returns] The number of values stored in the index. [endsect] -[#group__rtree__functions_1ga459e3d404fec7cbd66794714cbdd129e] +[#group__rtree__functions_1gaba44e2fb12fdc7b528bfee56a88e0844] [section empty(rtree<...> const &)] Query if there are no values stored in the index. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1ae889567443b0ba0dbdb975564c55804c rtree::empty()]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1aa5302ce1c26105d722aac20793e83f0e rtree::empty()]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``>` -`bool boost::geometry::index::empty``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +`bool boost::geometry::index::empty``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &` `tree``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index.]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &`][ `tree` ][The spatial index.]] ] [heading Returns] true if there are no values in the index. [endsect] -[#group__rtree__functions_1gadb11fdb8e75ba7652286ec6750b49c4f] +[#group__rtree__functions_1ga4e43e7720c66e88959ff511a7462a3ff] [section bounds(rtree<...> const &)] Get the box containing all stored values or an invalid box if the index has no values. @@ -332,40 +342,42 @@ Get the box containing all stored values or an invalid box if the index has no v It calls [^`rtree::envelope()`].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``>` -`rtree::bounds_type boost::geometry::index::bounds``(``rtree< Value, Options, Translator, Allocator > const &` `tree``)` +`rtree::bounds_type boost::geometry::index::bounds``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &` `tree``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > const &`][ `tree` ][The spatial index.]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &`][ `tree` ][The spatial index.]] ] [heading Returns] The box containing all stored values or an invalid box. [endsect] -[#group__rtree__functions_1ga043d21dc24c57fcabc5ee85093eb8b15] +[#group__rtree__functions_1gaa1250318a78d7e27ba8f3537eb0ddb3f] [section swap(rtree<...> &, rtree<...> &)] Exchanges the contents of the container with those of other. [heading Description] -It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1aad0285d25f96341a8dd6cc22feb3bd73 rtree::swap()]].[heading Synopsis] +It calls [^[link classboost_1_1geometry_1_1index_1_1rtree_1aedb719dfece91d298e9ee56878524c9b rtree::swap()]].[heading Synopsis] [pre `template<``typename Value``,` - `typename Options``,` - `typename Translator``,` + `typename Parameters``,` + `typename IndexableGetter``,` + `typename EqualTo``,` `typename Allocator``>` -`void boost::geometry::index::swap``(``rtree< Value, Options, Translator, Allocator > &` `l``,` `rtree< Value, Options, Translator, Allocator > &` `r``)` +`void boost::geometry::index::swap``(``rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `l``,` `rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &` `r``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `l` ][The first rtree. ]] -[[`rtree< Value, Options, Translator, Allocator > &`][ `r` ][The second rtree. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `l` ][The first rtree. ]] +[[`rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &`][ `r` ][The second rtree. ]] ] [endsect] diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index c00e43835..dd5718dbb 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 4bf610979..e66d1de71 100644 --- a/doc/html/geometry_index/r_tree.html +++ b/doc/html/geometry_index/r_tree.html @@ -3,7 +3,7 @@ R-tree - + @@ -34,8 +34,8 @@

                                                                                                                            Template parameters
                                                                                                                            -
                                                                                                                            Values, - Indexables and default Translator
                                                                                                                            +
                                                                                                                            Values + and Indexables
                                                                                                                            Balancing algorithms (compile-time)
                                                                                                                            Balancing @@ -74,10 +74,11 @@ of shared pointers to polygons
                                                                                                                            Index of iterators of a map storing variant geometries
                                                                                                                            -
                                                                                                                            Specializing - Translator - storing shared pointers in the rtree
                                                                                                                            -
                                                                                                                            Using - Translator object - storing indexes of external container's elements
                                                                                                                            +
                                                                                                                            Specializing + index::indexable function object - storing shared pointers in the rtree
                                                                                                                            +
                                                                                                                            Using + IndexableGetter function object - storing indexes of external container's + elements
                                                                                                                            Index stored in shared memory using Boost.Interprocess
                                                                                                                            @@ -88,7 +89,8 @@ related to the rtree
                                                                                                                            R-tree parameters (boost::geometry::index::)
                                                                                                                            -
                                                                                                                            boost::geometry::index::translator
                                                                                                                            +
                                                                                                                            boost::geometry::index::indexable
                                                                                                                            +
                                                                                                                            boost::geometry::index::equal_to
                                                                                                                            Predicates (boost::geometry::index::)
                                                                                                                            Nearest 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 5a53f97f9..0a04217d9 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 - + @@ -30,8 +30,8 @@
                                                                                                                            Template parameters
                                                                                                                            -
                                                                                                                            Values, - Indexables and default Translator
                                                                                                                            +
                                                                                                                            Values + and Indexables
                                                                                                                            Balancing algorithms (compile-time)
                                                                                                                            Balancing @@ -53,9 +53,13 @@

                                                                                                                            R-tree has 4 parameters:

                                                                                                                            -
                                                                                                                            rtree<Value, Parameters, Translator = index::translator<Value>, Allocator> = std::allocator<Value> >
                                                                                                                            +
                                                                                                                            rtree<Value,
                                                                                                                            +      Parameters,
                                                                                                                            +      IndexableGetter = index::indexable<Value>,
                                                                                                                            +      EqualTo = index::equal_to<Value>,
                                                                                                                            +      Allocator = std::allocator<Value> >
                                                                                                                             
                                                                                                                            -

                                                                                                                            - A Translator is a type which knows how to handle Values. - It has two purposes: -

                                                                                                                            -
                                                                                                                              -
                                                                                                                            • - it translates Value to a more suitable Indexable - type which is needed by most of operations, -
                                                                                                                            • -
                                                                                                                            • - performs a comparison of Value which is needed by the - removing process. -
                                                                                                                            • -
                                                                                                                            -

                                                                                                                            - A Translator translates the Value each time the - R-tree needs it. For this reason it should rather return const reference - to the Indexable than a copy. + index::indexable<Value> + translates the Value each time the R-tree needs it. For this + reason it should rather return const reference to the Indexable + than a copy.

                                                                                                                            - If comparison of two Values is required, the default translator: + If comparison of two Values is required, the predefined index::equal_to<Value>:

                                                                                                                            -
                                                                                                                              +
                                                                                                                              • for Point and Box @@ -142,9 +136,10 @@
                                                                                                                              • for std::pair<...> - - compares both components of the Value. The first one - is compared with geometry::equals(). If the second one is a Geometry, geometry::equals() function is used. For other types - it uses operator==(). + - compares both components of the Value. The first value + stored in the pair is compared before the second one. If the value + stored in the pair is a Geometry, geometry::equals() is used. For other types it uses + operator==().
                                                                                                                              • for boost::tuple<...> diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 74f9022ec..8dc523bbc 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                                                                                                                            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 + 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 [2]. + close to some point in space [2].

                                                                                                                            The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                                                                                                                            The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -181,13 +181,13 @@

                                                                                                                          - Implementation + Implementation details

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

                                                                                                                          -
                                                                                                                            +
                                                                                                                            • capable to store arbitrary Value type,
                                                                                                                            • @@ -211,7 +211,7 @@
                                                                                                                            - Dependencies + Dependencies

                                                                                                                            R-tree depends on Boost.Move, Boost.Container, Boost.Tuple, @@ -219,7 +219,7 @@

                                                                                                                            - Contributors + Contributors

                                                                                                                            The spatial index was originally started by Federico J. Fernandez during @@ -227,7 +227,7 @@

                                                                                                                            - Spatial + Spatial thanks

                                                                                                                            @@ -235,20 +235,20 @@ J. Simonson for their support and ideas.

                                                                                                                            -

                                                                                                                            -

                                                                                                                            [1] +


                                                                                                                            +

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

                                                                                                                            -

                                                                                                                            [2] +

                                                                                                                            [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                                                                                                                            -

                                                                                                                            [3] +

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

                                                                                                                            -

                                                                                                                            [4] +

                                                                                                                            [4] 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/queries.html b/doc/html/geometry_index/r_tree/queries.html index 2429cdc5f..4837026dc 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -44,7 +44,7 @@ Queries returns Values which meets some predicates. Currently supported are three types of predicates:

                                                                                                                            -
                                                                                                                              +
                                                                                                                              - +

                                                                                                                              Last revised: March 01, 2013 at 18:11:11 GMT

                                                                                                                              Last revised: March 02, 2013 at 02:16:56 GMT


                                                                                                                              diff --git a/doc/imports.qbk b/doc/imports.qbk index 8072b3859..5d81a7639 100644 --- a/doc/imports.qbk +++ b/doc/imports.qbk @@ -12,6 +12,6 @@ [import src/examples/rtree/polygons_vector.cpp] [import src/examples/rtree/polygons_shared_ptr.cpp] [import src/examples/rtree/variants_map.cpp] -[import src/examples/rtree/translator_shared_ptr.cpp] -[import src/examples/rtree/translator_index.cpp] +[import src/examples/rtree/value_shared_ptr.cpp] +[import src/examples/rtree/value_index.cpp] [import src/examples/rtree/interprocess.cpp] diff --git a/doc/index.qbk b/doc/index.qbk index 7c49b934b..ca2921efc 100644 --- a/doc/index.qbk +++ b/doc/index.qbk @@ -33,7 +33,6 @@ [def __value__ Value] [def __parameters__ Parameters] -[def __translator__ Translator] [def __allocator__ Allocator] [def __indexable__ Indexable] diff --git a/doc/make_qbk.py b/doc/make_qbk.py index 8bc316a60..51fa3b38d 100755 --- a/doc/make_qbk.py +++ b/doc/make_qbk.py @@ -27,9 +27,8 @@ os.system(cmd % ("classboost_1_1geometry_1_1index_1_1dynamic__linear", "rtree_dy os.system(cmd % ("classboost_1_1geometry_1_1index_1_1dynamic__quadratic", "rtree_dynamic_quadratic")) os.system(cmd % ("classboost_1_1geometry_1_1index_1_1dynamic__rstar", "rtree_dynamic_rstar")) -os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator", "translator")) -#os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_3_01std_1_1pair_3_01_indexable_00_01_second_01_4_01_4", "translator_pair")) -#os.system(cmd % ("structboost_1_1geometry_1_1index_1_1translator_3_01boost_1_1tuple_3_01_indexable_00_01_t1_00_01_1c55aa63046ee2c1171cfc2033fb0edd", "translator_tuple")) +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1indexable", "indexable")) +os.system(cmd % ("structboost_1_1geometry_1_1index_1_1equal__to", "equal_to")) os.system(cmd % ("group__predicates", "predicates")) os.system(cmd % ("group__nearest__relations", "nearest_relations")) diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 853f00fc6..2e5c51735 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -14,22 +14,26 @@ __rtree__ has 4 parameters: - rtree, Allocator> = std::allocator > + rtree, + EqualTo = index::equal_to, + Allocator = std::allocator > * `__value__` - type of object which will be stored in the container, * `Parameters` - parameters type, inserting/splitting algorithm, -* `__translator__` - type of object translating `Value` objects to - `__indexable__` objects (`__point__` or `__box__`) which __rtree__ can handle, +* `IndexableGetter` - function object translating `__value__` to `__indexable__` (`__point__` or `__box__`) which __rtree__ can handle, +* `EqualTo` - function object comparing `__value__`s, * `Allocator` - `Value`s allocator, all allocators needed by the container are created from it. [endsect] -[section Values, Indexables and default Translator] +[section Values and Indexables] -__rtree__ may store `__value__`s of any type as long the `__translator__` knows how to interpret those `__value__`s -and extract an object that the __rtree__ can handle. Those objects are called -`__indexable__`s in this documentation. Each type adapted to `__point__` or `__box__` concept is an `__indexable__`. -`__value__`s types which can be handled by the default `__translator__` - `index::translator<__value__>` +__rtree__ may store `__value__`s of any type as passed function objects knows how to interpret those `__value__`s, that is +extract an `__indexable__` that the __rtree__ can handle and compare `__values__`. +Each type adapted to `__point__` or `__box__` concept is an `__indexable__`. +`__value__`s types which can be handled by the predefined function objects `index::indexable` and `index::equal_to` are defined as follows: * `__indexable__ = __point__ | __box__` @@ -43,19 +47,14 @@ Examples of default `__value__` types: std::pair, unsigned> boost::tuple, int, float> -A `__translator__` is a type which knows how to handle `__value__`s. It has two purposes: - -* it translates `__value__` to a more suitable `__indexable__` type which is needed by most of operations, -* performs a comparison of `__value__` which is needed by the removing process. - -A `__translator__` translates the `__value__` each time the __rtree__ needs it. For this reason +`index::indexable` translates the `__value__` each time the __rtree__ needs it. For this reason it should rather return const reference to the `__indexable__` than a copy. -If comparison of two `__value__`s is required, the default translator: +If comparison of two `__value__`s is required, the predefined `index::equal_to`: * for `__point__` and `__box__` - compares `__value__`s with geometry::equals(). -* for `std::pair<...>` - compares both components of the `__value__`. The first one is compared with `geometry::equals()`. - If the second one is a `Geometry`, `geometry::equals()` function is used. For other types it uses `operator==()`. +* for `std::pair<...>` - compares both components of the `__value__`. The first value stored in the pair is compared before the second one. + If the value stored in the pair is a Geometry, `geometry::equals()` is used. For other types it uses `operator==()`. * for `boost::tuple<...>` - compares all components of the `__value__`. If the component is a `Geometry`, `geometry::equals()` function is used. For other types it uses `operator==()`. diff --git a/doc/rtree/examples.qbk b/doc/rtree/examples.qbk index a8ce7ac94..8b57bde7e 100644 --- a/doc/rtree/examples.qbk +++ b/doc/rtree/examples.qbk @@ -26,12 +26,12 @@ [rtree_variants_map] [endsect] -[section Specializing Translator - storing shared pointers in the rtree] -[rtree_translator_shared_ptr] +[section Specializing index::indexable function object - storing shared pointers in the rtree] +[rtree_value_shared_ptr] [endsect] -[section Using Translator object - storing indexes of external container's elements] -[rtree_translator_index] +[section Using IndexableGetter function object - storing indexes of external container's elements] +[rtree_value_index] [endsect] [section Index stored in shared memory using Boost.Interprocess] diff --git a/doc/rtree/reference.qbk b/doc/rtree/reference.qbk index a9665ff1f..c53b01fbd 100644 --- a/doc/rtree/reference.qbk +++ b/doc/rtree/reference.qbk @@ -24,11 +24,10 @@ [endsect] -[/section:translator Translator (boost::geometry::index::translator)/] +[/section:function_objects Function objects (boost::geometry::index::)/] -[include ../generated/translator.qbk] -[/include ../generated/translator_pair.qbk/] -[/include ../generated/translator_tuple.qbk/] +[include ../generated/indexable.qbk] +[include ../generated/equal_to.qbk] [/endsect/] diff --git a/doc/src/examples/rtree/Jamfile.v2 b/doc/src/examples/rtree/Jamfile.v2 index 381fc1e52..79778b9ab 100644 --- a/doc/src/examples/rtree/Jamfile.v2 +++ b/doc/src/examples/rtree/Jamfile.v2 @@ -10,8 +10,8 @@ exe quick_start : quick_start.cpp ; exe polygons_vector : polygons_vector.cpp ; exe polygons_shared_ptr : polygons_shared_ptr.cpp ; exe variants_map : variants_map.cpp ; -exe translator_shared_ptr : translator_shared_ptr.cpp ; -exe translator_index : translator_index.cpp ; +exe value_shared_ptr : value_shared_ptr.cpp ; +exe value_index : value_index.cpp ; exe interprocess : interprocess.cpp /boost/thread//boost_thread : diff --git a/doc/src/examples/rtree/interprocess.cpp b/doc/src/examples/rtree/interprocess.cpp index 4260ffdf1..61d3f0b50 100644 --- a/doc/src/examples/rtree/interprocess.cpp +++ b/doc/src/examples/rtree/interprocess.cpp @@ -37,9 +37,10 @@ int main(int argc, char *argv[]) typedef bgm::box

                                                                                                                              B; typedef bgi::linear<32, 8> Par; - typedef bgi::translator Tr; + typedef bgi::indexable I; + typedef bgi::equal_to E; typedef allocator Alloc; - typedef bgi::rtree Rtree; + typedef bgi::rtree Rtree; //Parent process if ( argc == 1 ) @@ -54,7 +55,7 @@ int main(int argc, char *argv[]) std::cout << "Parent: Constructing container\n"; - Rtree * tree = segment.construct("Rtree")(Par(), Tr(), Alloc(segment.get_segment_manager())); + Rtree * tree = segment.construct("Rtree")(Par(), I(), E(), Alloc(segment.get_segment_manager())); std::cout << "Parent: Filling container with 100 boxes\n"; @@ -108,4 +109,4 @@ int main(int argc, char *argv[]) return 0; }; -//] \ No newline at end of file +//] diff --git a/doc/src/examples/rtree/translator_index.cpp b/doc/src/examples/rtree/value_index.cpp similarity index 88% rename from doc/src/examples/rtree/translator_index.cpp rename to doc/src/examples/rtree/value_index.cpp index 978b7dbae..32f306909 100644 --- a/doc/src/examples/rtree/translator_index.cpp +++ b/doc/src/examples/rtree/value_index.cpp @@ -8,7 +8,7 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -//[rtree_translator_index +//[rtree_value_index #include #include @@ -25,7 +25,7 @@ namespace bg = boost::geometry; namespace bgi = boost::geometry::index; template -class index_translator +class my_indexable { typedef typename Container::size_type size_t; typedef typename Container::const_reference cref; @@ -33,9 +33,8 @@ class index_translator public: typedef cref result_type; - explicit index_translator(Container const& c) : container(c) {} + explicit my_indexable(Container const& c) : container(c) {} result_type operator()(size_t i) const { return container[i]; } - bool equals(size_t i1, size_t i2) const { return i1 == i2; } }; int main(void) @@ -44,7 +43,7 @@ int main(void) typedef bg::model::box box; typedef std::vector::size_type value; typedef bgi::rstar<16, 4> parameters; - typedef index_translator< std::vector > translator; + typedef my_indexable< std::vector > indexable_getter; // boxes std::vector boxes; @@ -63,8 +62,8 @@ int main(void) // create the rtree parameters params; - translator tr(boxes); - bgi::rtree rtree(params, tr); + indexable_getter ind(boxes); + bgi::rtree rtree(params, ind); // fill the spatial index for ( size_t i = 0 ; i < boxes.size() ; ++i ) diff --git a/doc/src/examples/rtree/translator_shared_ptr.cpp b/doc/src/examples/rtree/value_shared_ptr.cpp similarity index 94% rename from doc/src/examples/rtree/translator_shared_ptr.cpp rename to doc/src/examples/rtree/value_shared_ptr.cpp index 52e26a280..e2ff55737 100644 --- a/doc/src/examples/rtree/translator_shared_ptr.cpp +++ b/doc/src/examples/rtree/value_shared_ptr.cpp @@ -8,7 +8,7 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -//[rtree_translator_shared_ptr +//[rtree_value_shared_ptr #include #include @@ -28,13 +28,12 @@ namespace bgi = boost::geometry::index; namespace boost { namespace geometry { namespace index { template -struct translator< boost::shared_ptr > +struct indexable< boost::shared_ptr > { typedef boost::shared_ptr V; typedef Box const& result_type; result_type operator()(V const& v) const { return *v; } - bool equals(V const& v1, V const& v2) const { return v1 == v2; } }; }}} // namespace boost::geometry::index diff --git a/include/boost/geometry/index/detail/rtree/adaptors.hpp b/include/boost/geometry/index/detail/rtree/adaptors.hpp index 8874000ef..4e0eb9ba0 100644 --- a/include/boost/geometry/index/detail/rtree/adaptors.hpp +++ b/include/boost/geometry/index/detail/rtree/adaptors.hpp @@ -18,13 +18,13 @@ namespace boost { namespace geometry { namespace index { -template +template class rtree; namespace adaptors { namespace detail { -template -class query_range< index::rtree > +template +class query_range< index::rtree > { public: typedef std::vector result_type; @@ -32,7 +32,7 @@ public: typedef typename result_type::const_iterator const_iterator; template inline - query_range(index::rtree const& rtree, + query_range(index::rtree const& rtree, Predicates const& pred) { rtree.query(pred, std::back_inserter(m_result)); diff --git a/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp index 7b85a15db..587dd58f9 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp @@ -120,11 +120,11 @@ private: #error "To use are_boxes_ok BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" #endif -template -bool are_boxes_ok(index::rtree const& tree, +template +bool are_boxes_ok(index::rtree const& tree, bool exact_match = true) { - typedef index::rtree rt; + typedef index::rtree rt; detail::rtree::visitors::are_boxes_ok< typename rt::value_type, diff --git a/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp index 24383e87d..cd30e5239 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp @@ -91,10 +91,10 @@ private: #error "To use are_levels_ok() BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" #endif -template -bool are_levels_ok(index::rtree const& tree) +template +bool are_levels_ok(index::rtree const& tree) { - typedef index::rtree rt; + typedef index::rtree rt; detail::rtree::visitors::are_levels_ok< typename rt::value_type, diff --git a/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp b/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp index 14b1be42a..9a3c47f7b 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/gl_draw.hpp @@ -187,16 +187,16 @@ struct gl_draw : public rtree::visitor -void gl_draw(rtree const& tree, +template +void gl_draw(rtree const& tree, size_t level_first = 0, size_t level_last = (std::numeric_limits::max)(), typename index::detail::traits::coordinate_type< - typename rtree::box_type + typename rtree::box_type >::type z_coord_level_multiplier = 1 ) { - typedef rtree rtree_type; + typedef rtree rtree_type; typedef typename rtree_type::value_type value_type; typedef typename rtree_type::options_type options_type; diff --git a/include/boost/geometry/index/detail/rtree/visitors/print.hpp b/include/boost/geometry/index/detail/rtree/visitors/print.hpp index c28c0a0fc..0d989df02 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/print.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/print.hpp @@ -178,10 +178,10 @@ struct print : public rtree::visitor -std::ostream & operator<<(std::ostream & os, rtree const& tree) +template +std::ostream & operator<<(std::ostream & os, rtree const& tree) { - typedef rtree rtree_type; + typedef rtree rtree_type; typedef typename rtree_type::value_type value_type; typedef typename rtree_type::options_type options_type; typedef typename rtree_type::translator_type translator_type; diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index e95037f7e..17de3a113 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -89,15 +89,17 @@ or Box concepts (called Indexables). It also handles std::pair boost::tuple. For example, if std::pair is stored in the container, the default translator translates from std::pair const& to Box const&. -\tparam Value The type of objects stored in the container. -\tparam Parameters Compile-time parameters. -\tparam Translator The type of the translator which translates from Value to Indexable. -\tparam Allocator The allocator used to allocate/deallocate memory, construct/destroy nodes and Values. +\tparam Value The type of objects stored in the container. +\tparam Parameters Compile-time parameters. +\tparam IndexableGetter The function object extracting Indexable from Value. +\tparam EqualTo The function object comparing objects of type Value. +\tparam Allocator The allocator used to allocate/deallocate memory, construct/destroy nodes and Values. */ template < typename Value, typename Parameters, - typename Translator = index::translator, + typename IndexableGetter = index::indexable, + typename EqualTo = index::equal_to, typename Allocator = std::allocator > class rtree @@ -109,15 +111,16 @@ public: typedef Value value_type; /*! \brief R-tree parameters type. */ typedef Parameters parameters_type; - /*! \brief Value to Indexable Translator type. */ - typedef Translator translator_type; /*! \brief The type of allocator used by the container. */ typedef Allocator allocator_type; /*! \brief Unsigned integral type used by the container. */ typedef typename allocator_type::size_type size_type; + // temporarily public - don't use it + typedef detail::translator::translator translator_type; + /*! \brief The Indexable type to which Value is translated. */ - typedef typename index::detail::translator::indexable_type::type indexable_type; + typedef typename index::detail::translator::indexable_type::type indexable_type; /*! \brief The Box type used by the R-tree. */ typedef typename index::detail::default_box_type::type bounds_type; @@ -141,41 +144,46 @@ public: /*! \brief The constructor. - \param parameters The parameters object. - \param translator The translator object. + \param parameters The parameters object. + \param indexable_getter The function object extracting Indexable from Value. + \param equal_to The function object comparing Values. \par Throws If allocator default constructor throws. */ inline explicit rtree(parameters_type const& parameters = parameters_type(), - translator_type const& translator = translator_type()) - : m_members(translator, parameters) + IndexableGetter const& indexable_getter = IndexableGetter(), + EqualTo const& equal_to = EqualTo()) + : m_members(translator_type(indexable_getter, equal_to), parameters) {} /*! \brief The constructor. - \param parameters The parameters object. - \param translator The translator object. - \param allocator The allocator object. + \param parameters The parameters object. + \param indexable_getter The function object extracting Indexable from Value. + \param equal_to The function object comparing Values. + \param allocator The allocator object. \par Throws If allocator copy constructor throws. */ inline rtree(parameters_type const& parameters, - translator_type const& translator, + IndexableGetter const& indexable_getter, + EqualTo const& equal_to, allocator_type allocator) - : m_members(translator, parameters, allocator) + : m_members(translator_type(indexable_getter, equal_to), parameters, allocator) {} /*! \brief The constructor. - \param first The beginning of the range of Values. - \param last The end of the range of Values. - \param parameters The parameters object. - \param translator The translator object. - \param allocator The allocator object. + \param first The beginning of the range of Values. + \param last The end of the range of Values. + \param parameters The parameters object. + \param indexable_getter The function object extracting Indexable from Value. + \param equal_to The function object comparing Values. + \param allocator The allocator object. \par Throws \li If allocator copy constructor throws. @@ -186,9 +194,10 @@ public: template inline rtree(Iterator first, Iterator last, parameters_type const& parameters = parameters_type(), - translator_type const& translator = translator_type(), + IndexableGetter const& indexable_getter = IndexableGetter(), + EqualTo const& equal_to = EqualTo(), allocator_type allocator = allocator_type()) - : m_members(translator, parameters, allocator) + : m_members(translator_type(indexable_getter, equal_to), parameters, allocator) { try { @@ -204,10 +213,11 @@ public: /*! \brief The constructor. - \param rng The range of Values. - \param parameters The parameters object. - \param translator The translator object. - \param allocator The allocator object. + \param rng The range of Values. + \param parameters The parameters object. + \param indexable_getter The function object extracting Indexable from Value. + \param equal_to The function object comparing Values. + \param allocator The allocator object. \par Throws \li If allocator copy constructor throws. @@ -218,9 +228,10 @@ public: template inline explicit rtree(Range const& rng, parameters_type const& parameters = parameters_type(), - translator_type const& translator = translator_type(), + IndexableGetter const& indexable_getter = IndexableGetter(), + EqualTo const& equal_to = EqualTo(), allocator_type allocator = allocator_type()) - : m_members(translator, parameters, allocator) + : m_members(translator_type(indexable_getter, equal_to), parameters, allocator) { try { @@ -770,19 +781,6 @@ public: return m_members.parameters(); } - /*! - \brief Returns the translator object. - - \return The translator object. - - \par Throws - Nothing. - */ - inline translator_type const& translator() const - { - return m_members.translator(); - } - /*! \brief Returns allocator used by the rtree. @@ -799,6 +797,19 @@ public: #if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) private: #endif + /*! + \brief Returns the translator object. + + \return The translator object. + + \par Throws + Nothing. + */ + inline translator_type const& translator() const + { + return m_members.translator(); + } + /*! \brief Apply a visitor to the nodes structure in order to perform some operator. @@ -1094,8 +1105,8 @@ private: {} template - members_holder(Transl const& transl = Translator(), - Parameters const& parameters = Parameters()) + members_holder(Transl const& transl, + Parameters const& parameters) : translator_type(transl) , Parameters(parameters) , allocators_type() @@ -1129,8 +1140,8 @@ It calls rtree::insert(value_type const&). \param tree The spatial index. \param v The value which will be stored in the index. */ -template -inline void insert(rtree & tree, Value const& v) +template +inline void insert(rtree & tree, Value const& v) { tree.insert(v); } @@ -1146,8 +1157,8 @@ It calls rtree::insert(Iterator, Iterator). \param first The beginning of the range of values. \param last The end of the range of values. */ -template -inline void insert(rtree & tree, Iterator first, Iterator last) +template +inline void insert(rtree & tree, Iterator first, Iterator last) { tree.insert(first, last); } @@ -1162,8 +1173,8 @@ It calls rtree::insert(Range const&). \param tree The spatial index. \param rng The range of values. */ -template -inline void insert(rtree & tree, Range const& rng) +template +inline void insert(rtree & tree, Range const& rng) { tree.insert(rng); } @@ -1183,9 +1194,9 @@ It calls rtree::remove(value_type const&). \return 1 if value was removed, 0 otherwise. */ -template -inline typename rtree::size_type -remove(rtree & tree, Value const& v) +template +inline typename rtree::size_type +remove(rtree & tree, Value const& v) { return tree.remove(v); } @@ -1208,9 +1219,9 @@ It calls rtree::remove(Iterator, Iterator). \return The number of removed values. */ -template -inline typename rtree::size_type -remove(rtree & tree, Iterator first, Iterator last) +template +inline typename rtree::size_type +remove(rtree & tree, Iterator first, Iterator last) { return tree.remove(first, last); } @@ -1231,9 +1242,9 @@ It calls rtree::remove(Range const&). \return The number of removed values. */ -template -inline typename rtree::size_type -remove(rtree & tree, Range const& rng) +template +inline typename rtree::size_type +remove(rtree & tree, Range const& rng) { return tree.remove(rng); } @@ -1305,9 +1316,10 @@ Only one \c nearest() perdicate may be passed to the query. \return The number of values found. */ -template inline -typename rtree::size_type -query(rtree const& tree, +template inline +typename rtree::size_type +query(rtree const& tree, Predicates const& predicates, OutIter out_it) { @@ -1323,8 +1335,8 @@ It calls \c rtree::clear(). \param tree The spatial index. */ -template -inline void clear(rtree & tree) +template +inline void clear(rtree & tree) { return tree.clear(); } @@ -1340,8 +1352,8 @@ It calls \c rtree::size(). \return The number of values stored in the index. */ -template -inline size_t size(rtree const& tree) +template +inline size_t size(rtree const& tree) { return tree.size(); } @@ -1357,8 +1369,8 @@ It calls \c rtree::empty(). \return true if there are no values in the index. */ -template -inline bool empty(rtree const& tree) +template +inline bool empty(rtree const& tree) { return tree.bounds(); } @@ -1374,9 +1386,9 @@ It calls \c rtree::envelope(). \return The box containing all stored values or an invalid box. */ -template -inline typename rtree::bounds_type -bounds(rtree const& tree) +template +inline typename rtree::bounds_type +bounds(rtree const& tree) { return tree.bounds(); } @@ -1391,8 +1403,9 @@ It calls \c rtree::swap(). \param l The first rtree. \param r The second rtree. */ -template -inline void swap(rtree & l, rtree & r) +template +inline void swap(rtree & l, + rtree & r) { return l.swap(r); } diff --git a/include/boost/geometry/index/translator.hpp b/include/boost/geometry/index/translator.hpp index 828f2069c..611623057 100644 --- a/include/boost/geometry/index/translator.hpp +++ b/include/boost/geometry/index/translator.hpp @@ -55,79 +55,6 @@ struct equals } }; -}} // namespace detail::translator - -/*! -\brief The default translator. - -It translates Value object to Indexable object. The default version handles Values which are Indexables. -This translator is also specialized for std::pair and boost::tuple. - -\tparam Value The Value type which may be translated directly to the Indexable. -*/ -template -struct translator -{ - BOOST_MPL_ASSERT_MSG( - (!detail::translator::indexable_not_found_error< - typename detail::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); - } -}; - -/*! -\brief The default translator. - -This specialization translates from std::pair. - -\tparam Indexable The Indexable type. -\tparam Second The second type. -*/ -template -struct translator< std::pair > -{ - BOOST_MPL_ASSERT_MSG( - (!detail::translator::indexable_not_found_error< - typename detail::traits::indexable_type::type - >::value), - NOT_VALID_INDEXABLE_TYPE, - (Indexable) - ); - - typedef Indexable const& result_type; - - result_type operator()(std::pair const& value) const - { - return value.first; - } - - bool equals(std::pair const& v1, std::pair const& v2) const - { - return geometry::equals(v1.first, v2.first) - && - detail::translator::equals< - Second, - typename geometry::traits::tag::type - >::apply(v1.second, v2.second); - } -}; - -namespace detail { namespace translator { - template struct compare_tuples { @@ -155,62 +82,13 @@ struct compare_tuples }} // namespace detail::translator /*! -\brief The default translator. +\brief The function object extracting Indexable from Value. -This specialization translates from boost::tuple. +It translates Value object to Indexable object. The default version handles Values which are Indexables. +This template is also specialized for std::pair and boost::tuple. -\tparam Indexable The Indexable type. +\tparam Value The Value type which may be translated directly to the Indexable. */ -template -struct translator< boost::tuple > -{ - typedef boost::tuple value_type; - - BOOST_MPL_ASSERT_MSG( - (!detail::translator::indexable_not_found_error< - typename detail::traits::indexable_type::type - >::value), - NOT_VALID_INDEXABLE_TYPE, - (Indexable) - ); - - typedef Indexable const& result_type; - - result_type operator()(value_type const& value) const - { - return boost::get<0>(value); - } - - bool equals(value_type const& v1, value_type const& v2) const - { - return detail::translator::compare_tuples::value> - ::apply(v1, v2); - } -}; - -namespace detail { namespace translator { - -template -struct result_type -{ - typedef typename Translator::result_type type; -}; - -template -struct indexable_type -{ - typedef typename boost::remove_const< - typename boost::remove_reference< - typename result_type::type - >::type - >::type type; -}; - -}} // namespace detail::translator - -// indexable - template struct indexable { @@ -223,12 +101,20 @@ struct indexable ); typedef Value const& result_type; - result_type operator()(Value const& v) + result_type operator()(Value const& v) const { return v; } }; +/*! +\brief The function object extracting Indexable from Value. + +This specialization translates from std::pair. + +\tparam Indexable The Indexable type. +\tparam T2 The second type. +*/ template struct indexable< std::pair > { @@ -241,12 +127,19 @@ struct indexable< std::pair > ); typedef Indexable const& result_type; - result_type operator()(std::pair const& v) + result_type operator()(std::pair const& v) const { return v.first; } }; +/*! +\brief The function object extracting Indexable from Value. + +This specialization translates from boost::tuple. + +\tparam Indexable The Indexable type. +*/ template struct indexable< boost::tuple > @@ -270,16 +163,34 @@ struct indexable< boost::tuple > // equal_to +/*! +\brief The function object comparing Values. + +It compares Geometries using geometry::equals() function. Other types are compared using operator==. +The default version handles Values which are Indexables. +This template is also specialized for std::pair and boost::tuple<...>. + +\tparam Value The type of objects which are compared by this function object. +*/ template struct equal_to { typedef bool result_type; - bool operator()(Value const& l, Value const& r) + bool operator()(Value const& l, Value const& r) const { return detail::translator::equals::type>::apply(l ,r); } }; +/*! +\brief The function object comparing Values. + +This specialization compares values of type std::pair. +It compares pairs' first values, then second values. + +\tparam T1 The first type. +\tparam T2 The second type. +*/ template struct equal_to< std::pair > { @@ -293,6 +204,12 @@ struct equal_to< std::pair > } }; +/*! +\brief The function object comparing Values. + +This specialization compares values of type boost::tuple<...>. +It compares values stored in tuple in range [0, length>::value). +*/ template struct equal_to< boost::tuple > @@ -308,6 +225,50 @@ struct equal_to< boost::tuple > } }; +namespace detail { namespace translator { + +template +struct translator + : public IndexableGetter + , public EqualTo +{ + typedef typename IndexableGetter::result_type result_type; + + translator(IndexableGetter const& i, EqualTo const& e) + : IndexableGetter(i), EqualTo(e) + {} + + template + result_type operator()(Value const& value) const + { + return IndexableGetter::operator()(value); + } + + template + bool equals(Value const& v1, Value const& v2) const + { + return EqualTo::operator()(v1, v2); + } +}; + +template +struct result_type +{ + typedef typename Translator::result_type type; +}; + +template +struct indexable_type +{ + typedef typename boost::remove_const< + typename boost::remove_reference< + typename result_type::type + >::type + >::type type; +}; + +}} // namespace detail::translator + }}} // namespace boost::geometry::index #endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 78dd7be99..f8aba50d7 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -208,7 +208,7 @@ struct test_object namespace boost { namespace geometry { namespace index { template -struct translator< boost::shared_ptr< test_object > > +struct indexable< boost::shared_ptr< test_object > > { typedef boost::shared_ptr< test_object > value_type; typedef Indexable const& result_type; @@ -217,11 +217,6 @@ struct translator< boost::shared_ptr< test_object > > { return value->indexable; } - - bool equals(value_type const& v1, value_type const& v2) const - { - return v1 == v2; - } }; }}} @@ -269,17 +264,22 @@ struct counting_value namespace boost { namespace geometry { namespace index { template -struct translator< counting_value > +struct indexable< counting_value > { typedef counting_value value_type; typedef Indexable const& result_type; - result_type operator()(value_type const& value) const { return value.indexable; } +}; - bool equals(value_type const& v1, value_type const& v2) const +template +struct equal_to< counting_value > +{ + typedef counting_value value_type; + typedef bool result_type; + bool operator()(value_type const& v1, value_type const& v2) const { return boost::geometry::equals(v1.indexable, v2.indexable); } @@ -333,17 +333,22 @@ struct value_no_dctor namespace boost { namespace geometry { namespace index { template -struct translator< value_no_dctor > +struct indexable< value_no_dctor > { typedef value_no_dctor value_type; typedef Indexable const& result_type; - result_type operator()(value_type const& value) const { return value.indexable; } +}; - bool equals(value_type const& v1, value_type const& v2) const +template +struct equal_to< value_no_dctor > +{ + typedef value_no_dctor value_type; + typedef bool result_type; + bool operator()(value_type const& v1, value_type const& v2) const { return boost::geometry::equals(v1.indexable, v2.indexable); } @@ -894,7 +899,8 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); - Rtree t2(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t2(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); t2.swap(t1); BOOST_CHECK(tree.empty() == t2.empty()); BOOST_CHECK(tree.size() == t2.size()); @@ -942,7 +948,8 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); { - Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); BOOST_FOREACH(Value const& v, input) t.insert(v); BOOST_CHECK(tree.size() == t.size()); @@ -951,7 +958,8 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); std::copy(input.begin(), input.end(), bgi::inserter(t)); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -959,21 +967,24 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(input.begin(), input.end(), tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(input.begin(), input.end(), tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(input, tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(input, tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); t.insert(input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -981,7 +992,8 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); t.insert(input); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -990,7 +1002,8 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const } { - Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); BOOST_FOREACH(Value const& v, input) bgi::insert(t, v); BOOST_CHECK(tree.size() == t.size()); @@ -999,7 +1012,8 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); bgi::insert(t, input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -1007,7 +1021,8 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree.parameters(), tree.translator(), tree.get_allocator()); + // TEMPORARILY USED translator() + Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); bgi::insert(t, input); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -1134,14 +1149,15 @@ void test_clear(Rtree & tree, std::vector const& input, Box const& qbox) template void test_rtree_by_value(Parameters const& parameters, Allocator const& allocator) { - typedef bgi::translator T; + typedef bgi::indexable I; + typedef bgi::equal_to E; typedef typename Allocator::template rebind::other A; - typedef bgi::rtree Tree; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; // not empty tree test - Tree tree(parameters, T(), allocator); + Tree tree(parameters, I(), E(), allocator); std::vector input; B qbox; @@ -1171,7 +1187,7 @@ void test_rtree_by_value(Parameters const& parameters, Allocator const& allocato // empty tree test - Tree empty_tree(parameters, T(), allocator); + Tree empty_tree(parameters, I(), E(), allocator); std::vector empty_input; test_intersects(empty_tree, empty_input, qbox); @@ -1192,12 +1208,13 @@ void test_count_rtree_values(Parameters const& parameters, Allocator const& allo { typedef counting_value Value; - typedef bgi::translator T; + typedef bgi::indexable I; + typedef bgi::equal_to E; typedef typename Allocator::template rebind::other A; - typedef bgi::rtree Tree; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; - Tree t(parameters, T(), allocator); + Tree t(parameters, I(), E(), allocator); std::vector input; B qbox; @@ -1234,12 +1251,13 @@ void test_rtree_count(Parameters const& parameters, Allocator const& allocator) { typedef std::pair Value; - typedef bgi::translator T; + typedef bgi::indexable I; + typedef bgi::equal_to E; typedef typename Allocator::template rebind::other A; - typedef bgi::rtree Tree; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; - Tree t(parameters, T(), allocator); + Tree t(parameters, I(), E(), allocator); std::vector input; B qbox; @@ -1264,16 +1282,17 @@ void test_rtree_count(Parameters const& parameters, Allocator const& allocator) template void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator) { - typedef bgi::translator T; + typedef bgi::indexable I; + typedef bgi::equal_to E; typedef typename Allocator::template rebind::other A; - typedef bgi::rtree Tree; + typedef bgi::rtree Tree; typedef typename Tree::box_type B; typedef typename bg::traits::point_type::type P; B b; bg::assign_inverse(b); - Tree t(parameters, T(), allocator); + Tree t(parameters, I(), E(), allocator); std::vector input; B qbox; From 33aef8ae3ba78af3394085f3e7c47c722c621ca9 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 2 Mar 2013 23:51:13 +0000 Subject: [PATCH 352/366] rtree: added indexable_getter and value_equal. Macro enabling debug interface renamed. [SVN r83255] --- .../detail/rtree/visitors/are_boxes_ok.hpp | 4 +- .../detail/rtree/visitors/are_levels_ok.hpp | 4 +- include/boost/geometry/index/rtree.hpp | 44 ++++++++++++++++--- include/boost/geometry/index/translator.hpp | 3 ++ test/geometry_index_test_common.hpp | 2 +- test/rtree/generated/rtree_b2f_rstar.cpp | 4 ++ 6 files changed, 49 insertions(+), 12 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp index 587dd58f9..7c5470155 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp @@ -116,8 +116,8 @@ private: } // namespace visitors -#ifndef BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE -#error "To use are_boxes_ok BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE +#error "To use are_boxes_ok BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" #endif template diff --git a/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp index cd30e5239..f0d2c0823 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp @@ -87,8 +87,8 @@ private: } // namespace visitors -#ifndef BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE -#error "To use are_levels_ok() BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE +#error "To use are_levels_ok() BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE should be defined before including the rtree" #endif template diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 17de3a113..323f19824 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -116,17 +116,21 @@ public: /*! \brief Unsigned integral type used by the container. */ typedef typename allocator_type::size_type size_type; - // temporarily public - don't use it - typedef detail::translator::translator translator_type; + typedef IndexableGetter indexable_getter; + typedef EqualTo value_equal; /*! \brief The Indexable type to which Value is translated. */ - typedef typename index::detail::translator::indexable_type::type indexable_type; + typedef typename index::detail::translator::indexable_type< + detail::translator::translator + >::type indexable_type; /*! \brief The Box type used by the R-tree. */ typedef typename index::detail::default_box_type::type bounds_type; -#if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) +#if !defined(BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE) private: #endif + typedef detail::translator::translator translator_type; + typedef bounds_type box_type; typedef typename detail::rtree::options_type::type options_type; typedef typename options_type::node_tag node_tag; @@ -776,11 +780,37 @@ public: \par Throws Nothing. */ - inline parameters_type const& parameters() const + inline parameters_type parameters() const { return m_members.parameters(); } + /*! + \brief Returns function retrieving Indexable from Value. + + \return The indexable_getter object. + + \par Throws + Nothing. + */ + indexable_getter indexable_get() const + { + return m_members.translator().indexable_get(); + } + + /*! + \brief Returns function comparing Values + + \return The value_equal function. + + \par Throws + Nothing. + */ + value_equal value_eq() const + { + return m_members.translator().value_eq(); + } + /*! \brief Returns allocator used by the rtree. @@ -794,7 +824,7 @@ public: return m_members.allocators().allocator(); } -#if !defined(BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE) +#if !defined(BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE) private: #endif /*! @@ -805,7 +835,7 @@ private: \par Throws Nothing. */ - inline translator_type const& translator() const + inline translator_type translator() const { return m_members.translator(); } diff --git a/include/boost/geometry/index/translator.hpp b/include/boost/geometry/index/translator.hpp index 611623057..f5212eb6e 100644 --- a/include/boost/geometry/index/translator.hpp +++ b/include/boost/geometry/index/translator.hpp @@ -249,6 +249,9 @@ struct translator { return EqualTo::operator()(v1, v2); } + + IndexableGetter const& indexable_get() const { return *this; } + EqualTo const& value_eq() const { return *this; } }; template diff --git a/test/geometry_index_test_common.hpp b/test/geometry_index_test_common.hpp index 492d48530..b4e70dfbd 100644 --- a/test/geometry_index_test_common.hpp +++ b/test/geometry_index_test_common.hpp @@ -11,7 +11,7 @@ #define GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP #include -#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE +#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE #include #include diff --git a/test/rtree/generated/rtree_b2f_rstar.cpp b/test/rtree/generated/rtree_b2f_rstar.cpp index 10e1af46c..f065dc906 100644 --- a/test/rtree/generated/rtree_b2f_rstar.cpp +++ b/test/rtree/generated/rtree_b2f_rstar.cpp @@ -12,6 +12,10 @@ #include #include +#include + +bool cmp(int a, int b) { return a < b; } + int test_main(int, char* []) { typedef bg::model::point Point; From 7e6394ec68f9a8714f73fdb9246a2c005c4fa65a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 2 Mar 2013 23:53:47 +0000 Subject: [PATCH 353/366] rtree: test reverted [SVN r83256] --- test/rtree/generated/rtree_b2f_rstar.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/rtree/generated/rtree_b2f_rstar.cpp b/test/rtree/generated/rtree_b2f_rstar.cpp index f065dc906..10e1af46c 100644 --- a/test/rtree/generated/rtree_b2f_rstar.cpp +++ b/test/rtree/generated/rtree_b2f_rstar.cpp @@ -12,10 +12,6 @@ #include #include -#include - -bool cmp(int a, int b) { return a < b; } - int test_main(int, char* []) { typedef bg::model::point Point; From 4727f94f4d46bd1e1e9773a7e83bb3854130617c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 3 Mar 2013 00:34:45 +0000 Subject: [PATCH 354/366] rtree: IndexableGetter and EqualTo handled in members_holder interface. Fix in glut_vis example - macro name fixed. [SVN r83257] --- example/glut_vis.cpp | 2 +- include/boost/geometry/index/rtree.hpp | 51 +++++++++++++-------- include/boost/geometry/index/translator.hpp | 3 -- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/example/glut_vis.cpp b/example/glut_vis.cpp index 3ac3bb71a..d65f293b1 100644 --- a/example/glut_vis.cpp +++ b/example/glut_vis.cpp @@ -9,7 +9,7 @@ #include -#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE +#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE #include diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 323f19824..88b2733ac 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -158,7 +158,7 @@ public: inline explicit rtree(parameters_type const& parameters = parameters_type(), IndexableGetter const& indexable_getter = IndexableGetter(), EqualTo const& equal_to = EqualTo()) - : m_members(translator_type(indexable_getter, equal_to), parameters) + : m_members(indexable_getter, equal_to, parameters) {} /*! @@ -176,7 +176,7 @@ public: IndexableGetter const& indexable_getter, EqualTo const& equal_to, allocator_type allocator) - : m_members(translator_type(indexable_getter, equal_to), parameters, allocator) + : m_members(indexable_getter, equal_to, parameters, allocator) {} /*! @@ -201,7 +201,7 @@ public: IndexableGetter const& indexable_getter = IndexableGetter(), EqualTo const& equal_to = EqualTo(), allocator_type allocator = allocator_type()) - : m_members(translator_type(indexable_getter, equal_to), parameters, allocator) + : m_members(indexable_getter, equal_to, parameters, allocator) { try { @@ -235,7 +235,7 @@ public: IndexableGetter const& indexable_getter = IndexableGetter(), EqualTo const& equal_to = EqualTo(), allocator_type allocator = allocator_type()) - : m_members(translator_type(indexable_getter, equal_to), parameters, allocator) + : m_members(indexable_getter, equal_to, parameters, allocator) { try { @@ -273,7 +273,8 @@ public: \li When memory allocation for Node fails. */ inline rtree(rtree const& src) - : m_members(src.m_members.translator(), + : m_members(src.m_members.indexable_getter(), + src.m_members.equal_to(), src.m_members.parameters(), allocator_traits_type::select_on_container_copy_construction(src.get_allocator())) { @@ -295,7 +296,9 @@ public: \li When memory allocation for Node fails. */ inline rtree(rtree const& src, allocator_type const& allocator) - : m_members(src.m_members.translator(), src.m_members.parameters(), allocator) + : m_members(src.m_members.indexable_getter(), + src.m_members.equal_to(), + src.m_members.parameters(), allocator) { this->raw_copy(src, *this, false); } @@ -311,7 +314,8 @@ public: Nothing. */ inline rtree(BOOST_RV_REF(rtree) src) - : m_members(src.m_members.translator(), + : m_members(src.m_members.indexable_getter(), + src.m_members.equal_to(), src.m_members.parameters(), boost::move(src.m_members.allocators())) { @@ -335,7 +339,8 @@ public: \li When memory allocation for Node fails (only if allocators aren't equal). */ inline rtree(BOOST_RV_REF(rtree) src, allocator_type const& allocator) - : m_members(src.m_members.translator(), + : m_members(src.m_members.indexable_getter(), + src.m_members.equal_to(), src.m_members.parameters(), boost::move(allocator)) { @@ -403,8 +408,10 @@ public: { this->raw_destroy(*this); - m_members.translator() = src.m_members.translator(); + m_members.indexable_getter() = src.m_members.indexable_getter(); + m_members.equal_to() = src.m_members.equal_to(); m_members.parameters() = src.m_members.parameters(); + boost::swap(m_members.values_count, src.m_members.values_count); boost::swap(m_members.leafs_level, src.m_members.leafs_level); boost::swap(m_members.root, src.m_members.root); @@ -437,7 +444,8 @@ public: */ void swap(rtree & other) { - boost::swap(m_members.translator(), other.m_members.translator()); + boost::swap(m_members.indexable_getter(), other.m_members.indexable_getter()); + boost::swap(m_members.equal_to(), other.m_members.equal_to()); boost::swap(m_members.parameters(), other.m_members.parameters()); m_members.allocators().swap(other.m_members.allocators()); @@ -1014,7 +1022,8 @@ private: if ( copy_tr_and_params ) { - dst.m_members.translator() = src.m_members.translator(); // SHOULDN'T THROW + dst.m_members.indexable_getter() = src.m_members.indexable_getter(); + dst.m_members.equal_to() = src.m_members.equal_to(); dst.m_members.parameters() = src.m_members.parameters(); } @@ -1122,11 +1131,12 @@ private: members_holder(members_holder const&); public: - template - members_holder(Transl const& transl, + template + members_holder(IndGet const& ind_get, + ValEq const& val_eq, Parameters const& parameters, BOOST_FWD_REF(Alloc) alloc) - : translator_type(transl) + : translator_type(ind_get, val_eq) , Parameters(parameters) , allocators_type(boost::forward(alloc)) , values_count(0) @@ -1134,10 +1144,11 @@ private: , root(0) {} - template - members_holder(Transl const& transl, + template + members_holder(IndGet const& ind_get, + ValEq const& val_eq, Parameters const& parameters) - : translator_type(transl) + : translator_type(ind_get, val_eq) , Parameters(parameters) , allocators_type() , values_count(0) @@ -1146,7 +1157,11 @@ private: {} translator_type const& translator() const { return *this; } - translator_type & translator() { return *this; } + + IndexableGetter const& indexable_getter() const { return *this; } + IndexableGetter & indexable_getter() { return *this; } + EqualTo const& equal_to() const { return *this; } + EqualTo & equal_to() { return *this; } Parameters const& parameters() const { return *this; } Parameters & parameters() { return *this; } allocators_type const& allocators() const { return *this; } diff --git a/include/boost/geometry/index/translator.hpp b/include/boost/geometry/index/translator.hpp index f5212eb6e..611623057 100644 --- a/include/boost/geometry/index/translator.hpp +++ b/include/boost/geometry/index/translator.hpp @@ -249,9 +249,6 @@ struct translator { return EqualTo::operator()(v1, v2); } - - IndexableGetter const& indexable_get() const { return *this; } - EqualTo const& value_eq() const { return *this; } }; template From 5e2db81daf3ed6091412bbed7f9e39c8a62d762d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 3 Mar 2013 13:55:24 +0000 Subject: [PATCH 355/366] rtree: indexable_getter and value_equal description added. [SVN r83280] --- doc/generated/rtree.qbk | 48 +- doc/html/geometry_index/introduction.html | 2 +- doc/html/geometry_index/r_tree.html | 2 +- .../r_tree/creation_and_modification.html | 8 +- .../geometry_index/r_tree/introduction.html | 28 +- doc/html/geometry_index/r_tree/queries.html | 6 +- doc/html/geometry_index/r_tree/reference.html | 684 +++++++++++------- .../geometry_index/r_tree/rtree_examples.html | 2 +- .../r_tree/rtree_quickstart.html | 4 +- doc/html/index.html | 4 +- include/boost/geometry/index/rtree.hpp | 5 +- 11 files changed, 484 insertions(+), 309 deletions(-) diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 8e1d7c433..07610c04e 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -69,7 +69,9 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[[#classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17] `parameters_type`][R-tree parameters type. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e] `allocator_type`][The type of allocator used by the container. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4] `size_type`][Unsigned integral type used by the container. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1ac6b09c3c32ec7ed2dee19459fdee92a2] `indexable_type`][The Indexable type to which Value is translated. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5] `indexable_getter`][The function object extracting Indexable from Value. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b] `value_equal`][The function object comparing objects of type Value. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a4175e946d14b08f20f7126e2434e5646] `indexable_type`][The Indexable type to which Value is translated. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a89a6fd9a7c24f9d30422ef81ce2b959f] `bounds_type`][The Box type used by the R-tree. ]] ] @@ -105,7 +107,9 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[][[link classboost_1_1geometry_1_1index_1_1rtree_1a1bec40977c175983f585c4488cf8fe3c `clear()`]][Removes all values stored in the container. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a0dad06d0f117f45ed54b5c123cb41d6e `bounds()`]][Returns the box able to contain all values stored in the container. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1aaa834c241c191ac9de67f134564f36fa `count(ValueOrIndexable const &)`]][Count Values or Indexables stored in the container. ]] -[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1afef125f04ba51b50370fadc9c1b1e8bf `parameters()`]][Returns parameters. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a9076baef90a3a9c6018871fa25115a73 `parameters()`]][Returns parameters. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1af391fd642a218c5fb10fc68d643a62b5 `indexable_get()`]][Returns function retrieving Indexable from Value. ]] +[[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a16424563d0973960ac01f7a1969eeebe `value_eq()`]][Returns function comparing Values. ]] [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17d9cef211feb7f674a5b4602f4cc81e `get_allocator()`]][Returns allocator used by the rtree. ]] ] @@ -781,14 +785,14 @@ Nothing. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1afef125f04ba51b50370fadc9c1b1e8bf] +[#classboost_1_1geometry_1_1index_1_1rtree_1a9076baef90a3a9c6018871fa25115a73] [section parameters()] Returns parameters. [heading Synopsis] [pre -[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters``()` +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]] `parameters``()` ] [heading Modifier(s)] @@ -799,6 +803,42 @@ Nothing. [endsect] +[#classboost_1_1geometry_1_1index_1_1rtree_1af391fd642a218c5fb10fc68d643a62b5] +[section indexable_get()] +Returns function retrieving Indexable from Value. + +[heading Synopsis] +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]] `indexable_get``()` +] + +[heading Modifier(s)] +``const ``[heading Returns] +The indexable_getter object. +[heading Throws] +Nothing. + +[endsect] + +[#classboost_1_1geometry_1_1index_1_1rtree_1a16424563d0973960ac01f7a1969eeebe] +[section value_eq()] +Returns function comparing Values. + +[heading Synopsis] +[pre + +[^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]] `value_eq``()` +] + +[heading Modifier(s)] +``const ``[heading Returns] +The value_equal function. +[heading Throws] +Nothing. + +[endsect] + [#classboost_1_1geometry_1_1index_1_1rtree_1a17d9cef211feb7f674a5b4602f4cc81e] [section get_allocator()] Returns allocator used by the rtree. diff --git a/doc/html/geometry_index/introduction.html b/doc/html/geometry_index/introduction.html index dd5718dbb..c00e43835 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 e66d1de71..5ffa01253 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 0a04217d9..ffb24455d 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 - + @@ -59,7 +59,7 @@ EqualTo = index::equal_to<Value>, Allocator = std::allocator<Value> > -

                                                                                                                                +
                                                                                                                                • Value - type of object which will be stored in the container,
                                                                                                                                • @@ -97,7 +97,7 @@ concept is an Indexable. Values types which can be handled by the predefined function objects index::indexable<Value> and index::equal_to<Value> are defined as follows:

                                                                                                                                  -
                                                                                                                                    +
                                                                                                                                    • Indexable = Point | Box @@ -128,7 +128,7 @@

                                                                                                                                      If comparison of two Values is required, the predefined index::equal_to<Value>:

                                                                                                                                      -
                                                                                                                                        +
                                                                                                                                        • for Point and Box diff --git a/doc/html/geometry_index/r_tree/introduction.html b/doc/html/geometry_index/r_tree/introduction.html index 8dc523bbc..74f9022ec 100644 --- a/doc/html/geometry_index/r_tree/introduction.html +++ b/doc/html/geometry_index/r_tree/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -28,10 +28,10 @@

                                                                                                                                    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 + 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 [2]. + close to some point in space [2].

                                                                                                                                    The R-tree structure is presented on the image below. Each R-tree's node @@ -51,7 +51,7 @@

                                                                                                                                    The R-tree is a self-balanced data structure. The key part of balancing algorithm - is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure + is node splitting algorithm [3] [4]. Each algorithm produces different splits so the internal structure of a tree may be different for each one of them. In general more complex algorithms analyses elements better and produces less overlapping nodes. In the searching process less nodes must be traversed in order to find desired @@ -181,13 +181,13 @@

                                                                                                                                  - Implementation + Implementation details

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

                                                                                                                                  -
                                                                                                                                    +
                                                                                                                                    • capable to store arbitrary Value type,
                                                                                                                                    • @@ -211,7 +211,7 @@
                                                                                                                                    - Dependencies + Dependencies

                                                                                                                                    R-tree depends on Boost.Move, Boost.Container, Boost.Tuple, @@ -219,7 +219,7 @@

                                                                                                                                    - Contributors + Contributors

                                                                                                                                    The spatial index was originally started by Federico J. Fernandez during @@ -227,7 +227,7 @@

                                                                                                                                    - Spatial + Spatial thanks

                                                                                                                                    @@ -235,20 +235,20 @@ J. Simonson for their support and ideas.

                                                                                                                                    -

                                                                                                                                    -

                                                                                                                                    [1] +


                                                                                                                                    +

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

                                                                                                                                    -

                                                                                                                                    [2] +

                                                                                                                                    [2] Cheung, K.; Fu, A. (1998). Enhanced Nearest Neighbour Search on the R-tree

                                                                                                                                    -

                                                                                                                                    [3] +

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

                                                                                                                                    -

                                                                                                                                    [4] +

                                                                                                                                    [4] 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/queries.html b/doc/html/geometry_index/r_tree/queries.html index 4837026dc..2429cdc5f 100644 --- a/doc/html/geometry_index/r_tree/queries.html +++ b/doc/html/geometry_index/r_tree/queries.html @@ -3,7 +3,7 @@ Queries - + @@ -44,7 +44,7 @@ Queries returns Values which meets some predicates. Currently supported are three types of predicates:

                                                                                                                                    -
                                                                                                                                      +
                                                                                                                                      • spatial predicates - defining relationship between stored Values and some Geometry, @@ -61,7 +61,7 @@

                                                                                                                                        For example queries may be used to retrieve Values:

                                                                                                                                        -
                                                                                                                                          +
                                                                                                                                          • intersecting some area but not within other area,
                                                                                                                                          • diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index 4d224abeb..f6ee444da 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -3,7 +3,7 @@ Reference - + @@ -51,7 +51,7 @@

                                                                                                                                            - Description + Description

                                                                                                                                            This is self-balancing spatial index capable to store various types of @@ -59,7 +59,7 @@

                                                                                                                                            - Parameters + Parameters

                                                                                                                                            The user must pass a type defining the Parameters which will be used in @@ -69,7 +69,7 @@

                                                                                                                                            Predefined algorithms with compile-time parameters are:

                                                                                                                                            -
                                                                                                                                              +
                                                                                                                                              • boost::geometry::index::linear,
                                                                                                                                              • @@ -83,7 +83,7 @@

                                                                                                                                                Predefined algorithms with run-time parameters are:

                                                                                                                                                -
                                                                                                                                                  +
                                                                                                                                                  - Translator + Translator

                                                                                                                                                  The Translator translates from Value to Indexable each time r-tree requires @@ -113,14 +113,14 @@

                                                                                                                                                  - Header + Header

                                                                                                                                                  #include <boost/geometry/index/rtree.hpp>

                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                  template<typename Value,
                                                                                                                                                            typename Parameters,
                                                                                                                                                  @@ -134,7 +134,7 @@
                                                                                                                                                   
                                                                                                                                                  - Template + Template parameter(s)
                                                                                                                                                  @@ -220,7 +220,7 @@
                                                                                                                                                  - Typedef(s) + Typedef(s)
                                                                                                                                                  @@ -291,7 +291,31 @@ + + + + + + + +

                                                                                                                                                  - indexable_type + indexable_getter +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + The function object extracting Indexable from Value. +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + value_equal +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + The function object comparing objects of type Value. +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + indexable_type

                                                                                                                                                  @@ -316,7 +340,7 @@
                                                                                                                                                  - Constructor(s) + Constructor(s) and destructor
                                                                                                                                                  @@ -460,7 +484,7 @@
                                                                                                                                                  - Member(s) + Member(s)
                                                                                                                                                  @@ -729,7 +753,7 @@ + + + + + + + + + + @@ -405,7 +406,7 @@ @@ -817,7 +818,7 @@

                                                                                                                                                  - parameters() + parameters()

                                                                                                                                                  @@ -739,6 +763,40 @@
                                                                                                                                                  +

                                                                                                                                                  + const +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + indexable_get() +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + Returns function retrieving Indexable from Value. +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + const +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + value_eq() +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + Returns function comparing Values. +

                                                                                                                                                  +

                                                                                                                                                  const @@ -766,7 +824,7 @@

                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                  rtree(parameters_type const & parameters = parameters_type(),
                                                                                                                                                         IndexableGetter const & indexable_getter = IndexableGetter(),
                                                                                                                                                  @@ -774,7 +832,7 @@
                                                                                                                                                   
                                                                                                                                                  - Modifier(s) + Modifier(s)

                                                                                                                                                  @@ -783,7 +841,7 @@

                                                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                                                  @@ -863,7 +921,7 @@
                                                                                                                                                  - Throws + Throws

                                                                                                                                                  If allocator default constructor throws. @@ -879,7 +937,7 @@

                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                  rtree(parameters_type const & parameters,
                                                                                                                                                         IndexableGetter const & indexable_getter,
                                                                                                                                                  @@ -888,7 +946,7 @@
                                                                                                                                                   
                                                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                                                  @@ -985,7 +1043,7 @@
                                                                                                                                                  - Throws + Throws

                                                                                                                                                  If allocator copy constructor throws. @@ -1001,7 +1059,7 @@

                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                  template<typename Iterator>
                                                                                                                                                   rtree(Iterator first,
                                                                                                                                                  @@ -1013,7 +1071,7 @@
                                                                                                                                                   
                                                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                                                  @@ -1144,9 +1202,9 @@
                                                                                                                                                  - Throws + Throws
                                                                                                                                                  -
                                                                                                                                                    +
                                                                                                                                                    • If allocator copy constructor throws.
                                                                                                                                                    • @@ -1171,7 +1229,7 @@

                                                                                                                                                      - Synopsis + Synopsis
                                                                                                                                                      template<typename Range>
                                                                                                                                                       rtree(Range const & rng,
                                                                                                                                                      @@ -1182,7 +1240,7 @@
                                                                                                                                                       
                                                                                                                                                      - Modifier(s) + Modifier(s)

                                                                                                                                                      @@ -1191,7 +1249,7 @@

                                                                                                                                                      - Parameter(s) + Parameter(s)
                                                                                                                                                      @@ -1306,9 +1364,9 @@
                                                                                                                                                      - Throws + Throws
                                                                                                                                                      -
                                                                                                                                                        +
                                                                                                                                                        • If allocator copy constructor throws.
                                                                                                                                                        • @@ -1332,13 +1390,13 @@

                                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                                          ~rtree()
                                                                                                                                                           
                                                                                                                                                          - Throws + Throws

                                                                                                                                                          Nothing. @@ -1354,20 +1412,20 @@

                                                                                                                                                          - Description + Description

                                                                                                                                                          It uses parameters, translator and allocator from the source tree.

                                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                                          rtree(rtree const & src)
                                                                                                                                                           
                                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                                          @@ -1413,9 +1471,9 @@
                                                                                                                                                          - Throws + Throws
                                                                                                                                                          -
                                                                                                                                                            +
                                                                                                                                                            • If allocator copy constructor throws.
                                                                                                                                                            • @@ -1440,20 +1498,20 @@

                                                                                                                                                              - Description + Description

                                                                                                                                                              It uses Parameters and translator from the source tree.

                                                                                                                                                              - Synopsis + Synopsis
                                                                                                                                                              rtree(rtree const & src, allocator_type const & allocator)
                                                                                                                                                               
                                                                                                                                                              - Parameter(s) + Parameter(s)
                                                                                                                                                              @@ -1519,9 +1577,9 @@
                                                                                                                                                              - Throws + Throws
                                                                                                                                                              -
                                                                                                                                                                +
                                                                                                                                                                • If allocator copy constructor throws.
                                                                                                                                                                • @@ -1546,20 +1604,20 @@

                                                                                                                                                                  - Description + Description

                                                                                                                                                                  It uses parameters, translator and allocator from the source tree.

                                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                                  rtree(rtree && src)
                                                                                                                                                                   
                                                                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                                                                  @@ -1605,7 +1663,7 @@
                                                                                                                                                                  - Throws + Throws

                                                                                                                                                                  Nothing. @@ -1621,20 +1679,20 @@

                                                                                                                                                                  - Description + Description

                                                                                                                                                                  It uses parameters and translator from the source tree.

                                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                                  rtree(rtree && src, allocator_type const & allocator)
                                                                                                                                                                   
                                                                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                                                                  @@ -1700,9 +1758,9 @@
                                                                                                                                                                  - Throws + Throws
                                                                                                                                                                  -
                                                                                                                                                                    +
                                                                                                                                                                    • If allocator copy constructor throws.
                                                                                                                                                                    • @@ -1728,20 +1786,20 @@

                                                                                                                                                                      - Description + Description

                                                                                                                                                                      It uses parameters and translator from the source tree.

                                                                                                                                                                      - Synopsis + Synopsis
                                                                                                                                                                      rtree & operator=(const rtree & src)
                                                                                                                                                                       
                                                                                                                                                                      - Parameter(s) + Parameter(s)
                                                                                                                                                                      @@ -1787,9 +1845,9 @@
                                                                                                                                                                      - Throws + Throws
                                                                                                                                                                      -
                                                                                                                                                                        +
                                                                                                                                                                        • If Value copy constructor throws.
                                                                                                                                                                        • @@ -1811,20 +1869,20 @@

                                                                                                                                                                          - Description + Description

                                                                                                                                                                          It uses parameters and translator from the source tree.

                                                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                                                          rtree & operator=(rtree && src)
                                                                                                                                                                           
                                                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                                                          @@ -1870,12 +1928,12 @@
                                                                                                                                                                          - Throws + Throws

                                                                                                                                                                          Only if allocators aren't equal.

                                                                                                                                                                          -
                                                                                                                                                                            +
                                                                                                                                                                            • If Value copy constructor throws.
                                                                                                                                                                            • @@ -1897,20 +1955,20 @@

                                                                                                                                                                              - Description + Description

                                                                                                                                                                              Parameters, translator and allocators are swapped as well.

                                                                                                                                                                              - Synopsis + Synopsis
                                                                                                                                                                              void swap(rtree & other)
                                                                                                                                                                               
                                                                                                                                                                              - Parameter(s) + Parameter(s)
                                                                                                                                                                              @@ -1956,7 +2014,7 @@
                                                                                                                                                                              - Throws + Throws

                                                                                                                                                                              If allocators swap throws. @@ -1972,13 +2030,13 @@

                                                                                                                                                                              - Synopsis + Synopsis
                                                                                                                                                                              void insert(value_type const & value)
                                                                                                                                                                               
                                                                                                                                                                              - Parameter(s) + Parameter(s)
                                                                                                                                                                              @@ -2024,9 +2082,9 @@
                                                                                                                                                                              - Throws + Throws
                                                                                                                                                                              -
                                                                                                                                                                                +
                                                                                                                                                                                • If Value copy constructor or copy assignment throws.
                                                                                                                                                                                • @@ -2059,14 +2117,14 @@

                                                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                                                  template<typename Iterator>
                                                                                                                                                                                   void insert(Iterator first, Iterator last)
                                                                                                                                                                                   
                                                                                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                                                                                  @@ -2130,9 +2188,9 @@
                                                                                                                                                                                  - Throws + Throws
                                                                                                                                                                                  -
                                                                                                                                                                                    +
                                                                                                                                                                                    • If Value copy constructor or copy assignment throws.
                                                                                                                                                                                    • @@ -2165,14 +2223,14 @@

                                                                                                                                                                                      - Synopsis + Synopsis
                                                                                                                                                                                      template<typename Range>
                                                                                                                                                                                       void insert(Range const & rng)
                                                                                                                                                                                       
                                                                                                                                                                                      - Parameter(s) + Parameter(s)
                                                                                                                                                                                      @@ -2218,9 +2276,9 @@
                                                                                                                                                                                      - Throws + Throws
                                                                                                                                                                                      -
                                                                                                                                                                                        +
                                                                                                                                                                                        • If Value copy constructor or copy assignment throws.
                                                                                                                                                                                        • @@ -2253,7 +2311,7 @@

                                                                                                                                                                                          - Description + Description

                                                                                                                                                                                          In contrast to the std::set @@ -2262,13 +2320,13 @@

                                                                                                                                                                                          - Synopsis + Synopsis
                                                                                                                                                                                          size_type remove(value_type const & value)
                                                                                                                                                                                           
                                                                                                                                                                                          - Parameter(s) + Parameter(s)
                                                                                                                                                                                          @@ -2314,16 +2372,16 @@
                                                                                                                                                                                          - Returns + Returns

                                                                                                                                                                                          1 if the value was removed, 0 otherwise.

                                                                                                                                                                                          - Throws + Throws
                                                                                                                                                                                          -
                                                                                                                                                                                            +
                                                                                                                                                                                            • If Value copy constructor or copy assignment throws.
                                                                                                                                                                                            • @@ -2356,7 +2414,7 @@

                                                                                                                                                                                              - Description + Description

                                                                                                                                                                                              In contrast to the std::set @@ -2367,14 +2425,14 @@

                                                                                                                                                                                              - Synopsis + Synopsis
                                                                                                                                                                                              template<typename Iterator>
                                                                                                                                                                                               size_type remove(Iterator first, Iterator last)
                                                                                                                                                                                               
                                                                                                                                                                                              - Parameter(s) + Parameter(s)
                                                                                                                                                                                              @@ -2438,16 +2496,16 @@
                                                                                                                                                                                              - Returns + Returns

                                                                                                                                                                                              The number of removed values.

                                                                                                                                                                                              - Throws + Throws
                                                                                                                                                                                              -
                                                                                                                                                                                                +
                                                                                                                                                                                                • If Value copy constructor or copy assignment throws.
                                                                                                                                                                                                • @@ -2480,7 +2538,7 @@

                                                                                                                                                                                                  - Description + Description

                                                                                                                                                                                                  In contrast to the std::set @@ -2490,14 +2548,14 @@

                                                                                                                                                                                                  - Synopsis + Synopsis
                                                                                                                                                                                                  template<typename Range>
                                                                                                                                                                                                   size_type remove(Range const & rng)
                                                                                                                                                                                                   
                                                                                                                                                                                                  - Parameter(s) + Parameter(s)
                                                                                                                                                                                                  @@ -2543,16 +2601,16 @@
                                                                                                                                                                                                  - Returns + Returns

                                                                                                                                                                                                  The number of removed values.

                                                                                                                                                                                                  - Throws + Throws
                                                                                                                                                                                                  -
                                                                                                                                                                                                    +
                                                                                                                                                                                                    • If Value copy constructor or copy assignment throws.
                                                                                                                                                                                                    • @@ -2586,7 +2644,7 @@

                                                                                                                                                                                                      - Description + Description

                                                                                                                                                                                                      This query function performs spatial and k-nearest neighbor searches. @@ -2599,7 +2657,7 @@

                                                                                                                                                                                                      Spatial predicates may be generated by one of the functions listed below:

                                                                                                                                                                                                      -
                                                                                                                                                                                                        +
                                                                                                                                                                                                        • boost::geometry::index::covered_by(),
                                                                                                                                                                                                        • @@ -2619,7 +2677,7 @@

                                                                                                                                                                                                          It is possible to negate spatial predicates:

                                                                                                                                                                                                          -
                                                                                                                                                                                                            +
                                                                                                                                                                                                            - Functions + Functions
                                                                                                                                                                                                            @@ -3302,7 +3434,7 @@

                                                                                                                                                                                                            - Description + Description

                                                                                                                                                                                                            It calls rtree::insert(value_type @@ -3310,7 +3442,7 @@

                                                                                                                                                                                                            - Synopsis + Synopsis
                                                                                                                                                                                                            template<typename Value,
                                                                                                                                                                                                                      typename Parameters,
                                                                                                                                                                                                            @@ -3321,7 +3453,7 @@
                                                                                                                                                                                                             
                                                                                                                                                                                                            - Parameter(s) + Parameter(s)
                                                                                                                                                                                                            @@ -3401,7 +3533,7 @@

                                                                                                                                                                                                            - Description + Description

                                                                                                                                                                                                            It calls rtree::insert(Iterator, @@ -3409,7 +3541,7 @@

                                                                                                                                                                                                            - Synopsis + Synopsis
                                                                                                                                                                                                            template<typename Value,
                                                                                                                                                                                                                      typename Parameters,
                                                                                                                                                                                                            @@ -3423,7 +3555,7 @@
                                                                                                                                                                                                             
                                                                                                                                                                                                            - Parameter(s) + Parameter(s)
                                                                                                                                                                                                            @@ -3519,7 +3651,7 @@

                                                                                                                                                                                                            - Description + Description

                                                                                                                                                                                                            It calls rtree::insert(Range @@ -3527,7 +3659,7 @@

                                                                                                                                                                                                            - Synopsis + Synopsis
                                                                                                                                                                                                            template<typename Value,
                                                                                                                                                                                                                      typename Parameters,
                                                                                                                                                                                                            @@ -3539,7 +3671,7 @@
                                                                                                                                                                                                             
                                                                                                                                                                                                            - Parameter(s) + Parameter(s)
                                                                                                                                                                                                            @@ -3619,7 +3751,7 @@

                                                                                                                                                                                                            - Description + Description

                                                                                                                                                                                                            Remove a value from the container. In contrast to the std::set or std::map erase() method this function removes @@ -3631,7 +3763,7 @@

                                                                                                                                                                                                            - Synopsis + Synopsis
                                                                                                                                                                                                            template<typename Value,
                                                                                                                                                                                                                      typename Parameters,
                                                                                                                                                                                                            @@ -3642,7 +3774,7 @@
                                                                                                                                                                                                             
                                                                                                                                                                                                            - Parameter(s) + Parameter(s)
                                                                                                                                                                                                            @@ -3713,7 +3845,7 @@
                                                                                                                                                                                                            - Returns + Returns

                                                                                                                                                                                                            1 if value was removed, 0 otherwise. @@ -3729,7 +3861,7 @@

                                                                                                                                                                                                            - Description + Description

                                                                                                                                                                                                            Remove a range of values from the container. In contrast to the std::set or std::map erase() method it doesn't take iterators @@ -3743,7 +3875,7 @@

                                                                                                                                                                                                            - Synopsis + Synopsis
                                                                                                                                                                                                            template<typename Value,
                                                                                                                                                                                                                      typename Parameters,
                                                                                                                                                                                                            @@ -3757,7 +3889,7 @@
                                                                                                                                                                                                             
                                                                                                                                                                                                            - Parameter(s) + Parameter(s)
                                                                                                                                                                                                            @@ -3844,7 +3976,7 @@
                                                                                                                                                                                                            - Returns + Returns

                                                                                                                                                                                                            The number of removed values. @@ -3860,7 +3992,7 @@

                                                                                                                                                                                                            - Description + Description

                                                                                                                                                                                                            Remove a range of values from the container. In contrast to the std::set or std::map erase() method it removes values @@ -3873,7 +4005,7 @@

                                                                                                                                                                                                            - Synopsis + Synopsis
                                                                                                                                                                                                            template<typename Value,
                                                                                                                                                                                                                      typename Parameters,
                                                                                                                                                                                                            @@ -3885,7 +4017,7 @@
                                                                                                                                                                                                             
                                                                                                                                                                                                            - Parameter(s) + Parameter(s)
                                                                                                                                                                                                            @@ -3956,7 +4088,7 @@
                                                                                                                                                                                                            - Returns + Returns

                                                                                                                                                                                                            The number of removed values. @@ -3973,7 +4105,7 @@

                                                                                                                                                                                                            - Description + Description

                                                                                                                                                                                                            This query function performs spatial and k-nearest neighbor searches. @@ -3986,7 +4118,7 @@

                                                                                                                                                                                                            Spatial predicates may be generated by one of the functions listed below:

                                                                                                                                                                                                            -
                                                                                                                                                                                                              +
                                                                                                                                                                                                              • boost::geometry::index::covered_by(),
                                                                                                                                                                                                              • @@ -4006,7 +4138,7 @@

                                                                                                                                                                                                                It is possible to negate spatial predicates:

                                                                                                                                                                                                                -
                                                                                                                                                                                                                - +

                                                                                                                                                                                                                Last revised: March 02, 2013 at 02:16:56 GMT

                                                                                                                                                                                                                Last revised: March 03, 2013 at 13:54:15 GMT


                                                                                                                                                                                                                diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 88b2733ac..4118ca19e 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -115,14 +115,17 @@ public: typedef Allocator allocator_type; /*! \brief Unsigned integral type used by the container. */ typedef typename allocator_type::size_type size_type; - + /*! \brief The function object extracting Indexable from Value. */ typedef IndexableGetter indexable_getter; + /*! \brief The function object comparing objects of type Value. */ typedef EqualTo value_equal; + // TODO: SHOULD THIS TYPE BE REMOVED? /*! \brief The Indexable type to which Value is translated. */ typedef typename index::detail::translator::indexable_type< detail::translator::translator >::type indexable_type; + /*! \brief The Box type used by the R-tree. */ typedef typename index::detail::default_box_type::type bounds_type; From cfb49116306e16d8d78de84b7b7b524604dd2a41 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 3 Mar 2013 23:41:22 +0000 Subject: [PATCH 356/366] rtree: indexable<>, equal_to<> and translator<> relocated: translator<>, indexable_type<>, result_type<> moved to detail namespace. indexable<> and equal_to<> are now defined in separate files. detail::translator namespace removed. [SVN r83288] --- .../boost/geometry/index/detail/indexable.hpp | 38 --- .../detail/rtree/node/node_d_mem_dynamic.hpp | 4 +- .../detail/rtree/visitors/nearest_query.hpp | 6 +- .../geometry/index/detail/translator.hpp | 60 ++++ include/boost/geometry/index/equal_to.hpp | 126 ++++++++ include/boost/geometry/index/indexable.hpp | 112 +++++++ include/boost/geometry/index/rtree.hpp | 12 +- include/boost/geometry/index/translator.hpp | 274 ------------------ 8 files changed, 311 insertions(+), 321 deletions(-) create mode 100644 include/boost/geometry/index/detail/translator.hpp create mode 100644 include/boost/geometry/index/equal_to.hpp create mode 100644 include/boost/geometry/index/indexable.hpp delete mode 100644 include/boost/geometry/index/translator.hpp diff --git a/include/boost/geometry/index/detail/indexable.hpp b/include/boost/geometry/index/detail/indexable.hpp index 6d04b90ad..f0791b170 100644 --- a/include/boost/geometry/index/detail/indexable.hpp +++ b/include/boost/geometry/index/detail/indexable.hpp @@ -15,44 +15,6 @@ namespace boost { namespace geometry { namespace index { namespace detail { namespace dispatch { -// Distinguish between indexables and other geometries - -template -struct indexable_type -{ - typedef void type; -}; - -template -struct indexable_type -{ - typedef Point type; -}; - -template -struct indexable_type -{ - typedef Box type; -}; - -} // namespace dispatch - -namespace traits -{ - -template -struct indexable_type -{ - typedef typename dispatch::indexable_type< - Indexable, - typename geometry::traits::tag::type - >::type type; -}; - -} // namespace traits - -namespace dispatch { - template struct point_type { diff --git a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp index 5a39b3e87..7d7bc401e 100644 --- a/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/node_d_mem_dynamic.hpp @@ -96,7 +96,7 @@ struct visitor struct element_indexable_type { - typedef typename translator::indexable_type::type type; + typedef typename indexable_type::type type; }; template @@ -111,7 +111,7 @@ struct element_indexable_type< // element's indexable getter template -typename translator::result_type::type +typename result_type::type element_indexable(Element const& el, Translator const& tr) { return tr(el); diff --git a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp index 0019a4d81..43a808f5d 100644 --- a/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp +++ b/include/boost/geometry/index/detail/rtree/visitors/nearest_query.hpp @@ -68,7 +68,7 @@ struct nearest_query_result_k public: typedef typename geometry::default_distance_result< Point, - typename translator::indexable_type::type + typename indexable_type::type >::type distance_type; inline explicit nearest_query_result_k(size_t k, OutIt out_it) @@ -168,13 +168,13 @@ public: typedef index::detail::distances_calc< DistancesPredicates, - typename translator::indexable_type::type, + typename indexable_type::type, index::detail::value_tag > value_distances_calc; typedef typename value_distances_calc::result_type value_distances_type; typedef index::detail::distances_predicates_check< DistancesPredicates, - typename translator::indexable_type::type, + typename indexable_type::type, index::detail::value_tag > value_distances_predicates_check; diff --git a/include/boost/geometry/index/detail/translator.hpp b/include/boost/geometry/index/detail/translator.hpp new file mode 100644 index 000000000..f377c720a --- /dev/null +++ b/include/boost/geometry/index/detail/translator.hpp @@ -0,0 +1,60 @@ +// Boost.Geometry Index +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP +#define BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template +struct translator + : public IndexableGetter + , public EqualTo +{ + typedef typename IndexableGetter::result_type result_type; + + translator(IndexableGetter const& i, EqualTo const& e) + : IndexableGetter(i), EqualTo(e) + {} + + template + result_type operator()(Value const& value) const + { + return IndexableGetter::operator()(value); + } + + template + bool equals(Value const& v1, Value const& v2) const + { + return EqualTo::operator()(v1, v2); + } +}; + +template +struct result_type +{ + typedef typename IndexableGetter::result_type type; +}; + +template +struct indexable_type +{ + typedef typename boost::remove_const< + typename boost::remove_reference< + typename result_type::type + >::type + >::type type; +}; + +} // namespace detail + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_DETAIL_TRANSLATOR_HPP diff --git a/include/boost/geometry/index/equal_to.hpp b/include/boost/geometry/index/equal_to.hpp new file mode 100644 index 000000000..cf29b5d94 --- /dev/null +++ b/include/boost/geometry/index/equal_to.hpp @@ -0,0 +1,126 @@ +// Boost.Geometry Index +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_EQUAL_TO_HPP +#define BOOST_GEOMETRY_INDEX_EQUAL_TO_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template +struct equals +{ + static bool apply(Geometry const& g1, Geometry const& g2) + { + return geometry::equals(g1, g2); + } +}; + +template +struct equals +{ + static bool apply(T const& v1, T const& v2) + { + return v1 == v2; + } +}; + +template +struct tuple_equals +{ + inline static bool apply(Tuple const& t1, Tuple const& t2) + { + typedef typename boost::tuples::element::type T; + return + equals< + T, typename geometry::traits::tag::type + >::apply(boost::get(t1), boost::get(t2)) + && + tuple_equals::apply(t1, t2); + } +}; + +template +struct tuple_equals +{ + inline static bool apply(Tuple const&, Tuple const&) + { + return true; + } +}; + +} // namespace detail + +/*! +\brief The function object comparing Values. + +It compares Geometries using geometry::equals() function. Other types are compared using operator==. +The default version handles Values which are Indexables. +This template is also specialized for std::pair and boost::tuple<...>. + +\tparam Value The type of objects which are compared by this function object. +*/ +template +struct equal_to +{ + typedef bool result_type; + bool operator()(Value const& l, Value const& r) const + { + return detail::equals::type>::apply(l ,r); + } +}; + +/*! +\brief The function object comparing Values. + +This specialization compares values of type std::pair. +It compares pairs' first values, then second values. + +\tparam T1 The first type. +\tparam T2 The second type. +*/ +template +struct equal_to< std::pair > +{ + typedef bool result_type; + bool operator()(std::pair const& l, std::pair const& r) const + { + typedef detail::equals::type> equals1; + typedef detail::equals::type> equals2; + + return equals1::apply(l.first, r.first) && equals2::apply(l.second, r.second); + } +}; + +/*! +\brief The function object comparing Values. + +This specialization compares values of type boost::tuple<...>. +It compares values stored in tuple in range [0, length>::value). +*/ +template +struct equal_to< boost::tuple > +{ + typedef boost::tuple value_type; + + typedef bool result_type; + bool operator()(value_type const& l, value_type const& r) const + { + return detail::tuple_equals< + value_type, 0, boost::tuples::length::value + >::apply(l ,r); + } +}; + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_EQUAL_TO_HPP diff --git a/include/boost/geometry/index/indexable.hpp b/include/boost/geometry/index/indexable.hpp new file mode 100644 index 000000000..4f27459fe --- /dev/null +++ b/include/boost/geometry/index/indexable.hpp @@ -0,0 +1,112 @@ +// Boost.Geometry Index +// +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. +// +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_INDEX_INDEXABLE_HPP +#define BOOST_GEOMETRY_INDEX_INDEXABLE_HPP + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template +struct is_indexable_impl { static const bool value = false; }; + +template +struct is_indexable_impl { static const bool value = true; }; + +template +struct is_indexable_impl { static const bool value = true; }; + +template +struct is_indexable +{ + static const bool value = + is_indexable_impl::type>::value; +}; + +} // namespace detail + +/*! +\brief The function object extracting Indexable from Value. + +It translates Value object to Indexable object. The default version handles Values which are Indexables. +This template is also specialized for std::pair and boost::tuple. + +\tparam Value The Value type which may be translated directly to the Indexable. +*/ +template +struct indexable +{ + BOOST_MPL_ASSERT_MSG( + (detail::is_indexable::value), + NOT_VALID_INDEXABLE_TYPE, + (Value) + ); + + typedef Value const& result_type; + result_type operator()(Value const& v) const + { + return v; + } +}; + +/*! +\brief The function object extracting Indexable from Value. + +This specialization translates from std::pair. + +\tparam Indexable The Indexable type. +\tparam T2 The second type. +*/ +template +struct indexable< std::pair > +{ + BOOST_MPL_ASSERT_MSG( + (detail::is_indexable::value), + NOT_VALID_INDEXABLE_TYPE, + (Indexable) + ); + + typedef Indexable const& result_type; + result_type operator()(std::pair const& v) const + { + return v.first; + } +}; + +/*! +\brief The function object extracting Indexable from Value. + +This specialization translates from boost::tuple. + +\tparam Indexable The Indexable type. +*/ +template +struct indexable< boost::tuple > +{ + typedef boost::tuple value_type; + + BOOST_MPL_ASSERT_MSG( + (detail::is_indexable::value), + NOT_VALID_INDEXABLE_TYPE, + (Indexable) + ); + + typedef Indexable const& result_type; + result_type operator()(value_type const& v) const + { + return boost::get<0>(v); + } +}; + +}}} // namespace boost::geometry::index + +#endif // BOOST_GEOMETRY_INDEX_INDEXABLE_HPP diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 4118ca19e..1f8fd246a 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -25,7 +25,11 @@ #include -#include +#include +#include + +#include +#include #include #include @@ -122,8 +126,8 @@ public: // TODO: SHOULD THIS TYPE BE REMOVED? /*! \brief The Indexable type to which Value is translated. */ - typedef typename index::detail::translator::indexable_type< - detail::translator::translator + typedef typename index::detail::indexable_type< + detail::translator >::type indexable_type; /*! \brief The Box type used by the R-tree. */ @@ -132,7 +136,7 @@ public: #if !defined(BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE) private: #endif - typedef detail::translator::translator translator_type; + typedef detail::translator translator_type; typedef bounds_type box_type; typedef typename detail::rtree::options_type::type options_type; diff --git a/include/boost/geometry/index/translator.hpp b/include/boost/geometry/index/translator.hpp deleted file mode 100644 index 611623057..000000000 --- a/include/boost/geometry/index/translator.hpp +++ /dev/null @@ -1,274 +0,0 @@ -// Boost.Geometry Index -// -// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP -#define BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP - -// move index::translator::def<> to index::translator<> -// make all index::translator<> methods static -// remove translator::index -// move helpers to index::default::translator - -//#include -//#include - -#include - -#include -#include - -namespace boost { namespace geometry { namespace index { - -namespace detail { namespace translator { - -template -struct indexable_not_found_error -{ - static const bool value = false; -}; -template <> -struct indexable_not_found_error -{ - static const bool value = true; -}; - -template -struct equals -{ - static bool apply(Geometry const& g1, Geometry const& g2) - { - return geometry::equals(g1, g2); - } -}; - -template -struct equals -{ - static bool apply(T const& v1, T const& v2) - { - return v1 == v2; - } -}; - -template -struct compare_tuples -{ - inline static bool apply(Tuple const& t1, Tuple const& t2) - { - typedef typename boost::tuples::element::type T; - return detail::translator::equals< - T, - typename geometry::traits::tag::type - >::apply(boost::get(t1), boost::get(t2)) - && - compare_tuples::apply(t1, t2); - } -}; - -template -struct compare_tuples -{ - inline static bool apply(Tuple const&, Tuple const&) - { - return true; - } -}; - -}} // namespace detail::translator - -/*! -\brief The function object extracting Indexable from Value. - -It translates Value object to Indexable object. The default version handles Values which are Indexables. -This template is also specialized for std::pair and boost::tuple. - -\tparam Value The Value type which may be translated directly to the Indexable. -*/ -template -struct indexable -{ - BOOST_MPL_ASSERT_MSG( - (!detail::translator::indexable_not_found_error< - typename detail::traits::indexable_type::type - >::value), - NOT_VALID_INDEXABLE_TYPE, - (Value) - ); - - typedef Value const& result_type; - result_type operator()(Value const& v) const - { - return v; - } -}; - -/*! -\brief The function object extracting Indexable from Value. - -This specialization translates from std::pair. - -\tparam Indexable The Indexable type. -\tparam T2 The second type. -*/ -template -struct indexable< std::pair > -{ - BOOST_MPL_ASSERT_MSG( - (!detail::translator::indexable_not_found_error< - typename detail::traits::indexable_type::type - >::value), - NOT_VALID_INDEXABLE_TYPE, - (Indexable) - ); - - typedef Indexable const& result_type; - result_type operator()(std::pair const& v) const - { - return v.first; - } -}; - -/*! -\brief The function object extracting Indexable from Value. - -This specialization translates from boost::tuple. - -\tparam Indexable The Indexable type. -*/ -template -struct indexable< boost::tuple > -{ - typedef boost::tuple value_type; - - BOOST_MPL_ASSERT_MSG( - (!detail::translator::indexable_not_found_error< - typename detail::traits::indexable_type::type - >::value), - NOT_VALID_INDEXABLE_TYPE, - (Indexable) - ); - - typedef Indexable const& result_type; - result_type operator()(value_type const& v) const - { - return boost::get<0>(v); - } -}; - -// equal_to - -/*! -\brief The function object comparing Values. - -It compares Geometries using geometry::equals() function. Other types are compared using operator==. -The default version handles Values which are Indexables. -This template is also specialized for std::pair and boost::tuple<...>. - -\tparam Value The type of objects which are compared by this function object. -*/ -template -struct equal_to -{ - typedef bool result_type; - bool operator()(Value const& l, Value const& r) const - { - return detail::translator::equals::type>::apply(l ,r); - } -}; - -/*! -\brief The function object comparing Values. - -This specialization compares values of type std::pair. -It compares pairs' first values, then second values. - -\tparam T1 The first type. -\tparam T2 The second type. -*/ -template -struct equal_to< std::pair > -{ - typedef bool result_type; - bool operator()(std::pair const& l, std::pair const& r) const - { - typedef detail::translator::equals::type> equals1; - typedef detail::translator::equals::type> equals2; - - return equals1::apply(l.first, r.first) && equals2::apply(l.second, r.second); - } -}; - -/*! -\brief The function object comparing Values. - -This specialization compares values of type boost::tuple<...>. -It compares values stored in tuple in range [0, length>::value). -*/ -template -struct equal_to< boost::tuple > -{ - typedef boost::tuple value_type; - - typedef bool result_type; - bool operator()(value_type const& l, value_type const& r) const - { - return detail::translator::compare_tuples< - value_type, 0, boost::tuples::length::value - >::apply(l ,r); - } -}; - -namespace detail { namespace translator { - -template -struct translator - : public IndexableGetter - , public EqualTo -{ - typedef typename IndexableGetter::result_type result_type; - - translator(IndexableGetter const& i, EqualTo const& e) - : IndexableGetter(i), EqualTo(e) - {} - - template - result_type operator()(Value const& value) const - { - return IndexableGetter::operator()(value); - } - - template - bool equals(Value const& v1, Value const& v2) const - { - return EqualTo::operator()(v1, v2); - } -}; - -template -struct result_type -{ - typedef typename Translator::result_type type; -}; - -template -struct indexable_type -{ - typedef typename boost::remove_const< - typename boost::remove_reference< - typename result_type::type - >::type - >::type type; -}; - -}} // namespace detail::translator - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_INDEX_TRANSLATOR_TRANSLATOR_HPP From f2f41d8b7405a49d24075c38f17c8381f45b24e0 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 4 Mar 2013 01:06:58 +0000 Subject: [PATCH 357/366] rtree: errors in indexable_get() and value_eq() fixed, indexable_get() and value_eq() used in rtree tests instead of translator(). [SVN r83289] --- include/boost/geometry/index/rtree.hpp | 4 +- test/rtree/test_rtree.hpp | 52 +++++++++++--------------- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 1f8fd246a..ad379db2e 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -810,7 +810,7 @@ public: */ indexable_getter indexable_get() const { - return m_members.translator().indexable_get(); + return m_members.indexable_getter(); } /*! @@ -823,7 +823,7 @@ public: */ value_equal value_eq() const { - return m_members.translator().value_eq(); + return m_members.equal_to(); } /*! diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index f8aba50d7..91c3eb910 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -503,7 +503,7 @@ template Iter test_find(Rtree const& rtree, Iter first, Iter last, Value const& value) { for ( ; first != last ; ++first ) - if ( rtree.translator().equals(value, *first) ) + if ( rtree.value_eq()(value, *first) ) return first; return first; } @@ -535,7 +535,7 @@ void test_exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Ran typename Range2::const_iterator it2 = expected_output.begin(); for ( ; it1 != output.end() && it2 != expected_output.end() ; ++it1, ++it2 ) { - if ( !rtree.translator().equals(*it1, *it2) ) + if ( !rtree.value_eq()(*it1, *it2) ) { BOOST_CHECK(false && "rtree.translator().equals(*it1, *it2)"); break; @@ -576,7 +576,7 @@ void test_intersects(Rtree const& tree, std::vector const& input, Box con std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::intersects(tree.translator()(v), qbox) ) + if ( bg::intersects(tree.indexable_get()(v), qbox) ) expected_output.push_back(v); //test_spatial_query(tree, qbox, expected_output); @@ -600,7 +600,7 @@ void test_disjoint(Rtree const& tree, std::vector const& input, Box const std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::disjoint(tree.translator()(v), qbox) ) + if ( bg::disjoint(tree.indexable_get()(v), qbox) ) expected_output.push_back(v); test_spatial_query(tree, bgi::disjoint(qbox), expected_output); @@ -622,7 +622,7 @@ void test_covered_by(Rtree const& tree, std::vector const& input, Box con std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::covered_by(tree.translator()(v), qbox) ) + if ( bg::covered_by(tree.indexable_get()(v), qbox) ) expected_output.push_back(v); test_spatial_query(tree, bgi::covered_by(qbox), expected_output); @@ -645,7 +645,7 @@ struct test_overlap_impl std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::overlaps(tree.translator()(v), qbox) ) + if ( bg::overlaps(tree.indexable_get()(v), qbox) ) expected_output.push_back(v); test_spatial_query(tree, bgi::overlaps(qbox), expected_output); @@ -717,7 +717,7 @@ void test_within(Rtree const& tree, std::vector const& input, Box const& std::vector expected_output; BOOST_FOREACH(Value const& v, input) - if ( bg::within(tree.translator()(v), qbox) ) + if ( bg::within(tree.indexable_get()(v), qbox) ) expected_output.push_back(v); test_spatial_query(tree, bgi::within(qbox), expected_output); @@ -770,7 +770,7 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P // calculate test output - k closest values pairs BOOST_FOREACH(Value const& v, input) { - D d = bgi::detail::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::detail::comparable_distance_near(pt, rtree.indexable_get()(v)); if ( test_output.size() < k ) test_output.push_back(std::make_pair(d, v)); @@ -808,7 +808,7 @@ void test_nearest_query_k(Rtree const& rtree, std::vector const& input, P if ( test_find(rtree, expected_output.begin(), expected_output.end(), v) == expected_output.end() ) { - D d = bgi::detail::comparable_distance_near(pt, rtree.translator()(v)); + D d = bgi::detail::comparable_distance_near(pt, rtree.indexable_get()(v)); BOOST_CHECK(d == biggest_d); } } @@ -899,8 +899,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); - // TEMPORARILY USED translator() - Rtree t2(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t2(tree, tree.get_allocator()); t2.swap(t1); BOOST_CHECK(tree.empty() == t2.empty()); BOOST_CHECK(tree.size() == t2.size()); @@ -948,8 +947,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); { - // TEMPORARILY USED translator() - Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(tree, tree.get_allocator()); BOOST_FOREACH(Value const& v, input) t.insert(v); BOOST_CHECK(tree.size() == t.size()); @@ -958,8 +956,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - // TEMPORARILY USED translator() - Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(tree, tree.get_allocator()); std::copy(input.begin(), input.end(), bgi::inserter(t)); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -967,24 +964,21 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - // TEMPORARILY USED translator() - Rtree t(input.begin(), input.end(), tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(input.begin(), input.end(), tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { - // TEMPORARILY USED translator() - Rtree t(input, tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(input, tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); BOOST_CHECK(tree.size() == t.size()); std::vector output; t.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t, output, expected_output); } { - // TEMPORARILY USED translator() - Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(tree, tree.get_allocator()); t.insert(input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -992,8 +986,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - // TEMPORARILY USED translator() - Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(tree, tree.get_allocator()); t.insert(input); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -1002,8 +995,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const } { - // TEMPORARILY USED translator() - Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(tree, tree.get_allocator()); BOOST_FOREACH(Value const& v, input) bgi::insert(t, v); BOOST_CHECK(tree.size() == t.size()); @@ -1012,8 +1004,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - // TEMPORARILY USED translator() - Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(tree, tree.get_allocator()); bgi::insert(t, input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -1021,8 +1012,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - // TEMPORARILY USED translator() - Rtree t(tree.parameters(), tree.translator(), tree.translator(), tree.get_allocator()); + Rtree t(tree, tree.get_allocator()); bgi::insert(t, input); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -1301,7 +1291,7 @@ void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator) generate_rtree(t, input, qbox); BOOST_FOREACH(Value const& v, input) - bg::expand(b, t.translator()(v)); + bg::expand(b, t.indexable_get()(v)); BOOST_CHECK(bg::equals(t.bounds(), b)); BOOST_CHECK(bg::equals(t.bounds(), bgi::bounds(t))); @@ -1315,7 +1305,7 @@ void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator) bg::assign_inverse(b); BOOST_FOREACH(Value const& v, input) - bg::expand(b, t.translator()(v)); + bg::expand(b, t.indexable_get()(v)); BOOST_CHECK(bg::equals(t.bounds(), b)); From 14f606d158b8b128c6aa00a434ebb974cf16a8f8 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 4 Mar 2013 01:13:05 +0000 Subject: [PATCH 358/366] rtree: errors in test fixed [SVN r83290] --- test/rtree/test_rtree.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 91c3eb910..499f7283c 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -899,7 +899,7 @@ void test_copy_assignment_swap_move(Rtree const& tree, Box const& qbox) t1.query(bgi::intersects(qbox), std::back_inserter(output)); test_exactly_the_same_outputs(t1, output, expected_output); - Rtree t2(tree, tree.get_allocator()); + Rtree t2(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); t2.swap(t1); BOOST_CHECK(tree.empty() == t2.empty()); BOOST_CHECK(tree.size() == t2.size()); @@ -947,7 +947,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const tree.query(bgi::intersects(qbox), std::back_inserter(expected_output)); { - Rtree t(tree, tree.get_allocator()); + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); BOOST_FOREACH(Value const& v, input) t.insert(v); BOOST_CHECK(tree.size() == t.size()); @@ -956,7 +956,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree, tree.get_allocator()); + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); std::copy(input.begin(), input.end(), bgi::inserter(t)); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -978,7 +978,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree, tree.get_allocator()); + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); t.insert(input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -986,7 +986,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree, tree.get_allocator()); + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); t.insert(input); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -995,7 +995,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const } { - Rtree t(tree, tree.get_allocator()); + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); BOOST_FOREACH(Value const& v, input) bgi::insert(t, v); BOOST_CHECK(tree.size() == t.size()); @@ -1004,7 +1004,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree, tree.get_allocator()); + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); bgi::insert(t, input.begin(), input.end()); BOOST_CHECK(tree.size() == t.size()); std::vector output; @@ -1012,7 +1012,7 @@ void test_create_insert(Rtree & tree, std::vector const& input, Box const test_exactly_the_same_outputs(t, output, expected_output); } { - Rtree t(tree, tree.get_allocator()); + Rtree t(tree.parameters(), tree.indexable_get(), tree.value_eq(), tree.get_allocator()); bgi::insert(t, input); BOOST_CHECK(tree.size() == t.size()); std::vector output; From 6fc96171f8f95fc996167a3d22a5ee39f327c3fc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 5 Mar 2013 02:42:02 +0000 Subject: [PATCH 359/366] Added commented out specializations of insexable<>, equal_to<> and tests for std::tuple. Removed unneeded variant node get<> function. [SVN r83302] --- .../detail/rtree/node/static_visitor.hpp | 10 ---- include/boost/geometry/index/equal_to.hpp | 52 ++++++++++++++++ include/boost/geometry/index/indexable.hpp | 28 +++++++++ test/rtree/test_rtree.hpp | 60 +++++++++++++++++++ 4 files changed, 140 insertions(+), 10 deletions(-) diff --git a/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp b/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp index c96ca3265..9b74b1e41 100644 --- a/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp +++ b/include/boost/geometry/index/detail/rtree/node/static_visitor.hpp @@ -37,16 +37,6 @@ inline V & get( return boost::get(v); } -template -inline V * get( - boost::variant< - static_leaf, - static_internal_node - > *v) -{ - return boost::get(v); -} - // apply visitor template diff --git a/include/boost/geometry/index/equal_to.hpp b/include/boost/geometry/index/equal_to.hpp index cf29b5d94..4ba15e20f 100644 --- a/include/boost/geometry/index/equal_to.hpp +++ b/include/boost/geometry/index/equal_to.hpp @@ -123,4 +123,56 @@ struct equal_to< boost::tuple > }}} // namespace boost::geometry::index +//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +// +//#include +// +//namespace boost { namespace geometry { namespace index { +// +//namespace detail { +// +//template +//struct std_tuple_equals +//{ +// inline static bool apply(Tuple const& t1, Tuple const& t2) +// { +// typedef typename std::tuple_element::type T; +// return +// equals< +// T, typename geometry::traits::tag::type +// >::apply(std::get(t1), std::get(t2)) +// && +// std_tuple_equals::apply(t1, t2); +// } +//}; +// +//template +//struct std_tuple_equals +//{ +// inline static bool apply(Tuple const&, Tuple const&) +// { +// return true; +// } +//}; +// +//} // namespace detail +// +//template +//struct equal_to< std::tuple > +//{ +// typedef std::tuple value_type; +// +// typedef bool result_type; +// bool operator()(value_type const& l, value_type const& r) const +// { +// return detail::std_tuple_equals< +// value_type, 0, std::tuple_size::value +// >::apply(l ,r); +// } +//}; +// +//}}} // namespace boost::geometry::index +// +//#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + #endif // BOOST_GEOMETRY_INDEX_EQUAL_TO_HPP diff --git a/include/boost/geometry/index/indexable.hpp b/include/boost/geometry/index/indexable.hpp index 4f27459fe..19cc5a722 100644 --- a/include/boost/geometry/index/indexable.hpp +++ b/include/boost/geometry/index/indexable.hpp @@ -109,4 +109,32 @@ struct indexable< boost::tuple > }}} // namespace boost::geometry::index +//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +// +//#include +// +//namespace boost { namespace geometry { namespace index { +// +//template +//struct indexable< std::tuple > +//{ +// typedef std::tuple value_type; +// +// BOOST_MPL_ASSERT_MSG( +// (detail::is_indexable::value), +// NOT_VALID_INDEXABLE_TYPE, +// (Indexable) +// ); +// +// typedef Indexable const& result_type; +// result_type operator()(value_type const& v) const +// { +// return std::get<0>(v); +// } +//}; +// +//}}} // namespace boost::geometry::index +// +//#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + #endif // BOOST_GEOMETRY_INDEX_INDEXABLE_HPP diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index 499f7283c..b76c70c73 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -196,6 +196,56 @@ struct generate_value< boost::tuple >, } }; +//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +// +//template +//struct generate_value< std::tuple, int, int> > +//{ +// typedef bg::model::point P; +// typedef std::tuple R; +// static R apply(int x, int y) +// { +// return std::make_tuple(P(x, y), x + y * 100, 0); +// } +//}; +// +//template +//struct generate_value< std::tuple >, int, int> > +//{ +// typedef bg::model::point P; +// typedef bg::model::box

                                                                                                                                                                                                                B; +// typedef std::tuple R; +// static R apply(int x, int y) +// { +// return std::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0); +// } +//}; +// +//template +//struct generate_value< std::tuple, int, int> > +//{ +// typedef bg::model::point P; +// typedef std::tuple R; +// static R apply(int x, int y, int z) +// { +// return std::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0); +// } +//}; +// +//template +//struct generate_value< std::tuple >, int, int> > +//{ +// typedef bg::model::point P; +// typedef bg::model::box

                                                                                                                                                                                                                B; +// typedef std::tuple R; +// static R apply(int x, int y, int z) +// { +// return std::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0); +// } +//}; +// +//#endif // #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // shared_ptr value template @@ -1346,6 +1396,11 @@ void test_rtree_for_point(Parameters const& parameters, Allocator const& allocat test_rtree_count(parameters, allocator); test_rtree_bounds(parameters, allocator); + +//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +// typedef std::tuple StdTupleP; +// test_rtree_by_value(parameters, allocator); +//#endif } template @@ -1366,6 +1421,11 @@ void test_rtree_for_box(Parameters const& parameters, Allocator const& allocator test_rtree_count(parameters, allocator); test_rtree_bounds(parameters, allocator); + +//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +// typedef std::tuple StdTupleB; +// test_rtree_by_value(parameters, allocator); +//#endif } template From 2db7f67b5618262960a5946297a43b35d47e2509 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 5 Mar 2013 18:26:56 +0000 Subject: [PATCH 360/366] rtree: cosmetic changes allocator passed to ctors by const ref instead of a value, some parameters names changed, docs updated. [SVN r83315] --- doc/generated/equal_to.qbk | 2 +- doc/generated/indexable.qbk | 2 +- doc/generated/rtree.qbk | 64 ++++----- .../r_tree/creation_and_modification.html | 17 ++- doc/html/geometry_index/r_tree/reference.html | 128 ++++++++++-------- doc/html/index.html | 2 +- doc/rtree/creation.qbk | 9 +- include/boost/geometry/index/rtree.hpp | 66 ++++----- 8 files changed, 156 insertions(+), 134 deletions(-) diff --git a/doc/generated/equal_to.qbk b/doc/generated/equal_to.qbk index 58f0fb670..682e4cc16 100644 --- a/doc/generated/equal_to.qbk +++ b/doc/generated/equal_to.qbk @@ -9,7 +9,7 @@ The function object comparing Values. It compares Geometries using geometry::equals() function. Other types are compared using operator==. The default version handles Values which are Indexables. This template is also specialized for std::pair and boost::tuple<...>. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/indexable.qbk b/doc/generated/indexable.qbk index 0d70a9e74..bae0fb5d6 100644 --- a/doc/generated/indexable.qbk +++ b/doc/generated/indexable.qbk @@ -9,7 +9,7 @@ The function object extracting Indexable from Value. It translates Value object to Indexable object. The default version handles Values which are Indexables. This template is also specialized for std::pair and boost::tuple. [heading Header] -`#include ` +`#include ` [heading Synopsis] [pre diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index 07610c04e..bd33dd9fe 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -71,17 +71,17 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[[#classboost_1_1geometry_1_1index_1_1rtree_1a4b7187ed28a9035d68b2f7125ffae5b4] `size_type`][Unsigned integral type used by the container. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5] `indexable_getter`][The function object extracting Indexable from Value. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b] `value_equal`][The function object comparing objects of type Value. ]] -[[[#classboost_1_1geometry_1_1index_1_1rtree_1a4175e946d14b08f20f7126e2434e5646] `indexable_type`][The Indexable type to which Value is translated. ]] +[[[#classboost_1_1geometry_1_1index_1_1rtree_1a28e88e55d260a454688fe1bd5e5af96b] `indexable_type`][The Indexable type to which Value is translated. ]] [[[#classboost_1_1geometry_1_1index_1_1rtree_1a89a6fd9a7c24f9d30422ef81ce2b959f] `bounds_type`][The Box type used by the R-tree. ]] ] [heading Constructor(s) and destructor] [table [[Function][Description]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a55da92f65c8718efd65ef520ad058b28 `rtree()`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1afb26a28fd2309fd70e5f84ea20dc899d `rtree(parameters_type const &, IndexableGetter const &, EqualTo const &, allocator_type)`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1a07c03c285279cc976cc045f80265ee39 `rtree(Iterator, Iterator)`]][The constructor. ]] -[[[link classboost_1_1geometry_1_1index_1_1rtree_1adc4c1b5fce889a3755eb916fdd021bf1 `rtree(Range const &)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a55d5fd5d205df08db5267253689ccf0c `rtree()`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a1a6b696d4855cbf1866196fe058c3a87 `rtree(parameters_type const &, indexable_getter const &, value_equal const &, allocator_type const &)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a037f17d8a1dfa4a818ff471dec61c912 `rtree(Iterator, Iterator)`]][The constructor. ]] +[[[link classboost_1_1geometry_1_1index_1_1rtree_1a7b96b715c52ddc13d7a81db344825848 `rtree(Range const &)`]][The constructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1af8db72811d2be53c409240204e63fb5a `~rtree()`]][The destructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1a826fc3236e181ad718d5283e95d7866f `rtree(rtree const &)`]][The copy constructor. ]] [[[link classboost_1_1geometry_1_1index_1_1rtree_1a72b6b75e083eea2ed26f54d4a2265375 `rtree(rtree const &, allocator_type const &)`]][The copy constructor. ]] @@ -113,7 +113,7 @@ The Translator translates from Value to Indexable each time r-tree requires it. [[ `const`][[link classboost_1_1geometry_1_1index_1_1rtree_1a17d9cef211feb7f674a5b4602f4cc81e `get_allocator()`]][Returns allocator used by the rtree. ]] ] -[#classboost_1_1geometry_1_1index_1_1rtree_1a55da92f65c8718efd65ef520ad058b28] +[#classboost_1_1geometry_1_1index_1_1rtree_1a55d5fd5d205df08db5267253689ccf0c] [section rtree()] The constructor. @@ -121,8 +121,8 @@ The constructor. [pre `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]`()``,` - `IndexableGetter const &` `indexable_getter` = `IndexableGetter()``,` - `EqualTo const &` `equal_to` = `EqualTo()``)` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &` `getter` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &` `equal` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]`()``)` ] [heading Modifier(s)] @@ -130,41 +130,41 @@ The constructor. [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] -[[`EqualTo const &`][ `equal_to` ][]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &`][ `getter` ][The function object extracting Indexable from Value. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &`][ `equal` ][The function object comparing Values.]] ] [heading Throws] If allocator default constructor throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1afb26a28fd2309fd70e5f84ea20dc899d] -[section rtree(parameters_type const &, IndexableGetter const &, EqualTo const &, allocator_type)] +[#classboost_1_1geometry_1_1index_1_1rtree_1a1a6b696d4855cbf1866196fe058c3a87] +[section rtree(parameters_type const &, indexable_getter const &, value_equal const &, allocator_type const &)] The constructor. [heading Synopsis] [pre `rtree``(`[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters``,` - `IndexableGetter const &` `indexable_getter``,` - `EqualTo const &` `equal_to``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]] `allocator``)` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &` `getter``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &` `equal``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &` `allocator``)` ] [heading Parameter(s)] [table [[Type][Name][Description]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] -[[`EqualTo const &`][ `equal_to` ][]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]][ `allocator` ][The allocator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &`][ `getter` ][The function object extracting Indexable from Value. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &`][ `equal` ][The function object comparing Values. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &`][ `allocator` ][The allocator object.]] ] [heading Throws] If allocator copy constructor throws. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1a07c03c285279cc976cc045f80265ee39] +[#classboost_1_1geometry_1_1index_1_1rtree_1a037f17d8a1dfa4a818ff471dec61c912] [section rtree(Iterator, Iterator)] The constructor. @@ -174,9 +174,9 @@ The constructor. `rtree``(``Iterator` `first``,` `Iterator` `last``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]`()``,` - `IndexableGetter const &` `indexable_getter` = `IndexableGetter()``,` - `EqualTo const &` `equal_to` = `EqualTo()``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]`()``)` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &` `getter` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &` `equal` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &` `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]`()``)` ] [heading Parameter(s)] @@ -185,9 +185,9 @@ The constructor. [[`Iterator`][ `first` ][The beginning of the range of Values. ]] [[`Iterator`][ `last` ][The end of the range of Values. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] -[[`EqualTo const &`][ `equal_to` ][]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]][ `allocator` ][The allocator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &`][ `getter` ][The function object extracting Indexable from Value. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &`][ `equal` ][]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &`][ `allocator` ][The allocator object.]] ] [heading Throws] @@ -201,7 +201,7 @@ The constructor. [endsect] -[#classboost_1_1geometry_1_1index_1_1rtree_1adc4c1b5fce889a3755eb916fdd021bf1] +[#classboost_1_1geometry_1_1index_1_1rtree_1a7b96b715c52ddc13d7a81db344825848] [section rtree(Range const &)] The constructor. @@ -210,9 +210,9 @@ The constructor. `template<``typename Range``>` `rtree``(``Range const &` `rng``,` [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &` `parameters` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]`()``,` - `IndexableGetter const &` `indexable_getter` = `IndexableGetter()``,` - `EqualTo const &` `equal_to` = `EqualTo()``,` - [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]] `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]`()``)` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &` `getter` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &` `equal` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]`()``,` + [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &` `allocator` = [^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]`()``)` ] [heading Modifier(s)] @@ -221,9 +221,9 @@ The constructor. [[Type][Name][Description]] [[`Range const &`][ `rng` ][The range of Values. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] -[[`IndexableGetter const &`][ `indexable_getter` ][The function object extracting Indexable from Value. ]] -[[`EqualTo const &`][ `equal_to` ][]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]][ `allocator` ][The allocator object.]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &`][ `getter` ][The function object extracting Indexable from Value. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &`][ `equal` ][The function object comparing Values. ]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &`][ `allocator` ][The allocator object.]] ] [heading Throws] 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 ffb24455d..8b753a752 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -89,13 +89,16 @@ and Indexables

                                                                                                                                                                                                          - R-tree may store Values of any type as passed function objects - knows how to interpret those Values, that is extract an Indexable - that the R-tree can handle and compare __values__. - Each type adapted to Point - or Box - concept is an Indexable. Values types which can - be handled by the predefined function objects index::indexable<Value> and index::equal_to<Value> are defined as follows: + R-tree may store Values of any type as long as passed function + objects know how to interpret those Values, that is extract + an Indexable that the R-tree can handle and compare __values__. +

                                                                                                                                                                                                          +

                                                                                                                                                                                                          + By default function objects index::indexable<Value> and index::equal_to<Value> are defined for some typically used + Value types which may be stored without defining any additional + classes. By default the rtree may store pure Indexables, pairs + and tuples. In the case of those two collection types, the Indexable + must be the first stored type.

                                                                                                                                                                                                          • diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index f6ee444da..dbd46c77a 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -315,7 +315,7 @@

                                                                                                                                                  - indexable_type + indexable_type

                                                                                                                                                  @@ -364,7 +364,7 @@

                                                                                                                                                  - rtree() + rtree()

                                                                                                                                                  @@ -376,11 +376,12 @@

                                                                                                                                                  - rtree(parameters_type const - &, IndexableGetter + rtree(parameters_type const + &, indexable_getter const &, - EqualTo const - &, allocator_type) + value_equal const + &, allocator_type + const &)

                                                                                                                                                  @@ -392,7 +393,7 @@

                                                                                                                                                  - rtree(Iterator, + rtree(Iterator, Iterator)

                                                                                                                                                  - rtree(Range const + rtree(Range const &)

                                                                                                                                                  The constructor. @@ -827,8 +828,8 @@ Synopsis

                                                                                                                                                  rtree(parameters_type const & parameters = parameters_type(),
                                                                                                                                                  -      IndexableGetter const & indexable_getter = IndexableGetter(),
                                                                                                                                                  -      EqualTo const & equal_to = EqualTo())
                                                                                                                                                  +      indexable_getter const & getter = indexable_getter(),
                                                                                                                                                  +      value_equal const & equal = value_equal())
                                                                                                                                                   
                                                                                                                                                  @@ -888,12 +889,13 @@

                                                                                                                                                  - IndexableGetter const & + indexable_getter + const &

                                                                                                                                                  - indexable_getter + getter

                                                                                                                                                  @@ -905,16 +907,19 @@

                                                                                                                                                  - EqualTo const - & + value_equal + const &

                                                                                                                                                  - equal_to + equal

                                                                                                                                                  +

                                                                                                                                                  + The function object comparing Values. +

                                                                                                                                                  @@ -929,24 +934,25 @@

                                                                                                                                                  The constructor.

                                                                                                                                                  - - Synopsis + + Synopsis
                                                                                                                                                  rtree(parameters_type const & parameters,
                                                                                                                                                  -      IndexableGetter const & indexable_getter,
                                                                                                                                                  -      EqualTo const & equal_to,
                                                                                                                                                  -      allocator_type allocator)
                                                                                                                                                  +      indexable_getter const & getter,
                                                                                                                                                  +      value_equal const & equal,
                                                                                                                                                  +      allocator_type const & allocator)
                                                                                                                                                   
                                                                                                                                                  - - Parameter(s) + + Parameter(s)
                                                                                                                                                  @@ -993,12 +999,13 @@

                                                                                                                                                  - IndexableGetter const & + indexable_getter + const &

                                                                                                                                                  - indexable_getter + getter

                                                                                                                                                  @@ -1010,22 +1017,26 @@

                                                                                                                                                  - EqualTo const - & + value_equal + const &

                                                                                                                                                  - equal_to + equal

                                                                                                                                                  +

                                                                                                                                                  + The function object comparing Values. +

                                                                                                                                                  - allocator_type + allocator_type + const &

                                                                                                                                                  @@ -1042,8 +1053,8 @@
                                                                                                                                                  - - Throws + + Throws

                                                                                                                                                  If allocator copy constructor throws. @@ -1051,7 +1062,7 @@

                                                                                                                                                  @@ -1065,9 +1076,9 @@ rtree(Iterator first, Iterator last, parameters_type const & parameters = parameters_type(), - IndexableGetter const & indexable_getter = IndexableGetter(), - EqualTo const & equal_to = EqualTo(), - allocator_type allocator = allocator_type()) + indexable_getter const & getter = indexable_getter(), + value_equal const & equal = value_equal(), + allocator_type const & allocator = allocator_type())

                                                                                                                                                  @@ -1152,12 +1163,13 @@

                                                                                                                                                  - IndexableGetter const & + indexable_getter + const &

                                                                                                                                                  - indexable_getter + getter

                                                                                                                                                  @@ -1169,13 +1181,13 @@

                                                                                                                                                  - EqualTo const - & + value_equal + const &

                                                                                                                                                  - equal_to + equal

                                                                                                                                                  @@ -1184,7 +1196,8 @@

                                                                                                                                                  - allocator_type + allocator_type + const &

                                                                                                                                                  @@ -1221,7 +1234,7 @@

                                                                                                                                                  @@ -1234,9 +1247,9 @@

                                                                                                                                                  template<typename Range>
                                                                                                                                                   rtree(Range const & rng,
                                                                                                                                                         parameters_type const & parameters = parameters_type(),
                                                                                                                                                  -      IndexableGetter const & indexable_getter = IndexableGetter(),
                                                                                                                                                  -      EqualTo const & equal_to = EqualTo(),
                                                                                                                                                  -      allocator_type allocator = allocator_type())
                                                                                                                                                  +      indexable_getter const & getter = indexable_getter(),
                                                                                                                                                  +      value_equal const & equal = value_equal(),
                                                                                                                                                  +      allocator_type const & allocator = allocator_type())
                                                                                                                                                   
                                                                                                                                                  @@ -1314,12 +1327,13 @@

                                                                                                                                                  - IndexableGetter const & + indexable_getter + const &

                                                                                                                                                  - indexable_getter + getter

                                                                                                                                                  @@ -1331,22 +1345,26 @@

                                                                                                                                                  - EqualTo const - & + value_equal + const &

                                                                                                                                                  - equal_to + equal

                                                                                                                                                  +

                                                                                                                                                  + The function object comparing Values. +

                                                                                                                                                  - allocator_type + allocator_type + const &

                                                                                                                                                  @@ -5490,7 +5508,7 @@ Header

                                                                                                                                                  - #include <boost/geometry/index/translator.hpp> + #include <boost/geometry/index/indexable.hpp>

                                                                                                                                                  @@ -5560,7 +5578,7 @@ Header

                                                                                                                                                  - #include <boost/geometry/index/translator.hpp> + #include <boost/geometry/index/equal_to.hpp>

                                                                                                                                                  diff --git a/doc/html/index.html b/doc/html/index.html index 2155625da..f155feecb 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
                                                                                                                                                - +

                                                                                                                                                Last revised: March 03, 2013 at 13:54:15 GMT

                                                                                                                                                Last revised: March 05, 2013 at 18:22:50 GMT


                                                                                                                                                diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index 2e5c51735..a4480c6fc 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -30,11 +30,12 @@ __rtree__ has 4 parameters: [section Values and Indexables] -__rtree__ may store `__value__`s of any type as passed function objects knows how to interpret those `__value__`s, that is +__rtree__ may store `__value__`s of any type as long as passed function objects know how to interpret those `__value__`s, that is extract an `__indexable__` that the __rtree__ can handle and compare `__values__`. -Each type adapted to `__point__` or `__box__` concept is an `__indexable__`. -`__value__`s types which can be handled by the predefined function objects `index::indexable` and `index::equal_to` -are defined as follows: + +By default function objects `index::indexable` and `index::equal_to` are defined for some typically used `__value__` +types which may be stored without defining any additional classes. By default the rtree may store pure `__indexable__`s, pairs +and tuples. In the case of those two collection types, the `__indexable__` must be the first stored type. * `__indexable__ = __point__ | __box__` * `__value__ = Indexable | std::pair<__indexable__, T> | boost::tuple<__indexable__, ...>` diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index ad379db2e..8d9dcdee2 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -155,46 +155,46 @@ public: /*! \brief The constructor. - \param parameters The parameters object. - \param indexable_getter The function object extracting Indexable from Value. - \param equal_to The function object comparing Values. + \param parameters The parameters object. + \param getter The function object extracting Indexable from Value. + \param equal The function object comparing Values. \par Throws If allocator default constructor throws. */ inline explicit rtree(parameters_type const& parameters = parameters_type(), - IndexableGetter const& indexable_getter = IndexableGetter(), - EqualTo const& equal_to = EqualTo()) - : m_members(indexable_getter, equal_to, parameters) + indexable_getter const& getter = indexable_getter(), + value_equal const& equal = value_equal()) + : m_members(getter, equal, parameters) {} /*! \brief The constructor. - \param parameters The parameters object. - \param indexable_getter The function object extracting Indexable from Value. - \param equal_to The function object comparing Values. - \param allocator The allocator object. + \param parameters The parameters object. + \param getter The function object extracting Indexable from Value. + \param equal The function object comparing Values. + \param allocator The allocator object. \par Throws If allocator copy constructor throws. */ inline rtree(parameters_type const& parameters, - IndexableGetter const& indexable_getter, - EqualTo const& equal_to, - allocator_type allocator) - : m_members(indexable_getter, equal_to, parameters, allocator) + indexable_getter const& getter, + value_equal const& equal, + allocator_type const& allocator) + : m_members(getter, equal, parameters, allocator) {} /*! \brief The constructor. - \param first The beginning of the range of Values. - \param last The end of the range of Values. - \param parameters The parameters object. - \param indexable_getter The function object extracting Indexable from Value. - \param equal_to The function object comparing Values. - \param allocator The allocator object. + \param first The beginning of the range of Values. + \param last The end of the range of Values. + \param parameters The parameters object. + \param getter The function object extracting Indexable from Value. + \param equal_to The function object comparing Values. + \param allocator The allocator object. \par Throws \li If allocator copy constructor throws. @@ -205,10 +205,10 @@ public: template inline rtree(Iterator first, Iterator last, parameters_type const& parameters = parameters_type(), - IndexableGetter const& indexable_getter = IndexableGetter(), - EqualTo const& equal_to = EqualTo(), - allocator_type allocator = allocator_type()) - : m_members(indexable_getter, equal_to, parameters, allocator) + indexable_getter const& getter = indexable_getter(), + value_equal const& equal = value_equal(), + allocator_type const& allocator = allocator_type()) + : m_members(getter, equal, parameters, allocator) { try { @@ -224,11 +224,11 @@ public: /*! \brief The constructor. - \param rng The range of Values. - \param parameters The parameters object. - \param indexable_getter The function object extracting Indexable from Value. - \param equal_to The function object comparing Values. - \param allocator The allocator object. + \param rng The range of Values. + \param parameters The parameters object. + \param getter The function object extracting Indexable from Value. + \param equal The function object comparing Values. + \param allocator The allocator object. \par Throws \li If allocator copy constructor throws. @@ -239,10 +239,10 @@ public: template inline explicit rtree(Range const& rng, parameters_type const& parameters = parameters_type(), - IndexableGetter const& indexable_getter = IndexableGetter(), - EqualTo const& equal_to = EqualTo(), - allocator_type allocator = allocator_type()) - : m_members(indexable_getter, equal_to, parameters, allocator) + indexable_getter const& getter = indexable_getter(), + value_equal const& equal = value_equal(), + allocator_type const& allocator = allocator_type()) + : m_members(getter, equal, parameters, allocator) { try { From 801bd5ad93649acc8c9dbe1beb62c55cd215b8cd Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 5 Mar 2013 21:35:48 +0000 Subject: [PATCH 361/366] Added second rtree benchmark [SVN r83322] --- example/benchmark2.cpp | 102 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 example/benchmark2.cpp diff --git a/example/benchmark2.cpp b/example/benchmark2.cpp new file mode 100644 index 000000000..63e456de5 --- /dev/null +++ b/example/benchmark2.cpp @@ -0,0 +1,102 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +#include +#include +#include + +int main() +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + typedef boost::chrono::thread_clock clock_t; + typedef boost::chrono::duration dur_t; + + size_t values_count = 30000001; + size_t count_start = 500000; + size_t count_stop = 30000000; + size_t count_step = 500000; + size_t insrem_count = 10000; + + std::vector< std::pair > coords; + + //randomize values + { + boost::mt19937 rng; + //rng.seed(static_cast(std::time(0))); + float max_val = static_cast(values_count / 2); + boost::uniform_real range(-max_val, max_val); + boost::variate_generator > rnd(rng, range); + + coords.reserve(values_count); + + std::cout << "randomizing data\n"; + for ( size_t i = 0 ; i < values_count ; ++i ) + { + coords.push_back(std::make_pair(rnd(), rnd())); + } + std::cout << "randomized\n"; + } + + //typedef bg::model::d2::point_xy P; + typedef bg::model::point P; + typedef bgi::rtree > RT; + //typedef bgi::rtree RT; + //typedef bgi::rtree > RT; + //typedef bgi::rtree RT; + //typedef bgi::rtree > RT; + //typedef bgi::rtree RT; + + std::cout << "sizeof rtree: " << sizeof(RT) << std::endl; + + for ( size_t curr_count = count_start ; curr_count < count_stop ; curr_count += count_step ) + { + RT t; + //RT t(bgi::runtime::linear(32, 8)); + //RT t(bgi::runtime::quadratic(32, 8)); + //RT t(bgi::runtime::rstar(32, 8)); + + std::cout << curr_count << ' '; + + // inserting test + { + for (size_t i = 0 ; i < curr_count ; ++i ) + { + float x = coords[i].first; + float y = coords[i].second; + P p(x, y); + + t.insert(p); + } + + clock_t::time_point start = clock_t::now(); + + for (size_t i = 0 ; i < insrem_count ; ++i ) + { + float x = coords.back().first; + float y = coords.back().second; + P p(x, y); + + t.insert(p); + t.remove(p); + } + + dur_t time = clock_t::now() - start; + std::cout << time.count() << ' '; + } + + std::cout << '\n'; + } + + return 0; +} From 50a8d0bed04a9f7fec0fe642a98d322ab2ffc32d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 6 Mar 2013 14:15:22 +0000 Subject: [PATCH 362/366] benchmark2 modified [SVN r83330] --- example/benchmark2.cpp | 74 +++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/example/benchmark2.cpp b/example/benchmark2.cpp index 63e456de5..d88e5ffc1 100644 --- a/example/benchmark2.cpp +++ b/example/benchmark2.cpp @@ -14,6 +14,7 @@ #include #include #include +#include int main() { @@ -22,77 +23,68 @@ int main() typedef boost::chrono::thread_clock clock_t; typedef boost::chrono::duration dur_t; - size_t values_count = 30000001; - size_t count_start = 500000; - size_t count_stop = 30000000; - size_t count_step = 500000; - size_t insrem_count = 10000; + size_t values_count = 501; + size_t count_start = 10; + size_t count_stop = 500; + size_t count_step = 10; + size_t insrem_count = 3000000; std::vector< std::pair > coords; - //randomize values - { - boost::mt19937 rng; - //rng.seed(static_cast(std::time(0))); - float max_val = static_cast(values_count / 2); - boost::uniform_real range(-max_val, max_val); - boost::variate_generator > rnd(rng, range); - - coords.reserve(values_count); - - std::cout << "randomizing data\n"; - for ( size_t i = 0 ; i < values_count ; ++i ) - { - coords.push_back(std::make_pair(rnd(), rnd())); - } - std::cout << "randomized\n"; - } - //typedef bg::model::d2::point_xy P; - typedef bg::model::point P; - typedef bgi::rtree > RT; + typedef bg::model::point P; + typedef bgi::rtree > RT; //typedef bgi::rtree RT; //typedef bgi::rtree > RT; //typedef bgi::rtree RT; //typedef bgi::rtree > RT; //typedef bgi::rtree RT; - std::cout << "sizeof rtree: " << sizeof(RT) << std::endl; - + RT t; + std::set s; + size_t val_i = 0; for ( size_t curr_count = count_start ; curr_count < count_stop ; curr_count += count_step ) { - RT t; //RT t(bgi::runtime::linear(32, 8)); //RT t(bgi::runtime::quadratic(32, 8)); //RT t(bgi::runtime::rstar(32, 8)); - std::cout << curr_count << ' '; - // inserting test { - for (size_t i = 0 ; i < curr_count ; ++i ) + for (; val_i < curr_count ; ++val_i ) { - float x = coords[i].first; - float y = coords[i].second; - P p(x, y); - + float v = val_i / 100.0f; + P p(v); t.insert(p); + s.insert(v); } + float v = (val_i+1) / 100.0f; + P test_p(v); + + std::cout << t.size() << ' '; + clock_t::time_point start = clock_t::now(); for (size_t i = 0 ; i < insrem_count ; ++i ) { - float x = coords.back().first; - float y = coords.back().second; - P p(x, y); - - t.insert(p); - t.remove(p); + t.insert(test_p); + t.remove(test_p); } dur_t time = clock_t::now() - start; std::cout << time.count() << ' '; + + start = clock_t::now(); + + for (size_t i = 0 ; i < insrem_count ; ++i ) + { + s.insert(v); + s.erase(v); + } + + time = clock_t::now() - start; + std::cout << time.count() << ' '; } std::cout << '\n'; From 3595b85142dcd25f1db619f9263f9642b5fb4612 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 6 Mar 2013 17:55:11 +0000 Subject: [PATCH 363/366] rtree benchmarks slightly modified [SVN r83331] --- example/benchmark.cpp | 7 ------- example/benchmark2.cpp | 18 +++++------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/example/benchmark.cpp b/example/benchmark.cpp index 12a38ff3c..988dd5004 100644 --- a/example/benchmark.cpp +++ b/example/benchmark.cpp @@ -45,24 +45,17 @@ int main() std::cout << "randomized\n"; } - //typedef bg::model::d2::point_xy P; typedef bg::model::point P; typedef bg::model::box

                                                                                                                                                B; typedef bgi::rtree > RT; - //typedef bgi::rtree RT; //typedef bgi::rtree > RT; - //typedef bgi::rtree RT; //typedef bgi::rtree > RT; - //typedef bgi::rtree RT; std::cout << "sizeof rtree: " << sizeof(RT) << std::endl; for (;;) { RT t; - //RT t(bgi::runtime::linear(32, 8)); - //RT t(bgi::runtime::quadratic(32, 8)); - //RT t(bgi::runtime::rstar(32, 8)); // inserting test { diff --git a/example/benchmark2.cpp b/example/benchmark2.cpp index d88e5ffc1..12c19f3d6 100644 --- a/example/benchmark2.cpp +++ b/example/benchmark2.cpp @@ -23,32 +23,24 @@ int main() typedef boost::chrono::thread_clock clock_t; typedef boost::chrono::duration dur_t; - size_t values_count = 501; + size_t values_count = 1001; size_t count_start = 10; - size_t count_stop = 500; + size_t count_stop = 1000; size_t count_step = 10; size_t insrem_count = 3000000; std::vector< std::pair > coords; - //typedef bg::model::d2::point_xy P; typedef bg::model::point P; - typedef bgi::rtree > RT; - //typedef bgi::rtree RT; - //typedef bgi::rtree > RT; - //typedef bgi::rtree RT; - //typedef bgi::rtree > RT; - //typedef bgi::rtree RT; + //typedef bgi::rtree > RT; + typedef bgi::rtree > RT; + //typedef bgi::rtree > RT; RT t; std::set s; size_t val_i = 0; for ( size_t curr_count = count_start ; curr_count < count_stop ; curr_count += count_step ) { - //RT t(bgi::runtime::linear(32, 8)); - //RT t(bgi::runtime::quadratic(32, 8)); - //RT t(bgi::runtime::rstar(32, 8)); - // inserting test { for (; val_i < curr_count ; ++val_i ) From 8e8f91419dd3faedf66f8abd7aab6e803c54e677 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 6 Mar 2013 19:05:31 +0000 Subject: [PATCH 364/366] 3rd benchmark added, 2nd modified [SVN r83333] --- example/benchmark2.cpp | 4 +- example/benchmark3.cpp | 98 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 example/benchmark3.cpp diff --git a/example/benchmark2.cpp b/example/benchmark2.cpp index 12c19f3d6..70d2f9d1e 100644 --- a/example/benchmark2.cpp +++ b/example/benchmark2.cpp @@ -29,9 +29,7 @@ int main() size_t count_step = 10; size_t insrem_count = 3000000; - std::vector< std::pair > coords; - - typedef bg::model::point P; + typedef bg::model::point P; //typedef bgi::rtree > RT; typedef bgi::rtree > RT; //typedef bgi::rtree > RT; diff --git a/example/benchmark3.cpp b/example/benchmark3.cpp new file mode 100644 index 000000000..6898e4eb8 --- /dev/null +++ b/example/benchmark3.cpp @@ -0,0 +1,98 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +#include +#include +#include +#include + +int main() +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + typedef boost::chrono::thread_clock clock_t; + typedef boost::chrono::duration dur_t; + + size_t stored_count = 100000; + + std::vector< std::pair > coords; + + //randomize values + { + boost::mt19937 rng; + //rng.seed(static_cast(std::time(0))); + float max_val = static_cast(stored_count / 10); + boost::uniform_real range(-max_val, max_val); + boost::variate_generator > rnd(rng, range); + + coords.reserve(stored_count); + + std::cout << "randomizing data\n"; + for ( size_t i = 0 ; i < stored_count ; ++i ) + { + coords.push_back(std::make_pair(rnd(), rnd())); + } + std::cout << "randomized\n"; + } + + typedef bg::model::point P; + typedef bgi::rtree RTL; + typedef bgi::rtree RTQ; + typedef bgi::rtree RTR; + + for ( size_t m = 4 ; m < 33 ; m += 2 ) + { + size_t mm = ::ceil(m / 3.0f); + + RTL rtl(bgi::dynamic_linear(m, mm)); + RTQ rtq(bgi::dynamic_quadratic(m, mm)); + RTR rtr(bgi::dynamic_rstar(m, mm)); + + std::cout << m << ' ' << mm << ' '; + + // inserting test + { + clock_t::time_point start = clock_t::now(); + for (size_t i = 0 ; i < stored_count ; ++i ) + { + P p(coords[i].first, coords[i].second); + rtl.insert(p); + } + dur_t time = clock_t::now() - start; + std::cout << time.count() << ' '; + + start = clock_t::now(); + for (size_t i = 0 ; i < stored_count ; ++i ) + { + P p(coords[i].first, coords[i].second); + rtq.insert(p); + } + time = clock_t::now() - start; + std::cout << time.count() << ' '; + + start = clock_t::now(); + for (size_t i = 0 ; i < stored_count ; ++i ) + { + float v = i / 100.0f; + P p(coords[i].first, coords[i].second); + rtr.insert(p); + } + time = clock_t::now() - start; + std::cout << time.count() << ' '; + } + + std::cout << '\n'; + } + + return 0; +} From 453af42c4bd2047f0dd6f936a866eca14693908a Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 15 Mar 2013 17:17:54 +0000 Subject: [PATCH 365/366] Added indexable<> and equal_to<> specialized for std::tuple<> if the compiler supports c++11 tuples and variadic templates. [SVN r83438] --- doc/generated/rtree.qbk | 2 +- .../r_tree/creation_and_modification.html | 28 +++-- doc/html/geometry_index/r_tree/reference.html | 3 + doc/html/index.html | 2 +- doc/rtree/creation.qbk | 14 ++- include/boost/geometry/index/equal_to.hpp | 102 ++++++++-------- include/boost/geometry/index/indexable.hpp | 54 ++++----- include/boost/geometry/index/rtree.hpp | 2 +- test/rtree/test_rtree.hpp | 114 +++++++++--------- 9 files changed, 171 insertions(+), 150 deletions(-) diff --git a/doc/generated/rtree.qbk b/doc/generated/rtree.qbk index bd33dd9fe..ec111ca2e 100644 --- a/doc/generated/rtree.qbk +++ b/doc/generated/rtree.qbk @@ -186,7 +186,7 @@ The constructor. [[`Iterator`][ `last` ][The end of the range of Values. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a80db5532eb59f7a809bd44ded265eb17 parameters_type]]` const &`][ `parameters` ][The parameters object. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1a43a7adb311cafc08e23010ccb4e97fb5 indexable_getter]]` const &`][ `getter` ][The function object extracting Indexable from Value. ]] -[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &`][ `equal` ][]] +[[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ad8fe544de514014a1bd87ea1b881ff9b value_equal]]` const &`][ `equal` ][The function object comparing Values. ]] [[[^[link classboost_1_1geometry_1_1index_1_1rtree_1ab6618b5c7e88ed70533233fbac0f5b2e allocator_type]]` const &`][ `allocator` ][The allocator object.]] ] [heading Throws] 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 8b753a752..500debb2b 100644 --- a/doc/html/geometry_index/r_tree/creation_and_modification.html +++ b/doc/html/geometry_index/r_tree/creation_and_modification.html @@ -109,10 +109,16 @@ Value = Indexable | std::pair<Indexable, T> - | boost::tuple<Indexable, + | tuple<Indexable, ...>

                                                                                                                                              +

                                                                                                                                              + By default boost::tuple<...> + is supported on all compilers. If the compiler supports C++11 tuples and + variadic templates then std::tuple<...> may be used "out of the + box" as well. +

                                                                                                                                              Examples of default Value types:

                                                                                                                                              @@ -123,13 +129,21 @@ boost::tuple<geometry::model::point<...>, int, float>

                                                                                                                                              - index::indexable<Value> - translates the Value each time the R-tree needs it. For this - reason it should rather return const reference to the Indexable - than a copy. + The predefined index::indexable<Value> + returns const reference to the Indexable stored in the Value.

                                                                                                                                              +
                                                                                                                                              + + + + + +
                                                                                                                                              [Important]Important

                                                                                                                                              + The translation is done quite frequently inside the continer - each time + the rtree needs it. +

                                                                                                                                              - If comparison of two Values is required, the predefined index::equal_to<Value>: + The predefined index::equal_to<Value>:

                                                                                                                                              • @@ -145,7 +159,7 @@ operator==().
                                                                                                                                              • - for boost::tuple<...> + for tuple<...> - compares all components of the Value. If the component is a Geometry, geometry::equals() function is used. For other types it uses operator==(). diff --git a/doc/html/geometry_index/r_tree/reference.html b/doc/html/geometry_index/r_tree/reference.html index dbd46c77a..6a00083f7 100644 --- a/doc/html/geometry_index/r_tree/reference.html +++ b/doc/html/geometry_index/r_tree/reference.html @@ -1191,6 +1191,9 @@

                                                                                                                                                +

                                                                                                                                                + The function object comparing Values. +

                                                                                                                                                diff --git a/doc/html/index.html b/doc/html/index.html index f155feecb..92ca4927e 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -51,7 +51,7 @@
                                                                                                                                            - +

                                                                                                                                            Last revised: March 05, 2013 at 18:22:50 GMT

                                                                                                                                            Last revised: March 15, 2013 at 17:15:29 GMT


                                                                                                                                            diff --git a/doc/rtree/creation.qbk b/doc/rtree/creation.qbk index a4480c6fc..47a82d64d 100644 --- a/doc/rtree/creation.qbk +++ b/doc/rtree/creation.qbk @@ -38,7 +38,10 @@ types which may be stored without defining any additional classes. By default th and tuples. In the case of those two collection types, the `__indexable__` must be the first stored type. * `__indexable__ = __point__ | __box__` -* `__value__ = Indexable | std::pair<__indexable__, T> | boost::tuple<__indexable__, ...>` +* `__value__ = Indexable | std::pair<__indexable__, T> | tuple<__indexable__, ...>` + +By default `boost::tuple<...>` is supported on all compilers. If the compiler supports C++11 tuples and variadic templates +then `std::tuple<...>` may be used "out of the box" as well. Examples of default `__value__` types: @@ -48,15 +51,16 @@ Examples of default `__value__` types: std::pair, unsigned> boost::tuple, int, float> -`index::indexable` translates the `__value__` each time the __rtree__ needs it. For this reason -it should rather return const reference to the `__indexable__` than a copy. +The predefined `index::indexable` returns const reference to the `__indexable__` stored in the `__value__`. -If comparison of two `__value__`s is required, the predefined `index::equal_to`: +[important The translation is done quite frequently inside the continer - each time the rtree needs it. ] + +The predefined `index::equal_to`: * for `__point__` and `__box__` - compares `__value__`s with geometry::equals(). * for `std::pair<...>` - compares both components of the `__value__`. The first value stored in the pair is compared before the second one. If the value stored in the pair is a Geometry, `geometry::equals()` is used. For other types it uses `operator==()`. -* for `boost::tuple<...>` - compares all components of the `__value__`. If the component is a `Geometry`, `geometry::equals()` +* for `tuple<...>` - compares all components of the `__value__`. If the component is a `Geometry`, `geometry::equals()` function is used. For other types it uses `operator==()`. [endsect] diff --git a/include/boost/geometry/index/equal_to.hpp b/include/boost/geometry/index/equal_to.hpp index 4ba15e20f..3cec22ec8 100644 --- a/include/boost/geometry/index/equal_to.hpp +++ b/include/boost/geometry/index/equal_to.hpp @@ -123,56 +123,56 @@ struct equal_to< boost::tuple > }}} // namespace boost::geometry::index -//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -// -//#include -// -//namespace boost { namespace geometry { namespace index { -// -//namespace detail { -// -//template -//struct std_tuple_equals -//{ -// inline static bool apply(Tuple const& t1, Tuple const& t2) -// { -// typedef typename std::tuple_element::type T; -// return -// equals< -// T, typename geometry::traits::tag::type -// >::apply(std::get(t1), std::get(t2)) -// && -// std_tuple_equals::apply(t1, t2); -// } -//}; -// -//template -//struct std_tuple_equals -//{ -// inline static bool apply(Tuple const&, Tuple const&) -// { -// return true; -// } -//}; -// -//} // namespace detail -// -//template -//struct equal_to< std::tuple > -//{ -// typedef std::tuple value_type; -// -// typedef bool result_type; -// bool operator()(value_type const& l, value_type const& r) const -// { -// return detail::std_tuple_equals< -// value_type, 0, std::tuple_size::value -// >::apply(l ,r); -// } -//}; -// -//}}} // namespace boost::geometry::index -// -//#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#include + +namespace boost { namespace geometry { namespace index { + +namespace detail { + +template +struct std_tuple_equals +{ + inline static bool apply(Tuple const& t1, Tuple const& t2) + { + typedef typename std::tuple_element::type T; + return + equals< + T, typename geometry::traits::tag::type + >::apply(std::get(t1), std::get(t2)) + && + std_tuple_equals::apply(t1, t2); + } +}; + +template +struct std_tuple_equals +{ + inline static bool apply(Tuple const&, Tuple const&) + { + return true; + } +}; + +} // namespace detail + +template +struct equal_to< std::tuple > +{ + typedef std::tuple value_type; + + typedef bool result_type; + bool operator()(value_type const& l, value_type const& r) const + { + return detail::std_tuple_equals< + value_type, 0, std::tuple_size::value + >::apply(l ,r); + } +}; + +}}} // namespace boost::geometry::index + +#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #endif // BOOST_GEOMETRY_INDEX_EQUAL_TO_HPP diff --git a/include/boost/geometry/index/indexable.hpp b/include/boost/geometry/index/indexable.hpp index 19cc5a722..53f9a64f5 100644 --- a/include/boost/geometry/index/indexable.hpp +++ b/include/boost/geometry/index/indexable.hpp @@ -109,32 +109,32 @@ struct indexable< boost::tuple > }}} // namespace boost::geometry::index -//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -// -//#include -// -//namespace boost { namespace geometry { namespace index { -// -//template -//struct indexable< std::tuple > -//{ -// typedef std::tuple value_type; -// -// BOOST_MPL_ASSERT_MSG( -// (detail::is_indexable::value), -// NOT_VALID_INDEXABLE_TYPE, -// (Indexable) -// ); -// -// typedef Indexable const& result_type; -// result_type operator()(value_type const& v) const -// { -// return std::get<0>(v); -// } -//}; -// -//}}} // namespace boost::geometry::index -// -//#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#include + +namespace boost { namespace geometry { namespace index { + +template +struct indexable< std::tuple > +{ + typedef std::tuple value_type; + + BOOST_MPL_ASSERT_MSG( + (detail::is_indexable::value), + NOT_VALID_INDEXABLE_TYPE, + (Indexable) + ); + + typedef Indexable const& result_type; + result_type operator()(value_type const& v) const + { + return std::get<0>(v); + } +}; + +}}} // namespace boost::geometry::index + +#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #endif // BOOST_GEOMETRY_INDEX_INDEXABLE_HPP diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 8d9dcdee2..058ce7c0a 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -193,7 +193,7 @@ public: \param last The end of the range of Values. \param parameters The parameters object. \param getter The function object extracting Indexable from Value. - \param equal_to The function object comparing Values. + \param equal The function object comparing Values. \param allocator The allocator object. \par Throws diff --git a/test/rtree/test_rtree.hpp b/test/rtree/test_rtree.hpp index b76c70c73..9915929c7 100644 --- a/test/rtree/test_rtree.hpp +++ b/test/rtree/test_rtree.hpp @@ -196,55 +196,55 @@ struct generate_value< boost::tuple >, } }; -//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -// -//template -//struct generate_value< std::tuple, int, int> > -//{ -// typedef bg::model::point P; -// typedef std::tuple R; -// static R apply(int x, int y) -// { -// return std::make_tuple(P(x, y), x + y * 100, 0); -// } -//}; -// -//template -//struct generate_value< std::tuple >, int, int> > -//{ -// typedef bg::model::point P; -// typedef bg::model::box

                                                                                                                                            B; -// typedef std::tuple R; -// static R apply(int x, int y) -// { -// return std::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0); -// } -//}; -// -//template -//struct generate_value< std::tuple, int, int> > -//{ -// typedef bg::model::point P; -// typedef std::tuple R; -// static R apply(int x, int y, int z) -// { -// return std::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0); -// } -//}; -// -//template -//struct generate_value< std::tuple >, int, int> > -//{ -// typedef bg::model::point P; -// typedef bg::model::box

                                                                                                                                            B; -// typedef std::tuple R; -// static R apply(int x, int y, int z) -// { -// return std::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0); -// } -//}; -// -//#endif // #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template +struct generate_value< std::tuple, int, int> > +{ + typedef bg::model::point P; + typedef std::tuple R; + static R apply(int x, int y) + { + return std::make_tuple(P(x, y), x + y * 100, 0); + } +}; + +template +struct generate_value< std::tuple >, int, int> > +{ + typedef bg::model::point P; + typedef bg::model::box

                                                                                                                                            B; + typedef std::tuple R; + static R apply(int x, int y) + { + return std::make_tuple(B(P(x, y), P(x + 2, y + 3)), x + y * 100, 0); + } +}; + +template +struct generate_value< std::tuple, int, int> > +{ + typedef bg::model::point P; + typedef std::tuple R; + static R apply(int x, int y, int z) + { + return std::make_tuple(P(x, y, z), x + y * 100 + z * 10000, 0); + } +}; + +template +struct generate_value< std::tuple >, int, int> > +{ + typedef bg::model::point P; + typedef bg::model::box

                                                                                                                                            B; + typedef std::tuple R; + static R apply(int x, int y, int z) + { + return std::make_tuple(B(P(x, y, z), P(x + 2, y + 3, z + 4)), x + y * 100 + z * 10000, 0); + } +}; + +#endif // #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) // shared_ptr value @@ -1397,10 +1397,10 @@ void test_rtree_for_point(Parameters const& parameters, Allocator const& allocat test_rtree_count(parameters, allocator); test_rtree_bounds(parameters, allocator); -//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -// typedef std::tuple StdTupleP; -// test_rtree_by_value(parameters, allocator); -//#endif +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + typedef std::tuple StdTupleP; + test_rtree_by_value(parameters, allocator); +#endif } template @@ -1422,10 +1422,10 @@ void test_rtree_for_box(Parameters const& parameters, Allocator const& allocator test_rtree_count(parameters, allocator); test_rtree_bounds(parameters, allocator); -//#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -// typedef std::tuple StdTupleB; -// test_rtree_by_value(parameters, allocator); -//#endif +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + typedef std::tuple StdTupleB; + test_rtree_by_value(parameters, allocator); +#endif } template From f850426692063dbb05f6d4583ba7a9d1ce7cc28b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 15 Mar 2013 18:49:46 +0000 Subject: [PATCH 366/366] rtree: margin() renamed to comparable_margin(), other/simpler algorithm used, 3d_benchmark added [SVN r83449] --- example/3d_benchmark.cpp | 161 ++++++++++++++++++ .../index/detail/algorithms/margin.hpp | 135 +++++++++------ .../rtree/rstar/redistribute_elements.hpp | 2 +- 3 files changed, 244 insertions(+), 54 deletions(-) create mode 100644 example/3d_benchmark.cpp diff --git a/example/3d_benchmark.cpp b/example/3d_benchmark.cpp new file mode 100644 index 000000000..251817681 --- /dev/null +++ b/example/3d_benchmark.cpp @@ -0,0 +1,161 @@ +// Boost.Geometry Index +// Additional tests + +// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +#include +#include +#include + +int main() +{ + namespace bg = boost::geometry; + namespace bgi = bg::index; + typedef boost::chrono::thread_clock clock_t; + typedef boost::chrono::duration dur_t; + + size_t values_count = 500000; + size_t queries_count = 200000; + + std::vector< boost::tuple > coords; + + //randomize values + { + boost::mt19937 rng; + //rng.seed(static_cast(std::time(0))); + float max_val = static_cast(values_count / 2); + boost::uniform_real range(-max_val, max_val); + boost::variate_generator > rnd(rng, range); + + coords.reserve(values_count); + + std::cout << "randomizing data\n"; + for ( size_t i = 0 ; i < values_count ; ++i ) + { + coords.push_back(boost::make_tuple(rnd(), rnd(), rnd())); + } + std::cout << "randomized\n"; + } + + typedef bg::model::point P; + typedef bg::model::box

                                                                                                                                            B; + //typedef bgi::rtree > RT; + //typedef bgi::rtree > RT; + typedef bgi::rtree > RT; + + std::cout << "sizeof rtree: " << sizeof(RT) << std::endl; + + for (;;) + { + RT t; + + // inserting test + { + clock_t::time_point start = clock_t::now(); + for (size_t i = 0 ; i < values_count ; ++i ) + { + float x = boost::get<0>(coords[i]); + float y = boost::get<1>(coords[i]); + float z = boost::get<2>(coords[i]); + B b(P(x - 0.5f, y - 0.5f, z - 0.5f), P(x + 0.5f, y + 0.5f, z + 0.5f)); + + t.insert(b); + } + dur_t time = clock_t::now() - start; + std::cout << time << " - insert " << values_count << '\n'; + } + + std::vector result; + result.reserve(100); + B result_one; + + { + clock_t::time_point start = clock_t::now(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count ; ++i ) + { + float x = boost::get<0>(coords[i]); + float y = boost::get<1>(coords[i]); + float z = boost::get<2>(coords[i]); + result.clear(); + t.query(bgi::intersects(B(P(x - 10, y - 10, z - 10), P(x + 10, y + 10, z + 10))), std::back_inserter(result)); + temp += result.size(); + } + dur_t time = clock_t::now() - start; + std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n'; + } + + { + clock_t::time_point start = clock_t::now(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 2 ; ++i ) + { + float x1 = boost::get<0>(coords[i]); + float y1 = boost::get<1>(coords[i]); + float z1 = boost::get<2>(coords[i]); + float x2 = boost::get<0>(coords[i+1]); + float y2 = boost::get<1>(coords[i+1]); + float z2 = boost::get<2>(coords[i+1]); + float x3 = boost::get<0>(coords[i+2]); + float y3 = boost::get<1>(coords[i+2]); + float z3 = boost::get<2>(coords[i+2]); + result.clear(); + t.query( + bgi::intersects(B(P(x1 - 10, y1 - 10, z1 - 10), P(x1 + 10, y1 + 10, z1 + 10))) + && + !bgi::within(B(P(x2 - 10, y2 - 10, z2 - 10), P(x2 + 10, y2 + 10, z2 + 10))) + && + !bgi::overlaps(B(P(x3 - 10, y3 - 10, z3 - 10), P(x3 + 10, y3 + 10, z3 + 10))) + , + std::back_inserter(result) + ); + temp += result.size(); + } + dur_t time = clock_t::now() - start; + std::cout << time << " - query(i && !w && !o) " << queries_count << " found " << temp << '\n'; + } + + result.clear(); + + { + clock_t::time_point start = clock_t::now(); + size_t temp = 0; + for (size_t i = 0 ; i < queries_count / 10 ; ++i ) + { + float x = boost::get<0>(coords[i]) - 100; + float y = boost::get<1>(coords[i]) - 100; + float z = boost::get<2>(coords[i]) - 100; + result.clear(); + temp += t.query(bgi::nearest(P(x, y, z), 5), std::back_inserter(result)); + } + dur_t time = clock_t::now() - start; + std::cout << time << " - query(nearest(P, 5)) " << (queries_count / 10) << " found " << temp << '\n'; + } + + { + clock_t::time_point start = clock_t::now(); + for (size_t i = 0 ; i < values_count / 10 ; ++i ) + { + float x = boost::get<0>(coords[i]); + float y = boost::get<1>(coords[i]); + float z = boost::get<2>(coords[i]); + B b(P(x - 0.5f, y - 0.5f, z - 0.5f), P(x + 0.5f, y + 0.5f, z + 0.5f)); + + t.remove(b); + } + dur_t time = clock_t::now() - start; + std::cout << time << " - remove " << values_count / 10 << '\n'; + } + + std::cout << "------------------------------------------------\n"; + } + + return 0; +} diff --git a/include/boost/geometry/index/detail/algorithms/margin.hpp b/include/boost/geometry/index/detail/algorithms/margin.hpp index cebc2cfb7..a5b934815 100644 --- a/include/boost/geometry/index/detail/algorithms/margin.hpp +++ b/include/boost/geometry/index/detail/algorithms/margin.hpp @@ -22,35 +22,88 @@ struct default_margin_result >::type type; }; -template -struct margin_for_each_edge +//template +//struct margin_for_each_edge +//{ +// BOOST_STATIC_ASSERT(0 < CurrentDimension); +// BOOST_STATIC_ASSERT(0 < EdgeDimension); +// +// static inline typename default_margin_result::type apply(Box const& b) +// { +// return margin_for_each_edge::apply(b) * +// ( geometry::get(b) - geometry::get(b) ); +// } +//}; +// +//template +//struct margin_for_each_edge +//{ +// BOOST_STATIC_ASSERT(0 < CurrentDimension); +// +// static inline typename default_margin_result::type apply(Box const& b) +// { +// return margin_for_each_edge::apply(b); +// } +//}; +// +//template +//struct margin_for_each_edge +//{ +// BOOST_STATIC_ASSERT(0 < CurrentDimension); +// +// static inline typename default_margin_result::type apply(Box const& b) +// { +// return geometry::get(b) - geometry::get(b); +// } +//}; +// +//template +//struct margin_for_each_edge +//{ +// static inline typename default_margin_result::type apply(Box const& /*b*/) +// { +// return 1; +// } +//}; +// +//template +//struct margin_for_each_dimension +//{ +// BOOST_STATIC_ASSERT(0 < CurrentDimension); +// BOOST_STATIC_ASSERT(CurrentDimension <= detail::traits::dimension::value); +// +// static inline typename default_margin_result::type apply(Box const& b) +// { +// return margin_for_each_dimension::apply(b) + +// margin_for_each_edge::value>::apply(b); +// } +//}; +// +//template +//struct margin_for_each_dimension +//{ +// static inline typename default_margin_result::type apply(Box const& b) +// { +// return margin_for_each_edge::value>::apply(b); +// } +//}; + +template +struct simple_margin_for_each_dimension { BOOST_STATIC_ASSERT(0 < CurrentDimension); - BOOST_STATIC_ASSERT(0 < EdgeDimension); + BOOST_STATIC_ASSERT(CurrentDimension <= detail::traits::dimension::value); static inline typename default_margin_result::type apply(Box const& b) { - return margin_for_each_edge::apply(b) * - ( geometry::get(b) - geometry::get(b) ); + return simple_margin_for_each_dimension::apply(b) + + geometry::get(b) - geometry::get(b); } }; -template -struct margin_for_each_edge +template +struct simple_margin_for_each_dimension { - BOOST_STATIC_ASSERT(0 < CurrentDimension); - - static inline typename default_margin_result::type apply(Box const& b) - { - return margin_for_each_edge::apply(b); - } -}; - -template -struct margin_for_each_edge -{ - BOOST_STATIC_ASSERT(0 < CurrentDimension); - static inline typename default_margin_result::type apply(Box const& b) { return geometry::get(b) - geometry::get(b); @@ -58,42 +111,18 @@ struct margin_for_each_edge }; template -struct margin_for_each_edge +typename default_margin_result::type comparable_margin(Box const& b) { - static inline typename default_margin_result::type apply(Box const& /*b*/) - { - return 1; - } -}; - -template -struct margin_for_each_dimension -{ - BOOST_STATIC_ASSERT(0 < CurrentDimension); - BOOST_STATIC_ASSERT(CurrentDimension <= detail::traits::dimension::value); - - static inline typename default_margin_result::type apply(Box const& b) - { - return margin_for_each_dimension::apply(b) + - margin_for_each_edge::value>::apply(b); - } -}; - -template -struct margin_for_each_dimension -{ - static inline typename default_margin_result::type apply(Box const& b) - { - return margin_for_each_edge::value>::apply(b); - } -}; - -template -typename default_margin_result::type margin(Box const& b) -{ - return 2 * detail::margin_for_each_dimension::value>::apply(b); + //return detail::margin_for_each_dimension::value>::apply(b); + return detail::simple_margin_for_each_dimension::value>::apply(b); } +//template +//typename default_margin_result::type margin(Box const& b) +//{ +// return 2 * detail::margin_for_each_dimension::value>::apply(b); +//} + }}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP diff --git a/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp index f89c1d660..08cd51dbf 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp @@ -85,7 +85,7 @@ struct choose_split_axis_and_index_for_corner Box box1 = rtree::elements_box(elements_copy.begin(), elements_copy.begin() + i, translator); Box box2 = rtree::elements_box(elements_copy.begin() + i, elements_copy.end(), translator); - sum_of_margins += index::detail::margin(box1) + index::detail::margin(box2); + sum_of_margins += index::detail::comparable_margin(box1) + index::detail::comparable_margin(box2); content_type ovl = index::detail::intersection_content(box1, box2); content_type con = index::detail::content(box1) + index::detail::content(box2);