mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
Predicates and DistancePredicates are stored by value in visitors. Each predicate is stored by value in expression tuple. Examples and docs updated. [SVN r83232]
263 lines
9.0 KiB
Plaintext
263 lines
9.0 KiB
Plaintext
[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically]
|
|
[/ Generated from xml/group__predicates.xml]
|
|
[section:group__predicates Predicates (boost::geometry::index::)]
|
|
[heading Functions]
|
|
[table
|
|
[[Function][Description]]
|
|
[[[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 `covered_by(Geometry const &)`]][Generate [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 covered_by()]] predicate. ]]
|
|
[[[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d `disjoint(Geometry const &)`]][Generate [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d disjoint()]] predicate. ]]
|
|
[[[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 `intersects(Geometry const &)`]][Generate [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 intersects()]] predicate. ]]
|
|
[[[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 `overlaps(Geometry const &)`]][Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate. ]]
|
|
[[[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d `within(Geometry const &)`]][Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate. ]]
|
|
[[[link group__predicates_1gae7e9291c5b99041fb155d29de0860bab `satisfies(UnaryPredicate const &)`]][Generate [link group__predicates_1gae7e9291c5b99041fb155d29de0860bab satisfies()] predicate. ]]
|
|
[[[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 `nearest(PointOrRelation const &, unsigned)`]][Generate [link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()] predicate. ]]
|
|
]
|
|
|
|
[#group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61]
|
|
[section covered_by(Geometry const &)]
|
|
Generate [^[link group__predicates_1ga0a613a7f1d18ac33955bfdc2c5777c61 covered_by()]] predicate.
|
|
|
|
[heading Description]
|
|
Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::covered_by(Indexable, Geometry)`] returns true.[heading Synopsis]
|
|
[pre
|
|
`template<``typename Geometry``>`
|
|
`detail::covered_by<Geometry> boost::geometry::index::covered_by``(``Geometry const &` `g``)`
|
|
]
|
|
|
|
[heading Template parameter(s)]
|
|
[table
|
|
[[Parameter] [Description]]
|
|
[[`Geometry`][The Geometry type.]]
|
|
]
|
|
|
|
[heading Parameter(s)]
|
|
[table
|
|
[[Type][Name][Description]]
|
|
[[`Geometry const &`][ `g` ][The Geometry object. ]]
|
|
]
|
|
[heading Example]
|
|
|
|
``
|
|
bgi::query(spatial_index, bgi::covered_by(box), std::back_inserter(result));
|
|
``
|
|
|
|
|
|
[endsect]
|
|
|
|
[#group__predicates_1ga351bb3b82e019ff45adf789385b8007d]
|
|
[section disjoint(Geometry const &)]
|
|
Generate [^[link group__predicates_1ga351bb3b82e019ff45adf789385b8007d disjoint()]] predicate.
|
|
|
|
[heading Description]
|
|
Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::disjoint(Indexable, Geometry)`] returns true.[heading Synopsis]
|
|
[pre
|
|
`template<``typename Geometry``>`
|
|
`detail::disjoint<Geometry> boost::geometry::index::disjoint``(``Geometry const &` `g``)`
|
|
]
|
|
|
|
[heading Template parameter(s)]
|
|
[table
|
|
[[Parameter] [Description]]
|
|
[[`Geometry`][The Geometry type.]]
|
|
]
|
|
|
|
[heading Parameter(s)]
|
|
[table
|
|
[[Type][Name][Description]]
|
|
[[`Geometry const &`][ `g` ][The Geometry object. ]]
|
|
]
|
|
[heading Example]
|
|
|
|
``
|
|
bgi::query(spatial_index, bgi::disjoint(box), std::back_inserter(result));
|
|
``
|
|
|
|
|
|
[endsect]
|
|
|
|
[#group__predicates_1ga7301c50e0272976b9f1434536383e6d0]
|
|
[section intersects(Geometry const &)]
|
|
Generate [^[link group__predicates_1ga7301c50e0272976b9f1434536383e6d0 intersects()]] predicate.
|
|
|
|
[heading Description]
|
|
Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::intersects(Indexable, Geometry)`] returns true.[heading Synopsis]
|
|
[pre
|
|
`template<``typename Geometry``>`
|
|
`detail::intersects<Geometry> boost::geometry::index::intersects``(``Geometry const &` `g``)`
|
|
]
|
|
|
|
[heading Template parameter(s)]
|
|
[table
|
|
[[Parameter] [Description]]
|
|
[[`Geometry`][The Geometry type.]]
|
|
]
|
|
|
|
[heading Parameter(s)]
|
|
[table
|
|
[[Type][Name][Description]]
|
|
[[`Geometry const &`][ `g` ][The Geometry object. ]]
|
|
]
|
|
[heading Example]
|
|
|
|
``
|
|
bgi::query(spatial_index, bgi::intersects(box), std::back_inserter(result));
|
|
bgi::query(spatial_index, bgi::intersects(ring), std::back_inserter(result));
|
|
bgi::query(spatial_index, bgi::intersects(polygon), std::back_inserter(result));
|
|
``
|
|
|
|
|
|
[endsect]
|
|
|
|
[#group__predicates_1ga5511236f56be1defcccbf11e742ccd88]
|
|
[section overlaps(Geometry const &)]
|
|
Generate [^[link group__predicates_1ga5511236f56be1defcccbf11e742ccd88 overlaps()]] predicate.
|
|
|
|
[heading Description]
|
|
Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::overlaps(Indexable, Geometry)`] returns true.[heading Synopsis]
|
|
[pre
|
|
`template<``typename Geometry``>`
|
|
`detail::overlaps<Geometry> boost::geometry::index::overlaps``(``Geometry const &` `g``)`
|
|
]
|
|
|
|
[heading Template parameter(s)]
|
|
[table
|
|
[[Parameter] [Description]]
|
|
[[`Geometry`][The Geometry type.]]
|
|
]
|
|
|
|
[heading Parameter(s)]
|
|
[table
|
|
[[Type][Name][Description]]
|
|
[[`Geometry const &`][ `g` ][The Geometry object. ]]
|
|
]
|
|
[heading Example]
|
|
|
|
``
|
|
bgi::query(spatial_index, bgi::overlaps(box), std::back_inserter(result));
|
|
``
|
|
|
|
|
|
[endsect]
|
|
|
|
[#group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d]
|
|
[section within(Geometry const &)]
|
|
Generate [^[link group__predicates_1gabf9c4e76dd8a09a4c476f2f8fa8a0e4d within()]] predicate.
|
|
|
|
[heading Description]
|
|
Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if [^`bg::within(Indexable, Geometry)`] returns true.[heading Synopsis]
|
|
[pre
|
|
`template<``typename Geometry``>`
|
|
`detail::within<Geometry> boost::geometry::index::within``(``Geometry const &` `g``)`
|
|
]
|
|
|
|
[heading Template parameter(s)]
|
|
[table
|
|
[[Parameter] [Description]]
|
|
[[`Geometry`][The Geometry type.]]
|
|
]
|
|
|
|
[heading Parameter(s)]
|
|
[table
|
|
[[Type][Name][Description]]
|
|
[[`Geometry const &`][ `g` ][The Geometry object. ]]
|
|
]
|
|
[heading Example]
|
|
|
|
``
|
|
bgi::query(spatial_index, bgi::within(box), std::back_inserter(result));
|
|
``
|
|
|
|
|
|
[endsect]
|
|
|
|
[#group__predicates_1gae7e9291c5b99041fb155d29de0860bab]
|
|
[section satisfies(UnaryPredicate const &)]
|
|
Generate [link group__predicates_1gae7e9291c5b99041fb155d29de0860bab satisfies()] predicate.
|
|
|
|
[heading Description]
|
|
A wrapper around user-defined UnaryPredicate checking if Value should be returned by spatial query.[heading Synopsis]
|
|
[pre
|
|
`template<``typename UnaryPredicate``>`
|
|
`detail::satisfies<UnaryPredicate> boost::geometry::index::satisfies``(``UnaryPredicate const &` `pred``)`
|
|
]
|
|
|
|
[heading Template parameter(s)]
|
|
[table
|
|
[[Parameter] [Description]]
|
|
[[`UnaryPredicate`][A type of unary predicate function or function object.]]
|
|
]
|
|
|
|
[heading Parameter(s)]
|
|
[table
|
|
[[Type][Name][Description]]
|
|
[[`UnaryPredicate const &`][ `pred` ][The unary predicate function or function object. ]]
|
|
]
|
|
[heading Example]
|
|
|
|
``
|
|
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
|
|
``
|
|
|
|
|
|
[endsect]
|
|
|
|
[#group__predicates_1gae80a2c204673a8b11c4fc137cfff6556]
|
|
[section nearest(PointOrRelation const &, unsigned)]
|
|
Generate [link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()] predicate.
|
|
|
|
[heading Description]
|
|
When nearest predicate is passed to the query, k-nearest neighbour search will be performed.
|
|
|
|
The simplest way of defining the knn query is passing a [^`Point`] to which [^`Values`] must be closest.
|
|
|
|
It is possible to define how distance between values and query Point is calculated. This is done by passing PointRelation. It can be generated by following functions:
|
|
|
|
* [^[link group__nearest__relations_1gace3c7dbc60840c2a61da36e975d56636 boost::geometry::index::to_nearest()]] - default,
|
|
* [^[link group__nearest__relations_1gaccbba95d864d8dcf8a694796c840fbe0 boost::geometry::index::to_centroid()]],
|
|
* [^[link group__nearest__relations_1ga67dddd8a7fcaae150970e1db0401de02 boost::geometry::index::to_furthest()]].
|
|
|
|
[heading Synopsis]
|
|
[pre
|
|
`template<``typename PointOrRelation``>`
|
|
`detail::nearest<PointOrRelation> boost::geometry::index::nearest``(``PointOrRelation const &` `point_relation``,` `unsigned` `k``)`
|
|
]
|
|
|
|
[heading Parameter(s)]
|
|
[table
|
|
[[Type][Name][Description]]
|
|
[[`PointOrRelation const &`][ `point_relation` ][The point or relation describing how the distance will be calculated. ]]
|
|
[[`unsigned`][ `k` ][The maximum number of values to return. ]]
|
|
]
|
|
[heading Example]
|
|
|
|
``
|
|
bgi::query(spatial_index, bgi::nearest(pt, 5), std::back_inserter(result));
|
|
bgi::query(spatial_index, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result));
|
|
bgi::query(spatial_index, bgi::nearest(bgi::to_centroid(pt), 5) && bgi::within(box), std::back_inserter(result));
|
|
``
|
|
|
|
|
|
[warning Only one [^[link group__predicates_1gae80a2c204673a8b11c4fc137cfff6556 nearest()]] predicate may be used in a query.]
|
|
|
|
[endsect]
|
|
|
|
[endsect]
|
|
|