Boost.Geometry.Index
 All Classes Functions Typedefs Groups
Functions
R-tree free functions (boost::geometry::index::)

Functions

template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
void boost::geometry::index::insert (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Value const &v)
 Insert a value to the index. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Iterator >
void boost::geometry::index::insert (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Iterator first, Iterator last)
 Insert a range of values to the index. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename ConvertibleOrRange >
void boost::geometry::index::insert (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, ConvertibleOrRange const &conv_or_rng)
 Insert a value created using convertible object or a range of values to the index. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >::size_type 
boost::geometry::index::remove (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Value const &v)
 Remove a value from the container. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Iterator >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >::size_type 
boost::geometry::index::remove (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Iterator first, Iterator last)
 Remove a range of values from the container. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename ConvertibleOrRange >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >::size_type 
boost::geometry::index::remove (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, ConvertibleOrRange const &conv_or_rng)
 Remove a value corresponding to an object convertible to it or a range of values from the container. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Predicates , typename OutIter >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >::size_type 
boost::geometry::index::query (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree, Predicates const &predicates, OutIter out_it)
 Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Predicates >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >
::const_query_iterator 
boost::geometry::index::qbegin (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree, Predicates const &predicates)
 Returns the query iterator pointing at the begin of the query range. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >
::const_query_iterator 
boost::geometry::index::qend (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree)
 Returns the query iterator pointing at the end of the query range. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >::const_iterator 
boost::geometry::index::begin (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree)
 Returns the iterator pointing at the begin of the rtree values range. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >::const_iterator 
boost::geometry::index::end (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree)
 Returns the iterator pointing at the end of the rtree values range. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
void boost::geometry::index::clear (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree)
 Remove all values from the index. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
size_t boost::geometry::index::size (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree)
 Get the number of values stored in the index. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
bool boost::geometry::index::empty (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree)
 Query if there are no values stored in the index. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree< Value, Parameters,
IndexableGetter, EqualTo,
Allocator >::bounds_type 
boost::geometry::index::bounds (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree)
 Get the box containing all stored values or an invalid box if the index has no values. More...
 
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
void boost::geometry::index::swap (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &l, rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &r)
 Exchanges the contents of the container with those of other. More...
 

Detailed Description

Function Documentation

template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::const_iterator boost::geometry::index::begin ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree)
inline

Returns the iterator pointing at the begin of the rtree values range.

This method returns the iterator which may be used to iterate over all values stored in the rtree.

Example
std::for_each(bgi::begin(tree), bgi::end(tree), do_something());
// the same as
std::for_each(boost::begin(tree), boost::end(tree), do_something());
Iterator category
ForwardIterator
Throws
If allocation throws.
Warning
The modification of the rtree may invalidate the iterators.
Returns
The iterator pointing at the begin of the range.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::bounds_type boost::geometry::index::bounds ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree)
inline

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

It calls rtree::envelope().

Parameters
treeThe spatial index.
Returns
The box containing all stored values or an invalid box.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
void boost::geometry::index::clear ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  tree)
inline

Remove all values from the index.

It calls rtree::clear().

Parameters
treeThe spatial index.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
bool boost::geometry::index::empty ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree)
inline

Query if there are no values stored in the index.

It calls rtree::empty().

Parameters
treeThe spatial index.
Returns
true if there are no values in the index.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::const_iterator boost::geometry::index::end ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree)
inline

Returns the iterator pointing at the end of the rtree values range.

This method returns the iterator which may be compared with the iterator returned by begin() in order to check if the iteration has ended.

Example
std::for_each(bgi::begin(tree), bgi::end(tree), do_something());
// the same as
std::for_each(boost::begin(tree), boost::end(tree), do_something());
Iterator category
ForwardIterator
Throws
Nothing.
Warning
The modification of the rtree may invalidate the iterators.
Returns
The iterator pointing at the end of the range.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
void boost::geometry::index::insert ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  tree,
Value const &  v 
)
inline

Insert a value to the index.

It calls rtree::insert(value_type const&).

Parameters
treeThe spatial index.
vThe value which will be stored in the index.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Iterator >
void boost::geometry::index::insert ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  tree,
Iterator  first,
Iterator  last 
)
inline

Insert a range of values to the index.

It calls rtree::insert(Iterator, Iterator).

