Boost.Geometry.Index

- Main Page
- Modules
- Classes
- Files

Functions
Predicates (boost::geometry::index::)

## Functions

template<typename Geometry >
detail::predicates::spatial_predicate < Geometry, detail::predicates::contains_tag, false > | boost::geometry::index::contains (Geometry const &g)
| Generate `contains()` predicate.
template<typename Geometry >
detail::predicates::spatial_predicate < Geometry, detail::predicates::covered_by_tag, false > | boost::geometry::index::covered_by (Geometry const &g)
| Generate `covered_by()` predicate.
template<typename Geometry >
detail::predicates::spatial_predicate < Geometry, detail::predicates::covers_tag, false > | boost::geometry::index::covers (Geometry const &g)
| Generate `covers()` predicate.
template<typename Geometry >
detail::predicates::spatial_predicate < Geometry, detail::predicates::disjoint_tag, false > | boost::geometry::index::disjoint (Geometry const &g)
| Generate `disjoint()` predicate.
template<typename Geometry >
detail::predicates::spatial_predicate < Geometry, detail::predicates::intersects_tag, false > | boost::geometry::index::intersects (Geometry const &g)
| Generate `intersects()` predicate.
template<typename Geometry >
detail::predicates::spatial_predicate < Geometry, detail::predicates::overlaps_tag, false > | boost::geometry::index::overlaps (Geometry const &g)
| Generate `overlaps()` predicate.
template<typename Geometry >
detail::predicates::spatial_predicate < Geometry, detail::predicates::within_tag, false > | boost::geometry::index::within (Geometry const &g)
| Generate `within()` predicate.
template<typename UnaryPredicate >
detail::predicates::satisfies < UnaryPredicate, false > | boost::geometry::index::satisfies (UnaryPredicate const &pred)
| Generate satisfies() predicate.
template<typename Geometry >
detail::predicates::nearest < Geometry > | boost::geometry::index::nearest (Geometry const &geometry, unsigned k)
| Generate nearest() predicate.

## Function Documentation

template<typename Geometry >

detail::predicates::spatial_predicate<Geometry, detail::predicates::contains_tag, false> boost::geometry::index::contains | ( | Geometry const & | g | ) | `[inline]`

Generate `contains()` predicate.

Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if `bg::within(Geometry, Indexable)` returns true.

Example

      bgi::query(spatial_index, bgi::contains(box), std::back_inserter(result));

Template Parameters:

  Geometry | The Geometry type.

Parameters:

  g | The Geometry object.

template<typename Geometry >

detail::predicates::spatial_predicate<Geometry, detail::predicates::covered_by_tag, false> boost::geometry::index::covered_by | ( | Geometry const & | g | ) | `[inline]`

Generate `covered_by()` predicate.

Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if `bg::covered_by(Indexable, Geometry)` returns true.

Example

      bgi::query(spatial_index, bgi::covered_by(box), std::back_inserter(result));

Template Parameters:

  Geometry | The Geometry type.

Parameters:

  g | The Geometry object.

template<typename Geometry >

detail::predicates::spatial_predicate<Geometry, detail::predicates::covers_tag, false> boost::geometry::index::covers | ( | Geometry const & | g | ) | `[inline]`

Generate `covers()` predicate.

Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if `bg::covered_by(Geometry, Indexable)` returns true.

Example

      bgi::query(spatial_index, bgi::covers(box), std::back_inserter(result));

Template Parameters:

  Geometry | The Geometry type.

Parameters:

  g | The Geometry object.

template<typename Geometry >

detail::predicates::spatial_predicate<Geometry, detail::predicates::disjoint_tag, false> boost::geometry::index::disjoint | ( | Geometry const & | g | ) | `[inline]`

Generate `disjoint()` predicate.

Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if `bg::disjoint(Indexable, Geometry)` returns true.

Example

      bgi::query(spatial_index, bgi::disjoint(box), std::back_inserter(result));

Template Parameters:

  Geometry | The Geometry type.

Parameters:

  g | The Geometry object.

template<typename Geometry >

detail::predicates::spatial_predicate<Geometry, detail::predicates::intersects_tag, false> boost::geometry::index::intersects | ( | Geometry const & | g | ) | `[inline]`

Generate `intersects()` predicate.

Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if `bg::intersects(Indexable, Geometry)` returns true.

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));

Template Parameters:

  Geometry | The Geometry type.

Parameters:

  g | The Geometry object.

template<typename Geometry >

detail::predicates::nearest<Geometry> boost::geometry::index::nearest | ( | Geometry const & | geometry,
|  | unsigned | k
| ) |  | `[inline]`

Generate nearest() predicate.

When nearest predicate is passed to the query, k-nearest neighbour search will be performed. `nearest()` predicate takes a `Geometry` from which distances to `Values` are calculated and the maximum number of `Values` that should be returned. Internally boost::geometry::comparable_distance() is used to perform the calculation.

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(box, 5), std::back_inserter(result));

Warning:
  Only one `nearest()` predicate may be used in a query.

Parameters:

  geometry | The geometry from which distance is calculated.
  k | The maximum number of values to return.

template<typename Geometry >

detail::predicates::spatial_predicate<Geometry, detail::predicates::overlaps_tag, false> boost::geometry::index::overlaps | ( | Geometry const & | g | ) | `[inline]`

Generate `overlaps()` predicate.

Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if `bg::overlaps(Indexable, Geometry)` returns true.

Example

      bgi::query(spatial_index, bgi::overlaps(box), std::back_inserter(result));

Template Parameters:

  Geometry | The Geometry type.

Parameters:

  g | The Geometry object.

template<typename UnaryPredicate >

detail::predicates::satisfies<UnaryPredicate, false> boost::geometry::index::satisfies | ( | UnaryPredicate const & | pred | ) | `[inline]`

Generate satisfies() predicate.

A wrapper around user-defined UnaryPredicate checking if Value should be returned by spatial query.

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

Template Parameters:

  UnaryPredicate | A type of unary predicate function or function object.

Parameters:

  pred | The unary predicate function or function object.

template<typename Geometry >

detail::predicates::spatial_predicate<Geometry, detail::predicates::within_tag, false> boost::geometry::index::within | ( | Geometry const & | g | ) | `[inline]`

Generate `within()` predicate.

Generate a predicate defining Value and Geometry relationship. Value will be returned by the query if `bg::within(Indexable, Geometry)` returns true.

Example

      bgi::query(spatial_index, bgi::within(box), std::back_inserter(result));

Template Parameters:

  Geometry | The Geometry type.

Parameters:

  g | The Geometry object.

All Classes Functions Typedefs