rtree_functions

# R-tree free functions (boost::geometry::index::)

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
void void boost::geometry::index::insert (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Value const &v) insert rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > & tree Value const & v

Insert a value to the index.

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

tree

The spatial index.

v

The value which will be stored in the index.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
typename Iterator
void void boost::geometry::index::insert (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Iterator first, Iterator last) insert rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > & tree Iterator first Iterator last

Insert a range of values to the index.

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

tree

The spatial index.

first

The beginning of the range of values.

last

The end of the range of values.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
typename ConvertibleOrRange
void void boost::geometry::index::insert (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, ConvertibleOrRange const &conv_or_rng) 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.

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

tree

The spatial index.

conv_or_rng

The object of type convertible to value_type or a range of values.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::size_type rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::size_type boost::geometry::index::remove (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Value const &v) remove rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > & tree Value const & v

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&)`.

tree

The spatial index.

v

The value which will be removed from the index.

1 if value was removed, 0 otherwise.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
typename Iterator
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::size_type rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::size_type boost::geometry::index::remove (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree, Iterator first, Iterator last) remove rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > & tree Iterator first Iterator last

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)`.

tree

The spatial index.

first

The beginning of the range of values.

last

The end of the range of values.

The number of removed values.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
typename ConvertibleOrRange
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::size_type 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 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.

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&)`.

tree

The spatial index.

conv_or_rng

The object of type convertible to value_type or the range of values.

The number of removed values.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
typename Predicates
typename OutIter
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::size_type 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) 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.

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:

- `boost::geometry::index::contains()`,

- `boost::geometry::index::covered_by()`,

- `boost::geometry::index::covers()`,

- `boost::geometry::index::disjoint()`,

- `boost::geometry::index::intersects()`,

- `boost::geometry::index::overlaps()`,

- `boost::geometry::index::within()`,

It is possible to negate spatial predicates:

- `! boost::geometry::index::contains()`,

- `! boost::geometry::index::covered_by()`,

- `! boost::geometry::index::covers()`,

- `! boost::geometry::index::disjoint()`,

- `! boost::geometry::index::intersects()`,

- `! boost::geometry::index::overlaps()`,

- `! boost::geometry::index::within()`

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:

- `boost::geometry::index::satisfies()`.

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:

- `boost::geometry::index::nearest()`.

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.

Only one `nearest()` perdicate may be passed to the query. Passing more of them results in compile-time error.

tree

The rtree.

predicates

Predicates.

out_it

The output iterator, e.g. generated by std::back_inserter().

The number of values found.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
typename Predicates
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::const_query_iterator rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::const_query_iterator boost::geometry::index::qbegin (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree, Predicates const &predicates) qbegin rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const & tree Predicates const & predicates

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.

The modification of the rtree may invalidate the iterators.

tree

The rtree.

predicates

Predicates.

The iterator pointing at the begin of the query range.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::const_query_iterator rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::const_query_iterator boost::geometry::index::qend (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree) qend rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const & tree

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

The modification of the rtree may invalidate the iterators.

The iterator pointing at the end of the query range.

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

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.

The modification of the rtree may invalidate the iterators.

The iterator pointing at the begin of the range.

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

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.

The modification of the rtree may invalidate the iterators.

The iterator pointing at the end of the range.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
void void boost::geometry::index::clear (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &tree) clear rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > & tree

Remove all values from the index.

It calls `rtree::clear()`.

tree

The spatial index.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
size_t size_t boost::geometry::index::size (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree) size rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const & tree

Get the number of values stored in the index.

It calls `rtree::size()`.

tree

The spatial index.

The number of values stored in the index.

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

Query if there are no values stored in the index.

It calls `rtree::empty()`.

tree

The spatial index.

true if there are no values in the index.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::bounds_type rtree<Value, Parameters, IndexableGetter, EqualTo, Allocator>::bounds_type boost::geometry::index::bounds (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree) 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.

It calls `rtree::envelope()`.

tree

The spatial index.

The box containing all stored values or an invalid box.

typename Value
typename Parameters
typename IndexableGetter
typename EqualTo
typename Allocator
void void boost::geometry::index::swap (rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &l, rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > &r) 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.

It calls `rtree::swap()`.

l

The first rtree.

r

The second rtree.