Parameters
treeThe spatial index.
firstThe beginning of the range of values.
lastThe end of the range of values.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename ConvertibleOrRange >
void boost::geometry::index::insert ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  tree,
ConvertibleOrRange const &  conv_or_rng 
)
inline

Insert a value created using convertible object or a range of values to the index.

It calls rtree::insert(ConvertibleOrRange const&).

Parameters
treeThe spatial index.
conv_or_rngThe object of type convertible to value_type or a range of values.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Predicates >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::const_query_iterator boost::geometry::index::qbegin ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree,
Predicates const &  predicates 
)
inline

Returns the query iterator pointing at the begin of the query range.

This method returns the iterator which may be used to perform iterative queries. For the information about the predicates which may be passed to this method see query().

Example
std::for_each(bgi::qbegin(tree, bgi::nearest(pt, 3)), bgi::qend(tree), do_something());
Iterator category
ForwardIterator
Throws
If predicates copy throws. If allocation throws.
Warning
The modification of the rtree may invalidate the iterators.
Parameters
treeThe rtree.
predicatesPredicates.
Returns
The iterator pointing at the begin of the query range.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::const_query_iterator boost::geometry::index::qend ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree)
inline

Returns the query iterator pointing at the end of the query range.

This method returns the iterator which may be used to check if the query has ended.

Example
std::for_each(bgi::qbegin(tree, bgi::nearest(pt, 3)), bgi::qend(tree), do_something());
Iterator category
ForwardIterator
Throws
Nothing
Warning
The modification of the rtree may invalidate the iterators.
Returns
The iterator pointing at the end of the query range.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Predicates , typename OutIter >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::size_type boost::geometry::index::query ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree,
Predicates const &  predicates,
OutIter  out_it 
)
inline

Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box.

This query function performs spatial and k-nearest neighbor searches. It allows to pass a set of predicates. Values will be returned only if all predicates are met.

Spatial predicates

Spatial predicates may be generated by one of the functions listed below:

It is possible to negate spatial predicates:

Satisfies predicate

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:

Nearest predicate

If the nearest predicate is passed a k-nearest neighbor search will be performed. This query will result in returning k values to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by:

Connecting predicates

Predicates may be passed together connected with operator&&().

Example
// return elements intersecting box
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
bgi::query(tree, bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result));
// return 5 elements nearest to pt and elements are intersecting box
bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result));

// For each found value do_something (it is a type of function object)
tree.query(bgi::intersects(box),
           boost::make_function_output_iterator(do_something()));
Throws
If Value copy constructor or copy assignment throws.
Warning
Only one nearest() perdicate may be passed to the query. Passing more of them results in compile-time error.
Parameters
treeThe rtree.
predicatesPredicates.
out_itThe output iterator, e.g. generated by std::back_inserter().
Returns
The number of values found.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::size_type boost::geometry::index::remove ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  tree,
Value const &  v 
)
inline

Remove a value from the container.

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

It calls rtree::remove(value_type const&).

Parameters
treeThe spatial index.
vThe value which will be removed from the index.
Returns
1 if value was removed, 0 otherwise.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename Iterator >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::size_type boost::geometry::index::remove ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  tree,
Iterator  first,
Iterator  last 
)
inline

Remove a range of values from the container.

Remove a range of values from the container. In contrast to the std::set or std::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.

It calls rtree::remove(Iterator, Iterator).

Parameters
treeThe spatial index.
firstThe beginning of the range of values.
lastThe end of the range of values.
Returns
The number of removed values.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator , typename ConvertibleOrRange >
rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::size_type boost::geometry::index::remove ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  tree,
ConvertibleOrRange const &  conv_or_rng 
)
inline

Remove a value corresponding to an object convertible to it or a range of values from the container.

Remove a value corresponding to an object convertible to it or a range of values from the container. In contrast to the std::set or std::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.

It calls rtree::remove(ConvertibleOrRange const&).

Parameters
treeThe spatial index.
conv_or_rngThe object of type convertible to value_type or the range of values.
Returns
The number of removed values.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
size_t boost::geometry::index::size ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree)
inline

Get the number of values stored in the index.

It calls rtree::size().

Parameters
treeThe spatial index.
Returns
The number of values stored in the index.
template<typename Value , typename Parameters , typename IndexableGetter , typename EqualTo , typename Allocator >
void boost::geometry::index::swap ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  l,
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &  r 
)
inline

Exchanges the contents of the container with those of other.

It calls rtree::swap().

Parameters
lThe first rtree.
rThe second rtree.