21#ifndef GF_SPATIAL_DYNAMIC_TREE_H
22#define GF_SPATIAL_DYNAMIC_TREE_H
27#include "BlockAllocator.h"
31#include "SpatialTypes.h"
34#ifndef DOXYGEN_SHOULD_SKIP_THIS
96 std::size_t allocateNode();
97 void disposeNode(std::size_t index);
99 void doInsert(std::size_t leaf);
100 void doRemove(std::size_t leaf);
102 std::size_t balance(std::size_t iA);
113 bool isLeaf()
const {
118 BlockAllocator<Node> m_nodes;
123#ifndef DOXYGEN_SHOULD_SKIP_THIS
An implementation of dynamic tree.
Definition: Spatial_DynamicTree.h:42
DynamicTree()
Constructor.
void remove(SpatialId id)
Remove an object from the tree.
std::size_t query(const RectF &bounds, SpatialQueryCallback callback, SpatialQuery kind=SpatialQuery::Intersect)
Query objects in the tree.
SpatialId insert(Handle handle, const RectF &bounds)
Insert an object in the tree.
void clear()
Remove all the objects from the tree.
void modify(SpatialId id, RectF bounds)
Modify the bounds of an object.
Handle operator[](SpatialId id)
Get the handle associated to a spatial id.
A handle to an object or an id.
Definition: Handle.h:40
constexpr std::size_t NullIndex
A null index in a block allocator.
Definition: BlockAllocator.h:38
SpatialQuery
A kind of spatial query.
Definition: SpatialTypes.h:73
std::function< void(Handle)> SpatialQueryCallback
A callback for spatial query.
Definition: SpatialTypes.h:82
SpatialId
A spatial id.
Definition: SpatialTypes.h:42
@ Node
The structure represents an internal node.
@ Intersect
Search for all objects that intersect the given bounds.
The namespace for gf classes.