mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
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]
This commit is contained in:
parent
0afdadc5c4
commit
0bc541d1e9
@ -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 <typename Value> 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
|
||||
``
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="prev" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>R-tree</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="prev" href="introduction.html" title="Introduction">
|
||||
@ -57,8 +57,8 @@
|
||||
queries</a></span></dt>
|
||||
<dt><span class="section"><a href="r_tree/queries.html#geometry_index.r_tree.queries.nearest_neighbours_queries">Nearest
|
||||
neighbours queries</a></span></dt>
|
||||
<dt><span class="section"><a href="r_tree/queries.html#geometry_index.r_tree.queries.satisfies_predicate">Satisfies
|
||||
predicate</a></span></dt>
|
||||
<dt><span class="section"><a href="r_tree/queries.html#geometry_index.r_tree.queries.user_defined_unary_predicate">user-defined
|
||||
unary predicate</a></span></dt>
|
||||
<dt><span class="section"><a href="r_tree/queries.html#geometry_index.r_tree.queries.passing_a_set_of_predicates">Passing
|
||||
a set of predicates</a></span></dt>
|
||||
<dt><span class="section"><a href="r_tree/queries.html#geometry_index.r_tree.queries.inserting_query_results_into_the_other_r_tree">Inserting
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Creation and modification</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="rtree_quickstart.html" title="Quick Start">
|
||||
@ -55,7 +55,7 @@
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">rtree</span><span class="special"><</span><span class="identifier">Value</span><span class="special">,</span> <span class="identifier">Parameters</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">=</span> <span class="identifier">index</span><span class="special">::</span><span class="identifier">translator</span><span class="special"><</span><span class="identifier">Value</span><span class="special">>,</span> <span class="identifier">Allocator</span><span class="special">></span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">Value</span><span class="special">></span> <span class="special">></span>
|
||||
</pre>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">Value</code> - type of object which will be stored in the container,
|
||||
</li>
|
||||
@ -90,7 +90,7 @@
|
||||
be handled by the default <code class="computeroutput">Translator</code> - <code class="computeroutput"><span class="identifier">index</span><span class="special">::</span><span class="identifier">translator</span><span class="special"><</span>Value<span class="special">></span></code>
|
||||
are defined as follows:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">Indexable <span class="special">=</span> <a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_point.html" target="_top">Point</a>
|
||||
<span class="special">|</span> <a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a></code>
|
||||
@ -116,7 +116,7 @@
|
||||
A <code class="computeroutput">Translator</code> is a type which knows how to handle <code class="computeroutput">Value</code>s.
|
||||
It has two purposes:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
it translates <code class="computeroutput">Value</code> to a more suitable <code class="computeroutput">Indexable</code>
|
||||
type which is needed by most of operations,
|
||||
@ -134,7 +134,7 @@
|
||||
<p>
|
||||
If comparison of two <code class="computeroutput">Value</code>s is required, the default translator:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
for <code class="computeroutput"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_point.html" target="_top">Point</a></code>
|
||||
and <code class="computeroutput"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a></code>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="../r_tree.html" title="R-tree">
|
||||
@ -28,10 +28,10 @@
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
R-tree is a tree data structure used for spatial searching. It was proposed
|
||||
by Antonin Guttman in 1984 <sup>[<a name="geometry_index.r_tree.introduction.f0" href="#ftn.geometry_index.r_tree.introduction.f0" class="footnote">1</a>]</sup> as an expansion of B-tree for multi-dimensional data. It may
|
||||
by Antonin Guttman in 1984 <a href="#ftn.geometry_index.r_tree.introduction.f0" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f0"></a>[1]</sup></a> 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 <sup>[<a name="geometry_index.r_tree.introduction.f1" href="#ftn.geometry_index.r_tree.introduction.f1" class="footnote">2</a>]</sup>.
|
||||
close to some point in space <a href="#ftn.geometry_index.r_tree.introduction.f1" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f1"></a>[2]</sup></a>.
|
||||
</p>
|
||||
<p>
|
||||
The R-tree structure is presented on the image below. Each R-tree's node
|
||||
@ -51,7 +51,7 @@
|
||||
</p>
|
||||
<p>
|
||||
The R-tree is a self-balanced data structure. The key part of balancing algorithm
|
||||
is node splitting algorithm <sup>[<a name="geometry_index.r_tree.introduction.f2" href="#ftn.geometry_index.r_tree.introduction.f2" class="footnote">3</a>]</sup> <sup>[<a name="geometry_index.r_tree.introduction.f3" href="#ftn.geometry_index.r_tree.introduction.f3" class="footnote">4</a>]</sup>. Each algorithm produces different splits so the internal structure
|
||||
is node splitting algorithm <a href="#ftn.geometry_index.r_tree.introduction.f2" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f2"></a>[3]</sup></a> <a href="#ftn.geometry_index.r_tree.introduction.f3" class="footnote"><sup class="footnote"><a name="geometry_index.r_tree.introduction.f3"></a>[4]</sup></a>. 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 @@
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="geometry_index.r_tree.introduction.h0"></a>
|
||||
<span><a name="geometry_index.r_tree.introduction.implementation_details"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.implementation_details">Implementation
|
||||
<span class="phrase"><a name="geometry_index.r_tree.introduction.implementation_details"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.implementation_details">Implementation
|
||||
details</a>
|
||||
</h5>
|
||||
<p>
|
||||
Key features of this implementation of the R-tree are:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
capable to store arbitrary Value type,
|
||||
</li>
|
||||
@ -211,7 +211,7 @@
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="geometry_index.r_tree.introduction.h1"></a>
|
||||
<span><a name="geometry_index.r_tree.introduction.dependencies"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.dependencies">Dependencies</a>
|
||||
<span class="phrase"><a name="geometry_index.r_tree.introduction.dependencies"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.dependencies">Dependencies</a>
|
||||
</h5>
|
||||
<p>
|
||||
R-tree depends on <span class="bold"><strong>Boost.Move</strong></span>, <span class="bold"><strong>Boost.Container</strong></span>, <span class="bold"><strong>Boost.Tuple</strong></span>,
|
||||
@ -219,7 +219,7 @@
|
||||
</p>
|
||||
<h5>
|
||||
<a name="geometry_index.r_tree.introduction.h2"></a>
|
||||
<span><a name="geometry_index.r_tree.introduction.contributors"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.contributors">Contributors</a>
|
||||
<span class="phrase"><a name="geometry_index.r_tree.introduction.contributors"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.contributors">Contributors</a>
|
||||
</h5>
|
||||
<p>
|
||||
The spatial index was originally started by Federico J. Fernandez during
|
||||
@ -227,7 +227,7 @@
|
||||
</p>
|
||||
<h5>
|
||||
<a name="geometry_index.r_tree.introduction.h3"></a>
|
||||
<span><a name="geometry_index.r_tree.introduction.spatial_thanks"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.spatial_thanks">Spatial
|
||||
<span class="phrase"><a name="geometry_index.r_tree.introduction.spatial_thanks"></a></span><a class="link" href="introduction.html#geometry_index.r_tree.introduction.spatial_thanks">Spatial
|
||||
thanks</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -235,20 +235,20 @@
|
||||
J. Simonson for their support and ideas.
|
||||
</p>
|
||||
<div class="footnotes">
|
||||
<br><hr width="100" align="left">
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f0" href="#geometry_index.r_tree.introduction.f0" class="para">1</a>] </sup>
|
||||
<br><hr style="width:100; align:left;">
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f0" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f0" class="para"><sup class="para">[1] </sup></a>
|
||||
Guttman, A. (1984). <span class="emphasis"><em>R-Trees: A Dynamic Index Structure for Spatial
|
||||
Searching</em></span>
|
||||
</p></div>
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f1" href="#geometry_index.r_tree.introduction.f1" class="para">2</a>] </sup>
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f1" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f1" class="para"><sup class="para">[2] </sup></a>
|
||||
Cheung, K.; Fu, A. (1998). <span class="emphasis"><em>Enhanced Nearest Neighbour Search
|
||||
on the R-tree</em></span>
|
||||
</p></div>
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f2" href="#geometry_index.r_tree.introduction.f2" class="para">3</a>] </sup>
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f2" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f2" class="para"><sup class="para">[3] </sup></a>
|
||||
Greene, D. (1989). <span class="emphasis"><em>An implementation and performance analysis
|
||||
of spatial data access methods</em></span>
|
||||
</p></div>
|
||||
<div class="footnote"><p><sup>[<a id="ftn.geometry_index.r_tree.introduction.f3" href="#geometry_index.r_tree.introduction.f3" class="para">4</a>] </sup>
|
||||
<div id="ftn.geometry_index.r_tree.introduction.f3" class="footnote"><p><a href="#geometry_index.r_tree.introduction.f3" class="para"><sup class="para">[4] </sup></a>
|
||||
Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). <span class="emphasis"><em>The
|
||||
R*-tree: an efficient and robust access method for points and rectangles</em></span>
|
||||
</p></div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Queries</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="creation_and_modification.html" title="Creation and modification">
|
||||
@ -33,8 +33,8 @@
|
||||
queries</a></span></dt>
|
||||
<dt><span class="section"><a href="queries.html#geometry_index.r_tree.queries.nearest_neighbours_queries">Nearest
|
||||
neighbours queries</a></span></dt>
|
||||
<dt><span class="section"><a href="queries.html#geometry_index.r_tree.queries.satisfies_predicate">Satisfies
|
||||
predicate</a></span></dt>
|
||||
<dt><span class="section"><a href="queries.html#geometry_index.r_tree.queries.user_defined_unary_predicate">user-defined
|
||||
unary predicate</a></span></dt>
|
||||
<dt><span class="section"><a href="queries.html#geometry_index.r_tree.queries.passing_a_set_of_predicates">Passing
|
||||
a set of predicates</a></span></dt>
|
||||
<dt><span class="section"><a href="queries.html#geometry_index.r_tree.queries.inserting_query_results_into_the_other_r_tree">Inserting
|
||||
@ -44,24 +44,24 @@
|
||||
Queries returns <code class="computeroutput">Value</code>s which meets some predicates. Currently
|
||||
supported are three types of predicates:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
spatial predicates - defining relationship between stored Values and
|
||||
some Geometry,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
nearest predicates - defining relationship between stored Values and
|
||||
some Point,
|
||||
nearest predicate - defining relationship between stored Values and some
|
||||
Point,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
satisfies predicate - allows to pass user-defined UnaryPredicate (function
|
||||
or function object) to the query.
|
||||
user-defined unary predicate - function, function object or lambda expression
|
||||
checking user-defined condition.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
For example queries may be used to retrieve Values:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
intersecting some area but not within other area,
|
||||
</li>
|
||||
@ -78,31 +78,28 @@
|
||||
a query</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
There are three ways to perform a query. In the following example <code class="computeroutput"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a></code>
|
||||
is used as the predicate, this is a default spatial predicate described
|
||||
in the following section. Following queries returns <code class="computeroutput">Value</code>s
|
||||
intersecting some region defined as a <code class="computeroutput"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a></code>.
|
||||
These three ways are:
|
||||
There are three ways to perform a query presented below. All of them returns
|
||||
<code class="computeroutput">Value</code>s intersecting some region defined as a <code class="computeroutput"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a></code>.
|
||||
</p>
|
||||
<p>
|
||||
Method call
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span>Value<span class="special">></span> <span class="identifier">returned_values</span><span class="special">;</span>
|
||||
<a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a> <span class="identifier">box_region</span><span class="special">(...);</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">box_region</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">returned_values</span><span class="special">));</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box_region</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">returned_values</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
Function call
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span>Value<span class="special">></span> <span class="identifier">returned_values</span><span class="special">;</span>
|
||||
<a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a> <span class="identifier">box_region</span><span class="special">(...);</span>
|
||||
<span class="identifier">index</span><span class="special">::</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">rt</span><span class="special">,</span> <span class="identifier">box_region</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">returned_values</span><span class="special">));</span>
|
||||
<span class="identifier">index</span><span class="special">::</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">rt</span><span class="special">,</span> <span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box_region</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">returned_values</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
Use of pipe operator generating a range
|
||||
</p>
|
||||
<pre class="programlisting"><a href="http://www.boost.org/libs/geometry/doc/html/geometry/reference/concepts/concept_box.html" target="_top">Box</a> <span class="identifier">box_region</span><span class="special">(...);</span>
|
||||
<span class="identifier">BOOST_FOREACH</span><span class="special">(</span>Value <span class="special">&</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">rt</span> <span class="special">|</span> <span class="identifier">index</span><span class="special">::</span><span class="identifier">adaptors</span><span class="special">::</span><span class="identifier">queried</span><span class="special">(</span><span class="identifier">box_region</span><span class="special">))</span>
|
||||
<span class="identifier">BOOST_FOREACH</span><span class="special">(</span>Value <span class="special">&</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">rt</span> <span class="special">|</span> <span class="identifier">index</span><span class="special">::</span><span class="identifier">adaptors</span><span class="special">::</span><span class="identifier">queried</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box_region</span><span class="special">)))</span>
|
||||
<span class="special">;</span> <span class="comment">// do something with v</span>
|
||||
</pre>
|
||||
</div>
|
||||
@ -113,7 +110,7 @@
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Spatial query returns <code class="computeroutput">Value</code>s 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 <a href="http://www.boost.org/libs/geometry/doc/html/index.html" target="_top">Boost.Geometry</a>
|
||||
algorithms. Examples of some basic queries may be found in tables below.
|
||||
The query region and result <code class="computeroutput"><span class="identifier">Value</span></code>s
|
||||
@ -224,12 +221,10 @@
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
To use a spatial predicate one may pass a geometry (which is a default
|
||||
case) or use one of the functions defined in <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">index</span></code>
|
||||
namespace to define it explicitly.
|
||||
To use a spatial predicate one may use one of the functions defined in
|
||||
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">index</span></code> namespace.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span> <span class="comment">// default case - intersects</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span> <span class="comment">// the same as default</span>
|
||||
<pre class="programlisting"><span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">covered_by</span><span class="special">(</span><span class="identifier">box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">disjont</span><span class="special">(</span><span class="identifier">box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">overlaps</span><span class="special">(</span><span class="identifier">box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
@ -250,10 +245,10 @@
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Nearest neighbours queries returns <code class="computeroutput">Value</code>s which are closest
|
||||
to some point in space. Additionally it is possible to pass define how
|
||||
the distance to the <code class="computeroutput"><span class="identifier">Value</span></code>
|
||||
should be calculated. The examples of some knn queries may be found in
|
||||
the table below. All queries returns 5 closest <code class="computeroutput"><span class="identifier">Values</span></code>.
|
||||
to some point in space. Additionally it is possible to define how the distance
|
||||
to the <code class="computeroutput"><span class="identifier">Value</span></code> should be
|
||||
calculated. The examples of some knn queries may be found in the table
|
||||
below. All queries return 5 closest <code class="computeroutput"><span class="identifier">Values</span></code>.
|
||||
The query point and Values are orange.
|
||||
</p>
|
||||
<p>
|
||||
@ -314,23 +309,42 @@
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="geometry_index.r_tree.queries.satisfies_predicate"></a><a class="link" href="queries.html#geometry_index.r_tree.queries.satisfies_predicate" title="Satisfies predicate">Satisfies
|
||||
predicate</a>
|
||||
<a name="geometry_index.r_tree.queries.user_defined_unary_predicate"></a><a class="link" href="queries.html#geometry_index.r_tree.queries.user_defined_unary_predicate" title="user-defined unary predicate">user-defined
|
||||
unary predicate</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
There is a unique predicate <code class="computeroutput"><span class="identifier">index</span><span class="special">::</span><span class="identifier">satisfies</span><span class="special">(...)</span></code> taking user-defined function or function
|
||||
object which checks if <code class="computeroutput">Value</code> should be returned by the query.
|
||||
It may be used to check some specific conditions for user-defined Values.
|
||||
The user may pass a <code class="computeroutput"><span class="identifier">UnaryPredicate</span></code>
|
||||
- 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 <code class="computeroutput">Value</code> should be returned by the query. To
|
||||
do it one may use <code class="computeroutput"><span class="identifier">index</span><span class="special">::</span><span class="identifier">satisfies</span><span class="special">()</span></code> function like on the example below:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">fun</span><span class="special">(</span>Value <span class="keyword">const</span><span class="special">&</span> <span class="identifier">v</span><span class="special">)</span>
|
||||
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">is_red</span><span class="special">(</span>Value <span class="keyword">const</span><span class="special">&</span> <span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">is_red</span><span class="special">();</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">struct</span> <span class="identifier">is_red_o</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Value</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span>Value <span class="keyword">const</span><span class="special">&</span> <span class="identifier">v</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">is_red</span><span class="special">();</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="comment">// ...</span>
|
||||
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box</span><span class="special">)</span> <span class="special">&&</span> <span class="identifier">index</span><span class="special">::</span><span class="identifier">satisfies</span><span class="special">(</span><span class="identifier">fun</span><span class="special">),</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box</span><span class="special">)</span> <span class="special">&&</span> <span class="identifier">index</span><span class="special">::</span><span class="identifier">satisfies</span><span class="special">(</span><span class="identifier">is_red</span><span class="special">),</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box</span><span class="special">)</span> <span class="special">&&</span> <span class="identifier">index</span><span class="special">::</span><span class="identifier">satisfies</span><span class="special">(</span><span class="identifier">is_red_o</span><span class="special">()),</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
|
||||
<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_NO_CXX11_LAMBDAS</span>
|
||||
<span class="identifier">rt</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">index</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">box</span><span class="special">)</span> <span class="special">&&</span> <span class="identifier">index</span><span class="special">::</span><span class="identifier">satisfies</span><span class="special">([](</span>Value <span class="keyword">const</span><span class="special">&</span> <span class="identifier">v</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">is_red</span><span class="special">();</span> <span class="special">}),</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section">
|
||||
@ -387,7 +401,7 @@
|
||||
<span class="comment">/* some inserting into the tree */</span>
|
||||
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">Value</span><span class="special">></span> <span class="identifier">result</span><span class="special">;</span>
|
||||
<span class="identifier">rt1</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">Box</span><span class="special">(/*...*/),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
<span class="identifier">rt1</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">Box</span><span class="special">(/*...*/)),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
<span class="identifier">RTree</span> <span class="identifier">rt2</span><span class="special">(</span><span class="identifier">result</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">result</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
|
||||
</pre>
|
||||
<p>
|
||||
@ -397,14 +411,14 @@
|
||||
query results because temporary container won't be used.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">RTree</span> <span class="identifier">rt3</span><span class="special">;</span>
|
||||
<span class="identifier">rt1</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">Box</span><span class="special">(/*...*/),</span> <span class="identifier">bgi</span><span class="special">::</span><span class="identifier">inserter</span><span class="special">(</span><span class="identifier">rt3</span><span class="special">));</span>
|
||||
<span class="identifier">rt1</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">Box</span><span class="special">(/*...*/))),</span> <span class="identifier">bgi</span><span class="special">::</span><span class="identifier">inserter</span><span class="special">(</span><span class="identifier">rt3</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">RTree</span> <span class="identifier">rt4</span><span class="special">(</span><span class="identifier">rt1</span> <span class="special">|</span> <span class="identifier">bgi</span><span class="special">::</span><span class="identifier">adaptors</span><span class="special">::</span><span class="identifier">queried</span><span class="special">(</span><span class="identifier">Box</span><span class="special">(/*...*/)));</span>
|
||||
<pre class="programlisting"><span class="identifier">RTree</span> <span class="identifier">rt4</span><span class="special">(</span><span class="identifier">rt1</span> <span class="special">|</span> <span class="identifier">bgi</span><span class="special">::</span><span class="identifier">adaptors</span><span class="special">::</span><span class="identifier">queried</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">Box</span><span class="special">(/*...*/)))));</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Examples</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="queries.html" title="Queries">
|
||||
@ -86,7 +86,7 @@
|
||||
<span class="comment">// find values intersecting some area defined by a box</span>
|
||||
<span class="identifier">box</span> <span class="identifier">query_box</span><span class="special">(</span><span class="identifier">point</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">),</span> <span class="identifier">point</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_s</span><span class="special">;</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// find 5 nearest values to a point</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_n</span><span class="special">;</span>
|
||||
@ -179,7 +179,7 @@
|
||||
<span class="comment">// find values intersecting some area defined by a box</span>
|
||||
<span class="identifier">box</span> <span class="identifier">query_box</span><span class="special">(</span><span class="identifier">point</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">),</span> <span class="identifier">point</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_s</span><span class="special">;</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// find 5 nearest values to a point</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_n</span><span class="special">;</span>
|
||||
@ -264,7 +264,7 @@
|
||||
<span class="comment">// find values intersecting some area defined by a box</span>
|
||||
<span class="identifier">box</span> <span class="identifier">query_box</span><span class="special">(</span><span class="identifier">point</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">),</span> <span class="identifier">point</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_s</span><span class="special">;</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// find 5 nearest values to a point</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_n</span><span class="special">;</span>
|
||||
@ -404,7 +404,7 @@
|
||||
<span class="comment">// find values intersecting some area defined by a box</span>
|
||||
<span class="identifier">box</span> <span class="identifier">query_box</span><span class="special">(</span><span class="identifier">point</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">),</span> <span class="identifier">point</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_s</span><span class="special">;</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// find 5 nearest values to a point</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_n</span><span class="special">;</span>
|
||||
@ -493,7 +493,7 @@
|
||||
<span class="comment">// find values intersecting some area defined by a box</span>
|
||||
<span class="identifier">box</span> <span class="identifier">query_box</span><span class="special">(</span><span class="identifier">point</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">),</span> <span class="identifier">point</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_s</span><span class="special">;</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// find 5 nearest values to a point</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_n</span><span class="special">;</span>
|
||||
@ -588,7 +588,7 @@
|
||||
<span class="comment">// find values intersecting some area defined by a box</span>
|
||||
<span class="identifier">box</span> <span class="identifier">query_box</span><span class="special">(</span><span class="identifier">point</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">),</span> <span class="identifier">point</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_s</span><span class="special">;</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
|
||||
<span class="comment">// find 5 nearest values to a point</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_n</span><span class="special">;</span>
|
||||
@ -699,7 +699,7 @@
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Child: Querying for objects intersecting box = [(45, 45)(55, 55)]\n"</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">B</span><span class="special">></span> <span class="identifier">result</span><span class="special">;</span>
|
||||
<span class="keyword">unsigned</span> <span class="identifier">k</span> <span class="special">=</span> <span class="identifier">tree</span><span class="special">-></span><span class="identifier">query</span><span class="special">(</span><span class="identifier">B</span><span class="special">(</span><span class="identifier">P</span><span class="special">(</span><span class="number">45</span><span class="special">,</span> <span class="number">45</span><span class="special">),</span> <span class="identifier">P</span><span class="special">(</span><span class="number">55</span><span class="special">,</span> <span class="number">55</span><span class="special">)),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
<span class="keyword">unsigned</span> <span class="identifier">k</span> <span class="special">=</span> <span class="identifier">tree</span><span class="special">-></span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">B</span><span class="special">(</span><span class="identifier">P</span><span class="special">(</span><span class="number">45</span><span class="special">,</span> <span class="number">45</span><span class="special">),</span> <span class="identifier">P</span><span class="special">(</span><span class="number">55</span><span class="special">,</span> <span class="number">55</span><span class="special">))),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</span><span class="special">));</span>
|
||||
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Child: Found objects:\n"</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">k</span> <span class="special"><<</span> <span class="string">"\n"</span><span class="special">;</span>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Quick Start</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="up" href="../r_tree.html" title="R-tree">
|
||||
<link rel="prev" href="introduction.html" title="Introduction">
|
||||
@ -116,7 +116,7 @@
|
||||
<pre class="programlisting"><span class="comment">// find values intersecting some area defined by a box</span>
|
||||
<span class="identifier">box</span> <span class="identifier">query_box</span><span class="special">(</span><span class="identifier">point</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">0</span><span class="special">),</span> <span class="identifier">point</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">result_s</span><span class="special">;</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
<span class="identifier">rtree</span><span class="special">.</span><span class="identifier">query</span><span class="special">(</span><span class="identifier">bgi</span><span class="special">::</span><span class="identifier">intersects</span><span class="special">(</span><span class="identifier">query_box</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result_s</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
@ -156,7 +156,7 @@
|
||||
</p>
|
||||
<h4>
|
||||
<a name="geometry_index.r_tree.rtree_quickstart.h0"></a>
|
||||
<span><a name="geometry_index.r_tree.rtree_quickstart.more"></a></span><a class="link" href="rtree_quickstart.html#geometry_index.r_tree.rtree_quickstart.more">More</a>
|
||||
<span class="phrase"><a name="geometry_index.r_tree.rtree_quickstart.more"></a></span><a class="link" href="rtree_quickstart.html#geometry_index.r_tree.rtree_quickstart.more">More</a>
|
||||
</h4>
|
||||
<p>
|
||||
More information about the R-tree implementation, other algorithms and queries
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Chapter 1. Geometry Index</title>
|
||||
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Geometry Index">
|
||||
<link rel="next" href="geometry_index/introduction.html" title="Introduction">
|
||||
</head>
|
||||
@ -51,7 +51,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: March 01, 2013 at 02:58:06 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: March 01, 2013 at 18:11:11 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -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 <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
|
||||
|
||||
[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<Value> 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]
|
||||
|
||||
|
@ -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<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";
|
||||
|
@ -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<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;
|
||||
|
@ -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<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;
|
||||
|
@ -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<value> 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
|
||||
|
@ -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<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;
|
||||
|
@ -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<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;
|
||||
|
@ -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<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;
|
||||
|
@ -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;
|
||||
|
@ -20,8 +20,7 @@ namespace boost { namespace geometry { namespace index { namespace detail {
|
||||
// predicates
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
// not needed?
|
||||
struct empty {};
|
||||
//struct empty {};
|
||||
|
||||
template <typename Fun>
|
||||
struct satisfies
|
||||
@ -125,43 +124,102 @@ struct nearest
|
||||
unsigned count;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// is_predicate
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
//template <typename P> struct is_predicate { static const bool value = false; };
|
||||
////template <> struct is_predicate< empty > { static const bool value = true; };
|
||||
//template <typename UP> struct is_predicate< satisfies<UP> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< covered_by<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< disjoint<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< intersects<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< overlaps<G> > { static const bool value = true; };
|
||||
////template <typename G> struct is_predicate< touches<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< within<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< not_covered_by<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< not_disjoint<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< not_intersects<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< not_overlaps<G> > { static const bool value = true; };
|
||||
////template <typename G> struct is_predicate< not_touches<G> > { static const bool value = true; };
|
||||
//template <typename G> struct is_predicate< not_within<G> > { static const bool value = true; };
|
||||
//template <typename P> struct is_predicate< nearest<P> > { static const bool value = true; };
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicate_check_default
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
//template <typename GeometryOrUnary, typename GeometryTag, typename Tag>
|
||||
//struct predicate_check_default
|
||||
//{
|
||||
// BOOST_MPL_ASSERT_MSG(
|
||||
// (false),
|
||||
// NOT_IMPLEMENTED_FOR_THESE_TAGS,
|
||||
// (predicate_check_default));
|
||||
//};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicate_check
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename Geometry, typename Tag>
|
||||
template <typename Predicate, typename Tag>
|
||||
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 <typename Geometry, typename GeometryTag>
|
||||
//struct predicate_check_default<Geometry, GeometryTag, value_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
// {
|
||||
// return geometry::intersects(i, g);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//template <typename Unary>
|
||||
//struct predicate_check_default<Unary, void, value_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(Unary const& u, Value const& v, Indexable const&)
|
||||
// {
|
||||
// return u(v);
|
||||
// }
|
||||
//};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicate_check for value
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<Geometry, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, g);
|
||||
}
|
||||
};
|
||||
//template <typename GeometryOrUnary>
|
||||
//struct predicate_check<GeometryOrUnary, value_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(GeometryOrUnary const& g, Value const& v, Indexable const& i)
|
||||
// {
|
||||
// return predicate_check_default<
|
||||
// GeometryOrUnary, typename geometry::traits::tag<GeometryOrUnary>::type, bounds_tag
|
||||
// >::apply(g, v, i);
|
||||
// }
|
||||
//};
|
||||
|
||||
// not needed?
|
||||
template <>
|
||||
struct predicate_check<empty, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(empty const&, Value const&, Indexable const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
//template <>
|
||||
//struct predicate_check<empty, value_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(empty const&, Value const&, Indexable const&)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Fun>
|
||||
struct predicate_check<satisfies<Fun>, value_tag>
|
||||
@ -304,28 +362,54 @@ struct predicate_check<nearest<DistancePredicates>, value_tag>
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicates_chec for envelope
|
||||
// predicate_check_default for bounds
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<Geometry, bounds_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
{
|
||||
return geometry::intersects(i, g);
|
||||
}
|
||||
};
|
||||
//template <typename Geometry, typename GeometryTag>
|
||||
//struct predicate_check_default<Geometry, GeometryTag, bounds_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(Geometry const& g, Value const&, Indexable const& i)
|
||||
// {
|
||||
// return geometry::intersects(i, g);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//template <typename Unary>
|
||||
//struct predicate_check_default<Unary, void, bounds_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(Unary const&, Value const&, Indexable const&)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//};
|
||||
|
||||
template <>
|
||||
struct predicate_check<empty, bounds_tag>
|
||||
{
|
||||
template <typename Geometry, typename Value, typename Indexable>
|
||||
static inline bool apply(Geometry const&, Value const&, Indexable const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// ------------------------------------------------------------------ //
|
||||
// predicates_chec for bounds
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
//template <typename GeometryOrUnary>
|
||||
//struct predicate_check<GeometryOrUnary, bounds_tag>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(GeometryOrUnary const& g, Value const& v, Indexable const& i)
|
||||
// {
|
||||
// return predicate_check_default<
|
||||
// GeometryOrUnary, typename geometry::traits::tag<GeometryOrUnary>::type, bounds_tag
|
||||
// >::apply(g, v, i);
|
||||
// }
|
||||
//};
|
||||
|
||||
//template <>
|
||||
//struct predicate_check<empty, bounds_tag>
|
||||
//{
|
||||
// template <typename Geometry, typename Value, typename Indexable>
|
||||
// static inline bool apply(Geometry const&, Value const&, Indexable const&)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename Fun>
|
||||
struct predicate_check<satisfies<Fun>, bounds_tag>
|
||||
@ -481,17 +565,17 @@ struct predicates_length
|
||||
static const unsigned value = 1;
|
||||
};
|
||||
|
||||
template <typename F, typename S>
|
||||
struct predicates_length< std::pair<F, S> >
|
||||
{
|
||||
static const unsigned value = 2;
|
||||
};
|
||||
//template <typename F, typename S>
|
||||
//struct predicates_length< std::pair<F, S> >
|
||||
//{
|
||||
// static const unsigned value = 2;
|
||||
//};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct predicates_length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
{
|
||||
static const unsigned value = boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value;
|
||||
};
|
||||
//template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
//struct predicates_length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
//{
|
||||
// static const unsigned value = boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value;
|
||||
//};
|
||||
|
||||
template <typename Head, typename Tail>
|
||||
struct predicates_length< boost::tuples::cons<Head, Tail> >
|
||||
@ -511,30 +595,30 @@ struct predicates_element
|
||||
static type const& get(T const& p) { return p; }
|
||||
};
|
||||
|
||||
template <unsigned I, typename F, typename S>
|
||||
struct predicates_element< I, std::pair<F, S> >
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG((I < 2), INVALID_INDEX, (predicates_element));
|
||||
|
||||
typedef F type;
|
||||
static type const& get(std::pair<F, S> const& p) { return p.first; }
|
||||
};
|
||||
|
||||
template <typename F, typename S>
|
||||
struct predicates_element< 1, std::pair<F, S> >
|
||||
{
|
||||
typedef S type;
|
||||
static type const& get(std::pair<F, S> const& p) { return p.second; }
|
||||
};
|
||||
|
||||
template <unsigned I, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct predicates_element< I, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
{
|
||||
typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicate_type;
|
||||
|
||||
typedef typename boost::tuples::element<I, predicate_type>::type type;
|
||||
static type const& get(predicate_type const& p) { return boost::get<I>(p); }
|
||||
};
|
||||
//template <unsigned I, typename F, typename S>
|
||||
//struct predicates_element< I, std::pair<F, S> >
|
||||
//{
|
||||
// BOOST_MPL_ASSERT_MSG((I < 2), INVALID_INDEX, (predicates_element));
|
||||
//
|
||||
// typedef F type;
|
||||
// static type const& get(std::pair<F, S> const& p) { return p.first; }
|
||||
//};
|
||||
//
|
||||
//template <typename F, typename S>
|
||||
//struct predicates_element< 1, std::pair<F, S> >
|
||||
//{
|
||||
// typedef S type;
|
||||
// static type const& get(std::pair<F, S> const& p) { return p.second; }
|
||||
//};
|
||||
//
|
||||
//template <unsigned I, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
//struct predicates_element< I, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
//{
|
||||
// typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicate_type;
|
||||
//
|
||||
// typedef typename boost::tuples::element<I, predicate_type>::type type;
|
||||
// static type const& get(predicate_type const& p) { return boost::get<I>(p); }
|
||||
//};
|
||||
|
||||
template <unsigned I, typename Head, typename Tail>
|
||||
struct predicates_element< I, boost::tuples::cons<Head, Tail> >
|
||||
@ -549,49 +633,49 @@ struct predicates_element< I, boost::tuples::cons<Head, Tail> >
|
||||
// predicates_check
|
||||
// ------------------------------------------------------------------ //
|
||||
|
||||
template <typename PairPredicates, typename Tag, unsigned First, unsigned Last>
|
||||
struct predicates_check_pair {};
|
||||
|
||||
template <typename PairPredicates, typename Tag, unsigned I>
|
||||
struct predicates_check_pair<PairPredicates, Tag, I, I>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(PairPredicates const& , Value const& , Indexable const& )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PairPredicates, typename Tag>
|
||||
struct predicates_check_pair<PairPredicates, Tag, 0, 1>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<typename PairPredicates::first_type, Tag>::apply(p.first, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PairPredicates, typename Tag>
|
||||
struct predicates_check_pair<PairPredicates, Tag, 1, 2>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<typename PairPredicates::second_type, Tag>::apply(p.second, v, i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PairPredicates, typename Tag>
|
||||
struct predicates_check_pair<PairPredicates, Tag, 0, 2>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<typename PairPredicates::first_type, Tag>::apply(p.first, v, i)
|
||||
&& predicate_check<typename PairPredicates::second_type, Tag>::apply(p.second, v, i);
|
||||
}
|
||||
};
|
||||
//template <typename PairPredicates, typename Tag, unsigned First, unsigned Last>
|
||||
//struct predicates_check_pair {};
|
||||
//
|
||||
//template <typename PairPredicates, typename Tag, unsigned I>
|
||||
//struct predicates_check_pair<PairPredicates, Tag, I, I>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(PairPredicates const& , Value const& , Indexable const& )
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//template <typename PairPredicates, typename Tag>
|
||||
//struct predicates_check_pair<PairPredicates, Tag, 0, 1>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
|
||||
// {
|
||||
// return predicate_check<typename PairPredicates::first_type, Tag>::apply(p.first, v, i);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//template <typename PairPredicates, typename Tag>
|
||||
//struct predicates_check_pair<PairPredicates, Tag, 1, 2>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
|
||||
// {
|
||||
// return predicate_check<typename PairPredicates::second_type, Tag>::apply(p.second, v, i);
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//template <typename PairPredicates, typename Tag>
|
||||
//struct predicates_check_pair<PairPredicates, Tag, 0, 2>
|
||||
//{
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
|
||||
// {
|
||||
// return predicate_check<typename PairPredicates::first_type, Tag>::apply(p.first, v, i)
|
||||
// && predicate_check<typename PairPredicates::second_type, Tag>::apply(p.second, v, i);
|
||||
// }
|
||||
//};
|
||||
|
||||
template <typename TuplePredicates, typename Tag, unsigned First, unsigned Last>
|
||||
struct predicates_check_tuple
|
||||
@ -630,43 +714,43 @@ struct predicates_check_impl
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Predicate1, typename Predicate2, typename Tag, size_t First, size_t Last>
|
||||
struct predicates_check_impl<std::pair<Predicate1, Predicate2>, Tag, First, Last>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG((First < 2 && Last <= 2 && First <= Last), INVALID_INDEXES, (predicates_check_impl));
|
||||
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(std::pair<Predicate1, Predicate2> const& p, Value const& v, Indexable const& i)
|
||||
{
|
||||
return predicate_check<Predicate1, Tag>::apply(p.first, v, i)
|
||||
&& predicate_check<Predicate2, Tag>::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<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
Tag, First, Last
|
||||
>
|
||||
{
|
||||
typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicates_type;
|
||||
|
||||
static const unsigned pred_len = boost::tuples::length<predicates_type>::value;
|
||||
BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl));
|
||||
|
||||
template <typename Value, typename Indexable>
|
||||
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 <typename Predicate1, typename Predicate2, typename Tag, size_t First, size_t Last>
|
||||
//struct predicates_check_impl<std::pair<Predicate1, Predicate2>, Tag, First, Last>
|
||||
//{
|
||||
// BOOST_MPL_ASSERT_MSG((First < 2 && Last <= 2 && First <= Last), INVALID_INDEXES, (predicates_check_impl));
|
||||
//
|
||||
// template <typename Value, typename Indexable>
|
||||
// static inline bool apply(std::pair<Predicate1, Predicate2> const& p, Value const& v, Indexable const& i)
|
||||
// {
|
||||
// return predicate_check<Predicate1, Tag>::apply(p.first, v, i)
|
||||
// && predicate_check<Predicate2, Tag>::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<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
// Tag, First, Last
|
||||
//>
|
||||
//{
|
||||
// typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicates_type;
|
||||
//
|
||||
// static const unsigned pred_len = boost::tuples::length<predicates_type>::value;
|
||||
// BOOST_MPL_ASSERT_MSG((First < pred_len && Last <= pred_len && First <= Last), INVALID_INDEXES, (predicates_check_impl));
|
||||
//
|
||||
// template <typename Value, typename Indexable>
|
||||
// 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 <typename Head, typename Tail, typename Tag, unsigned First, unsigned Last>
|
||||
struct predicates_check_impl<
|
||||
@ -722,12 +806,12 @@ struct predicates_count_nearest
|
||||
static const unsigned value = predicates_is_nearest<T>::value;
|
||||
};
|
||||
|
||||
template <typename F, typename S>
|
||||
struct predicates_count_nearest< std::pair<F, S> >
|
||||
{
|
||||
static const unsigned value = predicates_is_nearest<F>::value
|
||||
+ predicates_is_nearest<S>::value;
|
||||
};
|
||||
//template <typename F, typename S>
|
||||
//struct predicates_count_nearest< std::pair<F, S> >
|
||||
//{
|
||||
// static const unsigned value = predicates_is_nearest<F>::value
|
||||
// + predicates_is_nearest<S>::value;
|
||||
//};
|
||||
|
||||
template <typename Tuple, unsigned N>
|
||||
struct predicates_count_nearest_tuple
|
||||
@ -744,14 +828,14 @@ struct predicates_count_nearest_tuple<Tuple, 1>
|
||||
predicates_is_nearest<typename boost::tuples::element<0, Tuple>::type>::value;
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct predicates_count_nearest< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
{
|
||||
static const unsigned value = predicates_count_nearest_tuple<
|
||||
boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value
|
||||
>::value;
|
||||
};
|
||||
//template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
//struct predicates_count_nearest< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
//{
|
||||
// static const unsigned value = predicates_count_nearest_tuple<
|
||||
// boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
// boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value
|
||||
// >::value;
|
||||
//};
|
||||
|
||||
template <typename Head, typename Tail>
|
||||
struct predicates_count_nearest< boost::tuples::cons<Head, Tail> >
|
||||
@ -770,12 +854,12 @@ struct predicates_find_nearest
|
||||
static const unsigned value = predicates_is_nearest<T>::value ? 0 : 1;
|
||||
};
|
||||
|
||||
template <typename F, typename S>
|
||||
struct predicates_find_nearest< std::pair<F, S> >
|
||||
{
|
||||
static const unsigned value = predicates_is_nearest<F>::value ? 0 :
|
||||
(predicates_is_nearest<S>::value ? 1 : 2);
|
||||
};
|
||||
//template <typename F, typename S>
|
||||
//struct predicates_find_nearest< std::pair<F, S> >
|
||||
//{
|
||||
// static const unsigned value = predicates_is_nearest<F>::value ? 0 :
|
||||
// (predicates_is_nearest<S>::value ? 1 : 2);
|
||||
//};
|
||||
|
||||
template <typename Tuple, unsigned N>
|
||||
struct predicates_find_nearest_tuple
|
||||
@ -796,14 +880,14 @@ struct predicates_find_nearest_tuple<Tuple, 1>
|
||||
static const unsigned value = is_found ? 0 : boost::tuples::length<Tuple>::value;
|
||||
};
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct predicates_find_nearest< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
{
|
||||
static const unsigned value = predicates_find_nearest_tuple<
|
||||
boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value
|
||||
>::value;
|
||||
};
|
||||
//template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
//struct predicates_find_nearest< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
//{
|
||||
// static const unsigned value = predicates_find_nearest_tuple<
|
||||
// boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
|
||||
// boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value
|
||||
// >::value;
|
||||
//};
|
||||
|
||||
template <typename Head, typename Tail>
|
||||
struct predicates_find_nearest< boost::tuples::cons<Head, Tail> >
|
||||
|
@ -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 <typename Value, typename Translator, typename Point>
|
||||
struct nearest_query_result_one
|
||||
{
|
||||
public:
|
||||
typedef typename geometry::default_distance_result<
|
||||
Point,
|
||||
typename translator::indexable_type<Translator>::type
|
||||
>::type distance_type;
|
||||
|
||||
inline nearest_query_result_one(Value & value)
|
||||
: m_value(value)
|
||||
, m_comp_dist((std::numeric_limits<distance_type>::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<distance_type>::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 <typename Value, typename Translator, typename Point>
|
||||
//struct nearest_query_result_one
|
||||
//{
|
||||
//public:
|
||||
// typedef typename geometry::default_distance_result<
|
||||
// Point,
|
||||
// typename translator::indexable_type<Translator>::type
|
||||
// >::type distance_type;
|
||||
//
|
||||
// inline nearest_query_result_one(Value & value)
|
||||
// : m_value(value)
|
||||
// , m_comp_dist((std::numeric_limits<distance_type>::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<distance_type>::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 <typename Value, typename Translator, typename Point, typename OutIt>
|
||||
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;
|
||||
};
|
||||
|
@ -66,7 +66,9 @@ struct spatial_query
|
||||
}
|
||||
|
||||
Translator const& tr;
|
||||
Predicates const& pred;
|
||||
|
||||
Predicates pred;
|
||||
|
||||
OutIter out_iter;
|
||||
size_t found_count;
|
||||
};
|
||||
|
@ -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 <typename Value> 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<is_predicate<Pred1>::value, Pred1, Pred1 const&>::type stored1;
|
||||
typedef typename boost::mpl::if_c<is_predicate<Pred2>::value, Pred2, Pred2 const&>::type stored2;*/
|
||||
namespace bt = boost::tuples;
|
||||
|
||||
return
|
||||
boost::tuples::cons<
|
||||
Pred1,
|
||||
boost::tuples::cons<Pred2, boost::tuples::null_type>
|
||||
>(
|
||||
p1,
|
||||
boost::tuples::cons<Pred2, boost::tuples::null_type>(p2, boost::tuples::null_type())
|
||||
);
|
||||
bt::cons< Pred1, bt::cons<Pred2, bt::null_type> >
|
||||
( p1, bt::cons<Pred2, bt::null_type>(p2, bt::null_type()) );
|
||||
}
|
||||
|
||||
template <typename Head, typename Tail, typename Pred> inline
|
||||
@ -343,12 +357,12 @@ typename tuples::push_back_impl<
|
||||
>::type
|
||||
operator&&(boost::tuples::cons<Head, Tail> const& t, Pred const& p)
|
||||
{
|
||||
//typedef typename boost::mpl::if_c<is_predicate<Pred>::value, Pred, Pred const&>::type stored;
|
||||
namespace bt = boost::tuples;
|
||||
|
||||
return
|
||||
tuples::push_back_impl<
|
||||
boost::tuples::cons<Head, Tail>,
|
||||
Pred,
|
||||
0,
|
||||
boost::tuples::length<boost::tuples::cons<Head, Tail> >::value
|
||||
bt::cons<Head, Tail>, Pred, 0, bt::length< bt::cons<Head, Tail> >::value
|
||||
>::apply(t, p);
|
||||
}
|
||||
|
||||
|
@ -596,11 +596,10 @@ public:
|
||||
|
||||
<b>Spatial predicates</b>
|
||||
|
||||
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 <tt>! boost::geometry::index::overlaps()</tt>,
|
||||
\li <tt>! boost::geometry::index::within()</tt>
|
||||
|
||||
<b>Value predicate</b>
|
||||
<b>Satisfies predicate</b>
|
||||
|
||||
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().
|
||||
|
||||
<b>Nearest predicate</b>
|
||||
|
||||
@ -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.
|
||||
|
||||
<b>Spatial predicates</b>
|
||||
|
||||
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 <tt>! boost::geometry::index::overlaps()</tt>,
|
||||
\li <tt>! boost::geometry::index::within()</tt>
|
||||
|
||||
<b>Value predicate</b>
|
||||
|
||||
This is a special kind of predicate which allows to pass a user-defined functor which checks
|
||||
<b>Satisfies predicate</b>
|
||||
|
||||
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().
|
||||
|
||||
<b>Nearest predicate</b>
|
||||
|
||||
@ -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
|
||||
|
@ -574,7 +574,7 @@ void test_intersects(Rtree const& tree, std::vector<Value> 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<Value> 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<Value> 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<Value> 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 <typename Rtree, typename Value, typename Box>
|
||||
void test_create_insert(Rtree & tree, std::vector<Value> const& input, Box const& qbox)
|
||||
{
|
||||
std::vector<Value> 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<Value> const& input, Box const
|
||||
t.insert(v);
|
||||
BOOST_CHECK(tree.size() == t.size());
|
||||
std::vector<Value> 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<Value> const& input, Box const
|
||||
std::copy(input.begin(), input.end(), bgi::inserter(t));
|
||||
BOOST_CHECK(tree.size() == t.size());
|
||||
std::vector<Value> 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<Value> 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<Value> 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<Value> const& input, Box const
|
||||
t.insert(input.begin(), input.end());
|
||||
BOOST_CHECK(tree.size() == t.size());
|
||||
std::vector<Value> 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<Value> const& input, Box const
|
||||
t.insert(input);
|
||||
BOOST_CHECK(tree.size() == t.size());
|
||||
std::vector<Value> 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<Value> const& input, Box const
|
||||
bgi::insert(t, v);
|
||||
BOOST_CHECK(tree.size() == t.size());
|
||||
std::vector<Value> 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<Value> const& input, Box const
|
||||
bgi::insert(t, input.begin(), input.end());
|
||||
BOOST_CHECK(tree.size() == t.size());
|
||||
std::vector<Value> 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<Value> const& input, Box const
|
||||
bgi::insert(t, input);
|
||||
BOOST_CHECK(tree.size() == t.size());
|
||||
std::vector<Value> 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<Value> 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<Value> expected_output;
|
||||
@ -1107,7 +1107,7 @@ template <typename Rtree, typename Value, typename Box>
|
||||
void test_clear(Rtree & tree, std::vector<Value> const& input, Box const& qbox)
|
||||
{
|
||||
std::vector<Value> 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<Value> 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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user