Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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. 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 >
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>::bounds_type boost::geometry::index::bounds ( rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &  tree)
inline

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::bounds().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

Remove all values from the index.

It calls rtree::clear().

Parameters
treeThe spatial index.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::clear().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::bounds().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::insert().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::insert().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::insert().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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
for ( Rtree::const_query_iterator it = qbegin(tree, bgi::nearest(pt, 10000)) ;
        it != qend(tree) ; ++it )
{
    // do something with value
    if ( has_enough_nearest_values() )
        break;
}
Throws
If predicates copy throws. If allocation throws.
Parameters
treeThe rtree.
predicatesPredicates.
Returns
The iterator pointing at the begin of the query range.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::qbegin().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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
for ( Rtree::const_query_iterator it = qbegin(tree, bgi::nearest(pt, 10000)) ;
      it != qend(tree) ; ++it )
{
    // do something with value
    if ( has_enough_nearest_values() )
        break;
}
Throws
Nothing
Returns
The iterator pointing at the end of the query range.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::qend().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::query().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::remove().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::remove().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::remove().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

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.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::size().

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

#include <boost_1_57_0/boost/geometry/index/rtree.hpp>

Exchanges the contents of the container with those of other.

It calls rtree::swap().

Parameters
lThe first rtree.
rThe second rtree.

References boost::geometry::index::rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::swap().