|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84170 - trunk/boost/geometry/index
From: adam.wulkiewicz_at_[hidden]
Date: 2013-05-06 12:15:40
Author: awulkiew
Date: 2013-05-06 12:15:38 EDT (Mon, 06 May 2013)
New Revision: 84170
URL: http://svn.boost.org/trac/boost/changeset/84170
Log:
geometry.index: nearest() predicate point relations shielded by BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL.
Text files modified:
trunk/boost/geometry/index/distance_predicates.hpp | 4 ++++
trunk/boost/geometry/index/predicates.hpp | 25 +++++++++----------------
trunk/boost/geometry/index/rtree.hpp | 8 ++------
3 files changed, 15 insertions(+), 22 deletions(-)
Modified: trunk/boost/geometry/index/distance_predicates.hpp
==============================================================================
--- trunk/boost/geometry/index/distance_predicates.hpp (original)
+++ trunk/boost/geometry/index/distance_predicates.hpp 2013-05-06 12:15:38 EDT (Mon, 06 May 2013)
@@ -21,6 +21,8 @@
// relations generators
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
/*!
\brief Generate to_nearest() relationship.
@@ -89,6 +91,8 @@
return detail::to_furthest<T>(v);
}
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
// distance predicates generators
/*!
Modified: trunk/boost/geometry/index/predicates.hpp
==============================================================================
--- trunk/boost/geometry/index/predicates.hpp (original)
+++ trunk/boost/geometry/index/predicates.hpp 2013-05-06 12:15:38 EDT (Mon, 06 May 2013)
@@ -175,10 +175,10 @@
\par Example
\verbatim
-bool is_red(__value__ const& v) { return v.is_red(); }
+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(); }
+template <typename Value> bool operator()(Value const& v) { return v.is_red(); }
}
// ...
@@ -190,7 +190,7 @@
std::back_inserter(result));
#ifndef BOOST_NO_CXX11_LAMBDAS
-rt.query(index::intersects(box) && index::satisfies([](__value__ const& v) { return v.is_red(); }),
+rt.query(index::intersects(box) && index::satisfies([](Value const& v) { return v.is_red(); }),
std::back_inserter(result));
#endif
\endverbatim
@@ -214,17 +214,10 @@
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:
-\li \c boost::geometry::index::to_nearest() - default,
-\li \c boost::geometry::index::to_centroid(),
-\li \c boost::geometry::index::to_furthest().
-
\par Example
\verbatim
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
@@ -232,14 +225,14 @@
\ingroup predicates
-\param point_relation The point or relation describing how the distance will be calculated.
-\param k The maximum number of values to return.
+\param point The point from which distance is calculated.
+\param k The maximum number of values to return.
*/
-template <typename PointOrRelation> inline
-detail::nearest<PointOrRelation>
-nearest(PointOrRelation const& point_relation, unsigned k)
+template <typename Point> inline
+detail::nearest<Point>
+nearest(Point const& point, unsigned k)
{
- return detail::nearest<PointOrRelation>(point_relation, k);
+ return detail::nearest<Point>(point, k);
}
namespace detail {
Modified: trunk/boost/geometry/index/rtree.hpp
==============================================================================
--- trunk/boost/geometry/index/rtree.hpp (original)
+++ trunk/boost/geometry/index/rtree.hpp 2013-05-06 12:15:38 EDT (Mon, 06 May 2013)
@@ -714,14 +714,12 @@
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
- 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.
- \info
+ \warning
Only one \c nearest() perdicate may be passed to the query. Passing more of them results in compile-time assert.
\param predicates Predicates.
@@ -1456,14 +1454,12 @@
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
-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.
-\note
+\warning
Only one \c nearest() perdicate may be passed to the query. Passing more of them results in compile-time assert.
\ingroup rtree_functions
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk