Boost C++ Libraries Home Libraries People FAQ More

PrevUpHome

Reference

boost::geometry::index::rtree
Functions related to the rtree (boost::geometry::index::)
Spatial predicates (boost::geometry::index::)
Distance predicates (boost::geometry::index::)
Adaptors (boost::geometry::index::adaptors::)
Translators (boost::geometry::index::translators::)
Inserters (boost::geometry::index::)

The R-tree spatial index.

Description

The R-tree spatial index. This is self-balancing spatial index capable to store various types of Values and balancing algorithms.

The user must pass a type defining the Parameters which will be used in rtree creation process. This type is used e.g. to specify balancing algorithm with specific parameters like min and max number of elements in node. Predefined algorithms with compile-time parameters are: bgi::linear<MinElements, MaxElements>, bgi::quadratic<MinElements, MaxElements>, bgi::rstar<MinElements, MaxElements, OverlapCostThreshold = 0, ReinsertedElements = MaxElements * 0.3>. Predefined algorithms with run-time parameters are: bgi::runtime::linear, bgi::runtime::quadratic, bgi::runtime::rstar.

The Translator translates from Value to Indexable each time r-tree requires it. Which means that this operation is done for each Value access. Therefore the Translator should return the Indexable by const reference instead of a value. Default translator can translate all types adapted to Point or Box concepts (which are Indexables). It also handles std::pair<Indexable, T>, pointers, smart pointers, and iterators. E.g. If std::pair<Box, int> is stored, the default translator translates from std::pair<Box, int> const& to Box const&.

Header

#include <.hpp>

Synopsis

template<typename Value,
         typename Parameters,
         typename Translator = translator::def<Value>,
         typename Allocator = std::allocator<Value>>
class rtree
{
  // ...
};

Template parameter(s)

Parameter

Description

Value

The type of objects stored in the container.

Parameters

Compile-time parameters.

Translator

The type of the translator which translates from Value to Indexable.

Allocator

The allocator used to allocate/deallocate memory, construct/destroy nodes and Values.

Typedef(s)

Type

Description

value_type

The type of Value stored in the container.

parameters_type

R-tree parameters type.

translator_type

Value to Indexable Translator type.

allocator_type

The type of allocator used by the container.

size_type

Unsigned integral type used by the container.

indexable_type

The Indexable type to which Value is translated.

box_type

The Box type used by the R-tree.

Constructor(s) and destructor

Function

Description

rtree()

The constructor.

rtree(parameters_type, translator_type const &, allocator_type)

The constructor.

rtree(Iterator, Iterator)

The constructor.

rtree(Range const &)

The constructor.

~rtree()

The destructor.

rtree(rtree const &)

The copy constructor.

rtree(rtree const &, allocator_type const &)

The copy constructor.

rtree(rtree &&)

The moving constructor.

Member(s)

Function

Description

operator=(const rtree &)

The assignment operator.

operator=(rtree &&)

The moving assignment.

swap(rtree &)

Swaps contents of two rtrees.

insert(value_type const &)

Insert a value to the index.

insert(Iterator, Iterator)

Insert a range of values to the index.

insert(Range const &)

Insert a range of values to the index.

remove(value_type const &)

Remove a value from the container.

remove(Iterator, Iterator)

Remove a range of values from the container.

remove(Range const &)

Remove a range of values from the container.

spatial_query(Predicates const &, OutIter)

Finds values meeting spatial predicates, e.g. intersecting some Box.

nearest_query(DistancesPredicates const &, value_type &)

Finds one value meeting distances predicates, e.g. nearest to some Point.

nearest_query(DistancesPredicates const &, Predicates const &, value_type &)

Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box.

nearest_query(DistancesPredicates const &, size_t, OutIter)

Finds k values meeting distances predicates, e.g. k nearest values to some Point.

nearest_query(DistancesPredicates const &, size_t, Predicates const &, OutIter)

Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box.

size()

Returns the number of stored values.

empty()

Query if the container is empty.

clear()

Removes all values stored in the container.

box()

Returns the box containing all values stored in the container.

count(ValueOrIndexable const &)

Count Values or Indexables stored in the container.

parameters()

Returns parameters.

translator()

Returns the translator object.

get_allocator()

Returns allocator used by the rtree.


The constructor.

Synopsis

rtree(parameters_type parameters = parameters_type(), translator_type const & translator = translator_type())

Parameters

Type

Name

Description

parameters_type

parameters

The parameters object.

translator_type const &

translator

The translator object.

Throws

If allocator default constructor throws.


The constructor.

Synopsis

rtree(parameters_type parameters,
      translator_type const & translator,
      allocator_type allocator)

Parameters

Type

Name

Description

parameters_type

parameters

The parameters object.

translator_type const &

translator

The translator object.

allocator_type

allocator

The allocator object.

Throws

If allocator copy constructor throws.


The constructor.

Synopsis

template<typename Iterator>
rtree(Iterator first,
      Iterator last,
      parameters_type parameters = parameters_type(),
      translator_type const & translator = translator_type(),
      allocator_type allocator = allocator_type())

Parameters

Type

Name

Description

Iterator

first

The beginning of the range of Values.

Iterator

last

The end of the range of Values.

parameters_type

parameters

The parameters object.

translator_type const &

translator

The translator object.

allocator_type

allocator

The allocator object.

Throws

If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails.


The constructor.

Synopsis

template<typename Range>
rtree(Range const & rng,
      parameters_type parameters = parameters_type(),
      translator_type const & translator = translator_type(),
      allocator_type allocator = allocator_type())

Parameters

Type

Name

Description

Range const &

rng

The range of Values.

parameters_type

parameters

The parameters object.

translator_type const &

translator

The translator object.

allocator_type

allocator

The allocator object.

Throws

If allocator copy constructor throws. If Value copy constructor or copy assignment throws. When nodes allocation fails.


The destructor.

Synopsis

~rtree()

Throws

Nothing.


The copy constructor.

Description

It uses parameters, translator and allocator from the source tree.

Synopsis

rtree(rtree const & src)

Parameters

Type

Name

Description

rtree const &

src

The rtree which content will be copied.

Throws

If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails.


The copy constructor.

Description

It uses Parameters and translator from the source tree.

Synopsis

rtree(rtree const & src, allocator_type const & allocator)

Parameters

Type

Name

Description

rtree const &

src

The rtree which content will be copied.

allocator_type const &

allocator

The allocator which will be used.

Throws

If allocator copy constructor throws. If Value copy constructor throws. When nodes allocation fails.


The moving constructor.

Description

It uses parameters, translator and allocator from the source tree.

Synopsis

rtree(rtree && src)

Parameters

Type

Name

Description

rtree &&

src

The rtree which content will be moved.

Throws

If allocator move constructor throws.


The assignment operator.

Description

It uses parameters and translator from the source tree.

Synopsis

rtree & operator=(const rtree & src)

Parameters

Type

Name

Description

const rtree &

src

The rtree which content will be copied.

Throws

If Value copy constructor throws. When nodes allocation fails.


The moving assignment.

Description

It uses parameters and translator from the source tree.

Synopsis

rtree & operator=(rtree && src)

Parameters

Type

Name

Description

rtree &&

src

The rtree which content will be moved.

Throws

Only if allocators aren't equal. If Value copy constructor throws. When nodes allocation fails.


Swaps contents of two rtrees.

Description

Parameters, translator and allocators are swapped as well.

Synopsis

void swap(rtree & other)

Parameters

Type

Name

Description

rtree &

other

The rtree which content will be swapped with this rtree content.

Throws

If allocators swap throws.


Insert a value to the index.

Synopsis

void insert(value_type const & value)

Parameters

Type

Name

Description

value_type const &

value

The value which will be stored in the container.

Throws

If Value copy constructor or copy assignment throws. When nodes allocation fails.

Exception-safety

This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.


Insert a range of values to the index.

Synopsis

template<typename Iterator>
void insert(Iterator first, Iterator last)

Parameters

Type

Name

Description

Iterator

first

The beginning of the range of values.

Iterator

last

The end of the range of values.

Throws

If Value copy constructor or copy assignment throws. When nodes allocation fails.

Exception-safety

This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.


Insert a range of values to the index.

Synopsis

template<typename Range>
void insert(Range const & rng)

Parameters

Type

Name

Description

Range const &

rng

The range of values.

Throws

If Value copy constructor or copy assignment throws. When nodes allocation fails.

Exception-safety

This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.


Remove a value from the container.

Description

In contrast to the STL set/map erase() method this method removes only one value from the container.

Synopsis

size_type remove(value_type const & value)

Parameters

Type

Name

Description

value_type const &

value

The value which will be removed from the container.

Returns

1 if the value was removed, 0 otherwise.

Throws

If Value copy constructor or copy assignment throws. When nodes allocation fails.

Exception-safety

This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.


Remove a range of values from the container.

Description

In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

Synopsis

template<typename Iterator>
size_type remove(Iterator first, Iterator last)

Parameters

Type

Name

Description

Iterator

first

The beginning of the range of values.

Iterator

last

The end of the range of values.

Returns

The number of removed values.

Throws

If Value copy constructor or copy assignment throws. When nodes allocation fails.

Exception-safety

This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.


Remove a range of values from the container.

Description

In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore, this method removes only one value for each one passed in the range, not all equal values.

Synopsis

template<typename Range>
size_type remove(Range const & rng)

Parameters

Type

Name

Description

Range const &

rng

The range of values.

Returns

The number of removed values.

Throws

If Value copy constructor or copy assignment throws. When nodes allocation fails.

Exception-safety

This operation is not thread safe. If it throws, the R-tree may be left in an inconsistent state, elements must not be inserted or removed, methods may return invalid data.


Finds values meeting spatial predicates, e.g. intersecting some Box.

Description

Spatial predicates may be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

Synopsis

template<typename Predicates, typename OutIter>
size_type spatial_query(Predicates const & pred, OutIter out_it)

Parameters

Type

Name

Description

Predicates const &

pred

The spatial predicates or a Geometry.

OutIter

out_it

The output iterator of the result range. E.g. an iterator generated by std::back_inserter(container)

Returns

The number of values found.

Throws

If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws.


Finds one value meeting distances predicates, e.g. nearest to some Point.

Description

The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

Synopsis

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

Parameters

Type

Name

Description

DistancesPredicates const &

dpred

The distances predicates or a Point.

value_type &

v

The reference to the object which will contain the result.

Returns

The number of values found.

Throws

If Value copy constructor or copy assignment throws.


Finds one value meeting distances predicates and spatial predicates, e.g. nearest to some Point and intersecting some Box.

Description

The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

Synopsis

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

Parameters

Type

Name

Description

DistancesPredicates const &

dpred

The distances predicates or a Point.

Predicates const &

pred

The spatial predicates or a Geometry

value_type &

v

The reference to the object which will contain the result.

Returns

The number of values found.

Throws

If Value copy constructor or copy assignment throws.


Finds k values meeting distances predicates, e.g. k nearest values to some Point.

Description

The distances predicates. May be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

Synopsis

template<typename DistancesPredicates, typename OutIter>
size_type nearest_query(DistancesPredicates const & dpred,
                        size_t k,
                        OutIter out_it)

Parameters

Type

Name

Description

DistancesPredicates const &

dpred

The distances predicates or a Point.

size_t

k

The max number of values.

OutIter

out_it

The output iterator of the result range. E.g. a back_insert_iterator.

Returns

The number of values found.

Throws

If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws.


Finds k values meeting distances predicates and spatial predicates, e.g. k nearest values to some Point and intersecting some Box.

Description

The distances predicates may be a Point. This is default case where Value which nearest point is closest to Point is returned. May be a PointRelation which define how distance to Value is calculated. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point). DistancesPredicates may also define distances bounds. E.g. that some distance must be between min_distance and max_distance. This may be generated by bgi::unbounded(PointRelation) - default case, bgi::min_bounded(PointRelation, MinRelation), bgi::max_bounded(PointRelation, MaxRelation), bgi::bounded(PointRelation, MinRelation, MaxRelation). MinRelation and MaxRelation describes bounds and may be generated by bgi::to_nearest(dist_bound), bgi::to_centroid(dist_bound) or bgi::to_furthest(dist_bound).

The spatial predicates. May be a Geometry (in this case default predicate - intersects is used) or generated by bgi::covered_by(geometry), bgi::disjoint(geometry), bgi::intersects(geometry), bgi::overlaps(geometry), bgi::within(geometry), !bgi::covered_by(geometry), !bgi::disjoint(geometry), !bgi::intersects(geometry), !bgi::overlaps(geometry), !bgi::within(geometry) or bgi::value(func). Those predicates may be passed together in std::pair or boost::tuple.

Synopsis

template<typename DistancesPredicates,
         typename Predicates,
         typename OutIter>
size_type nearest_query(DistancesPredicates const & dpred,
                        size_t k,
                        Predicates const & pred,
                        OutIter out_it)

Parameters

Type

Name

Description

DistancesPredicates const &

dpred

The distances predicates or a Point

size_t

k

The max number of values.

Predicates const &

pred

The spatial predicates or a Geometry.

OutIter

out_it

The output iterator of the result range. E.g. a back_insert_iterator.

Returns

The number of values found.

Throws

If Value copy constructor or copy assignment throws. If OutIter dereference or increment throws.


Returns the number of stored values.

Synopsis

size_type size()

Returns

The number of stored values.

Throws

Nothing.


Query if the container is empty.

Synopsis

bool empty()

Returns

true if the container is empty.

Throws

Nothing.


Removes all values stored in the container.

Synopsis

void clear()

Throws

Nothing.


Returns the box containing all values stored in the container.

Description

Returns the box containing all values stored in the container. If the container is empty the result of geometry::assign_inverse() is returned.

Synopsis

box_type box()

Returns

The box containing all values stored in the container or an invalid box if there are no values in the container.

Throws

Nothing.


Count Values or Indexables stored in the container.

Description

For indexable_type it returns the number of values which indexables equals the parameter. For value_type it returns the number of values which equals the parameter.

Synopsis

template<typename ValueOrIndexable>
size_type count(ValueOrIndexable const & vori)

Parameters

Type

Name

Description

ValueOrIndexable const &

vori

The value or indexable which will be counted.

Returns

The number of values found.

Throws

Nothing.


Returns parameters.

Synopsis

parameters_type const & parameters()

Returns

The parameters object.

Throws

Nothing.


Returns the translator object.

Synopsis

translator_type const & translator()

Returns

The translator object.

Throws

Nothing.


Returns allocator used by the rtree.

Synopsis

allocator_type get_allocator()

Returns

The allocator.

Throws

If allocator copy constructor throws.


Function

Description

insert(rtree<...> &, Value const &)

Insert a value to the index.

insert(rtree<...> &, Iterator, Iterator)

Insert a range of values to the index.

insert(rtree<...> &, Range const &)

Insert a range of values to the index.

remove(rtree<...> &, Value const &)

Remove a value from the container.

remove(rtree<...> &, Iterator, Iterator)

Remove a range of values from the container.

remove(rtree<...> &, Range const &)

Remove a range of values from the container.

spatial_query(rtree<...> const &, Predicates const &, OutIter)

Find values meeting spatial predicates.

nearest_query(rtree<...> const &, DistancesPredicates const &, Value &)

Find the value meeting distances predicates.

nearest_query(rtree<...> const &, DistancesPredicates const &, Predicates const &, Value &)

Find the value meeting distances and spatial predicates.

nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, OutIter)

Find k values meeting distances predicates.

nearest_query(rtree<...> const &, DistancesPredicates const &, size_t, Predicates const &, OutIter)

Find k values meeting distances and spatial predicates.

clear(rtree<...> &)

Remove all values from the index.

size(rtree<...> const &)

Get the number of values stored in the index.

empty(rtree<...> const &)

Query if there are no values stored in the index.

box(rtree<...> const &)

Get the box containing all stored values or an invalid box if the index has no values.

Insert a value to the index.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator>
void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > &

tree

The spatial index.

Value const &

v

The value which will be stored in the index.


Insert a range of values to the index.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename Iterator>
void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree,
                                    Iterator first,
                                    Iterator last)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > &

tree

The spatial index.

Iterator

first

The beginning of the range of values.

Iterator

last

The end of the range of values.


Insert a range of values to the index.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename Range>
void boost::geometry::index::insert(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > &

tree

The spatial index.

Range const &

rng

The range of values.


Remove a value from the container.

Description

Remove a value from the container. In contrast to the STL set/map erase() method this function removes only one value from the container.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator>
rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Value const & v)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > &

tree

The spatial index.

Value const &

v

The value which will be removed from the index.

Returns

1 if value was removed, 0 otherwise.


Remove a range of values from the container.

Description

Remove a range of values from the container. In contrast to the STL set/map erase() method it doesn't take iterators pointing to values stored in this container. It removes values equal to these passed as a range. Furthermore this function removes only one value for each one passed in the range, not all equal values.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename Iterator>
rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree,
                                                                                       Iterator first,
                                                                                       Iterator last)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > &

tree

The spatial index.

Iterator

first

The beginning of the range of values.

Iterator

last

The end of the range of values.

Returns

The number of removed values.


Remove a range of values from the container.

Description

Remove a range of values from the container. In contrast to the STL set/map erase() method it removes values equal to these passed as a range. Furthermore this method removes only one value for each one passed in the range, not all equal values.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename Range>
rtree<Value, Options, Translator, Allocator>::size_type boost::geometry::index::remove(rtree< Value, Options, Translator, Allocator > & tree, Range const & rng)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > &

tree

The spatial index.

Range const &

rng

The range of values.

Returns

The number of removed values.


Find values meeting spatial predicates.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename Predicates,
         typename OutIter>
size_t boost::geometry::index::spatial_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                             Predicates const & pred,
                                             OutIter out_it)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

Predicates const &

pred

The spatial predicates.

OutIter

out_it

The output iterator of the result range.

Returns

The number of found values.


Find the value meeting distances predicates.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename DistancesPredicates>
size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                             DistancesPredicates const & dpred,
                                             Value & v)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

DistancesPredicates const &

dpred

The distances predicates.

Value &

v

The result.

Returns

The number of found values.


Find the value meeting distances and spatial predicates.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename DistancesPredicates,
         typename Predicates>
size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                             DistancesPredicates const & dpred,
                                             Predicates const & pred,
                                             Value & v)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

DistancesPredicates const &

dpred

The distances predicates.

Predicates const &

pred

The spatial predicates.

Value &

v

The result.

Returns

The number of found values.


Find k values meeting distances predicates.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename DistancesPredicates,
         typename OutIter>
size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                             DistancesPredicates const & dpred,
                                             size_t k,
                                             OutIter out_it)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

DistancesPredicates const &

dpred

The distances predicates.

size_t

k

The max number of values.

OutIter

out_it

The output iterator of the result range.

Returns

The number of found values.


Find k values meeting distances and spatial predicates.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator,
         typename DistancesPredicates,
         typename Predicates,
         typename OutIter>
size_t boost::geometry::index::nearest_query(rtree< Value, Options, Translator, Allocator > const & tree,
                                             DistancesPredicates const & dpred,
                                             size_t k,
                                             Predicates const & pred,
                                             OutIter out_it)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

DistancesPredicates const &

dpred

The distances predicates.

size_t

k

The max number of values.

Predicates const &

pred

The spatial predicates.

OutIter

out_it

The output iterator of the result range.

Returns

The number of found values.


Remove all values from the index.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator>
void boost::geometry::index::clear(rtree< Value, Options, Translator, Allocator > & tree)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > &

tree

The spatial index.


Get the number of values stored in the index.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator>
size_t boost::geometry::index::size(rtree< Value, Options, Translator, Allocator > const & tree)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

Returns

The number of values stored in the index.


Query if there are no values stored in the index.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator>
bool boost::geometry::index::empty(rtree< Value, Options, Translator, Allocator > const & tree)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

Returns

true if there are no values in the index.


Get the box containing all stored values or an invalid box if the index has no values.

Synopsis

template<typename Value,
         typename Options,
         typename Translator,
         typename Allocator>
rtree<Value, Options, Translator, Allocator>::box_type boost::geometry::index::box(rtree< Value, Options, Translator, Allocator > const & tree)

Parameters

Type

Name

Description

rtree< Value, Options, Translator, Allocator > const &

tree

The spatial index.

Returns

The box containing all stored values or an invalid box.


Function

Description

empty()

Generate empty predicate.

value(ValuePredicate const &)

Generate value predicate.

covered_by(Geometry const &)

Generate covered_by() predicate.

disjoint(Geometry const &)

Generate disjoint() predicate.

intersects(Geometry const &)

Generate intersects() predicate.

overlaps(Geometry const &)

Generate overlaps() predicate.

within(Geometry const &)

Generate within() predicate.

Generate empty predicate.

Synopsis

detail::empty boost::geometry::index::empty()


Generate value predicate.

Description

A wrapper around user-defined functor describing if Value should be returned by spatial query.

Synopsis

template<typename ValuePredicate>
detail::value<ValuePredicate> boost::geometry::index::value(ValuePredicate const & vpred)

Parameters

Type

Name

Description

ValuePredicate const &

vpred

The functor.


Generate covered_by() predicate.

Description

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

Synopsis

template<typename Geometry>
detail::covered_by<Geometry> boost::geometry::index::covered_by(Geometry const & g)

Parameters

Type

Name

Description

Geometry const &

g

The Geometry object.


Generate disjoint() predicate.

Description

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

Synopsis

template<typename Geometry>
detail::disjoint<Geometry> boost::geometry::index::disjoint(Geometry const & g)

Parameters

Type

Name

Description

Geometry const &

g

The Geometry object.


Generate intersects() predicate.

Description

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

Synopsis

template<typename Geometry>
detail::intersects<Geometry> boost::geometry::index::intersects(Geometry const & g)

Parameters

Type

Name

Description

Geometry const &

g

The Geometry object.


Generate overlaps() predicate.

Description

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

Synopsis

template<typename Geometry>
detail::overlaps<Geometry> boost::geometry::index::overlaps(Geometry const & g)

Parameters

Type

Name

Description

Geometry const &

g

The Geometry object.


Generate within() predicate.

Description

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

Synopsis

template<typename Geometry>
detail::within<Geometry> boost::geometry::index::within(Geometry const & g)

Parameters

Type

Name

Description

Geometry const &

g

The Geometry object.


Function

Description

to_nearest(T const &)

Generate to_nearest() Point-Indexable relationship.

to_centroid(T const &)

Generate to_centroid() Point-Indexable relationship.

to_furthest(T const &)

Generate to_furthest() Point-Indexable relationship.

unbounded(PointRelation const &)

Generate unbounded() distance predicate.

min_bounded(PointRelation const &, MinRelation const &)

Generate min_bounded() distance predicate.

max_bounded(PointRelation const &, MaxRelation const &)

Generate max_bounded() distance predicate.

bounded(PointRelation const &, MinRelation const &, MaxRelation const &)

Generate bounded() distance predicate.

Generate to_nearest() Point-Indexable relationship.

Description

Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as smallest as possible between query Point and Indexable's points. In other words it should be the distance to the nearest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's nearest point should be closer or further than value v. This is default relation.

Synopsis

template<typename T>
detail::to_nearest<T> boost::geometry::index::to_nearest(T const & v)

Parameters

Type

Name

Description

T const &

v

Point or bound value.


Generate to_centroid() Point-Indexable relationship.

Description

Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances between query Point and Indexable's centroid. This function may be also used to define distances bounds which indicates that Indexable's centroid should be closer or further than value v.

Synopsis

template<typename T>
detail::to_centroid<T> boost::geometry::index::to_centroid(T const & v)

Parameters

Type

Name

Description

T const &

v

Point or bound value.


Generate to_furthest() Point-Indexable relationship.

Description

Generate a nearest query Point and Value's Indexable relationship while calculating distances. This function may be used to define that knn query should calculate distances as biggest as possible between query Point and Indexable's points. In other words it should be the distance to the furthest Indexable's point. This function may be also used to define distances bounds which indicates that Indexable's furthest point should be closer or further than value v.

Synopsis

template<typename T>
detail::to_furthest<T> boost::geometry::index::to_furthest(T const & v)

Parameters

Type

Name

Description

T const &

v

Point or bound value.


Generate unbounded() distance predicate.

Description

Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that there is no distance bounds and Values should be returned if distances between Point and Indexable are the smallest. Distance calculation is defined by PointRelation. This is default nearest predicate.

Synopsis

template<typename PointRelation>
detail::unbounded<PointRelation> boost::geometry::index::unbounded(PointRelation const & pr)

Parameters

Type

Name

Description

PointRelation const &

pr

The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point).


Generate min_bounded() distance predicate.

Description

Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance.

Synopsis

template<typename PointRelation, typename MinRelation>
detail::min_bounded<PointRelation, MinRelation> boost::geometry::index::min_bounded(PointRelation const & pr, MinRelation const & minr)

Parameters

Type

Name

Description

PointRelation const &

pr

The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point).

MinRelation const &

minr

The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance).


Generate max_bounded() distance predicate.

Description

Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are closer than some distance.

Synopsis

template<typename PointRelation, typename MaxRelation>
detail::max_bounded<PointRelation, MaxRelation> boost::geometry::index::max_bounded(PointRelation const & pr, MaxRelation const & maxr)

Parameters

Type

Name

Description

PointRelation const &

pr

The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point).

MaxRelation const &

maxr

The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance).


Generate bounded() distance predicate.

Description

Generate a distance predicate. This defines distances bounds which are used by knn query. This function indicates that Values should be returned only if distances between Point and Indexable are greater or equal to some min_distance passed in MinRelation and lesser or equal to some max_distance passed in MaxRelation. Check for closest Value is defined by PointRelation. So it is possible e.g. to return Values with centroids closest to some Point but only if nearest points are further than some distance and closer than some other distance.

Synopsis

template<typename PointRelation,
         typename MinRelation,
         typename MaxRelation>
detail::bounded<PointRelation, MinRelation, MaxRelation> boost::geometry::index::bounded(PointRelation const & pr,
                                                                                         MinRelation const & minr,
                                                                                         MaxRelation const & maxr)

Parameters

Type

Name

Description

PointRelation const &

pr

The point relation. This may be generated by bgi::to_nearest(Point), bgi::to_centroid(Point) or bgi::to_furthest(Point).

MinRelation const &

minr

The minimum bound relation. This may be generated by bgi::to_nearest(min_distance), bgi::to_centroid(min_distance) or bgi::to_furthest(min_distance).

MaxRelation const &

maxr

The maximum bound relation. This may be generated by bgi::to_nearest(max_distance), bgi::to_centroid(max_distance) or bgi::to_furthest(max_distance).


Function

Description

nearest_queried(DistancesPredicates const &, size_t, Predicates const &)

The nearest query index adaptor generator.

nearest_queried(DistancesPredicates const &, size_t)

The nearest query index adaptor generator.

spatial_queried(Predicates const &)

The spatial query index adaptor generator.

The nearest query index adaptor generator.

Synopsis

template<typename DistancesPredicates, typename Predicates>
detail::nearest_query<DistancesPredicates, Predicates> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred,
                                                                                                         size_t k,
                                                                                                         Predicates const & pred)

Parameters

Type

Name

Description

DistancesPredicates const &

dpred

Distance predicates.

size_t

k

The number of values to find.

Predicates const &

pred

Spatial predicates.


The nearest query index adaptor generator.

Synopsis

template<typename DistancesPredicates>
detail::nearest_query<DistancesPredicates, index::detail::empty> boost::geometry::index::adaptors::nearest_queried(DistancesPredicates const & dpred, size_t k)

Parameters

Type

Name

Description

DistancesPredicates const &

dpred

Distance predicates.

size_t

k

The number of values to find.


The spatial query index adaptor generator.

Synopsis

template<typename Predicates>
detail::spatial_query<Predicates> boost::geometry::index::adaptors::spatial_queried(Predicates const & pred)

Parameters

Type

Name

Description

Predicates const &

pred

Spatial predicates.


The default translator.

Description

It translates Value object to Indexable object. The default version handles Values which are Indexables. This translator is also specialized for std::pair<Indexable, Second> and boost::tuple<Indexable, ...>.

Header

#include <.hpp>

Synopsis

template<typename Value>
struct def
{
  // ...
};

Template parameter(s)

Parameter

Description

Value

The Value type which may be translated directly to the Indexable.

The index translator.

Description

This translator translates from index of an element in an external Container to the Indexable. The container should have operator[](size_type) defined. Index translator uses translator::def<...> to translate from Container::value_type to the Indexable which means that it can handle Indexables, std::pairs and boost::tuples stored in an external Container.

Header

#include <.hpp>

Synopsis

template<typename Container>
class index
{
  // ...
};

Template parameter(s)

Parameter

Description

Container

The Container type.

Constructor(s) and destructor

Function

Description

index(Container const &)

The constructor.


The constructor.

Synopsis

index(Container const & c)

Parameters

Type

Name

Description

Container const &

c

The container which stores indexed values.


Function

Description

inserter(Container &)

Insert iterator generator.

Insert iterator generator.

Description

Returns insert iterator capable to insert values to the container (spatial index) which has member function insert(value_type const&) defined.

Synopsis

template<typename Container>
insert_iterator<Container> boost::geometry::index::inserter(Container & c)

Parameters

Type

Name

Description

Container &

c

The reference to the container (spatial index) to which values will be inserted.

Returns

The insert iterator inserting values to the container.



PrevUpHome